Ejemplo n.º 1
0
 /// <summary>
 /// Add a child to the current AST
 /// </summary>
 /// <param name="currentAST">The AST to add a child to</param>
 /// <param name="child">The child AST to be added</param>
 public override void  addASTChild(ref ASTPair currentAST, AST child)
 {
     if (child != null)
     {
         if (currentAST.root == null)
         {
             // Make new child the current root
             currentAST.root = child;
             ((ASTNode)child).setParent(null);
         }
         else
         {
             ((ASTNode)child).setParent((ASTNode)currentAST.root);
             if (currentAST.child == null)
             {
                 // Add new child to current root
                 currentAST.root.setFirstChild(child);
                 ((ASTNode)child).setPreviousSibling(null);
             }
             else
             {
                 currentAST.child.setNextSibling(child);
                 ((ASTNode)child).setPreviousSibling((ASTNode)currentAST.child);
             }
         }
         // Make new child the current child
         currentAST.child = child;
         currentAST.advanceChildToEnd();
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Make an AST the root of current AST.
 /// </summary>
 /// <param name="currentAST"></param>
 /// <param name="root"></param>
 public override void  makeASTRoot(ref ASTPair currentAST, AST root)
 {
     if (root != null)
     {
         // Add the current root as a child of new root
         ((ASTNode)root).addChildEx((ASTNode)currentAST.root);
         // The new current child is the last sibling of the old root
         currentAST.child = currentAST.root;
         currentAST.advanceChildToEnd();
         // Set the new root
         currentAST.root = root;
     }
 }
Ejemplo n.º 3
0
		public void relationalExpression() //throws RecognitionException, TokenStreamException
	{

			returnAST = null;
			ASTPair currentAST = new ASTPair();
			GodLesZ.Library.Amf.Expression.FluorineAST relationalExpression_AST = null;
			GodLesZ.Library.Amf.Expression.FluorineAST e1_AST = null;
			GodLesZ.Library.Amf.Expression.FluorineAST op_AST = null;

			try {      // for error handling
				sumExpr();
				if (0 == inputState.guessing) {
					e1_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)returnAST;
					astFactory.addASTChild(ref currentAST, (AST)returnAST);
				}
				{
					switch (LA(1)) {
						case IS:
						case EQUAL:
						case NOT_EQUAL:
						case LESS_THAN:
						case LESS_THAN_OR_EQUAL:
						case GREATER_THAN:
						case GREATER_THAN_OR_EQUAL: {
								relationalOperator();
								if (0 == inputState.guessing) {
									op_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)returnAST;
								}
								sumExpr();
								if (0 == inputState.guessing) {
									astFactory.addASTChild(ref currentAST, (AST)returnAST);
								}
								if (0 == inputState.guessing) {
									relationalExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)currentAST.root;
									relationalExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.make((AST)(GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.create(EXPR, op_AST.getText(), GetRelationalOperatorNodeType(op_AST.getText())), (AST)relationalExpression_AST);
									currentAST.root = relationalExpression_AST;
									if ((null != relationalExpression_AST) && (null != relationalExpression_AST.getFirstChild()))
										currentAST.child = relationalExpression_AST.getFirstChild();
									else
										currentAST.child = relationalExpression_AST;
									currentAST.advanceChildToEnd();
								}
								break;
							}
						case IN: {
								match(IN);
								listInitializer();
								if (0 == inputState.guessing) {
									astFactory.addASTChild(ref currentAST, (AST)returnAST);
								}
								if (0 == inputState.guessing) {
									relationalExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)currentAST.root;
									relationalExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.make((AST)(GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.create(EXPR, "IN", GetRelationalOperatorNodeType("IN")), (AST)relationalExpression_AST);
									currentAST.root = relationalExpression_AST;
									if ((null != relationalExpression_AST) && (null != relationalExpression_AST.getFirstChild()))
										currentAST.child = relationalExpression_AST.getFirstChild();
									else
										currentAST.child = relationalExpression_AST;
									currentAST.advanceChildToEnd();
								}
								break;
							}
						case BETWEEN: {
								match(BETWEEN);
								betweenExpr();
								if (0 == inputState.guessing) {
									astFactory.addASTChild(ref currentAST, (AST)returnAST);
								}
								if (0 == inputState.guessing) {
									relationalExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)currentAST.root;
									relationalExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.make((AST)(GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.create(EXPR, "BETWEEN", GetRelationalOperatorNodeType("BETWEEN")), (AST)relationalExpression_AST);
									currentAST.root = relationalExpression_AST;
									if ((null != relationalExpression_AST) && (null != relationalExpression_AST.getFirstChild()))
										currentAST.child = relationalExpression_AST.getFirstChild();
									else
										currentAST.child = relationalExpression_AST;
									currentAST.advanceChildToEnd();
								}
								break;
							}
						case LIKE: {
								match(LIKE);
								pattern();
								if (0 == inputState.guessing) {
									astFactory.addASTChild(ref currentAST, (AST)returnAST);
								}
								if (0 == inputState.guessing) {
									relationalExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)currentAST.root;
									relationalExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.make((AST)(GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.create(EXPR, "LIKE", GetRelationalOperatorNodeType("LIKE")), (AST)relationalExpression_AST);
									currentAST.root = relationalExpression_AST;
									if ((null != relationalExpression_AST) && (null != relationalExpression_AST.getFirstChild()))
										currentAST.child = relationalExpression_AST.getFirstChild();
									else
										currentAST.child = relationalExpression_AST;
									currentAST.advanceChildToEnd();
								}
								break;
							}
						case EOF:
						case AND:
						case OR:
						case RPAREN:
						case COMMA: {
								break;
							}
						default:
							if ((LA(1) == NOT) && (LA(2) == IN)) {
								match(NOT);
								match(IN);
								listInitializer();
								if (0 == inputState.guessing) {
									astFactory.addASTChild(ref currentAST, (AST)returnAST);
								}
								if (0 == inputState.guessing) {
									relationalExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)currentAST.root;
									relationalExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.make((AST)(GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.create(EXPR, "NOT", "GodLesZ.Library.Amf.Expression.OpNOT"), (AST)(GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.make((AST)(GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.create(EXPR, "IN", GetRelationalOperatorNodeType("IN")), (AST)relationalExpression_AST));
									currentAST.root = relationalExpression_AST;
									if ((null != relationalExpression_AST) && (null != relationalExpression_AST.getFirstChild()))
										currentAST.child = relationalExpression_AST.getFirstChild();
									else
										currentAST.child = relationalExpression_AST;
									currentAST.advanceChildToEnd();
								}
							} else if ((LA(1) == NOT) && (LA(2) == BETWEEN)) {
								match(NOT);
								match(BETWEEN);
								betweenExpr();
								if (0 == inputState.guessing) {
									astFactory.addASTChild(ref currentAST, (AST)returnAST);
								}
								if (0 == inputState.guessing) {
									relationalExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)currentAST.root;
									relationalExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.make((AST)(GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.create(EXPR, "NOT", "GodLesZ.Library.Amf.Expression.OpNOT"), (AST)(GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.make((AST)(GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.create(EXPR, "BETWEEN", GetRelationalOperatorNodeType("BETWEEN")), (AST)relationalExpression_AST));
									currentAST.root = relationalExpression_AST;
									if ((null != relationalExpression_AST) && (null != relationalExpression_AST.getFirstChild()))
										currentAST.child = relationalExpression_AST.getFirstChild();
									else
										currentAST.child = relationalExpression_AST;
									currentAST.advanceChildToEnd();
								}
							} else if ((LA(1) == NOT) && (LA(2) == LIKE)) {
								match(NOT);
								match(LIKE);
								pattern();
								if (0 == inputState.guessing) {
									astFactory.addASTChild(ref currentAST, (AST)returnAST);
								}
								if (0 == inputState.guessing) {
									relationalExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)currentAST.root;
									relationalExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.make((AST)(GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.create(EXPR, "NOT", "GodLesZ.Library.Amf.Expression.OpNOT"), (AST)(GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.make((AST)(GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.create(EXPR, "LIKE", GetRelationalOperatorNodeType("LIKE")), (AST)relationalExpression_AST));
									currentAST.root = relationalExpression_AST;
									if ((null != relationalExpression_AST) && (null != relationalExpression_AST.getFirstChild()))
										currentAST.child = relationalExpression_AST.getFirstChild();
									else
										currentAST.child = relationalExpression_AST;
									currentAST.advanceChildToEnd();
								}
							} else {
								throw new NoViableAltException(LT(1), getFilename());
							}
							break;
					}
				}
				relationalExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)currentAST.root;
			} catch (RecognitionException ex) {
				if (0 == inputState.guessing) {
					reportError(ex);
					recover(ex, tokenSet_3_);
				} else {
					throw ex;
				}
			}
			returnAST = relationalExpression_AST;
		}
Ejemplo n.º 4
0
        //throws RecognitionException, TokenStreamException
        public void typeExpression()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST typeExpression_AST = null;

            {
            switch ( LA(1) )
            {
            case COLON:
            {
                match(COLON);
                identifier();
                if (0 == inputState.guessing)
                {
                    astFactory.addASTChild(ref currentAST, returnAST);
                }
                if (0==inputState.guessing)
                {
                    typeExpression_AST = (AST)currentAST.root;
                    typeExpression_AST = (AST) astFactory.make(astFactory.create(TYPE_SPEC,"TYPE_SPEC"), typeExpression_AST);
                    currentAST.root = typeExpression_AST;
                    if ( (null != typeExpression_AST) && (null != typeExpression_AST.getFirstChild()) )
                        currentAST.child = typeExpression_AST.getFirstChild();
                    else
                        currentAST.child = typeExpression_AST;
                    currentAST.advanceChildToEnd();
                }
                break;
            }
            case LCURLY:
            case SEMI:
            case RCURLY:
            case LITERAL_import:
            case LBRACK:
            case COMMA:
            case LPAREN:
            case RPAREN:
            case LITERAL_class:
            case LITERAL_interface:
            case LITERAL_function:
            case IDENT:
            case LITERAL_namespace:
            case LITERAL_var:
            case LITERAL_const:
            case ASSIGN:
            case LITERAL_while:
            case LITERAL_do:
            case LITERAL_with:
            case LITERAL_if:
            case LITERAL_else:
            case LITERAL_throw:
            case LITERAL_return:
            case LITERAL_continue:
            case LITERAL_break:
            case LITERAL_switch:
            case LITERAL_case:
            case LITERAL_default:
            case LITERAL_for:
            case LITERAL_in:
            case LITERAL_public:
            case LITERAL_private:
            case LITERAL_protected:
            case LITERAL_internal:
            case LITERAL_static:
            case LITERAL_final:
            case LITERAL_enumerable:
            case LITERAL_explicit:
            case LITERAL_override:
            case LITERAL_dynamic:
            case NUMBER:
            case PLUS:
            case MINUS:
            case INC:
            case DEC:
            case LITERAL_delete:
            case LITERAL_typeof:
            case LNOT:
            case BNOT:
            case LITERAL_null:
            case LITERAL_true:
            case LITERAL_false:
            case LITERAL_undefined:
            case STRING_LITERAL:
            case REGEX_LITERAL:
            case XML_LITERAL:
            case LITERAL_new:
            {
                break;
            }
            default:
            {
                throw new NoViableAltException(LT(1), getFilename());
            }
             }
            }
            typeExpression_AST = currentAST.root;
            returnAST = typeExpression_AST;
        }
Ejemplo n.º 5
0
        //throws RecognitionException, TokenStreamException
        public void typeBlock()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST typeBlock_AST = null;
            IToken  s = null;
            AST s_AST = null;
            AST m_AST = null;
            IToken  e = null;
            AST e_AST = null;

            s = LT(1);
            s_AST = astFactory.create(s);
            match(LCURLY);
            {    // ( ... )*
            for (;;)
            {
                switch ( LA(1) )
                {
                case LBRACK:
                {
                    metadataDefinition();
                    if (0 == inputState.guessing)
                    {
                        astFactory.addASTChild(ref currentAST, returnAST);
                    }
                    break;
                }
                case LITERAL_function:
                case LITERAL_var:
                case LITERAL_const:
                case LITERAL_public:
                case LITERAL_private:
                case LITERAL_protected:
                case LITERAL_internal:
                case LITERAL_static:
                case LITERAL_final:
                case LITERAL_enumerable:
                case LITERAL_explicit:
                case LITERAL_override:
                case LITERAL_dynamic:
                {
                    modifiers();
                    if (0 == inputState.guessing)
                    {
                        m_AST = (AST)returnAST;
                    }
                    {
                        switch ( LA(1) )
                        {
                        case LITERAL_var:
                        case LITERAL_const:
                        {
                            variableDefinition(m_AST);
                            if (0 == inputState.guessing)
                            {
                                astFactory.addASTChild(ref currentAST, returnAST);
                            }
                            break;
                        }
                        case LITERAL_function:
                        {
                            methodDefinition(m_AST);
                            if (0 == inputState.guessing)
                            {
                                astFactory.addASTChild(ref currentAST, returnAST);
                            }
                            break;
                        }
                        default:
                        {
                            throw new NoViableAltException(LT(1), getFilename());
                        }
                         }
                    }
                    break;
                }
                case SEMI:
                {
                    match(SEMI);
                    break;
                }
                default:
                {
                    goto _loop28_breakloop;
                }
                 }
            }
            _loop28_breakloop:			;
            }    // ( ... )*
            e = LT(1);
            e_AST = astFactory.create(e);
            match(RCURLY);
            if (0==inputState.guessing)
            {
            typeBlock_AST = (AST)currentAST.root;
            typeBlock_AST = (AST) astFactory.make(astFactory.create(TYPE_BLOCK,"TYPE_BLOCK"), typeBlock_AST);
                    setRegionInfo(typeBlock_AST,s_AST,e_AST);
            currentAST.root = typeBlock_AST;
            if ( (null != typeBlock_AST) && (null != typeBlock_AST.getFirstChild()) )
                currentAST.child = typeBlock_AST.getFirstChild();
            else
                currentAST.child = typeBlock_AST;
            currentAST.advanceChildToEnd();
            }
            typeBlock_AST = currentAST.root;
            returnAST = typeBlock_AST;
        }
Ejemplo n.º 6
0
        //throws RecognitionException, TokenStreamException
        public void statement()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST statement_AST = null;
            AST s1_AST = null;
            IToken  e1 = null;
            AST e1_AST = null;
            AST s2_AST = null;
            IToken  e2 = null;
            AST e2_AST = null;

            switch ( LA(1) )
            {
            case LITERAL_var:
            {
            declaration();
            if (0 == inputState.guessing)
            {
                s1_AST = (AST)returnAST;
                astFactory.addASTChild(ref currentAST, returnAST);
            }
            {
                if (((LA(1)==SEMI) && (tokenSet_6_.member(LA(2))))&&(LA(1)==SEMI))
                {
                    {
                        e1 = LT(1);
                        e1_AST = astFactory.create(e1);
                        match(SEMI);
                    }
                }
                else if ((tokenSet_6_.member(LA(1))) && (tokenSet_7_.member(LA(2)))) {
                }
                else
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }

            }
            if (0==inputState.guessing)
            {
                statement_AST = (AST)currentAST.root;
                setRegionInfo(statement_AST,s1_AST,e1_AST);
            }
            statement_AST = currentAST.root;
            break;
            }
            case LITERAL_if:
            {
            ifStatement();
            if (0 == inputState.guessing)
            {
                astFactory.addASTChild(ref currentAST, returnAST);
            }
            statement_AST = currentAST.root;
            break;
            }
            case LITERAL_for:
            {
            forStatement();
            if (0 == inputState.guessing)
            {
                astFactory.addASTChild(ref currentAST, returnAST);
            }
            statement_AST = currentAST.root;
            break;
            }
            case LITERAL_while:
            {
            AST tmp48_AST = null;
            tmp48_AST = astFactory.create(LT(1));
            astFactory.makeASTRoot(ref currentAST, tmp48_AST);
            match(LITERAL_while);
            match(LPAREN);
            expression();
            if (0 == inputState.guessing)
            {
                astFactory.addASTChild(ref currentAST, returnAST);
            }
            match(RPAREN);
            statement();
            if (0 == inputState.guessing)
            {
                astFactory.addASTChild(ref currentAST, returnAST);
            }
            statement_AST = currentAST.root;
            break;
            }
            case LITERAL_do:
            {
            AST tmp51_AST = null;
            tmp51_AST = astFactory.create(LT(1));
            astFactory.makeASTRoot(ref currentAST, tmp51_AST);
            match(LITERAL_do);
            statement();
            if (0 == inputState.guessing)
            {
                astFactory.addASTChild(ref currentAST, returnAST);
            }
            match(LITERAL_while);
            match(LPAREN);
            expression();
            if (0 == inputState.guessing)
            {
                astFactory.addASTChild(ref currentAST, returnAST);
            }
            match(RPAREN);
            statement_AST = currentAST.root;
            break;
            }
            case LITERAL_with:
            {
            AST tmp55_AST = null;
            tmp55_AST = astFactory.create(LT(1));
            astFactory.makeASTRoot(ref currentAST, tmp55_AST);
            match(LITERAL_with);
            match(LPAREN);
            expression();
            if (0 == inputState.guessing)
            {
                astFactory.addASTChild(ref currentAST, returnAST);
            }
            match(RPAREN);
            statement();
            if (0 == inputState.guessing)
            {
                astFactory.addASTChild(ref currentAST, returnAST);
            }
            statement_AST = currentAST.root;
            break;
            }
            case LITERAL_switch:
            {
            switchStatement();
            if (0 == inputState.guessing)
            {
                astFactory.addASTChild(ref currentAST, returnAST);
            }
            statement_AST = currentAST.root;
            break;
            }
            case LITERAL_break:
            {
            breakStatement();
            if (0 == inputState.guessing)
            {
                astFactory.addASTChild(ref currentAST, returnAST);
            }
            statement_AST = currentAST.root;
            break;
            }
            case LITERAL_continue:
            {
            continueStatement();
            if (0 == inputState.guessing)
            {
                astFactory.addASTChild(ref currentAST, returnAST);
            }
            statement_AST = currentAST.root;
            break;
            }
            case LITERAL_return:
            {
            returnStatement();
            if (0 == inputState.guessing)
            {
                astFactory.addASTChild(ref currentAST, returnAST);
            }
            statement_AST = currentAST.root;
            break;
            }
            case LITERAL_throw:
            {
            throwStatement();
            if (0 == inputState.guessing)
            {
                astFactory.addASTChild(ref currentAST, returnAST);
            }
            statement_AST = currentAST.root;
            break;
            }
            case SEMI:
            {
            match(SEMI);
            statement_AST = currentAST.root;
            break;
            }
            default:
            if (((LA(1)==LCURLY) && (tokenSet_8_.member(LA(2))))&&(LA(1)==LCURLY))
            {
                {
                    block();
                    if (0 == inputState.guessing)
                    {
                        astFactory.addASTChild(ref currentAST, returnAST);
                    }
                }
                statement_AST = currentAST.root;
            }
            else if ((tokenSet_3_.member(LA(1))) && (tokenSet_9_.member(LA(2)))) {
                assignmentExpression();
                if (0 == inputState.guessing)
                {
                    s2_AST = (AST)returnAST;
                    astFactory.addASTChild(ref currentAST, returnAST);
                }
                {
                    if (((LA(1)==SEMI) && (tokenSet_6_.member(LA(2))))&&(LA(1)==SEMI))
                    {
                        {
                            e2 = LT(1);
                            e2_AST = astFactory.create(e2);
                            match(SEMI);
                        }
                    }
                    else if ((tokenSet_6_.member(LA(1))) && (tokenSet_7_.member(LA(2)))) {
                    }
                    else
                    {
                        throw new NoViableAltException(LT(1), getFilename());
                    }

                }
                if (0==inputState.guessing)
                {
                    statement_AST = (AST)currentAST.root;
                    statement_AST = (AST) astFactory.make(astFactory.create(EXPR_STMNT,"EXPR_STMNT"), statement_AST);
                            setRegionInfo(statement_AST,s2_AST,e2_AST);
                    currentAST.root = statement_AST;
                    if ( (null != statement_AST) && (null != statement_AST.getFirstChild()) )
                        currentAST.child = statement_AST.getFirstChild();
                    else
                        currentAST.child = statement_AST;
                    currentAST.advanceChildToEnd();
                }
                statement_AST = currentAST.root;
            }
            else
            {
            throw new NoViableAltException(LT(1), getFilename());
            }
            break; }
            returnAST = statement_AST;
        }
Ejemplo n.º 7
0
        //throws RecognitionException, TokenStreamException
        public void parameterDeclarationList()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST parameterDeclarationList_AST = null;
            IToken  s = null;
            AST s_AST = null;
            IToken  e = null;
            AST e_AST = null;

            s = LT(1);
            s_AST = astFactory.create(s);
            match(LPAREN);
            {
            switch ( LA(1) )
            {
            case IDENT:
            case LITERAL_const:
            case REST:
            {
                {
                    switch ( LA(1) )
                    {
                    case IDENT:
                    case LITERAL_const:
                    {
                        parameterDeclaration();
                        if (0 == inputState.guessing)
                        {
                            astFactory.addASTChild(ref currentAST, returnAST);
                        }
                        break;
                    }
                    case REST:
                    {
                        parameterRestDeclaration();
                        if (0 == inputState.guessing)
                        {
                            astFactory.addASTChild(ref currentAST, returnAST);
                        }
                        break;
                    }
                    default:
                    {
                        throw new NoViableAltException(LT(1), getFilename());
                    }
                     }
                }
                {    // ( ... )*
                    for (;;)
                    {
                        if ((LA(1)==COMMA))
                        {
                            match(COMMA);
                            {
                                switch ( LA(1) )
                                {
                                case IDENT:
                                case LITERAL_const:
                                {
                                    parameterDeclaration();
                                    if (0 == inputState.guessing)
                                    {
                                        astFactory.addASTChild(ref currentAST, returnAST);
                                    }
                                    break;
                                }
                                case REST:
                                {
                                    parameterRestDeclaration();
                                    if (0 == inputState.guessing)
                                    {
                                        astFactory.addASTChild(ref currentAST, returnAST);
                                    }
                                    break;
                                }
                                default:
                                {
                                    throw new NoViableAltException(LT(1), getFilename());
                                }
                                 }
                            }
                        }
                        else
                        {
                            goto _loop50_breakloop;
                        }

                    }
            _loop50_breakloop:					;
                }    // ( ... )*
                break;
            }
            case RPAREN:
            {
                break;
            }
            default:
            {
                throw new NoViableAltException(LT(1), getFilename());
            }
             }
            }
            e = LT(1);
            e_AST = astFactory.create(e);
            match(RPAREN);
            if (0==inputState.guessing)
            {
            parameterDeclarationList_AST = (AST)currentAST.root;
            parameterDeclarationList_AST = (AST) astFactory.make(astFactory.create(PARAMS,"PARAMS"), parameterDeclarationList_AST);
                    setRegionInfo(parameterDeclarationList_AST,s_AST,e_AST);
            currentAST.root = parameterDeclarationList_AST;
            if ( (null != parameterDeclarationList_AST) && (null != parameterDeclarationList_AST.getFirstChild()) )
                currentAST.child = parameterDeclarationList_AST.getFirstChild();
            else
                currentAST.child = parameterDeclarationList_AST;
            currentAST.advanceChildToEnd();
            }
            parameterDeclarationList_AST = currentAST.root;
            returnAST = parameterDeclarationList_AST;
        }
