Package eu.admire.dispel.parser.expression

Examples of eu.admire.dispel.parser.expression.Expression


    {
        switch (context)
        {
        case TUPLE_ELEMENT:
            TupleElementStrategy tupleElement = (TupleElementStrategy)strategy;   
            Expression expression = tupleElement.getExpression();
            mTuple.add(tupleElement.getElementName(), expression);
        }
    }
View Full Code Here


            String name = ast.getChild(0).getText();
            Tree args = ast.getChild(1);
            List<Expression> arguments = new ArrayList<Expression>();
            for (int i=0; i<args.getChildCount(); i++)
            {
                Expression parameter = buildExpression(args.getChild(i).getChild(0));
                arguments.add(parameter);
            }
            mFunctionResult = mBuilder.callFunction(name, arguments);
            break;
        }
        case DISPEL_v4Parser.ARGUMENTS:
            handleAllChildren(ast);
            break;
        case DISPEL_v4Parser.RETURN:
            createContext(Context.RETURN, ast);
            // no more processing after a return statement
            mReturn = true;
            break;
        case DISPEL_v4Parser.SUBMIT:
            mBuilder.submit(buildExpression(ast.getChild(0)));
            break;
        case DISPEL_v4Parser.REGISTER:
            Map<String, Expression> annotations = new HashMap<String, Expression>();
            for (int i=1; i<ast.getChildCount(); i++)
            {
                Tree annotation = ast.getChild(i);
                String key = getTextFromChildren(annotation.getChild(0));
                Expression value = buildExpression(annotation.getChild(1));
                annotations.put(key, value);
            }
            mBuilder.register(ast.getChild(0).getText(), annotations);
            break;
        case DISPEL_v4Parser.GENERIC_PE:
            createContext(Context.GENERIC_PE, ast);
            break;
        case DISPEL_v4Parser.TUPLE:
            createContext(Context.TUPLE, ast);
            break;
        case DISPEL_v4Parser.OUTPUTS:
            createContext(Context.OUTPUTS, ast);
            break;
        case DISPEL_v4Parser.INPUTS:
            createContext(Context.INPUTS, ast);
            break;
        case DISPEL_v4Parser.CREATE_PE:
            createContext(Context.CREATE_PE, ast);
            break;
        case DISPEL_v4Parser.SEQUENCE:
            createContext(Context.SEQUENCE, ast);
            break;
        case DISPEL_v4Parser.LIST:
        case DISPEL_v4Parser.COLLECTION:
            createContext(Context.LIST, ast);
            break;
        case DISPEL_v4Parser.WHILE:
            createContext(Context.WHILE, ast);
            break;
        case DISPEL_v4Parser.FOR:
            createContext(Context.FOR, ast);
            break;
        case DISPEL_v4Parser.FOR_INIT:
            createContext(Context.FOR_INIT, ast);
            break;
        case DISPEL_v4Parser.FOR_UPDATE:
            createContext(Context.FOR_UPDATE, ast);
            break;
        case DISPEL_v4Parser.IF:
            createContext(Context.IF, ast);
            break;
        case DISPEL_v4Parser.THEN:
            mBuilder.beginContext(Context.THEN);
            if (mBuilder.parseBlock(ast))
            {
                createContext(Context.BLOCK, ast);
            }
            mBuilder.endContext(Context.THEN);
            break;
        case DISPEL_v4Parser.ELSE:
            mBuilder.beginContext(Context.ELSE);
            if (mBuilder.parseBlock(ast))
            {
                createContext(Context.BLOCK, ast);
            }
            mBuilder.endContext(Context.ELSE);
            break;
        case DISPEL_v4Parser.ARRAY:
            createContext(Context.ARRAY, ast);
            break;
        case DISPEL_v4Parser.ARRAY_INITIALISER:
            createContext(Context.ARRAY_INITIALISER, ast);
            break;
        case DISPEL_v4Parser.VARIABLE_ID:
            createContext(Context.VARIABLE_ID, ast);
            break;
        case DISPEL_v4Parser.ANNOTATION:
            createContext(Context.ANNOTATION, ast);
            break;
        case DISPEL_v4Parser.PROPERTY:
            mBuilder.setProperty(getTextFromChildren(ast));
            break;
        case DISPEL_v4Parser.CONNECTION_DECLARATION:
        case DISPEL_v4Parser.CONNECTION_ID:
        case DISPEL_v4Parser.CONNECTION_TYPE:
            mBuilder.setConnection(getTextFromChildren(ast));
            break;
        case DISPEL_v4Parser.OUTPUT_DECLARATION:
            createContext(Context.OUTPUT_DECLARATION, ast);
            break;
        case DISPEL_v4Parser.INPUT_DECLARATION:
            createContext(Context.INPUT_DECLARATION, ast);
            break;
        case DISPEL_v4Parser.ARRAY_DECLARATION:
            mBuilder.declareArray(ast.getChildCount());
            break;
        case DISPEL_v4Parser.CONNECTION_ASSERTION:
            createContext(Context.CONNECTION_ASSERTION, ast);
            break;
        case DISPEL_v4Parser.TYPE_DEF:
            createContext(Context.TYPE_DEF, ast);
            break;
        case DISPEL_v4Parser.STYPE_DEF:
            createContext(Context.STYPE_DEF, ast);
            break;
        case DISPEL_v4Parser.STYPE:
            createContext(Context.STYPE, ast);
            break;
        case DISPEL_v4Parser.DTYPE_DEF:
            createContext(Context.DTYPE_DEF, ast);
            break;
        case DISPEL_v4Parser.DTYPE:
            createContext(Context.DTYPE, ast);
            break;
        case DISPEL_v4Parser.TUPLE_ELEMENT:
            createContext(Context.TUPLE_ELEMENT, ast);
            break;
        case DISPEL_v4Parser.REPEAT_ENOUGH:
            createContext(Context.REPEAT_ENOUGH, ast);
            break;
        case DISPEL_v4Parser.REPEAT:
            createContext(Context.REPEAT, ast);
            break;
        case DISPEL_v4Parser.WITH:
            createContext(Context.WITH_ASSERTION, ast);
            break;
        case DISPEL_v4Parser.INDEX:
        case DISPEL_v4Parser.EXPRESSION:
        {
            Expression expression = buildExpression(ast.getChild(0));
            mBuilder.setExpression(expression);
            break;
        }
        case DISPEL_v4Parser.ATTRIBUTE:
        {
View Full Code Here

            handleChild(ast);
            return mFunctionResult;
        }
        else if (Operator.isOperator(ast.getText()))
        {
            Expression left = null;
            Expression right = null;
            if (ast.getChildCount() > 1)
            {
                left = buildExpression(ast.getChild(0));
                right = buildExpression(ast.getChild(1));
            }
            else
            {
                right = buildExpression(ast.getChild(0));
            }
            Expression expression =
                Operator.getOperator(ast.getText()).getExpression();
            expression.setChild(1, right);
            if (left != null)
            {
                expression.setChild(0, left);
            }
            return expression;
        }
        else if (Comparator.isComparison(ast.getText()))
        {
            Expression left = buildExpression(ast.getChild(0));
            Expression right = buildExpression(ast.getChild(1));
            Expression expression =
                Comparator.getComparator(ast.getText()).getExpression();
            expression.setChild(0, left);
            expression.setChild(1, right);
            return expression;
        }
        else
        {
            handleChild(ast);
View Full Code Here

TOP

Related Classes of eu.admire.dispel.parser.expression.Expression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.