Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
lambda.Lambda2Parser Maven / Gradle / Ivy
// Generated from Lambda2.g by ANTLR 4.5
package com.wantedtech.common.xpresso.functional.lambda;
import java.util.*;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import com.wantedtech.common.xpresso.functional.Function;
import com.wantedtech.common.xpresso.helpers.Helpers;
import com.wantedtech.common.xpresso.types.tuples.tuple2;
import com.wantedtech.common.xpresso.types.list;
import com.wantedtech.common.xpresso.types.tuple;
import com.wantedtech.common.xpresso.types.dict;
import com.wantedtech.common.xpresso.x;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class Lambda2Parser extends Parser {
static { RuntimeMetaData.checkVersion("4.5", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9,
T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, FTOK=15, And=16, Or=17,
Identifier=18, Number=19, JavaString=20, PythonString=21, Space=22, OPENBRACKET=23,
CLOSEDBRACKET=24, WS=25;
public static final int
RULE_eval = 0, RULE_lambdaExpression = 1, RULE_anyExpression = 2, RULE_arithmeticExpressionE = 3,
RULE_booleanExpressionB = 4, RULE_productExpressionT = 5, RULE_basicExpressionF = 6,
RULE_complexIdentifier = 7, RULE_function = 8, RULE_inputVars = 9;
public static final String[] ruleNames = {
"eval", "lambdaExpression", "anyExpression", "arithmeticExpressionE",
"booleanExpressionB", "productExpressionT", "basicExpressionF", "complexIdentifier",
"function", "inputVars"
};
private static final String[] _LITERAL_NAMES = {
null, "':'", "'+'", "'-'", "'='", "'<='", "'<'", "'>='", "'>'", "'!'",
"'('", "')'", "'*'", "'/'", "','", null, null, null, null, null, null,
null, "' '", "'['", "']'"
};
private static final String[] _SYMBOLIC_NAMES = {
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, "FTOK", "And", "Or", "Identifier", "Number", "JavaString",
"PythonString", "Space", "OPENBRACKET", "CLOSEDBRACKET", "WS"
};
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
@Override
public String getGrammarFileName() { return "Lambda2.g"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public ATN getATN() { return _ATN; }
Value inputValue;
HashMap inputValues;
Function[] inputFunction;
ArrayList inputVarNames;
public Lambda2Parser(TokenStream input) {
super(input);
_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
public static class EvalContext extends ParserRuleContext {
public Value value;
public LambdaExpressionContext exp00;
public Token exp10;
public LambdaExpressionContext lambdaExpression() {
return getRuleContext(LambdaExpressionContext.class,0);
}
public TerminalNode EOF() { return getToken(Lambda2Parser.EOF, 0); }
public EvalContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_eval; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).enterEval(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).exitEval(this);
}
}
public final EvalContext eval() throws RecognitionException {
EvalContext _localctx = new EvalContext(_ctx, getState());
enterRule(_localctx, 0, RULE_eval);
try {
setState(24);
switch (_input.LA(1)) {
case Identifier:
enterOuterAlt(_localctx, 1);
{
setState(20);
((EvalContext)_localctx).exp00 = lambdaExpression();
((EvalContext)_localctx).value = ((EvalContext)_localctx).exp00.value;
}
break;
case EOF:
enterOuterAlt(_localctx, 2);
{
setState(23);
((EvalContext)_localctx).exp10 = match(EOF);
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class LambdaExpressionContext extends ParserRuleContext {
public Value value;
public InputVarsContext id10;
public AnyExpressionContext an10;
public InputVarsContext inputVars() {
return getRuleContext(InputVarsContext.class,0);
}
public AnyExpressionContext anyExpression() {
return getRuleContext(AnyExpressionContext.class,0);
}
public LambdaExpressionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_lambdaExpression; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).enterLambdaExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).exitLambdaExpression(this);
}
}
public final LambdaExpressionContext lambdaExpression() throws RecognitionException {
LambdaExpressionContext _localctx = new LambdaExpressionContext(_ctx, getState());
enterRule(_localctx, 2, RULE_lambdaExpression);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(26);
((LambdaExpressionContext)_localctx).id10 = inputVars(0);
inputVarNames = ((LambdaExpressionContext)_localctx).id10.value;
if(x.len(inputVarNames) > 1 && !(inputValue.value instanceof tuple) && !(inputValue.value instanceof list>) && !(inputValue.value instanceof List>) && !(inputValue.value instanceof ArrayList>) && !(inputValue.value instanceof Collection>)){
list replacedElement = x.list();
for (String elementFieldName : inputVarNames){
if (elementFieldName.equals("_")) {
replacedElement.append(null);
} else if(x.Object(inputValue.value).hasField(elementFieldName)){
try {
Field f = inputValue.value.getClass().getField(elementFieldName);
f.setAccessible(true);
replacedElement.append(f.get(inputValue.value));
} catch (Exception e) {
// cant happen
e.printStackTrace();
}
}else if (x.Object(inputValue.value).hasMethod(elementFieldName)) {
try {
Method m = inputValue.value.getClass().getMethod(elementFieldName);
m.setAccessible(true);
replacedElement.append(m.invoke(inputValue.value));
} catch (Exception e) {
// cant happen
e.printStackTrace();
}
}else if (x.Object(inputValue.value).hasMethod("get"+x.String(elementFieldName).title())) {
try {
Method m = inputValue.value.getClass().getMethod("get"+x.String(elementFieldName).title());
m.setAccessible(true);
replacedElement.append(m.invoke(inputValue.value));
} catch (Exception e) {
// cant happen
e.printStackTrace();
}
}else{
throw new IllegalArgumentException("Could not find the field " + elementFieldName + " in an element of the input Iterable.");
}
}
inputValue.value = replacedElement;
}
inputValues = new HashMap();
if(x.len(inputVarNames) > 1 && inputValue.value instanceof Iterable>){
for (tuple2 index__var : x.enumerate(inputVarNames)){
inputValues.put(index__var.value1,new Value(x.list((Iterable>)(inputValue.value)).get(index__var.value0)));
}
}else if(x.len(inputVarNames) > 1 && inputValue.value instanceof tuple){
for (tuple2 index__var : x.enumerate(inputVarNames)){
inputValues.put(index__var.value1,new Value(((tuple)inputValue.value).get(index__var.value0)));
}
}else{
inputValues.put(inputVarNames.get(0),inputValue);
}
if(x.len(inputVarNames) != x.len(inputValues)){
throw new IllegalArgumentException("Expected the input value of dimensionality "+x.len(inputVarNames) + " Got "+x.len(inputValue));
}
setState(31);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(28);
match(Space);
}
}
setState(33);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(34);
match(T__0);
setState(38);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(35);
match(Space);
}
}
setState(40);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(41);
((LambdaExpressionContext)_localctx).an10 = anyExpression();
((LambdaExpressionContext)_localctx).value = ((LambdaExpressionContext)_localctx).an10.value;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class AnyExpressionContext extends ParserRuleContext {
public Value value;
public BooleanExpressionBContext be20;
public ArithmeticExpressionEContext ae20;
public BooleanExpressionBContext booleanExpressionB() {
return getRuleContext(BooleanExpressionBContext.class,0);
}
public ArithmeticExpressionEContext arithmeticExpressionE() {
return getRuleContext(ArithmeticExpressionEContext.class,0);
}
public AnyExpressionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_anyExpression; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).enterAnyExpression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).exitAnyExpression(this);
}
}
public final AnyExpressionContext anyExpression() throws RecognitionException {
AnyExpressionContext _localctx = new AnyExpressionContext(_ctx, getState());
enterRule(_localctx, 4, RULE_anyExpression);
try {
setState(50);
switch ( getInterpreter().adaptivePredict(_input,3,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(44);
((AnyExpressionContext)_localctx).be20 = booleanExpressionB(0);
((AnyExpressionContext)_localctx).value = ((AnyExpressionContext)_localctx).be20.value;
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(47);
((AnyExpressionContext)_localctx).ae20 = arithmeticExpressionE(0);
((AnyExpressionContext)_localctx).value = ((AnyExpressionContext)_localctx).ae20.value;
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ArithmeticExpressionEContext extends ParserRuleContext {
public Value value;
public ArithmeticExpressionEContext ae40;
public ProductExpressionTContext pe40;
public ProductExpressionTContext productExpressionT() {
return getRuleContext(ProductExpressionTContext.class,0);
}
public ArithmeticExpressionEContext arithmeticExpressionE() {
return getRuleContext(ArithmeticExpressionEContext.class,0);
}
public ArithmeticExpressionEContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_arithmeticExpressionE; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).enterArithmeticExpressionE(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).exitArithmeticExpressionE(this);
}
}
public final ArithmeticExpressionEContext arithmeticExpressionE() throws RecognitionException {
return arithmeticExpressionE(0);
}
private ArithmeticExpressionEContext arithmeticExpressionE(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
ArithmeticExpressionEContext _localctx = new ArithmeticExpressionEContext(_ctx, _parentState);
ArithmeticExpressionEContext _prevctx = _localctx;
int _startState = 6;
enterRecursionRule(_localctx, 6, RULE_arithmeticExpressionE, _p);
int _la;
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
{
setState(53);
((ArithmeticExpressionEContext)_localctx).pe40 = productExpressionT(0);
((ArithmeticExpressionEContext)_localctx).value = ((ArithmeticExpressionEContext)_localctx).pe40.value;
}
_ctx.stop = _input.LT(-1);
setState(92);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,9,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
setState(90);
switch ( getInterpreter().adaptivePredict(_input,8,_ctx) ) {
case 1:
{
_localctx = new ArithmeticExpressionEContext(_parentctx, _parentState);
_localctx.ae40 = _prevctx;
_localctx.ae40 = _prevctx;
pushNewRecursionContext(_localctx, _startState, RULE_arithmeticExpressionE);
setState(56);
if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)");
setState(60);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(57);
match(Space);
}
}
setState(62);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(63);
match(T__1);
setState(67);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(64);
match(Space);
}
}
setState(69);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(70);
((ArithmeticExpressionEContext)_localctx).pe40 = productExpressionT(0);
((ArithmeticExpressionEContext)_localctx).value = ((ArithmeticExpressionEContext)_localctx).ae40.value.plus(((ArithmeticExpressionEContext)_localctx).pe40.value);
}
break;
case 2:
{
_localctx = new ArithmeticExpressionEContext(_parentctx, _parentState);
_localctx.ae40 = _prevctx;
_localctx.ae40 = _prevctx;
pushNewRecursionContext(_localctx, _startState, RULE_arithmeticExpressionE);
setState(73);
if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)");
setState(77);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(74);
match(Space);
}
}
setState(79);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(80);
match(T__2);
setState(84);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(81);
match(Space);
}
}
setState(86);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(87);
((ArithmeticExpressionEContext)_localctx).pe40 = productExpressionT(0);
((ArithmeticExpressionEContext)_localctx).value = ((ArithmeticExpressionEContext)_localctx).ae40.value.minus(((ArithmeticExpressionEContext)_localctx).pe40.value);
}
break;
}
}
}
setState(94);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,9,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}
public static class BooleanExpressionBContext extends ParserRuleContext {
public Value value;
public BooleanExpressionBContext be30;
public ArithmeticExpressionEContext ae30;
public ArithmeticExpressionEContext ae31;
public ComplexIdentifierContext ce30;
public FunctionContext fu30;
public BooleanExpressionBContext be31;
public List booleanExpressionB() {
return getRuleContexts(BooleanExpressionBContext.class);
}
public BooleanExpressionBContext booleanExpressionB(int i) {
return getRuleContext(BooleanExpressionBContext.class,i);
}
public List arithmeticExpressionE() {
return getRuleContexts(ArithmeticExpressionEContext.class);
}
public ArithmeticExpressionEContext arithmeticExpressionE(int i) {
return getRuleContext(ArithmeticExpressionEContext.class,i);
}
public ComplexIdentifierContext complexIdentifier() {
return getRuleContext(ComplexIdentifierContext.class,0);
}
public FunctionContext function() {
return getRuleContext(FunctionContext.class,0);
}
public TerminalNode And() { return getToken(Lambda2Parser.And, 0); }
public TerminalNode Or() { return getToken(Lambda2Parser.Or, 0); }
public BooleanExpressionBContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_booleanExpressionB; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).enterBooleanExpressionB(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).exitBooleanExpressionB(this);
}
}
public final BooleanExpressionBContext booleanExpressionB() throws RecognitionException {
return booleanExpressionB(0);
}
private BooleanExpressionBContext booleanExpressionB(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
BooleanExpressionBContext _localctx = new BooleanExpressionBContext(_ctx, _parentState);
BooleanExpressionBContext _prevctx = _localctx;
int _startState = 8;
enterRecursionRule(_localctx, 8, RULE_booleanExpressionB, _p);
int _la;
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(215);
switch ( getInterpreter().adaptivePredict(_input,22,_ctx) ) {
case 1:
{
setState(96);
match(T__8);
setState(97);
((BooleanExpressionBContext)_localctx).be30 = booleanExpressionB(3);
((BooleanExpressionBContext)_localctx).value = ((BooleanExpressionBContext)_localctx).be30.value.not();
}
break;
case 2:
{
setState(100);
((BooleanExpressionBContext)_localctx).ae30 = arithmeticExpressionE(0);
setState(104);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(101);
match(Space);
}
}
setState(106);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(107);
match(T__3);
setState(108);
match(T__3);
setState(112);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(109);
match(Space);
}
}
setState(114);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(115);
((BooleanExpressionBContext)_localctx).ae31 = arithmeticExpressionE(0);
((BooleanExpressionBContext)_localctx).value = new Value(((BooleanExpressionBContext)_localctx).ae30.value.equals(((BooleanExpressionBContext)_localctx).ae31.value));
}
break;
case 3:
{
setState(118);
((BooleanExpressionBContext)_localctx).ae30 = arithmeticExpressionE(0);
setState(122);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(119);
match(Space);
}
}
setState(124);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(125);
match(T__4);
setState(129);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(126);
match(Space);
}
}
setState(131);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(132);
((BooleanExpressionBContext)_localctx).ae31 = arithmeticExpressionE(0);
((BooleanExpressionBContext)_localctx).value = ((BooleanExpressionBContext)_localctx).ae30.value.lessorequals(((BooleanExpressionBContext)_localctx).ae31.value);
}
break;
case 4:
{
setState(135);
((BooleanExpressionBContext)_localctx).ae30 = arithmeticExpressionE(0);
setState(139);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(136);
match(Space);
}
}
setState(141);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(142);
match(T__5);
setState(146);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(143);
match(Space);
}
}
setState(148);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(149);
((BooleanExpressionBContext)_localctx).ae31 = arithmeticExpressionE(0);
((BooleanExpressionBContext)_localctx).value = ((BooleanExpressionBContext)_localctx).ae30.value.less(((BooleanExpressionBContext)_localctx).ae31.value);
}
break;
case 5:
{
setState(152);
((BooleanExpressionBContext)_localctx).ae30 = arithmeticExpressionE(0);
setState(156);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(153);
match(Space);
}
}
setState(158);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(159);
match(T__6);
setState(163);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(160);
match(Space);
}
}
setState(165);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(166);
((BooleanExpressionBContext)_localctx).ae31 = arithmeticExpressionE(0);
((BooleanExpressionBContext)_localctx).value = ((BooleanExpressionBContext)_localctx).ae30.value.less(((BooleanExpressionBContext)_localctx).ae31.value).not();
}
break;
case 6:
{
setState(169);
((BooleanExpressionBContext)_localctx).ae30 = arithmeticExpressionE(0);
setState(173);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(170);
match(Space);
}
}
setState(175);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(176);
match(T__7);
setState(180);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(177);
match(Space);
}
}
setState(182);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(183);
((BooleanExpressionBContext)_localctx).ae31 = arithmeticExpressionE(0);
((BooleanExpressionBContext)_localctx).value = ((BooleanExpressionBContext)_localctx).ae30.value.lessorequals(((BooleanExpressionBContext)_localctx).ae31.value).not();
}
break;
case 7:
{
setState(186);
((BooleanExpressionBContext)_localctx).ae30 = arithmeticExpressionE(0);
setState(190);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(187);
match(Space);
}
}
setState(192);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(193);
match(T__8);
setState(194);
match(T__3);
setState(198);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(195);
match(Space);
}
}
setState(200);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(201);
((BooleanExpressionBContext)_localctx).ae31 = arithmeticExpressionE(0);
((BooleanExpressionBContext)_localctx).value = new Value(!((BooleanExpressionBContext)_localctx).ae30.value.equals(((BooleanExpressionBContext)_localctx).ae31.value));
}
break;
case 8:
{
setState(204);
match(T__9);
setState(205);
((BooleanExpressionBContext)_localctx).be30 = booleanExpressionB(0);
setState(206);
match(T__10);
((BooleanExpressionBContext)_localctx).value = ((BooleanExpressionBContext)_localctx).be30.value;
}
break;
case 9:
{
setState(209);
((BooleanExpressionBContext)_localctx).ce30 = complexIdentifier();
((BooleanExpressionBContext)_localctx).value = ((BooleanExpressionBContext)_localctx).ce30.value;
}
break;
case 10:
{
setState(212);
((BooleanExpressionBContext)_localctx).fu30 = function();
((BooleanExpressionBContext)_localctx).value = ((BooleanExpressionBContext)_localctx).fu30.value;
}
break;
}
_ctx.stop = _input.LT(-1);
setState(253);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,28,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
setState(251);
switch ( getInterpreter().adaptivePredict(_input,27,_ctx) ) {
case 1:
{
_localctx = new BooleanExpressionBContext(_parentctx, _parentState);
_localctx.be30 = _prevctx;
_localctx.be30 = _prevctx;
pushNewRecursionContext(_localctx, _startState, RULE_booleanExpressionB);
setState(217);
if (!(precpred(_ctx, 6))) throw new FailedPredicateException(this, "precpred(_ctx, 6)");
setState(221);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(218);
match(Space);
}
}
setState(223);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(224);
match(And);
setState(228);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(225);
match(Space);
}
}
setState(230);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(231);
((BooleanExpressionBContext)_localctx).be31 = booleanExpressionB(7);
((BooleanExpressionBContext)_localctx).value = ((BooleanExpressionBContext)_localctx).be30.value.and(((BooleanExpressionBContext)_localctx).be31.value);
}
break;
case 2:
{
_localctx = new BooleanExpressionBContext(_parentctx, _parentState);
_localctx.be30 = _prevctx;
_localctx.be30 = _prevctx;
pushNewRecursionContext(_localctx, _startState, RULE_booleanExpressionB);
setState(234);
if (!(precpred(_ctx, 5))) throw new FailedPredicateException(this, "precpred(_ctx, 5)");
setState(238);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(235);
match(Space);
}
}
setState(240);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(241);
match(Or);
setState(245);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(242);
match(Space);
}
}
setState(247);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(248);
((BooleanExpressionBContext)_localctx).be31 = booleanExpressionB(6);
((BooleanExpressionBContext)_localctx).value = ((BooleanExpressionBContext)_localctx).be30.value.or(((BooleanExpressionBContext)_localctx).be31.value);
}
break;
}
}
}
setState(255);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,28,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}
public static class ProductExpressionTContext extends ParserRuleContext {
public Value value;
public ProductExpressionTContext pe50;
public BasicExpressionFContext be50;
public BasicExpressionFContext basicExpressionF() {
return getRuleContext(BasicExpressionFContext.class,0);
}
public ProductExpressionTContext productExpressionT() {
return getRuleContext(ProductExpressionTContext.class,0);
}
public ProductExpressionTContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_productExpressionT; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).enterProductExpressionT(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).exitProductExpressionT(this);
}
}
public final ProductExpressionTContext productExpressionT() throws RecognitionException {
return productExpressionT(0);
}
private ProductExpressionTContext productExpressionT(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
ProductExpressionTContext _localctx = new ProductExpressionTContext(_ctx, _parentState);
ProductExpressionTContext _prevctx = _localctx;
int _startState = 10;
enterRecursionRule(_localctx, 10, RULE_productExpressionT, _p);
int _la;
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
{
setState(257);
((ProductExpressionTContext)_localctx).be50 = basicExpressionF();
((ProductExpressionTContext)_localctx).value = ((ProductExpressionTContext)_localctx).be50.value;
}
_ctx.stop = _input.LT(-1);
setState(296);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,34,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
setState(294);
switch ( getInterpreter().adaptivePredict(_input,33,_ctx) ) {
case 1:
{
_localctx = new ProductExpressionTContext(_parentctx, _parentState);
_localctx.pe50 = _prevctx;
_localctx.pe50 = _prevctx;
pushNewRecursionContext(_localctx, _startState, RULE_productExpressionT);
setState(260);
if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)");
setState(264);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(261);
match(Space);
}
}
setState(266);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(267);
match(T__11);
setState(271);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(268);
match(Space);
}
}
setState(273);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(274);
((ProductExpressionTContext)_localctx).be50 = basicExpressionF();
((ProductExpressionTContext)_localctx).value = ((ProductExpressionTContext)_localctx).pe50.value.multiplyBy(((ProductExpressionTContext)_localctx).be50.value);
}
break;
case 2:
{
_localctx = new ProductExpressionTContext(_parentctx, _parentState);
_localctx.pe50 = _prevctx;
_localctx.pe50 = _prevctx;
pushNewRecursionContext(_localctx, _startState, RULE_productExpressionT);
setState(277);
if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)");
setState(281);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(278);
match(Space);
}
}
setState(283);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(284);
match(T__12);
setState(288);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(285);
match(Space);
}
}
setState(290);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(291);
((ProductExpressionTContext)_localctx).be50 = basicExpressionF();
((ProductExpressionTContext)_localctx).value = ((ProductExpressionTContext)_localctx).pe50.value.diviseBy(((ProductExpressionTContext)_localctx).be50.value);
}
break;
}
}
}
setState(298);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,34,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}
public static class BasicExpressionFContext extends ParserRuleContext {
public Value value;
public ArithmeticExpressionEContext ae60;
public Token nu60;
public Token js60;
public Token ps60;
public ComplexIdentifierContext ci60;
public FunctionContext fu60;
public ArithmeticExpressionEContext arithmeticExpressionE() {
return getRuleContext(ArithmeticExpressionEContext.class,0);
}
public TerminalNode Number() { return getToken(Lambda2Parser.Number, 0); }
public TerminalNode JavaString() { return getToken(Lambda2Parser.JavaString, 0); }
public TerminalNode PythonString() { return getToken(Lambda2Parser.PythonString, 0); }
public ComplexIdentifierContext complexIdentifier() {
return getRuleContext(ComplexIdentifierContext.class,0);
}
public FunctionContext function() {
return getRuleContext(FunctionContext.class,0);
}
public BasicExpressionFContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_basicExpressionF; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).enterBasicExpressionF(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).exitBasicExpressionF(this);
}
}
public final BasicExpressionFContext basicExpressionF() throws RecognitionException {
BasicExpressionFContext _localctx = new BasicExpressionFContext(_ctx, getState());
enterRule(_localctx, 12, RULE_basicExpressionF);
try {
setState(316);
switch (_input.LA(1)) {
case T__9:
enterOuterAlt(_localctx, 1);
{
setState(299);
match(T__9);
setState(300);
((BasicExpressionFContext)_localctx).ae60 = arithmeticExpressionE(0);
setState(301);
match(T__10);
((BasicExpressionFContext)_localctx).value = ((BasicExpressionFContext)_localctx).ae60.value;
}
break;
case Number:
enterOuterAlt(_localctx, 2);
{
setState(304);
((BasicExpressionFContext)_localctx).nu60 = match(Number);
if(x.String(".").in((((BasicExpressionFContext)_localctx).nu60!=null?((BasicExpressionFContext)_localctx).nu60.getText():null)))
((BasicExpressionFContext)_localctx).value = new Value(Double.parseDouble((((BasicExpressionFContext)_localctx).nu60!=null?((BasicExpressionFContext)_localctx).nu60.getText():null)));
else
((BasicExpressionFContext)_localctx).value = new Value(Integer.parseInt((((BasicExpressionFContext)_localctx).nu60!=null?((BasicExpressionFContext)_localctx).nu60.getText():null)));
}
break;
case JavaString:
enterOuterAlt(_localctx, 3);
{
setState(306);
((BasicExpressionFContext)_localctx).js60 = match(JavaString);
((BasicExpressionFContext)_localctx).value = new Value(x.String((((BasicExpressionFContext)_localctx).js60!=null?((BasicExpressionFContext)_localctx).js60.getText():null)).slice(1,-1));
}
break;
case PythonString:
enterOuterAlt(_localctx, 4);
{
setState(308);
((BasicExpressionFContext)_localctx).ps60 = match(PythonString);
((BasicExpressionFContext)_localctx).value = new Value(x.String((((BasicExpressionFContext)_localctx).ps60!=null?((BasicExpressionFContext)_localctx).ps60.getText():null)).slice(3,-3));
}
break;
case Identifier:
enterOuterAlt(_localctx, 5);
{
setState(310);
((BasicExpressionFContext)_localctx).ci60 = complexIdentifier();
((BasicExpressionFContext)_localctx).value = ((BasicExpressionFContext)_localctx).ci60.value;
}
break;
case FTOK:
enterOuterAlt(_localctx, 6);
{
setState(313);
((BasicExpressionFContext)_localctx).fu60 = function();
((BasicExpressionFContext)_localctx).value = ((BasicExpressionFContext)_localctx).fu60.value;
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ComplexIdentifierContext extends ParserRuleContext {
public Value value;
public Token id70;
public Token nu70;
public TerminalNode OPENBRACKET() { return getToken(Lambda2Parser.OPENBRACKET, 0); }
public TerminalNode CLOSEDBRACKET() { return getToken(Lambda2Parser.CLOSEDBRACKET, 0); }
public TerminalNode Identifier() { return getToken(Lambda2Parser.Identifier, 0); }
public TerminalNode Number() { return getToken(Lambda2Parser.Number, 0); }
public ComplexIdentifierContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_complexIdentifier; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).enterComplexIdentifier(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).exitComplexIdentifier(this);
}
}
public final ComplexIdentifierContext complexIdentifier() throws RecognitionException {
ComplexIdentifierContext _localctx = new ComplexIdentifierContext(_ctx, getState());
enterRule(_localctx, 14, RULE_complexIdentifier);
try {
setState(325);
switch ( getInterpreter().adaptivePredict(_input,36,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(318);
((ComplexIdentifierContext)_localctx).id70 = match(Identifier);
setState(319);
match(OPENBRACKET);
setState(320);
((ComplexIdentifierContext)_localctx).nu70 = match(Number);
setState(321);
match(CLOSEDBRACKET);
if(!inputVarNames.contains((((ComplexIdentifierContext)_localctx).id70!=null?((ComplexIdentifierContext)_localctx).id70.getText():null))) throw new IllegalArgumentException("Undefined variable: "+(((ComplexIdentifierContext)_localctx).id70!=null?((ComplexIdentifierContext)_localctx).id70.getText():null));
if((((ComplexIdentifierContext)_localctx).nu70!=null?((ComplexIdentifierContext)_localctx).nu70.getText():null).contains("."))
throw new IllegalArgumentException("The index of the input variable has to be an integer.");
else if(Integer.parseInt((((ComplexIdentifierContext)_localctx).nu70!=null?((ComplexIdentifierContext)_localctx).nu70.getText():null)) >= (x.len(inputValues.get((((ComplexIdentifierContext)_localctx).id70!=null?((ComplexIdentifierContext)_localctx).id70.getText():null)).value)))
throw new IndexOutOfBoundsException("Illegal dimension parameter: "+(((ComplexIdentifierContext)_localctx).nu70!=null?((ComplexIdentifierContext)_localctx).nu70.getText():null)+". The input variable only has "+x.len(x.len(inputValues.get((((ComplexIdentifierContext)_localctx).id70!=null?((ComplexIdentifierContext)_localctx).id70.getText():null))))+" dimensions.");
if(inputValues.get((((ComplexIdentifierContext)_localctx).id70!=null?((ComplexIdentifierContext)_localctx).id70.getText():null)).value instanceof Iterable>)
((ComplexIdentifierContext)_localctx).value = new Value((x.list((Iterable>)(inputValues.get((((ComplexIdentifierContext)_localctx).id70!=null?((ComplexIdentifierContext)_localctx).id70.getText():null)).value)).get(Integer.parseInt((((ComplexIdentifierContext)_localctx).nu70!=null?((ComplexIdentifierContext)_localctx).nu70.getText():null)))));
else if(inputValues.get((((ComplexIdentifierContext)_localctx).id70!=null?((ComplexIdentifierContext)_localctx).id70.getText():null)).value instanceof tuple)
((ComplexIdentifierContext)_localctx).value = new Value((((tuple)(inputValues.get((((ComplexIdentifierContext)_localctx).id70!=null?((ComplexIdentifierContext)_localctx).id70.getText():null)).value)).get(Integer.parseInt((((ComplexIdentifierContext)_localctx).nu70!=null?((ComplexIdentifierContext)_localctx).nu70.getText():null)))));
else if(inputValues.get((((ComplexIdentifierContext)_localctx).id70!=null?((ComplexIdentifierContext)_localctx).id70.getText():null)).value instanceof String)
((ComplexIdentifierContext)_localctx).value = new Value(x.String(inputValues.get((((ComplexIdentifierContext)_localctx).id70!=null?((ComplexIdentifierContext)_localctx).id70.getText():null)).value.toString()).get(Integer.parseInt((((ComplexIdentifierContext)_localctx).nu70!=null?((ComplexIdentifierContext)_localctx).nu70.getText():null))));
else
throw new IllegalArgumentException("The input variable is not multi-dimensional, you cannot use the [...] notation in your lambda expression.");
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(323);
((ComplexIdentifierContext)_localctx).id70 = match(Identifier);
if (inputValues.containsKey((((ComplexIdentifierContext)_localctx).id70!=null?((ComplexIdentifierContext)_localctx).id70.getText():null))) {
((ComplexIdentifierContext)_localctx).value = new Value(inputValues.get((((ComplexIdentifierContext)_localctx).id70!=null?((ComplexIdentifierContext)_localctx).id70.getText():null)));
} else {
throw new IllegalArgumentException("Could not find input variable with name " + (((ComplexIdentifierContext)_localctx).id70!=null?((ComplexIdentifierContext)_localctx).id70.getText():null));
}
}
break;
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class FunctionContext extends ParserRuleContext {
public Value value;
public Token ft80;
public AnyExpressionContext ae80;
public TerminalNode FTOK() { return getToken(Lambda2Parser.FTOK, 0); }
public AnyExpressionContext anyExpression() {
return getRuleContext(AnyExpressionContext.class,0);
}
public FunctionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_function; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).enterFunction(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).exitFunction(this);
}
}
public final FunctionContext function() throws RecognitionException {
FunctionContext _localctx = new FunctionContext(_ctx, getState());
enterRule(_localctx, 16, RULE_function);
try {
enterOuterAlt(_localctx, 1);
{
setState(327);
((FunctionContext)_localctx).ft80 = match(FTOK);
setState(328);
match(T__9);
setState(329);
((FunctionContext)_localctx).ae80 = anyExpression();
setState(330);
match(T__10);
int funNum = Integer.parseInt(x.String((((FunctionContext)_localctx).ft80!=null?((FunctionContext)_localctx).ft80.getText():null)).sliceFrom(1));
if(funNum >= inputFunction.length)
throw new IllegalArgumentException("The unknown function "+(((FunctionContext)_localctx).ft80!=null?((FunctionContext)_localctx).ft80.getText():null)+".");
else
((FunctionContext)_localctx).value = new Value(inputFunction[funNum].apply(((FunctionContext)_localctx).ae80.value.value));
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class InputVarsContext extends ParserRuleContext {
public ArrayList value;
public InputVarsContext iv92;
public Token iv90;
public Token iv93;
public TerminalNode Identifier() { return getToken(Lambda2Parser.Identifier, 0); }
public InputVarsContext inputVars() {
return getRuleContext(InputVarsContext.class,0);
}
public InputVarsContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_inputVars; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).enterInputVars(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof Lambda2Listener ) ((Lambda2Listener)listener).exitInputVars(this);
}
}
public final InputVarsContext inputVars() throws RecognitionException {
return inputVars(0);
}
private InputVarsContext inputVars(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
InputVarsContext _localctx = new InputVarsContext(_ctx, _parentState);
InputVarsContext _prevctx = _localctx;
int _startState = 18;
enterRecursionRule(_localctx, 18, RULE_inputVars, _p);
int _la;
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
{
setState(334);
((InputVarsContext)_localctx).iv90 = match(Identifier);
ArrayList fields = Helpers.newArrayList();
fields.add((((InputVarsContext)_localctx).iv90!=null?((InputVarsContext)_localctx).iv90.getText():null));
((InputVarsContext)_localctx).value = fields;
}
_ctx.stop = _input.LT(-1);
setState(355);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,39,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
{
_localctx = new InputVarsContext(_parentctx, _parentState);
_localctx.iv92 = _prevctx;
_localctx.iv92 = _prevctx;
pushNewRecursionContext(_localctx, _startState, RULE_inputVars);
setState(337);
if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)");
setState(341);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(338);
match(Space);
}
}
setState(343);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(344);
match(T__13);
setState(348);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==Space) {
{
{
setState(345);
match(Space);
}
}
setState(350);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(351);
((InputVarsContext)_localctx).iv93 = match(Identifier);
ArrayList fields = Helpers.newArrayList(((InputVarsContext)_localctx).iv92.value); fields.add((((InputVarsContext)_localctx).iv93!=null?((InputVarsContext)_localctx).iv93.getText():null)); ((InputVarsContext)_localctx).value = fields;
}
}
}
setState(357);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,39,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}
public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
switch (ruleIndex) {
case 3:
return arithmeticExpressionE_sempred((ArithmeticExpressionEContext)_localctx, predIndex);
case 4:
return booleanExpressionB_sempred((BooleanExpressionBContext)_localctx, predIndex);
case 5:
return productExpressionT_sempred((ProductExpressionTContext)_localctx, predIndex);
case 9:
return inputVars_sempred((InputVarsContext)_localctx, predIndex);
}
return true;
}
private boolean arithmeticExpressionE_sempred(ArithmeticExpressionEContext _localctx, int predIndex) {
switch (predIndex) {
case 0:
return precpred(_ctx, 3);
case 1:
return precpred(_ctx, 2);
}
return true;
}
private boolean booleanExpressionB_sempred(BooleanExpressionBContext _localctx, int predIndex) {
switch (predIndex) {
case 2:
return precpred(_ctx, 6);
case 3:
return precpred(_ctx, 5);
}
return true;
}
private boolean productExpressionT_sempred(ProductExpressionTContext _localctx, int predIndex) {
switch (predIndex) {
case 4:
return precpred(_ctx, 3);
case 5:
return precpred(_ctx, 2);
}
return true;
}
private boolean inputVars_sempred(InputVarsContext _localctx, int predIndex) {
switch (predIndex) {
case 6:
return precpred(_ctx, 1);
}
return true;
}
public static final String _serializedATN =
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\33\u0169\4\2\t\2"+
"\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+
"\t\13\3\2\3\2\3\2\3\2\5\2\33\n\2\3\3\3\3\3\3\7\3 \n\3\f\3\16\3#\13\3\3"+
"\3\3\3\7\3\'\n\3\f\3\16\3*\13\3\3\3\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\4\5"+
"\4\65\n\4\3\5\3\5\3\5\3\5\3\5\3\5\7\5=\n\5\f\5\16\5@\13\5\3\5\3\5\7\5"+
"D\n\5\f\5\16\5G\13\5\3\5\3\5\3\5\3\5\3\5\7\5N\n\5\f\5\16\5Q\13\5\3\5\3"+
"\5\7\5U\n\5\f\5\16\5X\13\5\3\5\3\5\3\5\7\5]\n\5\f\5\16\5`\13\5\3\6\3\6"+
"\3\6\3\6\3\6\3\6\3\6\7\6i\n\6\f\6\16\6l\13\6\3\6\3\6\3\6\7\6q\n\6\f\6"+
"\16\6t\13\6\3\6\3\6\3\6\3\6\3\6\7\6{\n\6\f\6\16\6~\13\6\3\6\3\6\7\6\u0082"+
"\n\6\f\6\16\6\u0085\13\6\3\6\3\6\3\6\3\6\3\6\7\6\u008c\n\6\f\6\16\6\u008f"+
"\13\6\3\6\3\6\7\6\u0093\n\6\f\6\16\6\u0096\13\6\3\6\3\6\3\6\3\6\3\6\7"+
"\6\u009d\n\6\f\6\16\6\u00a0\13\6\3\6\3\6\7\6\u00a4\n\6\f\6\16\6\u00a7"+
"\13\6\3\6\3\6\3\6\3\6\3\6\7\6\u00ae\n\6\f\6\16\6\u00b1\13\6\3\6\3\6\7"+
"\6\u00b5\n\6\f\6\16\6\u00b8\13\6\3\6\3\6\3\6\3\6\3\6\7\6\u00bf\n\6\f\6"+
"\16\6\u00c2\13\6\3\6\3\6\3\6\7\6\u00c7\n\6\f\6\16\6\u00ca\13\6\3\6\3\6"+
"\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\5\6\u00da\n\6\3\6\3\6"+
"\7\6\u00de\n\6\f\6\16\6\u00e1\13\6\3\6\3\6\7\6\u00e5\n\6\f\6\16\6\u00e8"+
"\13\6\3\6\3\6\3\6\3\6\3\6\7\6\u00ef\n\6\f\6\16\6\u00f2\13\6\3\6\3\6\7"+
"\6\u00f6\n\6\f\6\16\6\u00f9\13\6\3\6\3\6\3\6\7\6\u00fe\n\6\f\6\16\6\u0101"+
"\13\6\3\7\3\7\3\7\3\7\3\7\3\7\7\7\u0109\n\7\f\7\16\7\u010c\13\7\3\7\3"+
"\7\7\7\u0110\n\7\f\7\16\7\u0113\13\7\3\7\3\7\3\7\3\7\3\7\7\7\u011a\n\7"+
"\f\7\16\7\u011d\13\7\3\7\3\7\7\7\u0121\n\7\f\7\16\7\u0124\13\7\3\7\3\7"+
"\3\7\7\7\u0129\n\7\f\7\16\7\u012c\13\7\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b"+
"\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\5\b\u013f\n\b\3\t\3\t\3\t\3\t\3\t"+
"\3\t\3\t\5\t\u0148\n\t\3\n\3\n\3\n\3\n\3\n\3\n\3\13\3\13\3\13\3\13\3\13"+
"\3\13\7\13\u0156\n\13\f\13\16\13\u0159\13\13\3\13\3\13\7\13\u015d\n\13"+
"\f\13\16\13\u0160\13\13\3\13\3\13\7\13\u0164\n\13\f\13\16\13\u0167\13"+
"\13\3\13\2\6\b\n\f\24\f\2\4\6\b\n\f\16\20\22\24\2\2\u0192\2\32\3\2\2\2"+
"\4\34\3\2\2\2\6\64\3\2\2\2\b\66\3\2\2\2\n\u00d9\3\2\2\2\f\u0102\3\2\2"+
"\2\16\u013e\3\2\2\2\20\u0147\3\2\2\2\22\u0149\3\2\2\2\24\u014f\3\2\2\2"+
"\26\27\5\4\3\2\27\30\b\2\1\2\30\33\3\2\2\2\31\33\7\2\2\3\32\26\3\2\2\2"+
"\32\31\3\2\2\2\33\3\3\2\2\2\34\35\5\24\13\2\35!\b\3\1\2\36 \7\30\2\2\37"+
"\36\3\2\2\2 #\3\2\2\2!\37\3\2\2\2!\"\3\2\2\2\"$\3\2\2\2#!\3\2\2\2$(\7"+
"\3\2\2%\'\7\30\2\2&%\3\2\2\2\'*\3\2\2\2(&\3\2\2\2()\3\2\2\2)+\3\2\2\2"+
"*(\3\2\2\2+,\5\6\4\2,-\b\3\1\2-\5\3\2\2\2./\5\n\6\2/\60\b\4\1\2\60\65"+
"\3\2\2\2\61\62\5\b\5\2\62\63\b\4\1\2\63\65\3\2\2\2\64.\3\2\2\2\64\61\3"+
"\2\2\2\65\7\3\2\2\2\66\67\b\5\1\2\678\5\f\7\289\b\5\1\29^\3\2\2\2:>\f"+
"\5\2\2;=\7\30\2\2<;\3\2\2\2=@\3\2\2\2><\3\2\2\2>?\3\2\2\2?A\3\2\2\2@>"+
"\3\2\2\2AE\7\4\2\2BD\7\30\2\2CB\3\2\2\2DG\3\2\2\2EC\3\2\2\2EF\3\2\2\2"+
"FH\3\2\2\2GE\3\2\2\2HI\5\f\7\2IJ\b\5\1\2J]\3\2\2\2KO\f\4\2\2LN\7\30\2"+
"\2ML\3\2\2\2NQ\3\2\2\2OM\3\2\2\2OP\3\2\2\2PR\3\2\2\2QO\3\2\2\2RV\7\5\2"+
"\2SU\7\30\2\2TS\3\2\2\2UX\3\2\2\2VT\3\2\2\2VW\3\2\2\2WY\3\2\2\2XV\3\2"+
"\2\2YZ\5\f\7\2Z[\b\5\1\2[]\3\2\2\2\\:\3\2\2\2\\K\3\2\2\2]`\3\2\2\2^\\"+
"\3\2\2\2^_\3\2\2\2_\t\3\2\2\2`^\3\2\2\2ab\b\6\1\2bc\7\13\2\2cd\5\n\6\5"+
"de\b\6\1\2e\u00da\3\2\2\2fj\5\b\5\2gi\7\30\2\2hg\3\2\2\2il\3\2\2\2jh\3"+
"\2\2\2jk\3\2\2\2km\3\2\2\2lj\3\2\2\2mn\7\6\2\2nr\7\6\2\2oq\7\30\2\2po"+
"\3\2\2\2qt\3\2\2\2rp\3\2\2\2rs\3\2\2\2su\3\2\2\2tr\3\2\2\2uv\5\b\5\2v"+
"w\b\6\1\2w\u00da\3\2\2\2x|\5\b\5\2y{\7\30\2\2zy\3\2\2\2{~\3\2\2\2|z\3"+
"\2\2\2|}\3\2\2\2}\177\3\2\2\2~|\3\2\2\2\177\u0083\7\7\2\2\u0080\u0082"+
"\7\30\2\2\u0081\u0080\3\2\2\2\u0082\u0085\3\2\2\2\u0083\u0081\3\2\2\2"+
"\u0083\u0084\3\2\2\2\u0084\u0086\3\2\2\2\u0085\u0083\3\2\2\2\u0086\u0087"+
"\5\b\5\2\u0087\u0088\b\6\1\2\u0088\u00da\3\2\2\2\u0089\u008d\5\b\5\2\u008a"+
"\u008c\7\30\2\2\u008b\u008a\3\2\2\2\u008c\u008f\3\2\2\2\u008d\u008b\3"+
"\2\2\2\u008d\u008e\3\2\2\2\u008e\u0090\3\2\2\2\u008f\u008d\3\2\2\2\u0090"+
"\u0094\7\b\2\2\u0091\u0093\7\30\2\2\u0092\u0091\3\2\2\2\u0093\u0096\3"+
"\2\2\2\u0094\u0092\3\2\2\2\u0094\u0095\3\2\2\2\u0095\u0097\3\2\2\2\u0096"+
"\u0094\3\2\2\2\u0097\u0098\5\b\5\2\u0098\u0099\b\6\1\2\u0099\u00da\3\2"+
"\2\2\u009a\u009e\5\b\5\2\u009b\u009d\7\30\2\2\u009c\u009b\3\2\2\2\u009d"+
"\u00a0\3\2\2\2\u009e\u009c\3\2\2\2\u009e\u009f\3\2\2\2\u009f\u00a1\3\2"+
"\2\2\u00a0\u009e\3\2\2\2\u00a1\u00a5\7\t\2\2\u00a2\u00a4\7\30\2\2\u00a3"+
"\u00a2\3\2\2\2\u00a4\u00a7\3\2\2\2\u00a5\u00a3\3\2\2\2\u00a5\u00a6\3\2"+
"\2\2\u00a6\u00a8\3\2\2\2\u00a7\u00a5\3\2\2\2\u00a8\u00a9\5\b\5\2\u00a9"+
"\u00aa\b\6\1\2\u00aa\u00da\3\2\2\2\u00ab\u00af\5\b\5\2\u00ac\u00ae\7\30"+
"\2\2\u00ad\u00ac\3\2\2\2\u00ae\u00b1\3\2\2\2\u00af\u00ad\3\2\2\2\u00af"+
"\u00b0\3\2\2\2\u00b0\u00b2\3\2\2\2\u00b1\u00af\3\2\2\2\u00b2\u00b6\7\n"+
"\2\2\u00b3\u00b5\7\30\2\2\u00b4\u00b3\3\2\2\2\u00b5\u00b8\3\2\2\2\u00b6"+
"\u00b4\3\2\2\2\u00b6\u00b7\3\2\2\2\u00b7\u00b9\3\2\2\2\u00b8\u00b6\3\2"+
"\2\2\u00b9\u00ba\5\b\5\2\u00ba\u00bb\b\6\1\2\u00bb\u00da\3\2\2\2\u00bc"+
"\u00c0\5\b\5\2\u00bd\u00bf\7\30\2\2\u00be\u00bd\3\2\2\2\u00bf\u00c2\3"+
"\2\2\2\u00c0\u00be\3\2\2\2\u00c0\u00c1\3\2\2\2\u00c1\u00c3\3\2\2\2\u00c2"+
"\u00c0\3\2\2\2\u00c3\u00c4\7\13\2\2\u00c4\u00c8\7\6\2\2\u00c5\u00c7\7"+
"\30\2\2\u00c6\u00c5\3\2\2\2\u00c7\u00ca\3\2\2\2\u00c8\u00c6\3\2\2\2\u00c8"+
"\u00c9\3\2\2\2\u00c9\u00cb\3\2\2\2\u00ca\u00c8\3\2\2\2\u00cb\u00cc\5\b"+
"\5\2\u00cc\u00cd\b\6\1\2\u00cd\u00da\3\2\2\2\u00ce\u00cf\7\f\2\2\u00cf"+
"\u00d0\5\n\6\2\u00d0\u00d1\7\r\2\2\u00d1\u00d2\b\6\1\2\u00d2\u00da\3\2"+
"\2\2\u00d3\u00d4\5\20\t\2\u00d4\u00d5\b\6\1\2\u00d5\u00da\3\2\2\2\u00d6"+
"\u00d7\5\22\n\2\u00d7\u00d8\b\6\1\2\u00d8\u00da\3\2\2\2\u00d9a\3\2\2\2"+
"\u00d9f\3\2\2\2\u00d9x\3\2\2\2\u00d9\u0089\3\2\2\2\u00d9\u009a\3\2\2\2"+
"\u00d9\u00ab\3\2\2\2\u00d9\u00bc\3\2\2\2\u00d9\u00ce\3\2\2\2\u00d9\u00d3"+
"\3\2\2\2\u00d9\u00d6\3\2\2\2\u00da\u00ff\3\2\2\2\u00db\u00df\f\b\2\2\u00dc"+
"\u00de\7\30\2\2\u00dd\u00dc\3\2\2\2\u00de\u00e1\3\2\2\2\u00df\u00dd\3"+
"\2\2\2\u00df\u00e0\3\2\2\2\u00e0\u00e2\3\2\2\2\u00e1\u00df\3\2\2\2\u00e2"+
"\u00e6\7\22\2\2\u00e3\u00e5\7\30\2\2\u00e4\u00e3\3\2\2\2\u00e5\u00e8\3"+
"\2\2\2\u00e6\u00e4\3\2\2\2\u00e6\u00e7\3\2\2\2\u00e7\u00e9\3\2\2\2\u00e8"+
"\u00e6\3\2\2\2\u00e9\u00ea\5\n\6\t\u00ea\u00eb\b\6\1\2\u00eb\u00fe\3\2"+
"\2\2\u00ec\u00f0\f\7\2\2\u00ed\u00ef\7\30\2\2\u00ee\u00ed\3\2\2\2\u00ef"+
"\u00f2\3\2\2\2\u00f0\u00ee\3\2\2\2\u00f0\u00f1\3\2\2\2\u00f1\u00f3\3\2"+
"\2\2\u00f2\u00f0\3\2\2\2\u00f3\u00f7\7\23\2\2\u00f4\u00f6\7\30\2\2\u00f5"+
"\u00f4\3\2\2\2\u00f6\u00f9\3\2\2\2\u00f7\u00f5\3\2\2\2\u00f7\u00f8\3\2"+
"\2\2\u00f8\u00fa\3\2\2\2\u00f9\u00f7\3\2\2\2\u00fa\u00fb\5\n\6\b\u00fb"+
"\u00fc\b\6\1\2\u00fc\u00fe\3\2\2\2\u00fd\u00db\3\2\2\2\u00fd\u00ec\3\2"+
"\2\2\u00fe\u0101\3\2\2\2\u00ff\u00fd\3\2\2\2\u00ff\u0100\3\2\2\2\u0100"+
"\13\3\2\2\2\u0101\u00ff\3\2\2\2\u0102\u0103\b\7\1\2\u0103\u0104\5\16\b"+
"\2\u0104\u0105\b\7\1\2\u0105\u012a\3\2\2\2\u0106\u010a\f\5\2\2\u0107\u0109"+
"\7\30\2\2\u0108\u0107\3\2\2\2\u0109\u010c\3\2\2\2\u010a\u0108\3\2\2\2"+
"\u010a\u010b\3\2\2\2\u010b\u010d\3\2\2\2\u010c\u010a\3\2\2\2\u010d\u0111"+
"\7\16\2\2\u010e\u0110\7\30\2\2\u010f\u010e\3\2\2\2\u0110\u0113\3\2\2\2"+
"\u0111\u010f\3\2\2\2\u0111\u0112\3\2\2\2\u0112\u0114\3\2\2\2\u0113\u0111"+
"\3\2\2\2\u0114\u0115\5\16\b\2\u0115\u0116\b\7\1\2\u0116\u0129\3\2\2\2"+
"\u0117\u011b\f\4\2\2\u0118\u011a\7\30\2\2\u0119\u0118\3\2\2\2\u011a\u011d"+
"\3\2\2\2\u011b\u0119\3\2\2\2\u011b\u011c\3\2\2\2\u011c\u011e\3\2\2\2\u011d"+
"\u011b\3\2\2\2\u011e\u0122\7\17\2\2\u011f\u0121\7\30\2\2\u0120\u011f\3"+
"\2\2\2\u0121\u0124\3\2\2\2\u0122\u0120\3\2\2\2\u0122\u0123\3\2\2\2\u0123"+
"\u0125\3\2\2\2\u0124\u0122\3\2\2\2\u0125\u0126\5\16\b\2\u0126\u0127\b"+
"\7\1\2\u0127\u0129\3\2\2\2\u0128\u0106\3\2\2\2\u0128\u0117\3\2\2\2\u0129"+
"\u012c\3\2\2\2\u012a\u0128\3\2\2\2\u012a\u012b\3\2\2\2\u012b\r\3\2\2\2"+
"\u012c\u012a\3\2\2\2\u012d\u012e\7\f\2\2\u012e\u012f\5\b\5\2\u012f\u0130"+
"\7\r\2\2\u0130\u0131\b\b\1\2\u0131\u013f\3\2\2\2\u0132\u0133\7\25\2\2"+
"\u0133\u013f\b\b\1\2\u0134\u0135\7\26\2\2\u0135\u013f\b\b\1\2\u0136\u0137"+
"\7\27\2\2\u0137\u013f\b\b\1\2\u0138\u0139\5\20\t\2\u0139\u013a\b\b\1\2"+
"\u013a\u013f\3\2\2\2\u013b\u013c\5\22\n\2\u013c\u013d\b\b\1\2\u013d\u013f"+
"\3\2\2\2\u013e\u012d\3\2\2\2\u013e\u0132\3\2\2\2\u013e\u0134\3\2\2\2\u013e"+
"\u0136\3\2\2\2\u013e\u0138\3\2\2\2\u013e\u013b\3\2\2\2\u013f\17\3\2\2"+
"\2\u0140\u0141\7\24\2\2\u0141\u0142\7\31\2\2\u0142\u0143\7\25\2\2\u0143"+
"\u0144\7\32\2\2\u0144\u0148\b\t\1\2\u0145\u0146\7\24\2\2\u0146\u0148\b"+
"\t\1\2\u0147\u0140\3\2\2\2\u0147\u0145\3\2\2\2\u0148\21\3\2\2\2\u0149"+
"\u014a\7\21\2\2\u014a\u014b\7\f\2\2\u014b\u014c\5\6\4\2\u014c\u014d\7"+
"\r\2\2\u014d\u014e\b\n\1\2\u014e\23\3\2\2\2\u014f\u0150\b\13\1\2\u0150"+
"\u0151\7\24\2\2\u0151\u0152\b\13\1\2\u0152\u0165\3\2\2\2\u0153\u0157\f"+
"\3\2\2\u0154\u0156\7\30\2\2\u0155\u0154\3\2\2\2\u0156\u0159\3\2\2\2\u0157"+
"\u0155\3\2\2\2\u0157\u0158\3\2\2\2\u0158\u015a\3\2\2\2\u0159\u0157\3\2"+
"\2\2\u015a\u015e\7\20\2\2\u015b\u015d\7\30\2\2\u015c\u015b\3\2\2\2\u015d"+
"\u0160\3\2\2\2\u015e\u015c\3\2\2\2\u015e\u015f\3\2\2\2\u015f\u0161\3\2"+
"\2\2\u0160\u015e\3\2\2\2\u0161\u0162\7\24\2\2\u0162\u0164\b\13\1\2\u0163"+
"\u0153\3\2\2\2\u0164\u0167\3\2\2\2\u0165\u0163\3\2\2\2\u0165\u0166\3\2"+
"\2\2\u0166\25\3\2\2\2\u0167\u0165\3\2\2\2*\32!(\64>EOV\\^jr|\u0083\u008d"+
"\u0094\u009e\u00a5\u00af\u00b6\u00c0\u00c8\u00d9\u00df\u00e6\u00f0\u00f7"+
"\u00fd\u00ff\u010a\u0111\u011b\u0122\u0128\u012a\u013e\u0147\u0157\u015e"+
"\u0165";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
}