Ejemplo n.º 8
0
        //throws RecognitionException, TokenStreamException
        public void newExpression()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST newExpression_AST = null;
            IToken  s = null;
            AST s_AST = null;
            AST e_AST = null;

            s = LT(1);
            s_AST = astFactory.create(s);
            astFactory.addASTChild(ref currentAST, s_AST);
            match(LITERAL_new);
            postfixExpression();
            if (0 == inputState.guessing)
            {
            e_AST = (AST)returnAST;
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            if (0==inputState.guessing)
            {
            newExpression_AST = (AST)currentAST.root;
            newExpression_AST = (AST) astFactory.make(astFactory.create(NEW_EXPR,"NEW_EXPR"), newExpression_AST);
                    setRegionInfo(newExpression_AST,s_AST,e_AST);
            currentAST.root = newExpression_AST;
            if ( (null != newExpression_AST) && (null != newExpression_AST.getFirstChild()) )
                currentAST.child = newExpression_AST.getFirstChild();
            else
                currentAST.child = newExpression_AST;
            currentAST.advanceChildToEnd();
            }
            newExpression_AST = currentAST.root;
            returnAST = newExpression_AST;
        }
Ejemplo n.º 9
0
        //throws RecognitionException, TokenStreamException
        public void modifiers()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST modifiers_AST = null;
            AST s_AST = null;
            AST e_AST = null;

            {
            switch ( LA(1) )
            {
            case LITERAL_public:
            case LITERAL_private:
            case LITERAL_protected:
            case LITERAL_internal:
            case LITERAL_static:
            case LITERAL_final:
            case LITERAL_enumerable:
            case LITERAL_explicit:
            case LITERAL_override:
            case LITERAL_dynamic:
            {
                modifier();
                if (0 == inputState.guessing)
                {
                    s_AST = (AST)returnAST;
                    astFactory.addASTChild(ref currentAST, returnAST);
                }
                {    // ( ... )*
                    for (;;)
                    {
                        if (((LA(1) >= LITERAL_public && LA(1) <= LITERAL_dynamic)))
                        {
                            modifier();
                            if (0 == inputState.guessing)
                            {
                                e_AST = (AST)returnAST;
                                astFactory.addASTChild(ref currentAST, returnAST);
                            }
                        }
                        else
                        {
                            goto _loop120_breakloop;
                        }

                    }
            _loop120_breakloop:					;
                }    // ( ... )*
                break;
            }
            case LITERAL_class:
            case LITERAL_interface:
            case LITERAL_function:
            case LITERAL_namespace:
            case LITERAL_var:
            case LITERAL_const:
            {
                break;
            }
            default:
            {
                throw new NoViableAltException(LT(1), getFilename());
            }
             }
            }
            if (0==inputState.guessing)
            {
            modifiers_AST = (AST)currentAST.root;
            modifiers_AST = (AST) astFactory.make(astFactory.create(MODIFIERS,"MODIFIERS"), modifiers_AST);
                    setRegionInfo(modifiers_AST,s_AST,e_AST);
            currentAST.root = modifiers_AST;
            if ( (null != modifiers_AST) && (null != modifiers_AST.getFirstChild()) )
                currentAST.child = modifiers_AST.getFirstChild();
            else
                currentAST.child = modifiers_AST;
            currentAST.advanceChildToEnd();
            }
            modifiers_AST = currentAST.root;
            returnAST = modifiers_AST;
        }
