public final FactorContext factor() throws RecognitionException { FactorContext _localctx = new FactorContext(_ctx, getState()); enterRule(_localctx, 4, RULE_factor); try { setState(38); switch ( getInterpreter().adaptivePredict(_input,2,_ctx) ) { case 1: enterOuterAlt(_localctx, 1); setState(30); match(1); setState(31); exp(0); setState(32); match(2); enterOuterAlt(_localctx, 2); setState(34); value(); enterOuterAlt(_localctx, 3); setState(35); comparison(); enterOuterAlt(_localctx, 4); setState(36); match(NOT); setState(37); factor(); exitRule();
public final ComparisonContext comparison() throws RecognitionException { ComparisonContext _localctx = new ComparisonContext(_ctx, getState()); enterRule(_localctx, 6, RULE_comparison); try { enterOuterAlt(_localctx, 1); { setState(40); value(); setState(41); match(COMPARISON); setState(42); value(); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; }
public final TermContext term() throws RecognitionException { TermContext _localctx = new TermContext(_ctx, getState()); enterRule(_localctx, 2, RULE_term); try { setState(28); switch ( getInterpreter().adaptivePredict(_input,1,_ctx) ) { case 1: enterOuterAlt(_localctx, 1); setState(23); factor(); enterOuterAlt(_localctx, 2); setState(24); factor(); setState(25); match(AND); setState(26); term(); exitRule();
private ExpContext exp(int _p) throws RecognitionException { ParserRuleContext _parentctx = _ctx; int _parentState = getState(); ExpContext _localctx = new ExpContext(_ctx, _parentState); ExpContext _prevctx = _localctx; int _startState = 0; enterRecursionRule(_localctx, 0, RULE_exp, _p); try { int _alt; enterOuterAlt(_localctx, 1); setState(13); term(); setState(20); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,0,_ctx); while ( _alt!=2 && _alt!=ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { if ( _parseListeners!=null ) triggerExitRuleEvent(); _prevctx = _localctx; pushNewRecursionContext(_localctx, _startState, RULE_exp); setState(15); if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); setState(16); match(OR); setState(17); term(); setState(22); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,0,_ctx);
public final ValueContext value() throws RecognitionException { ValueContext _localctx = new ValueContext(_ctx, getState()); enterRule(_localctx, 10, RULE_value); try { setState(48); switch (_input.LA(1)) { case NUMBER: case STRING: case BOOLEAN: enterOuterAlt(_localctx, 1); setState(46); constant(); enterOuterAlt(_localctx, 2); setState(47); match(IDENTIFIER); exitRule();
public final ConstantContext constant() throws RecognitionException { ConstantContext _localctx = new ConstantContext(_ctx, getState()); enterRule(_localctx, 8, RULE_constant); int _la; try { enterOuterAlt(_localctx, 1); { setState(44); _la = _input.LA(1); if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << NUMBER) | (1L << STRING) | (1L << BOOLEAN))) != 0)) ) { _errHandler.recoverInline(this); } consume(); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; }
public static FilterExpression of(String expression) { if (expression.equals("true")) { return ALWAYS_TRUE; } final ANTLRInputStream inputStream = new ANTLRInputStream(expression); final FilterLexer lexer = new FilterLexer(inputStream); lexer.getErrorListeners().clear(); lexer.addErrorListener(ERROR_LISTENER); final CommonTokenStream tokenStream = new CommonTokenStream(lexer); final FilterParser parser = new FilterParser(tokenStream); parser.getErrorListeners().clear(); parser.addErrorListener(ERROR_LISTENER); return new FilterExpression(expression, parser); }
public final ExpContext exp() throws RecognitionException { return exp(0); }
private FilterExpression(String expressionString, FilterParser parser) { this.expression = parser.exp(); this.walker = new ParseTreeWalker(); this.expressionString = expressionString; }