/*Copy an ASTPair. Don't call it clone() because we want type-safety */ public ASTPair copy() { ASTPair tmp = new ASTPair(); tmp.root = root; tmp.child = child; return tmp; }
/// <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 virtual void addASTChild(ref ASTPair currentAST, AST child) { if (child != null) { if (currentAST.root == null) { // Make new child the current root currentAST.root = child; } else { if (currentAST.child == null) { // Add new child to current root currentAST.root.setFirstChild(child); } else { currentAST.child.setNextSibling(child); } } // Make new child the current child currentAST.child = child; currentAST.advanceChildToEnd(); } }
/*Copy an ASTPair. Don't call it clone() because we want type-safety */ public ASTPair copy() { ASTPair tmp = new ASTPair(); tmp.root = root; tmp.child = child; return(tmp); }
/// <summary> /// Make an AST the root of current AST. /// </summary> /// <param name="currentAST"></param> /// <param name="root"></param> public virtual void makeASTRoot(ref ASTPair currentAST, AST root) { if (root != null) { // Add the current root as a child of new root root.addChild(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; } }
public void namedArgument() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST namedArgument_AST = null; try { // for error handling bool synPredMatched111 = false; if (((LA(1)==ID) && (LA(2)==ASSIGN))) { int _m111 = mark(); synPredMatched111 = true; inputState.guessing++; try { { match(ID); match(ASSIGN); } } catch (RecognitionException) { synPredMatched111 = false; } rewind(_m111); inputState.guessing--; } if ( synPredMatched111 ) { Spring.Expressions.NamedArgumentNode tmp108_AST = null; tmp108_AST = (Spring.Expressions.NamedArgumentNode) astFactory.create(LT(1), "Spring.Expressions.NamedArgumentNode"); astFactory.makeASTRoot(ref currentAST, (AST)tmp108_AST); match(ID); match(ASSIGN); expression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } namedArgument_AST = (Spring.Expressions.SpringAST)currentAST.root; } else if ((tokenSet_9_.member(LA(1))) && (tokenSet_22_.member(LA(2)))) { argument(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } namedArgument_AST = (Spring.Expressions.SpringAST)currentAST.root; } else { throw new NoViableAltException(LT(1), getFilename()); } } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_23_); } else { throw ex; } } returnAST = namedArgument_AST; }
public void boolLiteral() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST boolLiteral_AST = null; try { // for error handling if ((LA(1)==TRUE)) { Spring.Expressions.BooleanLiteralNode tmp110_AST = null; tmp110_AST = (Spring.Expressions.BooleanLiteralNode) astFactory.create(LT(1), "Spring.Expressions.BooleanLiteralNode"); astFactory.addASTChild(ref currentAST, (AST)tmp110_AST); match(TRUE); boolLiteral_AST = (Spring.Expressions.SpringAST)currentAST.root; } else if ((LA(1)==FALSE)) { Spring.Expressions.BooleanLiteralNode tmp111_AST = null; tmp111_AST = (Spring.Expressions.BooleanLiteralNode) astFactory.create(LT(1), "Spring.Expressions.BooleanLiteralNode"); astFactory.addASTChild(ref currentAST, (AST)tmp111_AST); match(FALSE); boolLiteral_AST = (Spring.Expressions.SpringAST)currentAST.root; } else { throw new NoViableAltException(LT(1), getFilename()); } } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_2_); } else { throw ex; } } returnAST = boolLiteral_AST; }
public void lastSelection() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST lastSelection_AST = null; try { // for error handling Spring.Expressions.SelectionLastNode tmp64_AST = null; tmp64_AST = (Spring.Expressions.SelectionLastNode) astFactory.create(LT(1), "Spring.Expressions.SelectionLastNode"); astFactory.makeASTRoot(ref currentAST, (AST)tmp64_AST); match(SELECT_LAST); expression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } match(RCURLY); lastSelection_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_2_); } else { throw ex; } } returnAST = lastSelection_AST; }
public void attribute() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST attribute_AST = null; Spring.Expressions.SpringAST tn_AST = null; try { // for error handling match(AT); match(LBRACKET); qualifiedId(); if (0 == inputState.guessing) { tn_AST = (Spring.Expressions.SpringAST)returnAST; } { if ((LA(1)==LPAREN)) { ctorArgs(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } } else if ((LA(1)==RBRACKET)) { } else { throw new NoViableAltException(LT(1), getFilename()); } } match(RBRACKET); if (0==inputState.guessing) { attribute_AST = (Spring.Expressions.SpringAST)currentAST.root; attribute_AST = (Spring.Expressions.SpringAST) astFactory.make((AST)(Spring.Expressions.SpringAST) astFactory.create(EXPR,tn_AST.getText(),"Spring.Expressions.AttributeNode"), (AST)attribute_AST); currentAST.root = attribute_AST; if ( (null != attribute_AST) && (null != attribute_AST.getFirstChild()) ) currentAST.child = attribute_AST.getFirstChild(); else currentAST.child = attribute_AST; currentAST.advanceChildToEnd(); } attribute_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_2_); } else { throw ex; } } returnAST = attribute_AST; }
public void relationalOperator() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST relationalOperator_AST = null; try { // for error handling switch ( LA(1) ) { case EQUAL: { Spring.Expressions.SpringAST tmp16_AST = null; tmp16_AST = (Spring.Expressions.SpringAST) astFactory.create(LT(1)); astFactory.addASTChild(ref currentAST, (AST)tmp16_AST); match(EQUAL); relationalOperator_AST = (Spring.Expressions.SpringAST)currentAST.root; break; } case NOT_EQUAL: { Spring.Expressions.SpringAST tmp17_AST = null; tmp17_AST = (Spring.Expressions.SpringAST) astFactory.create(LT(1)); astFactory.addASTChild(ref currentAST, (AST)tmp17_AST); match(NOT_EQUAL); relationalOperator_AST = (Spring.Expressions.SpringAST)currentAST.root; break; } case LESS_THAN: { Spring.Expressions.SpringAST tmp18_AST = null; tmp18_AST = (Spring.Expressions.SpringAST) astFactory.create(LT(1)); astFactory.addASTChild(ref currentAST, (AST)tmp18_AST); match(LESS_THAN); relationalOperator_AST = (Spring.Expressions.SpringAST)currentAST.root; break; } case LESS_THAN_OR_EQUAL: { Spring.Expressions.SpringAST tmp19_AST = null; tmp19_AST = (Spring.Expressions.SpringAST) astFactory.create(LT(1)); astFactory.addASTChild(ref currentAST, (AST)tmp19_AST); match(LESS_THAN_OR_EQUAL); relationalOperator_AST = (Spring.Expressions.SpringAST)currentAST.root; break; } case GREATER_THAN: { Spring.Expressions.SpringAST tmp20_AST = null; tmp20_AST = (Spring.Expressions.SpringAST) astFactory.create(LT(1)); astFactory.addASTChild(ref currentAST, (AST)tmp20_AST); match(GREATER_THAN); relationalOperator_AST = (Spring.Expressions.SpringAST)currentAST.root; break; } case GREATER_THAN_OR_EQUAL: { Spring.Expressions.SpringAST tmp21_AST = null; tmp21_AST = (Spring.Expressions.SpringAST) astFactory.create(LT(1)); astFactory.addASTChild(ref currentAST, (AST)tmp21_AST); match(GREATER_THAN_OR_EQUAL); relationalOperator_AST = (Spring.Expressions.SpringAST)currentAST.root; break; } case IN: { Spring.Expressions.SpringAST tmp22_AST = null; tmp22_AST = (Spring.Expressions.SpringAST) astFactory.create(LT(1)); astFactory.addASTChild(ref currentAST, (AST)tmp22_AST); match(IN); relationalOperator_AST = (Spring.Expressions.SpringAST)currentAST.root; break; } case IS: { Spring.Expressions.SpringAST tmp23_AST = null; tmp23_AST = (Spring.Expressions.SpringAST) astFactory.create(LT(1)); astFactory.addASTChild(ref currentAST, (AST)tmp23_AST); match(IS); relationalOperator_AST = (Spring.Expressions.SpringAST)currentAST.root; break; } case BETWEEN: { Spring.Expressions.SpringAST tmp24_AST = null; tmp24_AST = (Spring.Expressions.SpringAST) astFactory.create(LT(1)); astFactory.addASTChild(ref currentAST, (AST)tmp24_AST); match(BETWEEN); relationalOperator_AST = (Spring.Expressions.SpringAST)currentAST.root; break; } case LIKE: { Spring.Expressions.SpringAST tmp25_AST = null; tmp25_AST = (Spring.Expressions.SpringAST) astFactory.create(LT(1)); astFactory.addASTChild(ref currentAST, (AST)tmp25_AST); match(LIKE); relationalOperator_AST = (Spring.Expressions.SpringAST)currentAST.root; break; } case MATCHES: { Spring.Expressions.SpringAST tmp26_AST = null; tmp26_AST = (Spring.Expressions.SpringAST) astFactory.create(LT(1)); astFactory.addASTChild(ref currentAST, (AST)tmp26_AST); match(MATCHES); relationalOperator_AST = (Spring.Expressions.SpringAST)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 = relationalOperator_AST; }
public void powExpr() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST powExpr_AST = null; try { // for error handling unaryExpression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } { if ((LA(1)==POWER)) { Spring.Expressions.OpPOWER tmp30_AST = null; tmp30_AST = (Spring.Expressions.OpPOWER) astFactory.create(LT(1), "Spring.Expressions.OpPOWER"); astFactory.makeASTRoot(ref currentAST, (AST)tmp30_AST); match(POWER); unaryExpression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } } else if ((tokenSet_11_.member(LA(1)))) { } else { throw new NoViableAltException(LT(1), getFilename()); } } powExpr_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_11_); } else { throw ex; } } returnAST = powExpr_AST; }
public void ctorArgs() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST ctorArgs_AST = null; try { // for error handling match(LPAREN); { if ((tokenSet_9_.member(LA(1)))) { namedArgument(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } { // ( ... )* for (;;) { if ((LA(1)==COMMA)) { match(COMMA); namedArgument(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } } else { goto _loop107_breakloop; } } _loop107_breakloop: ; } // ( ... )* } else if ((LA(1)==RPAREN)) { } else { throw new NoViableAltException(LT(1), getFilename()); } } match(RPAREN); ctorArgs_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_2_); } else { throw ex; } } returnAST = ctorArgs_AST; }
public void relationalExpression() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST relationalExpression_AST = null; Spring.Expressions.SpringAST e1_AST = null; Spring.Expressions.SpringAST op_AST = null; Spring.Expressions.SpringAST e2_AST = null; try { // for error handling sumExpr(); if (0 == inputState.guessing) { e1_AST = (Spring.Expressions.SpringAST)returnAST; astFactory.addASTChild(ref currentAST, (AST)returnAST); } { if ((tokenSet_6_.member(LA(1)))) { relationalOperator(); if (0 == inputState.guessing) { op_AST = (Spring.Expressions.SpringAST)returnAST; } sumExpr(); if (0 == inputState.guessing) { e2_AST = (Spring.Expressions.SpringAST)returnAST; astFactory.addASTChild(ref currentAST, (AST)returnAST); } if (0==inputState.guessing) { relationalExpression_AST = (Spring.Expressions.SpringAST)currentAST.root; relationalExpression_AST = (Spring.Expressions.SpringAST) astFactory.make((AST)(Spring.Expressions.SpringAST) 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(); } } else if ((tokenSet_7_.member(LA(1)))) { } else { throw new NoViableAltException(LT(1), getFilename()); } } relationalExpression_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_7_); } else { throw ex; } } returnAST = relationalExpression_AST; }
public void quotableName() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST quotableName_AST = null; try { // for error handling if ((LA(1)==STRING_LITERAL)) { Spring.Expressions.QualifiedIdentifier tmp91_AST = null; tmp91_AST = (Spring.Expressions.QualifiedIdentifier) astFactory.create(LT(1), "Spring.Expressions.QualifiedIdentifier"); astFactory.makeASTRoot(ref currentAST, (AST)tmp91_AST); match(STRING_LITERAL); quotableName_AST = (Spring.Expressions.SpringAST)currentAST.root; } else if ((LA(1)==ID)) { name(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } quotableName_AST = (Spring.Expressions.SpringAST)currentAST.root; } else { throw new NoViableAltException(LT(1), getFilename()); } } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_16_); } else { throw ex; } } returnAST = quotableName_AST; }
public void qualifiedId() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST qualifiedId_AST = null; try { // for error handling Spring.Expressions.QualifiedIdentifier tmp94_AST = null; tmp94_AST = (Spring.Expressions.QualifiedIdentifier) astFactory.create(LT(1), "Spring.Expressions.QualifiedIdentifier"); astFactory.makeASTRoot(ref currentAST, (AST)tmp94_AST); match(ID); { // ( ... )* for (;;) { if ((LA(1)==DOT)) { Spring.Expressions.SpringAST tmp95_AST = null; tmp95_AST = (Spring.Expressions.SpringAST) astFactory.create(LT(1)); astFactory.addASTChild(ref currentAST, (AST)tmp95_AST); match(DOT); Spring.Expressions.SpringAST tmp96_AST = null; tmp96_AST = (Spring.Expressions.SpringAST) astFactory.create(LT(1)); astFactory.addASTChild(ref currentAST, (AST)tmp96_AST); match(ID); } else { goto _loop114_breakloop; } } _loop114_breakloop: ; } // ( ... )* qualifiedId_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_18_); } else { throw ex; } } returnAST = qualifiedId_AST; }
public void property() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST property_AST = null; try { // for error handling Spring.Expressions.PropertyOrFieldNode tmp90_AST = null; tmp90_AST = (Spring.Expressions.PropertyOrFieldNode) astFactory.create(LT(1), "Spring.Expressions.PropertyOrFieldNode"); astFactory.addASTChild(ref currentAST, (AST)tmp90_AST); match(ID); property_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_2_); } else { throw ex; } } returnAST = property_AST; }
public void localVar() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST localVar_AST = null; try { // for error handling match(DOLLAR); Spring.Expressions.LocalVariableNode tmp89_AST = null; tmp89_AST = (Spring.Expressions.LocalVariableNode) astFactory.create(LT(1), "Spring.Expressions.LocalVariableNode"); astFactory.makeASTRoot(ref currentAST, (AST)tmp89_AST); match(ID); localVar_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_2_); } else { throw ex; } } returnAST = localVar_AST; }
public void function() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST function_AST = null; try { // for error handling match(POUND); Spring.Expressions.FunctionNode tmp80_AST = null; tmp80_AST = (Spring.Expressions.FunctionNode) astFactory.create(LT(1), "Spring.Expressions.FunctionNode"); astFactory.makeASTRoot(ref currentAST, (AST)tmp80_AST); match(ID); methodArgs(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } function_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_2_); } else { throw ex; } } returnAST = function_AST; }
public void parenExpr() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST parenExpr_AST = null; try { // for error handling match(LPAREN); expression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } match(RPAREN); parenExpr_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_2_); } else { throw ex; } } returnAST = parenExpr_AST; }
public void argList() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST argList_AST = null; try { // for error handling { Spring.Expressions.SpringAST tmp100_AST = null; tmp100_AST = (Spring.Expressions.SpringAST) astFactory.create(LT(1)); astFactory.addASTChild(ref currentAST, (AST)tmp100_AST); match(ID); { // ( ... )* for (;;) { if ((LA(1)==COMMA)) { match(COMMA); Spring.Expressions.SpringAST tmp102_AST = null; tmp102_AST = (Spring.Expressions.SpringAST) astFactory.create(LT(1)); astFactory.addASTChild(ref currentAST, (AST)tmp102_AST); match(ID); } else { goto _loop87_breakloop; } } _loop87_breakloop: ; } // ( ... )* } if (0==inputState.guessing) { argList_AST = (Spring.Expressions.SpringAST)currentAST.root; argList_AST = (Spring.Expressions.SpringAST) astFactory.make((AST)(Spring.Expressions.SpringAST) astFactory.create(EXPR,"args"), (AST)argList_AST); currentAST.root = argList_AST; if ( (null != argList_AST) && (null != argList_AST.getFirstChild()) ) currentAST.child = argList_AST.getFirstChild(); else currentAST.child = argList_AST; currentAST.advanceChildToEnd(); } argList_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_19_); } else { throw ex; } } returnAST = argList_AST; }
public void logicalAndExpression() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST logicalAndExpression_AST = null; try { // for error handling relationalExpression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } { // ( ... )* for (;;) { if ((LA(1)==AND)) { Spring.Expressions.OpAND tmp13_AST = null; tmp13_AST = (Spring.Expressions.OpAND) astFactory.create(LT(1), "Spring.Expressions.OpAND"); astFactory.makeASTRoot(ref currentAST, (AST)tmp13_AST); match(AND); relationalExpression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } } else { goto _loop19_breakloop; } } _loop19_breakloop: ; } // ( ... )* logicalAndExpression_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_5_); } else { throw ex; } } returnAST = logicalAndExpression_AST; }
public void exprList() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST exprList_AST = null; try { // for error handling match(LPAREN); expression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } { // ( ... )+ int _cnt4=0; for (;;) { if ((LA(1)==SEMI)) { match(SEMI); expression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } } else { if (_cnt4 >= 1) { goto _loop4_breakloop; } else { throw new NoViableAltException(LT(1), getFilename());; } } _cnt4++; } _loop4_breakloop: ; } // ( ... )+ match(RPAREN); if (0==inputState.guessing) { exprList_AST = (Spring.Expressions.SpringAST)currentAST.root; exprList_AST = (Spring.Expressions.SpringAST) astFactory.make((AST)(Spring.Expressions.SpringAST) astFactory.create(EXPR,"expressionList","Spring.Expressions.ExpressionListNode"), (AST)exprList_AST); currentAST.root = exprList_AST; if ( (null != exprList_AST) && (null != exprList_AST.getFirstChild()) ) currentAST.child = exprList_AST.getFirstChild(); else currentAST.child = exprList_AST; currentAST.advanceChildToEnd(); } exprList_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_2_); } else { throw ex; } } returnAST = exprList_AST; }
public void sumExpr() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST sumExpr_AST = null; try { // for error handling prodExpr(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } { // ( ... )* for (;;) { if ((LA(1)==PLUS||LA(1)==MINUS)) { { if ((LA(1)==PLUS)) { Spring.Expressions.OpADD tmp14_AST = null; tmp14_AST = (Spring.Expressions.OpADD) astFactory.create(LT(1), "Spring.Expressions.OpADD"); astFactory.makeASTRoot(ref currentAST, (AST)tmp14_AST); match(PLUS); } else if ((LA(1)==MINUS)) { Spring.Expressions.OpSUBTRACT tmp15_AST = null; tmp15_AST = (Spring.Expressions.OpSUBTRACT) astFactory.create(LT(1), "Spring.Expressions.OpSUBTRACT"); astFactory.makeASTRoot(ref currentAST, (AST)tmp15_AST); match(MINUS); } else { throw new NoViableAltException(LT(1), getFilename()); } } prodExpr(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } } else { goto _loop25_breakloop; } } _loop25_breakloop: ; } // ( ... )* sumExpr_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_8_); } else { throw ex; } } returnAST = sumExpr_AST; }
public void mapInitializer() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST mapInitializer_AST = null; try { // for error handling match(POUND); Spring.Expressions.MapInitializerNode tmp70_AST = null; tmp70_AST = (Spring.Expressions.MapInitializerNode) astFactory.create(LT(1), "Spring.Expressions.MapInitializerNode"); astFactory.makeASTRoot(ref currentAST, (AST)tmp70_AST); match(LCURLY); mapEntry(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } { // ( ... )* for (;;) { if ((LA(1)==COMMA)) { match(COMMA); mapEntry(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } } else { goto _loop102_breakloop; } } _loop102_breakloop: ; } // ( ... )* match(RCURLY); mapInitializer_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_2_); } else { throw ex; } } returnAST = mapInitializer_AST; }
public void prodExpr() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST prodExpr_AST = null; try { // for error handling powExpr(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } { // ( ... )* for (;;) { if (((LA(1) >= STAR && LA(1) <= MOD))) { { switch ( LA(1) ) { case STAR: { Spring.Expressions.OpMULTIPLY tmp27_AST = null; tmp27_AST = (Spring.Expressions.OpMULTIPLY) astFactory.create(LT(1), "Spring.Expressions.OpMULTIPLY"); astFactory.makeASTRoot(ref currentAST, (AST)tmp27_AST); match(STAR); break; } case DIV: { Spring.Expressions.OpDIVIDE tmp28_AST = null; tmp28_AST = (Spring.Expressions.OpDIVIDE) astFactory.create(LT(1), "Spring.Expressions.OpDIVIDE"); astFactory.makeASTRoot(ref currentAST, (AST)tmp28_AST); match(DIV); break; } case MOD: { Spring.Expressions.OpMODULUS tmp29_AST = null; tmp29_AST = (Spring.Expressions.OpMODULUS) astFactory.create(LT(1), "Spring.Expressions.OpMODULUS"); astFactory.makeASTRoot(ref currentAST, (AST)tmp29_AST); match(MOD); break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } powExpr(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } } else { goto _loop29_breakloop; } } _loop29_breakloop: ; } // ( ... )* prodExpr_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_10_); } else { throw ex; } } returnAST = prodExpr_AST; }
public void unaryExpression() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST unaryExpression_AST = null; try { // for error handling if ((LA(1)==PLUS||LA(1)==MINUS||LA(1)==BANG)) { { switch ( LA(1) ) { case PLUS: { Spring.Expressions.OpUnaryPlus tmp31_AST = null; tmp31_AST = (Spring.Expressions.OpUnaryPlus) astFactory.create(LT(1), "Spring.Expressions.OpUnaryPlus"); astFactory.makeASTRoot(ref currentAST, (AST)tmp31_AST); match(PLUS); break; } case MINUS: { Spring.Expressions.OpUnaryMinus tmp32_AST = null; tmp32_AST = (Spring.Expressions.OpUnaryMinus) astFactory.create(LT(1), "Spring.Expressions.OpUnaryMinus"); astFactory.makeASTRoot(ref currentAST, (AST)tmp32_AST); match(MINUS); break; } case BANG: { Spring.Expressions.OpNOT tmp33_AST = null; tmp33_AST = (Spring.Expressions.OpNOT) astFactory.create(LT(1), "Spring.Expressions.OpNOT"); astFactory.makeASTRoot(ref currentAST, (AST)tmp33_AST); match(BANG); break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } unaryExpression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } unaryExpression_AST = (Spring.Expressions.SpringAST)currentAST.root; } else if ((tokenSet_12_.member(LA(1)))) { primaryExpression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } unaryExpression_AST = (Spring.Expressions.SpringAST)currentAST.root; } else { throw new NoViableAltException(LT(1), getFilename()); } } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_13_); } else { throw ex; } } returnAST = unaryExpression_AST; }
public void constructor() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST constructor_AST = null; Spring.Expressions.SpringAST type_AST = null; try { // for error handling bool synPredMatched90 = false; if (((LA(1)==LITERAL_new) && (LA(2)==ID))) { int _m90 = mark(); synPredMatched90 = true; inputState.guessing++; try { { match(LITERAL_new); qualifiedId(); match(LPAREN); } } catch (RecognitionException) { synPredMatched90 = false; } rewind(_m90); inputState.guessing--; } if ( synPredMatched90 ) { match(LITERAL_new); qualifiedId(); if (0 == inputState.guessing) { type_AST = (Spring.Expressions.SpringAST)returnAST; } ctorArgs(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } if (0==inputState.guessing) { constructor_AST = (Spring.Expressions.SpringAST)currentAST.root; constructor_AST = (Spring.Expressions.SpringAST) astFactory.make((AST)(Spring.Expressions.SpringAST) astFactory.create(EXPR,type_AST.getText(),"Spring.Expressions.ConstructorNode"), (AST)constructor_AST); currentAST.root = constructor_AST; if ( (null != constructor_AST) && (null != constructor_AST.getFirstChild()) ) currentAST.child = constructor_AST.getFirstChild(); else currentAST.child = constructor_AST; currentAST.advanceChildToEnd(); } constructor_AST = (Spring.Expressions.SpringAST)currentAST.root; } else if ((LA(1)==LITERAL_new) && (LA(2)==ID)) { arrayConstructor(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } constructor_AST = (Spring.Expressions.SpringAST)currentAST.root; } else { throw new NoViableAltException(LT(1), getFilename()); } } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_2_); } else { throw ex; } } returnAST = constructor_AST; }
public void arrayConstructor() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST arrayConstructor_AST = null; Spring.Expressions.SpringAST type_AST = null; try { // for error handling match(LITERAL_new); qualifiedId(); if (0 == inputState.guessing) { type_AST = (Spring.Expressions.SpringAST)returnAST; } arrayRank(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } { if ((LA(1)==LCURLY)) { listInitializer(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } } else if ((tokenSet_2_.member(LA(1)))) { } else { throw new NoViableAltException(LT(1), getFilename()); } } if (0==inputState.guessing) { arrayConstructor_AST = (Spring.Expressions.SpringAST)currentAST.root; arrayConstructor_AST = (Spring.Expressions.SpringAST) astFactory.make((AST)(Spring.Expressions.SpringAST) astFactory.create(EXPR,type_AST.getText(),"Spring.Expressions.ArrayConstructorNode"), (AST)arrayConstructor_AST); currentAST.root = arrayConstructor_AST; if ( (null != arrayConstructor_AST) && (null != arrayConstructor_AST.getFirstChild()) ) currentAST.child = arrayConstructor_AST.getFirstChild(); else currentAST.child = arrayConstructor_AST; currentAST.advanceChildToEnd(); } arrayConstructor_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_2_); } else { throw ex; } } returnAST = arrayConstructor_AST; }
public void lambda() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST lambda_AST = null; try { // for error handling match(LAMBDA); { if ((LA(1)==ID)) { argList(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } } else if ((LA(1)==PIPE)) { } else { throw new NoViableAltException(LT(1), getFilename()); } } match(PIPE); expression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } match(RCURLY); if (0==inputState.guessing) { lambda_AST = (Spring.Expressions.SpringAST)currentAST.root; lambda_AST = (Spring.Expressions.SpringAST) astFactory.make((AST)(Spring.Expressions.SpringAST) astFactory.create(EXPR,"lambda","Spring.Expressions.LambdaExpressionNode"), (AST)lambda_AST); currentAST.root = lambda_AST; if ( (null != lambda_AST) && (null != lambda_AST.getFirstChild()) ) currentAST.child = lambda_AST.getFirstChild(); else currentAST.child = lambda_AST; currentAST.advanceChildToEnd(); } lambda_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_2_); } else { throw ex; } } returnAST = lambda_AST; }
public void arrayRank() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST arrayRank_AST = null; try { // for error handling Spring.Expressions.SpringAST tmp104_AST = null; tmp104_AST = (Spring.Expressions.SpringAST) astFactory.create(LT(1)); astFactory.makeASTRoot(ref currentAST, (AST)tmp104_AST); match(LBRACKET); { if ((tokenSet_9_.member(LA(1)))) { expression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } { // ( ... )* for (;;) { if ((LA(1)==COMMA)) { match(COMMA); expression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } } else { goto _loop96_breakloop; } } _loop96_breakloop: ; } // ( ... )* } else if ((LA(1)==RBRACKET)) { } else { throw new NoViableAltException(LT(1), getFilename()); } } match(RBRACKET); arrayRank_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_20_); } else { throw ex; } } returnAST = arrayRank_AST; }
public void mapEntry() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST mapEntry_AST = null; try { // for error handling expression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } match(COLON); expression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } if (0==inputState.guessing) { mapEntry_AST = (Spring.Expressions.SpringAST)currentAST.root; mapEntry_AST = (Spring.Expressions.SpringAST) astFactory.make((AST)(Spring.Expressions.SpringAST) astFactory.create(EXPR,"entry","Spring.Expressions.MapEntryNode"), (AST)mapEntry_AST); currentAST.root = mapEntry_AST; if ( (null != mapEntry_AST) && (null != mapEntry_AST.getFirstChild()) ) currentAST.child = mapEntry_AST.getFirstChild(); else currentAST.child = mapEntry_AST; currentAST.advanceChildToEnd(); } mapEntry_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_21_); } else { throw ex; } } returnAST = mapEntry_AST; }
public void expression() //throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); Spring.Expressions.SpringAST expression_AST = null; try { // for error handling logicalOrExpression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } { switch ( LA(1) ) { case ASSIGN: { { Spring.Expressions.AssignNode tmp2_AST = null; tmp2_AST = (Spring.Expressions.AssignNode) astFactory.create(LT(1), "Spring.Expressions.AssignNode"); astFactory.makeASTRoot(ref currentAST, (AST)tmp2_AST); match(ASSIGN); logicalOrExpression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } } break; } case DEFAULT: { { Spring.Expressions.DefaultNode tmp3_AST = null; tmp3_AST = (Spring.Expressions.DefaultNode) astFactory.create(LT(1), "Spring.Expressions.DefaultNode"); astFactory.makeASTRoot(ref currentAST, (AST)tmp3_AST); match(DEFAULT); logicalOrExpression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } } break; } case QMARK: { { Spring.Expressions.TernaryNode tmp4_AST = null; tmp4_AST = (Spring.Expressions.TernaryNode) astFactory.create(LT(1), "Spring.Expressions.TernaryNode"); astFactory.makeASTRoot(ref currentAST, (AST)tmp4_AST); match(QMARK); expression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } match(COLON); expression(); if (0 == inputState.guessing) { astFactory.addASTChild(ref currentAST, (AST)returnAST); } } break; } case EOF: case SEMI: case RPAREN: case COLON: case COMMA: case RBRACKET: case RCURLY: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } expression_AST = (Spring.Expressions.SpringAST)currentAST.root; } catch (RecognitionException ex) { if (0 == inputState.guessing) { reportError(ex); recover(ex,tokenSet_1_); } else { throw ex; } } returnAST = expression_AST; }