Ejemplo n.º 10
0
        //throws RecognitionException, TokenStreamException
        public void expression()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST expression_AST = null;
            AST s_AST = null;

            assignmentExpression();
            if (0 == inputState.guessing)
            {
            s_AST = (AST)returnAST;
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            if (0==inputState.guessing)
            {
            expression_AST = (AST)currentAST.root;
            expression_AST = (AST) astFactory.make(astFactory.create(EXPR,"EXPR"), expression_AST);
                    setRegionInfo(expression_AST,s_AST,null);
            currentAST.root = expression_AST;
            if ( (null != expression_AST) && (null != expression_AST.getFirstChild()) )
                currentAST.child = expression_AST.getFirstChild();
            else
                currentAST.child = expression_AST;
            currentAST.advanceChildToEnd();
            }
            expression_AST = currentAST.root;
            returnAST = expression_AST;
        }
Ejemplo n.º 11
0
        //throws RecognitionException, TokenStreamException
        public void encapsulatedExpression()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST encapsulatedExpression_AST = null;
            IToken  s = null;
            AST s_AST = null;
            IToken  e = null;
            AST e_AST = null;

            s = LT(1);
            s_AST = astFactory.create(s);
            match(LPAREN);
            assignmentExpression();
            if (0 == inputState.guessing)
            {
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            e = LT(1);
            e_AST = astFactory.create(e);
            match(RPAREN);
            if (0==inputState.guessing)
            {
            encapsulatedExpression_AST = (AST)currentAST.root;
            encapsulatedExpression_AST = (AST) astFactory.make(astFactory.create(ENCPS_EXPR,"ENCPS_EXPR"), encapsulatedExpression_AST);
                    setRegionInfo(encapsulatedExpression_AST,s_AST,e_AST);
            currentAST.root = encapsulatedExpression_AST;
            if ( (null != encapsulatedExpression_AST) && (null != encapsulatedExpression_AST.getFirstChild()) )
                currentAST.child = encapsulatedExpression_AST.getFirstChild();
            else
                currentAST.child = encapsulatedExpression_AST;
            currentAST.advanceChildToEnd();
            }
            encapsulatedExpression_AST = currentAST.root;
            returnAST = encapsulatedExpression_AST;
        }
