/** * Parses the expression into a label expression tree. * * TODO: replace this with a real parser later */ public static Label parseExpression(String labelExpression) throws ANTLRException { LabelExpressionLexer lexer = new LabelExpressionLexer(new StringReader(labelExpression)); return new LabelExpressionParser(lexer).expr(); }
public final Label term5() throws RecognitionException, TokenStreamException { Label l; Label x; switch ( LA(1)) { case LPAREN: case ATOM: case STRINGLITERAL: { l=term6(); break; } case NOT: { match(NOT); x=term6(); l=x.not(); break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } return l; }
Token s = null; switch ( LA(1)) { case LPAREN: match(LPAREN); l=term1(); match(RPAREN); l=l.paren(); break; a = LT(1); match(ATOM); l=LabelAtom.get(a.getText()); break; s = LT(1); match(STRINGLITERAL); l=LabelAtom.get(hudson.util.QuotedStringTokenizer.unquote(s.getText())); break; throw new NoViableAltException(LT(1), getFilename());
public final Label term2() throws RecognitionException, TokenStreamException { Label l; Label r; l=term3(); { switch ( LA(1)) { case IMPLIES: { match(IMPLIES); r=term3(); l=l.implies(r); break; } case EOF: case IFF: case RPAREN: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } return l; }
public final Label term1() throws RecognitionException, TokenStreamException { Label l; Label r; l=term2(); { switch ( LA(1)) { case IFF: { match(IFF); r=term2(); l=l.iff(r); break; } case EOF: case RPAREN: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } return l; }
public final Label expr() throws RecognitionException { Label l = null; Label t =null; try { // hudson/model/labels/LabelExpression.g:25:3: (t= term1 EOF ) // hudson/model/labels/LabelExpression.g:25:5: t= term1 EOF { pushFollow(FOLLOW_term1_in_expr58); t=term1(); state._fsp--; match(input,EOF,FOLLOW_EOF_in_expr60); l = t; } } finally { // do for sure before leaving } return l; } // $ANTLR end "expr"
pushFollow(FOLLOW_term2_in_term181); t=term2(); match(input,IFF,FOLLOW_IFF_in_term186); pushFollow(FOLLOW_term2_in_term190); r=term2();
pushFollow(FOLLOW_term4_in_term3152); t=term4(); match(input,OR,FOLLOW_OR_in_term3156); pushFollow(FOLLOW_term4_in_term3160); r=term4();
pushFollow(FOLLOW_term5_in_term4187); t=term5(); match(input,AND,FOLLOW_AND_in_term4191); pushFollow(FOLLOW_term5_in_term4195); r=term5();
pushFollow(FOLLOW_term3_in_term2117); t=term3(); match(input,IMPLIES,FOLLOW_IMPLIES_in_term2121); pushFollow(FOLLOW_term3_in_term2125); r=term3();
pushFollow(FOLLOW_term6_in_term5221); t=term6(); match(input,NOT,FOLLOW_NOT_in_term5229); pushFollow(FOLLOW_term6_in_term5233); x=term6();
public final Label term2() throws RecognitionException, TokenStreamException { Label l; Label r; l=term3(); { switch ( LA(1)) { case IMPLIES: { match(IMPLIES); r=term3(); l=l.implies(r); break; } case EOF: case IFF: case RPAREN: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } return l; }
public final Label term1() throws RecognitionException, TokenStreamException { Label l; Label r; l=term2(); { switch ( LA(1)) { case IFF: { match(IFF); r=term2(); l=l.iff(r); break; } case EOF: case RPAREN: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } return l; }