private static ParserRuleContext parseTypeCalculation(String calculation) { TypeCalculationLexer lexer = new TypeCalculationLexer(new CaseInsensitiveStream(new ANTLRInputStream(calculation))); CommonTokenStream tokenStream = new CommonTokenStream(lexer); TypeCalculationParser parser = new TypeCalculationParser(tokenStream); lexer.removeErrorListeners(); lexer.addErrorListener(ERROR_LISTENER); parser.removeErrorListeners(); parser.addErrorListener(ERROR_LISTENER); ParserRuleContext tree; try { // first, try parsing with potentially faster SLL mode parser.getInterpreter().setPredictionMode(PredictionMode.SLL); tree = parser.typeCalculation(); } catch (ParseCancellationException ex) { // if we fail, parse with LL mode tokenStream.reset(); // rewind input stream parser.reset(); parser.getInterpreter().setPredictionMode(PredictionMode.LL); tree = parser.typeCalculation(); } return tree; }
private ExpressionContext expression(int _p) throws RecognitionException { ParserRuleContext _parentctx = _ctx; int _parentState = getState(); ExpressionContext _localctx = new ExpressionContext(_ctx, _parentState); ExpressionContext _prevctx = _localctx; int _startState = 2; enterRecursionRule(_localctx, 2, RULE_expression, _p); int _la; try { int _alt; enterOuterAlt(_localctx, 1); setState(26); _errHandler.sync(this); switch (_input.LA(1)) { setState(10); match(NULL); _ctx = _localctx; _prevctx = _localctx; setState(11); match(INTEGER_VALUE); _ctx = _localctx; _prevctx = _localctx; setState(12); binaryFunctionName(); setState(13); match(T__0);
public final TypeCalculationContext typeCalculation() throws RecognitionException { TypeCalculationContext _localctx = new TypeCalculationContext(_ctx, getState()); enterRule(_localctx, 0, RULE_typeCalculation); try { enterOuterAlt(_localctx, 1); { setState(6); expression(0); setState(7); match(EOF); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; }
public final BinaryFunctionNameContext binaryFunctionName() throws RecognitionException { BinaryFunctionNameContext _localctx = new BinaryFunctionNameContext(_ctx, getState()); enterRule(_localctx, 4, RULE_binaryFunctionName); int _la; try { enterOuterAlt(_localctx, 1); { setState(39); ((BinaryFunctionNameContext)_localctx).name = _input.LT(1); _la = _input.LA(1); if ( !(_la==MIN || _la==MAX) ) { ((BinaryFunctionNameContext)_localctx).name = (Token)_errHandler.recoverInline(this); } else { if ( _input.LA(1)==Token.EOF ) matchedEOF = true; _errHandler.reportMatch(this); consume(); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; }
public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { switch (ruleIndex) { case 1: return expression_sempred((ExpressionContext)_localctx, predIndex); } return true; } private boolean expression_sempred(ExpressionContext _localctx, int predIndex) {
public final ExpressionContext expression() throws RecognitionException { return expression(0); }
public final BinaryFunctionNameContext binaryFunctionName() throws RecognitionException { BinaryFunctionNameContext _localctx = new BinaryFunctionNameContext(_ctx, getState()); enterRule(_localctx, 4, RULE_binaryFunctionName); int _la; try { enterOuterAlt(_localctx, 1); { setState(38); ((BinaryFunctionNameContext)_localctx).name = _input.LT(1); _la = _input.LA(1); if ( !(_la==MIN || _la==MAX) ) { ((BinaryFunctionNameContext)_localctx).name = (Token)_errHandler.recoverInline(this); } else { consume(); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; }
public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { switch (ruleIndex) { case 1: return expression_sempred((ExpressionContext)_localctx, predIndex); } return true; } private boolean expression_sempred(ExpressionContext _localctx, int predIndex) {
public final ExpressionContext expression() throws RecognitionException { return expression(0); }
private ExpressionContext expression(int _p) throws RecognitionException { ParserRuleContext _parentctx = _ctx; int _parentState = getState(); ExpressionContext _localctx = new ExpressionContext(_ctx, _parentState); ExpressionContext _prevctx = _localctx; int _startState = 2; enterRecursionRule(_localctx, 2, RULE_expression, _p); int _la; try { int _alt; enterOuterAlt(_localctx, 1); setState(25); switch (_input.LA(1)) { case PLUS: setState(9); ((ArithmeticUnaryContext)_localctx).operator = _input.LT(1); _la = _input.LA(1); ((ArithmeticUnaryContext)_localctx).operator = (Token)_errHandler.recoverInline(this); } else { consume(); setState(10); expression(3); _ctx = _localctx; _prevctx = _localctx; setState(11);
public final TypeCalculationContext typeCalculation() throws RecognitionException { TypeCalculationContext _localctx = new TypeCalculationContext(_ctx, getState()); enterRule(_localctx, 0, RULE_typeCalculation); try { enterOuterAlt(_localctx, 1); { setState(6); expression(0); setState(7); match(EOF); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; }
private static ParserRuleContext parseTypeCalculation(String calculation) { TypeCalculationLexer lexer = new TypeCalculationLexer(new CaseInsensitiveStream(new ANTLRInputStream(calculation))); CommonTokenStream tokenStream = new CommonTokenStream(lexer); TypeCalculationParser parser = new TypeCalculationParser(tokenStream); lexer.removeErrorListeners(); lexer.addErrorListener(ERROR_LISTENER); parser.removeErrorListeners(); parser.addErrorListener(ERROR_LISTENER); ParserRuleContext tree; try { // first, try parsing with potentially faster SLL mode parser.getInterpreter().setPredictionMode(PredictionMode.SLL); tree = parser.typeCalculation(); } catch (ParseCancellationException ex) { // if we fail, parse with LL mode tokenStream.reset(); // rewind input stream parser.reset(); parser.getInterpreter().setPredictionMode(PredictionMode.LL); tree = parser.typeCalculation(); } return tree; }
public final BinaryFunctionNameContext binaryFunctionName() throws RecognitionException { BinaryFunctionNameContext _localctx = new BinaryFunctionNameContext(_ctx, getState()); enterRule(_localctx, 4, RULE_binaryFunctionName); int _la; try { enterOuterAlt(_localctx, 1); { setState(39); ((BinaryFunctionNameContext)_localctx).name = _input.LT(1); _la = _input.LA(1); if ( !(_la==MIN || _la==MAX) ) { ((BinaryFunctionNameContext)_localctx).name = (Token)_errHandler.recoverInline(this); } else { if ( _input.LA(1)==Token.EOF ) matchedEOF = true; _errHandler.reportMatch(this); consume(); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; }
public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { switch (ruleIndex) { case 1: return expression_sempred((ExpressionContext)_localctx, predIndex); } return true; } private boolean expression_sempred(ExpressionContext _localctx, int predIndex) {
public final ExpressionContext expression() throws RecognitionException { return expression(0); }
private ExpressionContext expression(int _p) throws RecognitionException { ParserRuleContext _parentctx = _ctx; int _parentState = getState(); ExpressionContext _localctx = new ExpressionContext(_ctx, _parentState); ExpressionContext _prevctx = _localctx; int _startState = 2; enterRecursionRule(_localctx, 2, RULE_expression, _p); int _la; try { int _alt; enterOuterAlt(_localctx, 1); setState(26); _errHandler.sync(this); switch (_input.LA(1)) { setState(10); match(NULL); _ctx = _localctx; _prevctx = _localctx; setState(11); match(INTEGER_VALUE); _ctx = _localctx; _prevctx = _localctx; setState(12); binaryFunctionName(); setState(13); match(T__0);
public final TypeCalculationContext typeCalculation() throws RecognitionException { TypeCalculationContext _localctx = new TypeCalculationContext(_ctx, getState()); enterRule(_localctx, 0, RULE_typeCalculation); try { enterOuterAlt(_localctx, 1); { setState(6); expression(0); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; }
private static ParserRuleContext parseTypeCalculation(String calculation) { TypeCalculationLexer lexer = new TypeCalculationLexer(new CaseInsensitiveStream(new ANTLRInputStream(calculation))); CommonTokenStream tokenStream = new CommonTokenStream(lexer); TypeCalculationParser parser = new TypeCalculationParser(tokenStream); lexer.removeErrorListeners(); lexer.addErrorListener(ERROR_LISTENER); parser.removeErrorListeners(); parser.addErrorListener(ERROR_LISTENER); ParserRuleContext tree; try { // first, try parsing with potentially faster SLL mode parser.getInterpreter().setPredictionMode(PredictionMode.SLL); tree = parser.typeCalculation(); } catch (ParseCancellationException ex) { // if we fail, parse with LL mode tokenStream.reset(); // rewind input stream parser.reset(); parser.getInterpreter().setPredictionMode(PredictionMode.LL); tree = parser.typeCalculation(); } return tree; }