Ejemplo n.º 12
0
        //throws RecognitionException, TokenStreamException
        /**
         * this is the start rule for this parser
         */
        public void compilationUnit()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST compilationUnit_AST = null;
            AST mods_AST = null;

            AST tmp1_AST = null;
            tmp1_AST = astFactory.create(LT(1));
            astFactory.addASTChild(ref currentAST, tmp1_AST);
            match(LITERAL_package);
            {
            switch ( LA(1) )
            {
            case IDENT:
            {
                identifier();
                if (0 == inputState.guessing)
                {
                    astFactory.addASTChild(ref currentAST, returnAST);
                }
                break;
            }
            case LCURLY:
            {
                break;
            }
            default:
            {
                throw new NoViableAltException(LT(1), getFilename());
            }
             }
            }
            match(LCURLY);
            {    // ( ... )*
            for (;;)
            {
                switch ( LA(1) )
                {
                case LITERAL_import:
                {
                    importDefinition();
                    if (0 == inputState.guessing)
                    {
                        astFactory.addASTChild(ref currentAST, returnAST);
                    }
                    break;
                }
                case LBRACK:
                {
                    metadataDefinition();
                    if (0 == inputState.guessing)
                    {
                        astFactory.addASTChild(ref currentAST, returnAST);
                    }
                    break;
                }
                case LITERAL_class:
                case LITERAL_interface:
                case LITERAL_function:
                case LITERAL_namespace:
                case LITERAL_var:
                case LITERAL_const:
                case LITERAL_public:
                case LITERAL_private:
                case LITERAL_protected:
                case LITERAL_internal:
                case LITERAL_static:
                case LITERAL_final:
                case LITERAL_enumerable:
                case LITERAL_explicit:
                case LITERAL_override:
                case LITERAL_dynamic:
                {
                    modifiers();
                    if (0 == inputState.guessing)
                    {
                        mods_AST = (AST)returnAST;
                    }
                    {
                        switch ( LA(1) )
                        {
                        case LITERAL_class:
                        {
                            classDefinition(mods_AST);
                            if (0 == inputState.guessing)
                            {
                                astFactory.addASTChild(ref currentAST, returnAST);
                            }
                            break;
                        }
                        case LITERAL_interface:
                        {
                            interfaceDefinition(mods_AST);
                            if (0 == inputState.guessing)
                            {
                                astFactory.addASTChild(ref currentAST, returnAST);
                            }
                            break;
                        }
                        case LITERAL_var:
                        case LITERAL_const:
                        {
                            variableDefinition(mods_AST);
                            if (0 == inputState.guessing)
                            {
                                astFactory.addASTChild(ref currentAST, returnAST);
                            }
                            break;
                        }
                        case LITERAL_function:
                        {
                            methodDefinition(mods_AST);
                            if (0 == inputState.guessing)
                            {
                                astFactory.addASTChild(ref currentAST, returnAST);
                            }
                            break;
                        }
                        case LITERAL_namespace:
                        {
                            namespaceDefinition(mods_AST);
                            if (0 == inputState.guessing)
                            {
                                astFactory.addASTChild(ref currentAST, returnAST);
                            }
                            break;
                        }
                        default:
                        {
                            throw new NoViableAltException(LT(1), getFilename());
                        }
                         }
                    }
                    break;
                }
                case SEMI:
                {
                    match(SEMI);
                    break;
                }
                default:
                {
                    goto _loop5_breakloop;
                }
                 }
            }
            _loop5_breakloop:			;
            }    // ( ... )*
            match(RCURLY);
            match(Token.EOF_TYPE);
            if (0==inputState.guessing)
            {
            compilationUnit_AST = (AST)currentAST.root;
            compilationUnit_AST = (AST) astFactory.make(astFactory.create(COMPILATION_UNIT,"COMPILATION_UNIT"), compilationUnit_AST);
            currentAST.root = compilationUnit_AST;
            if ( (null != compilationUnit_AST) && (null != compilationUnit_AST.getFirstChild()) )
                currentAST.child = compilationUnit_AST.getFirstChild();
            else
                currentAST.child = compilationUnit_AST;
            currentAST.advanceChildToEnd();
            }
            compilationUnit_AST = currentAST.root;
            returnAST = compilationUnit_AST;
        }
Ejemplo n.º 13
0
        //throws RecognitionException, TokenStreamException
        public void classDefinition(
		AST mods
	)
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST classDefinition_AST = null;
            IToken  s = null;
            AST s_AST = null;
            AST e_AST = null;

            s = LT(1);
            s_AST = astFactory.create(s);
            match(LITERAL_class);
            identifier();
            if (0 == inputState.guessing)
            {
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            extendsClause();
            if (0 == inputState.guessing)
            {
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            implementsClause();
            if (0 == inputState.guessing)
            {
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            typeBlock();
            if (0 == inputState.guessing)
            {
            e_AST = (AST)returnAST;
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            if (0==inputState.guessing)
            {
            classDefinition_AST = (AST)currentAST.root;
            classDefinition_AST = (AST) astFactory.make(astFactory.create(CLASS_DEF,"CLASS_DEF"), classDefinition_AST, mods);
                    setRegionInfo(classDefinition_AST,s_AST,e_AST);
            currentAST.root = classDefinition_AST;
            if ( (null != classDefinition_AST) && (null != classDefinition_AST.getFirstChild()) )
                currentAST.child = classDefinition_AST.getFirstChild();
            else
                currentAST.child = classDefinition_AST;
            currentAST.advanceChildToEnd();
            }
            classDefinition_AST = currentAST.root;
            returnAST = classDefinition_AST;
        }
Ejemplo n.º 14
0
        //throws RecognitionException, TokenStreamException
        public void block()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST block_AST = null;
            IToken  s = null;
            AST s_AST = null;
            IToken  e = null;
            AST e_AST = null;

            s = LT(1);
            s_AST = astFactory.create(s);
            match(LCURLY);
            {    // ( ... )*
            for (;;)
            {
                if ((tokenSet_1_.member(LA(1))))
                {
                    statement();
                    if (0 == inputState.guessing)
                    {
                        astFactory.addASTChild(ref currentAST, returnAST);
                    }
                }
                else
                {
                    goto _loop58_breakloop;
                }

            }
            _loop58_breakloop:			;
            }    // ( ... )*
            e = LT(1);
            e_AST = astFactory.create(e);
            match(RCURLY);
            if (0==inputState.guessing)
            {
            block_AST = (AST)currentAST.root;
            block_AST = (AST) astFactory.make(astFactory.create(BLOCK,"BLOCK"), block_AST);
                    setRegionInfo(block_AST,s_AST,e_AST);
            currentAST.root = block_AST;
            if ( (null != block_AST) && (null != block_AST.getFirstChild()) )
                currentAST.child = block_AST.getFirstChild();
            else
                currentAST.child = block_AST;
            currentAST.advanceChildToEnd();
            }
            block_AST = currentAST.root;
            returnAST = block_AST;
        }
Ejemplo n.º 15
0
        //throws RecognitionException, TokenStreamException
        /** Match (foo)() and (foo+".terse")() */
        public void indirectTemplate()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            Antlr.StringTemplate.Language.StringTemplateAST indirectTemplate_AST = null;
            Antlr.StringTemplate.Language.StringTemplateAST e_AST = null;
            Antlr.StringTemplate.Language.StringTemplateAST args_AST = null;

            try {      // for error handling
            Antlr.StringTemplate.Language.StringTemplateAST tmp36_AST = null;
            tmp36_AST = (Antlr.StringTemplate.Language.StringTemplateAST) astFactory.create(LT(1));
            match(LPAREN);
            templatesExpr();
            if (0 == inputState.guessing)
            {
                e_AST = (Antlr.StringTemplate.Language.StringTemplateAST)returnAST;
            }
            Antlr.StringTemplate.Language.StringTemplateAST tmp37_AST = null;
            tmp37_AST = (Antlr.StringTemplate.Language.StringTemplateAST) astFactory.create(LT(1));
            match(RPAREN);
            argList();
            if (0 == inputState.guessing)
            {
                args_AST = (Antlr.StringTemplate.Language.StringTemplateAST)returnAST;
            }
            if (0==inputState.guessing)
            {
                indirectTemplate_AST = (Antlr.StringTemplate.Language.StringTemplateAST)currentAST.root;
                indirectTemplate_AST = (Antlr.StringTemplate.Language.StringTemplateAST) astFactory.make((AST)(Antlr.StringTemplate.Language.StringTemplateAST) astFactory.create(VALUE,"value"), (AST)e_AST, (AST)args_AST);
                currentAST.root = indirectTemplate_AST;
                if ( (null != indirectTemplate_AST) && (null != indirectTemplate_AST.getFirstChild()) )
                    currentAST.child = indirectTemplate_AST.getFirstChild();
                else
                    currentAST.child = indirectTemplate_AST;
                currentAST.advanceChildToEnd();
            }
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex);
                recover(ex,tokenSet_9_);
            }
            else
            {
                throw ex;
            }
            }
            returnAST = indirectTemplate_AST;
        }
Ejemplo n.º 16
0
        //throws RecognitionException, TokenStreamException
        public void expressionList()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST expressionList_AST = null;
            AST s_AST = null;
            AST e_AST = null;

            expression();
            if (0 == inputState.guessing)
            {
            s_AST = (AST)returnAST;
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            {    // ( ... )*
            for (;;)
            {
                if ((LA(1)==COMMA))
                {
                    match(COMMA);
                    expression();
                    if (0 == inputState.guessing)
                    {
                        e_AST = (AST)returnAST;
                        astFactory.addASTChild(ref currentAST, returnAST);
                    }
                }
                else
                {
                    goto _loop142_breakloop;
                }

            }
            _loop142_breakloop:			;
            }    // ( ... )*
            if (0==inputState.guessing)
            {
            expressionList_AST = (AST)currentAST.root;
            expressionList_AST = (AST) astFactory.make(astFactory.create(ELIST,"ELIST"), expressionList_AST);
                    setRegionInfo(expressionList_AST,s_AST,e_AST);
            currentAST.root = expressionList_AST;
            if ( (null != expressionList_AST) && (null != expressionList_AST.getFirstChild()) )
                currentAST.child = expressionList_AST.getFirstChild();
            else
                currentAST.child = expressionList_AST;
            currentAST.advanceChildToEnd();
            }
            expressionList_AST = currentAST.root;
            returnAST = expressionList_AST;
        }
Ejemplo n.º 17
0
        //throws RecognitionException, TokenStreamException
        public void methodDefinition(
		AST mods
	)
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST methodDefinition_AST = null;
            IToken  s = null;
            AST s_AST = null;
            AST e1_AST = null;
            AST e2_AST = null;

            s = LT(1);
            s_AST = astFactory.create(s);
            match(LITERAL_function);
            {
            switch ( LA(1) )
            {
            case LITERAL_get:
            case LITERAL_set:
            {
                {
                    switch ( LA(1) )
                    {
                    case LITERAL_get:
                    {
                        AST tmp13_AST = null;
                        tmp13_AST = astFactory.create(LT(1));
                        astFactory.addASTChild(ref currentAST, tmp13_AST);
                        match(LITERAL_get);
                        break;
                    }
                    case LITERAL_set:
                    {
                        AST tmp14_AST = null;
                        tmp14_AST = astFactory.create(LT(1));
                        astFactory.addASTChild(ref currentAST, tmp14_AST);
                        match(LITERAL_set);
                        break;
                    }
                    default:
                    {
                        throw new NoViableAltException(LT(1), getFilename());
                    }
                     }
                }
                {
                    AST tmp15_AST = null;
                    tmp15_AST = astFactory.create(LT(1));
                    astFactory.addASTChild(ref currentAST, tmp15_AST);
                    match(tokenSet_0_);
                }
                break;
            }
            case IDENT:
            {
                break;
            }
            default:
            {
                throw new NoViableAltException(LT(1), getFilename());
            }
             }
            }
            AST tmp16_AST = null;
            tmp16_AST = astFactory.create(LT(1));
            astFactory.addASTChild(ref currentAST, tmp16_AST);
            match(IDENT);
            parameterDeclarationList();
            if (0 == inputState.guessing)
            {
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            typeExpression();
            if (0 == inputState.guessing)
            {
            e1_AST = (AST)returnAST;
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            {
            switch ( LA(1) )
            {
            case LCURLY:
            {
                block();
                if (0 == inputState.guessing)
                {
                    e2_AST = (AST)returnAST;
                    astFactory.addASTChild(ref currentAST, returnAST);
                }
                break;
            }
            case SEMI:
            case RCURLY:
            case LITERAL_import:
            case LBRACK:
            case LITERAL_class:
            case LITERAL_interface:
            case LITERAL_function:
            case LITERAL_namespace:
            case LITERAL_var:
            case LITERAL_const:
            case LITERAL_public:
            case LITERAL_private:
            case LITERAL_protected:
            case LITERAL_internal:
            case LITERAL_static:
            case LITERAL_final:
            case LITERAL_enumerable:
            case LITERAL_explicit:
            case LITERAL_override:
            case LITERAL_dynamic:
            {
                break;
            }
            default:
            {
                throw new NoViableAltException(LT(1), getFilename());
            }
             }
            }
            if (0==inputState.guessing)
            {
            methodDefinition_AST = (AST)currentAST.root;
            methodDefinition_AST = (AST) astFactory.make(astFactory.create(METHOD_DEF,"METHOD_DEF"), methodDefinition_AST, mods);
                    setRegionInfo(methodDefinition_AST,s_AST,e2_AST==null?e1_AST:e2_AST);
            currentAST.root = methodDefinition_AST;
            if ( (null != methodDefinition_AST) && (null != methodDefinition_AST.getFirstChild()) )
                currentAST.child = methodDefinition_AST.getFirstChild();
            else
                currentAST.child = methodDefinition_AST;
            currentAST.advanceChildToEnd();
            }
            methodDefinition_AST = currentAST.root;
            returnAST = methodDefinition_AST;
        }
Ejemplo n.º 18
0
        //throws RecognitionException, TokenStreamException
        public void extendsClause()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST extendsClause_AST = null;
            IToken  s = null;
            AST s_AST = null;
            AST e_AST = null;

            {
            switch ( LA(1) )
            {
            case LITERAL_extends:
            {
                s = LT(1);
                s_AST = astFactory.create(s);
                match(LITERAL_extends);
                identifier();
                if (0 == inputState.guessing)
                {
                    e_AST = (AST)returnAST;
                    astFactory.addASTChild(ref currentAST, returnAST);
                }
                break;
            }
            case LCURLY:
            case LITERAL_implements:
            {
                break;
            }
            default:
            {
                throw new NoViableAltException(LT(1), getFilename());
            }
             }
            }
            if (0==inputState.guessing)
            {
            extendsClause_AST = (AST)currentAST.root;
            extendsClause_AST = (AST) astFactory.make(astFactory.create(EXTENDS_CLAUSE,"EXTENDS_CLAUSE"), extendsClause_AST);
                    setRegionInfo(extendsClause_AST,s_AST,e_AST);
            currentAST.root = extendsClause_AST;
            if ( (null != extendsClause_AST) && (null != extendsClause_AST.getFirstChild()) )
                currentAST.child = extendsClause_AST.getFirstChild();
            else
                currentAST.child = extendsClause_AST;
            currentAST.advanceChildToEnd();
            }
            extendsClause_AST = currentAST.root;
            returnAST = extendsClause_AST;
        }
Ejemplo n.º 19
0
        //throws RecognitionException, TokenStreamException
        public void namespaceDefinition(
		AST mods
	)
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST namespaceDefinition_AST = null;
            IToken  s = null;
            AST s_AST = null;
            IToken  e = null;
            AST e_AST = null;

            s = LT(1);
            s_AST = astFactory.create(s);
            match(LITERAL_namespace);
            e = LT(1);
            e_AST = astFactory.create(e);
            astFactory.addASTChild(ref currentAST, e_AST);
            match(IDENT);
            if (0==inputState.guessing)
            {
            namespaceDefinition_AST = (AST)currentAST.root;
            namespaceDefinition_AST = (AST) astFactory.make(astFactory.create(NAMESPACE_DEF,"NAMESPACE_DEF"), namespaceDefinition_AST, mods);
                    setRegionInfo(namespaceDefinition_AST,s_AST,e_AST);
            currentAST.root = namespaceDefinition_AST;
            if ( (null != namespaceDefinition_AST) && (null != namespaceDefinition_AST.getFirstChild()) )
                currentAST.child = namespaceDefinition_AST.getFirstChild();
            else
                currentAST.child = namespaceDefinition_AST;
            currentAST.advanceChildToEnd();
            }
            namespaceDefinition_AST = currentAST.root;
            returnAST = namespaceDefinition_AST;
        }
Ejemplo n.º 20
0
        //throws RecognitionException, TokenStreamException
        public void forIter()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST forIter_AST = null;
            AST s_AST = null;

            {
            switch ( LA(1) )
            {
            case LCURLY:
            case LBRACK:
            case LPAREN:
            case LITERAL_function:
            case IDENT:
            case NUMBER:
            case PLUS:
            case MINUS:
            case INC:
            case DEC:
            case LITERAL_delete:
            case LITERAL_typeof:
            case LNOT:
            case BNOT:
            case LITERAL_null:
            case LITERAL_true:
            case LITERAL_false:
            case LITERAL_undefined:
            case STRING_LITERAL:
            case REGEX_LITERAL:
            case XML_LITERAL:
            case LITERAL_new:
            {
                expressionList();
                if (0 == inputState.guessing)
                {
                    s_AST = (AST)returnAST;
                    astFactory.addASTChild(ref currentAST, returnAST);
                }
                break;
            }
            case RPAREN:
            {
                break;
            }
            default:
            {
                throw new NoViableAltException(LT(1), getFilename());
            }
             }
            }
            if (0==inputState.guessing)
            {
            forIter_AST = (AST)currentAST.root;
            forIter_AST = (AST) astFactory.make(astFactory.create(FOR_ITERATOR,"FOR_ITERATOR"), forIter_AST);
                    setRegionInfo(forIter_AST,s_AST,null);
            currentAST.root = forIter_AST;
            if ( (null != forIter_AST) && (null != forIter_AST.getFirstChild()) )
                currentAST.child = forIter_AST.getFirstChild();
            else
                currentAST.child = forIter_AST;
            currentAST.advanceChildToEnd();
            }
            forIter_AST = currentAST.root;
            returnAST = forIter_AST;
        }
Ejemplo n.º 21
0
        //throws RecognitionException, TokenStreamException
        public void objectLiteral()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST objectLiteral_AST = null;
            IToken  s = null;
            AST s_AST = null;
            IToken  e = null;
            AST e_AST = null;

            s = LT(1);
            s_AST = astFactory.create(s);
            match(LCURLY);
            {
            switch ( LA(1) )
            {
            case IDENT:
            case NUMBER:
            {
                fieldList();
                if (0 == inputState.guessing)
                {
                    astFactory.addASTChild(ref currentAST, returnAST);
                }
                break;
            }
            case RCURLY:
            {
                break;
            }
            default:
            {
                throw new NoViableAltException(LT(1), getFilename());
            }
             }
            }
            e = LT(1);
            e_AST = astFactory.create(e);
            match(RCURLY);
            if (0==inputState.guessing)
            {
            objectLiteral_AST = (AST)currentAST.root;
            objectLiteral_AST = (AST) astFactory.make(astFactory.create(OBJECT_LITERAL,"OBJECT_LITERAL"), objectLiteral_AST);
                    setRegionInfo(objectLiteral_AST,s_AST,e_AST);
            currentAST.root = objectLiteral_AST;
            if ( (null != objectLiteral_AST) && (null != objectLiteral_AST.getFirstChild()) )
                currentAST.child = objectLiteral_AST.getFirstChild();
            else
                currentAST.child = objectLiteral_AST;
            currentAST.advanceChildToEnd();
            }
            objectLiteral_AST = currentAST.root;
            returnAST = objectLiteral_AST;
        }
Ejemplo n.º 22
0
        //throws RecognitionException, TokenStreamException
        public void functionDefinition()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST functionDefinition_AST = null;
            IToken  s = null;
            AST s_AST = null;
            AST e_AST = null;

            s = LT(1);
            s_AST = astFactory.create(s);
            astFactory.addASTChild(ref currentAST, s_AST);
            match(LITERAL_function);
            parameterDeclarationList();
            if (0 == inputState.guessing)
            {
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            typeExpression();
            if (0 == inputState.guessing)
            {
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            block();
            if (0 == inputState.guessing)
            {
            e_AST = (AST)returnAST;
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            if (0==inputState.guessing)
            {
            functionDefinition_AST = (AST)currentAST.root;
            functionDefinition_AST = (AST) astFactory.make(astFactory.create(FUNC_DEF,"FUNC_DEF"), functionDefinition_AST);
                    setRegionInfo(functionDefinition_AST,s_AST,e_AST);
            currentAST.root = functionDefinition_AST;
            if ( (null != functionDefinition_AST) && (null != functionDefinition_AST.getFirstChild()) )
                currentAST.child = functionDefinition_AST.getFirstChild();
            else
                currentAST.child = functionDefinition_AST;
            currentAST.advanceChildToEnd();
            }
            functionDefinition_AST = currentAST.root;
            returnAST = functionDefinition_AST;
        }
Ejemplo n.º 23
0
        //throws RecognitionException, TokenStreamException
        public void parameterRestDeclaration()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST parameterRestDeclaration_AST = null;

            AST tmp31_AST = null;
            tmp31_AST = astFactory.create(LT(1));
            astFactory.addASTChild(ref currentAST, tmp31_AST);
            match(REST);
            {
            switch ( LA(1) )
            {
            case LITERAL_const:
            {
                AST tmp32_AST = null;
                tmp32_AST = astFactory.create(LT(1));
                astFactory.addASTChild(ref currentAST, tmp32_AST);
                match(LITERAL_const);
                break;
            }
            case IDENT:
            {
                break;
            }
            default:
            {
                throw new NoViableAltException(LT(1), getFilename());
            }
             }
            }
            AST tmp33_AST = null;
            tmp33_AST = astFactory.create(LT(1));
            astFactory.addASTChild(ref currentAST, tmp33_AST);
            match(IDENT);
            if (0==inputState.guessing)
            {
            parameterRestDeclaration_AST = (AST)currentAST.root;
            parameterRestDeclaration_AST = (AST) astFactory.make(astFactory.create(PARAM,"PARAM"), parameterRestDeclaration_AST);
            currentAST.root = parameterRestDeclaration_AST;
            if ( (null != parameterRestDeclaration_AST) && (null != parameterRestDeclaration_AST.getFirstChild()) )
                currentAST.child = parameterRestDeclaration_AST.getFirstChild();
            else
                currentAST.child = parameterRestDeclaration_AST;
            currentAST.advanceChildToEnd();
            }
            parameterRestDeclaration_AST = currentAST.root;
            returnAST = parameterRestDeclaration_AST;
        }
Ejemplo n.º 24
0
        //throws RecognitionException, TokenStreamException
        public void implementsClause()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST implementsClause_AST = null;
            IToken  s = null;
            AST s_AST = null;
            AST e1_AST = null;
            AST e2_AST = null;

            {    // ( ... )*
            for (;;)
            {
                if ((LA(1)==LITERAL_implements))
                {
                    s = LT(1);
                    s_AST = astFactory.create(s);
                    match(LITERAL_implements);
                    identifier();
                    if (0 == inputState.guessing)
                    {
                        e1_AST = (AST)returnAST;
                        astFactory.addASTChild(ref currentAST, returnAST);
                    }
                    {    // ( ... )*
                        for (;;)
                        {
                            if ((LA(1)==COMMA))
                            {
                                match(COMMA);
                                identifier();
                                if (0 == inputState.guessing)
                                {
                                    e2_AST = (AST)returnAST;
                                    astFactory.addASTChild(ref currentAST, returnAST);
                                }
                            }
                            else
                            {
                                goto _loop23_breakloop;
                            }

                        }
            _loop23_breakloop:						;
                    }    // ( ... )*
                }
                else
                {
                    goto _loop24_breakloop;
                }

            }
            _loop24_breakloop:			;
            }    // ( ... )*
            if (0==inputState.guessing)
            {
            implementsClause_AST = (AST)currentAST.root;
            implementsClause_AST = (AST) astFactory.make(astFactory.create(IMPLEMENTS_CLAUSE,"IMPLEMENTS_CLAUSE"), implementsClause_AST);
                    setRegionInfo(implementsClause_AST,s_AST,e2_AST==null?e1_AST:e2_AST);
            currentAST.root = implementsClause_AST;
            if ( (null != implementsClause_AST) && (null != implementsClause_AST.getFirstChild()) )
                currentAST.child = implementsClause_AST.getFirstChild();
            else
                currentAST.child = implementsClause_AST;
            currentAST.advanceChildToEnd();
            }
            implementsClause_AST = currentAST.root;
            returnAST = implementsClause_AST;
        }
Ejemplo n.º 25
0
        //throws RecognitionException, TokenStreamException
        public void switchBlock()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST switchBlock_AST = null;
            IToken  s = null;
            AST s_AST = null;
            IToken  e = null;
            AST e_AST = null;

            s = LT(1);
            s_AST = astFactory.create(s);
            match(LCURLY);
            {    // ( ... )*
            for (;;)
            {
                if ((LA(1)==LITERAL_case))
                {
                    caseStatement();
                    if (0 == inputState.guessing)
                    {
                        astFactory.addASTChild(ref currentAST, returnAST);
                    }
                }
                else
                {
                    goto _loop85_breakloop;
                }

            }
            _loop85_breakloop:			;
            }    // ( ... )*
            {
            switch ( LA(1) )
            {
            case LITERAL_default:
            {
                defaultStatement();
                if (0 == inputState.guessing)
                {
                    astFactory.addASTChild(ref currentAST, returnAST);
                }
                break;
            }
            case RCURLY:
            {
                break;
            }
            default:
            {
                throw new NoViableAltException(LT(1), getFilename());
            }
             }
            }
            e = LT(1);
            e_AST = astFactory.create(e);
            match(RCURLY);
            if (0==inputState.guessing)
            {
            switchBlock_AST = (AST)currentAST.root;
            switchBlock_AST = (AST) astFactory.make(astFactory.create(BLOCK,"BLOCK"), switchBlock_AST);
                    setRegionInfo(switchBlock_AST,s_AST,e_AST);
            currentAST.root = switchBlock_AST;
            if ( (null != switchBlock_AST) && (null != switchBlock_AST.getFirstChild()) )
                currentAST.child = switchBlock_AST.getFirstChild();
            else
                currentAST.child = switchBlock_AST;
            currentAST.advanceChildToEnd();
            }
            switchBlock_AST = currentAST.root;
            returnAST = switchBlock_AST;
        }
Ejemplo n.º 26
0
        //throws RecognitionException, TokenStreamException
        public void importDefinition()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST importDefinition_AST = null;
            IToken  s = null;
            AST s_AST = null;
            AST e_AST = null;

            s = LT(1);
            s_AST = astFactory.create(s);
            match(LITERAL_import);
            identifierStar();
            if (0 == inputState.guessing)
            {
            e_AST = (AST)returnAST;
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            if (0==inputState.guessing)
            {
            importDefinition_AST = (AST)currentAST.root;
            importDefinition_AST = (AST) astFactory.make(astFactory.create(IMPORT,"IMPORT"), importDefinition_AST);
                    setRegionInfo(importDefinition_AST,s_AST,e_AST);
            currentAST.root = importDefinition_AST;
            if ( (null != importDefinition_AST) && (null != importDefinition_AST.getFirstChild()) )
                currentAST.child = importDefinition_AST.getFirstChild();
            else
                currentAST.child = importDefinition_AST;
            currentAST.advanceChildToEnd();
            }
            importDefinition_AST = currentAST.root;
            returnAST = importDefinition_AST;
        }
Ejemplo n.º 27
0
        //throws RecognitionException, TokenStreamException
        public void arguments()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST arguments_AST = null;

            {
            switch ( LA(1) )
            {
            case LCURLY:
            case LBRACK:
            case LPAREN:
            case LITERAL_function:
            case IDENT:
            case NUMBER:
            case PLUS:
            case MINUS:
            case INC:
            case DEC:
            case LITERAL_delete:
            case LITERAL_typeof:
            case LNOT:
            case BNOT:
            case LITERAL_null:
            case LITERAL_true:
            case LITERAL_false:
            case LITERAL_undefined:
            case STRING_LITERAL:
            case REGEX_LITERAL:
            case XML_LITERAL:
            case LITERAL_new:
            {
                expressionList();
                if (0 == inputState.guessing)
                {
                    astFactory.addASTChild(ref currentAST, returnAST);
                }
                break;
            }
            case RPAREN:
            {
                if (0==inputState.guessing)
                {
                    arguments_AST = (AST)currentAST.root;
                    arguments_AST = astFactory.create(ELIST,"ELIST");
                    currentAST.root = arguments_AST;
                    if ( (null != arguments_AST) && (null != arguments_AST.getFirstChild()) )
                        currentAST.child = arguments_AST.getFirstChild();
                    else
                        currentAST.child = arguments_AST;
                    currentAST.advanceChildToEnd();
                }
                break;
            }
            default:
            {
                throw new NoViableAltException(LT(1), getFilename());
            }
             }
            }
            arguments_AST = currentAST.root;
            returnAST = arguments_AST;
        }
Ejemplo n.º 28
0
        //throws RecognitionException, TokenStreamException
        public void interfaceDefinition(
		AST mods
	)
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST interfaceDefinition_AST = null;
            IToken  s = null;
            AST s_AST = null;
            AST e_AST = null;

            s = LT(1);
            s_AST = astFactory.create(s);
            match(LITERAL_interface);
            identifier();
            if (0 == inputState.guessing)
            {
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            extendsClause();
            if (0 == inputState.guessing)
            {
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            typeBlock();
            if (0 == inputState.guessing)
            {
            e_AST = (AST)returnAST;
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            if (0==inputState.guessing)
            {
            interfaceDefinition_AST = (AST)currentAST.root;
            interfaceDefinition_AST = (AST) astFactory.make(astFactory.create(INTERFACE_DEF,"INTERFACE_DEF"), interfaceDefinition_AST, mods);
                    setRegionInfo(interfaceDefinition_AST,s_AST,e_AST);
            currentAST.root = interfaceDefinition_AST;
            if ( (null != interfaceDefinition_AST) && (null != interfaceDefinition_AST.getFirstChild()) )
                currentAST.child = interfaceDefinition_AST.getFirstChild();
            else
                currentAST.child = interfaceDefinition_AST;
            currentAST.advanceChildToEnd();
            }
            interfaceDefinition_AST = currentAST.root;
            returnAST = interfaceDefinition_AST;
        }
Ejemplo n.º 29
0
        //throws RecognitionException, TokenStreamException
        public void variableDeclarator(
		AST mods
	)
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST variableDeclarator_AST = null;
            IToken  s = null;
            AST s_AST = null;
            AST e1_AST = null;
            AST e2_AST = null;

            s = LT(1);
            s_AST = astFactory.create(s);
            astFactory.addASTChild(ref currentAST, s_AST);
            match(IDENT);
            typeExpression();
            if (0 == inputState.guessing)
            {
            e1_AST = (AST)returnAST;
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            {
            switch ( LA(1) )
            {
            case ASSIGN:
            {
                variableInitializer();
                if (0 == inputState.guessing)
                {
                    e2_AST = (AST)returnAST;
                    astFactory.addASTChild(ref currentAST, returnAST);
                }
                break;
            }
            case LCURLY:
            case SEMI:
            case RCURLY:
            case LITERAL_import:
            case LBRACK:
            case COMMA:
            case LPAREN:
            case LITERAL_class:
            case LITERAL_interface:
            case LITERAL_function:
            case IDENT:
            case LITERAL_namespace:
            case LITERAL_var:
            case LITERAL_const:
            case LITERAL_while:
            case LITERAL_do:
            case LITERAL_with:
            case LITERAL_if:
            case LITERAL_else:
            case LITERAL_throw:
            case LITERAL_return:
            case LITERAL_continue:
            case LITERAL_break:
            case LITERAL_switch:
            case LITERAL_case:
            case LITERAL_default:
            case LITERAL_for:
            case LITERAL_in:
            case LITERAL_public:
            case LITERAL_private:
            case LITERAL_protected:
            case LITERAL_internal:
            case LITERAL_static:
            case LITERAL_final:
            case LITERAL_enumerable:
            case LITERAL_explicit:
            case LITERAL_override:
            case LITERAL_dynamic:
            case NUMBER:
            case PLUS:
            case MINUS:
            case INC:
            case DEC:
            case LITERAL_delete:
            case LITERAL_typeof:
            case LNOT:
            case BNOT:
            case LITERAL_null:
            case LITERAL_true:
            case LITERAL_false:
            case LITERAL_undefined:
            case STRING_LITERAL:
            case REGEX_LITERAL:
            case XML_LITERAL:
            case LITERAL_new:
            {
                break;
            }
            default:
            {
                throw new NoViableAltException(LT(1), getFilename());
            }
             }
            }
            if (0==inputState.guessing)
            {
            variableDeclarator_AST = (AST)currentAST.root;
            variableDeclarator_AST = (AST) astFactory.make(astFactory.create(VARIABLE_DEF,"VARIABLE_DEF"), variableDeclarator_AST, mods);
                    setRegionInfo(variableDeclarator_AST,s_AST,e2_AST==null?e1_AST:e2_AST);
            currentAST.root = variableDeclarator_AST;
            if ( (null != variableDeclarator_AST) && (null != variableDeclarator_AST.getFirstChild()) )
                currentAST.child = variableDeclarator_AST.getFirstChild();
            else
                currentAST.child = variableDeclarator_AST;
            currentAST.advanceChildToEnd();
            }
            variableDeclarator_AST = currentAST.root;
            returnAST = variableDeclarator_AST;
        }
Ejemplo n.º 30
0
        //throws RecognitionException, TokenStreamException
        public void literalField()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            AST literalField_AST = null;
            AST s_AST = null;
            AST e_AST = null;

            fieldName();
            if (0 == inputState.guessing)
            {
            s_AST = (AST)returnAST;
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            match(COLON);
            element();
            if (0 == inputState.guessing)
            {
            e_AST = (AST)returnAST;
            astFactory.addASTChild(ref currentAST, returnAST);
            }
            if (0==inputState.guessing)
            {
            literalField_AST = (AST)currentAST.root;
            literalField_AST = (AST) astFactory.make(astFactory.create(OBJECT_FIELD,"OBJECT_FIELD"), literalField_AST);
                    setRegionInfo(literalField_AST,s_AST,e_AST);
            currentAST.root = literalField_AST;
            if ( (null != literalField_AST) && (null != literalField_AST.getFirstChild()) )
                currentAST.child = literalField_AST.getFirstChild();
            else
                currentAST.child = literalField_AST;
            currentAST.advanceChildToEnd();
            }
            literalField_AST = currentAST.root;
            returnAST = literalField_AST;
        }
Ejemplo n.º 31
0
		public void primaryExpression() //throws RecognitionException, TokenStreamException
	{

			returnAST = null;
			ASTPair currentAST = new ASTPair();
			GodLesZ.Library.Amf.Expression.FluorineAST primaryExpression_AST = null;

			try {      // for error handling
				switch (LA(1)) {
					case LPAREN: {
							parenExpr();
							if (0 == inputState.guessing) {
								astFactory.addASTChild(ref currentAST, (AST)returnAST);
							}
							primaryExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)currentAST.root;
							break;
						}
					case FALSE:
					case TRUE:
					case NULL_LITERAL:
					case INTEGER_LITERAL:
					case HEXADECIMAL_INTEGER_LITERAL:
					case REAL_LITERAL:
					case STRING_LITERAL:
					case LITERAL_date: {
							literal();
							if (0 == inputState.guessing) {
								astFactory.addASTChild(ref currentAST, (AST)returnAST);
							}
							primaryExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)currentAST.root;
							break;
						}
					case POUND:
					case ID: {
							functionOrVar();
							if (0 == inputState.guessing) {
								astFactory.addASTChild(ref currentAST, (AST)returnAST);
							}
							if (0 == inputState.guessing) {
								primaryExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)currentAST.root;
								primaryExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.make((AST)(GodLesZ.Library.Amf.Expression.FluorineAST)astFactory.create(EXPR, "expression", "GodLesZ.Library.Amf.Expression.Expression"), (AST)primaryExpression_AST);
								currentAST.root = primaryExpression_AST;
								if ((null != primaryExpression_AST) && (null != primaryExpression_AST.getFirstChild()))
									currentAST.child = primaryExpression_AST.getFirstChild();
								else
									currentAST.child = primaryExpression_AST;
								currentAST.advanceChildToEnd();
							}
							primaryExpression_AST = (GodLesZ.Library.Amf.Expression.FluorineAST)currentAST.root;
							break;
						}
					default: {
							throw new NoViableAltException(LT(1), getFilename());
						}
				}
			} catch (RecognitionException ex) {
				if (0 == inputState.guessing) {
					reportError(ex);
					recover(ex, tokenSet_9_);
				} else {
					throw ex;
				}
			}
			returnAST = primaryExpression_AST;
		}
Ejemplo n.º 32
0
        //throws RecognitionException, TokenStreamException
        public void function()
        {
            returnAST = null;
            ASTPair currentAST = new ASTPair();
            Antlr.StringTemplate.Language.StringTemplateAST function_AST = null;

            try {      // for error handling
            {
                switch ( LA(1) )
                {
                case LITERAL_first:
                {
                    Antlr.StringTemplate.Language.StringTemplateAST tmp28_AST = null;
                    tmp28_AST = (Antlr.StringTemplate.Language.StringTemplateAST) astFactory.create(LT(1));
                    astFactory.addASTChild(ref currentAST, (AST)tmp28_AST);
                    match(LITERAL_first);
                    break;
                }
                case LITERAL_rest:
                {
                    Antlr.StringTemplate.Language.StringTemplateAST tmp29_AST = null;
                    tmp29_AST = (Antlr.StringTemplate.Language.StringTemplateAST) astFactory.create(LT(1));
                    astFactory.addASTChild(ref currentAST, (AST)tmp29_AST);
                    match(LITERAL_rest);
                    break;
                }
                case LITERAL_last:
                {
                    Antlr.StringTemplate.Language.StringTemplateAST tmp30_AST = null;
                    tmp30_AST = (Antlr.StringTemplate.Language.StringTemplateAST) astFactory.create(LT(1));
                    astFactory.addASTChild(ref currentAST, (AST)tmp30_AST);
                    match(LITERAL_last);
                    break;
                }
                case LITERAL_length:
                {
                    Antlr.StringTemplate.Language.StringTemplateAST tmp31_AST = null;
                    tmp31_AST = (Antlr.StringTemplate.Language.StringTemplateAST) astFactory.create(LT(1));
                    astFactory.addASTChild(ref currentAST, (AST)tmp31_AST);
                    match(LITERAL_length);
                    break;
                }
                case LITERAL_strip:
                {
                    Antlr.StringTemplate.Language.StringTemplateAST tmp32_AST = null;
                    tmp32_AST = (Antlr.StringTemplate.Language.StringTemplateAST) astFactory.create(LT(1));
                    astFactory.addASTChild(ref currentAST, (AST)tmp32_AST);
                    match(LITERAL_strip);
                    break;
                }
                case LITERAL_trunc:
                {
                    Antlr.StringTemplate.Language.StringTemplateAST tmp33_AST = null;
                    tmp33_AST = (Antlr.StringTemplate.Language.StringTemplateAST) astFactory.create(LT(1));
                    astFactory.addASTChild(ref currentAST, (AST)tmp33_AST);
                    match(LITERAL_trunc);
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            singleArg();
            if (0 == inputState.guessing)
            {
                astFactory.addASTChild(ref currentAST, (AST)returnAST);
            }
            if (0==inputState.guessing)
            {
                function_AST = (Antlr.StringTemplate.Language.StringTemplateAST)currentAST.root;
                function_AST = (Antlr.StringTemplate.Language.StringTemplateAST) astFactory.make((AST)(Antlr.StringTemplate.Language.StringTemplateAST) astFactory.create(FUNCTION), (AST)function_AST);
                currentAST.root = function_AST;
                if ( (null != function_AST) && (null != function_AST.getFirstChild()) )
                    currentAST.child = function_AST.getFirstChild();
                else
                    currentAST.child = function_AST;
                currentAST.advanceChildToEnd();
            }
            function_AST = (Antlr.StringTemplate.Language.StringTemplateAST)currentAST.root;
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex);
                recover(ex,tokenSet_9_);
            }
            else
            {
                throw ex;
            }
            }
            returnAST = function_AST;
        }