// Generated from /home/runner/work/cypher-language-support/cypher-language-support/vendor/antlr4-c3/tests/Expr.g4 by ANTLR 4.13.0
// noinspection ES6UnusedImports,JSUnusedGlobalSymbols,JSUnusedLocalSymbols
import { ATN, ATNDeserializer, DFA, FailedPredicateException, RecognitionException, NoViableAltException, Parser, ParserATNSimulator, ParserRuleContext, PredictionContextCache, Token } from 'antlr4';
export default class ExprParser extends Parser {
    static { this.VAR = 1; }
    static { this.LET = 2; }
    static { this.PLUS = 3; }
    static { this.MINUS = 4; }
    static { this.MULTIPLY = 5; }
    static { this.DIVIDE = 6; }
    static { this.EQUAL = 7; }
    static { this.OPEN_PAR = 8; }
    static { this.CLOSE_PAR = 9; }
    static { this.ID = 10; }
    static { this.WS = 11; }
    static { this.EOF = Token.EOF; }
    static { this.RULE_expression = 0; }
    static { this.RULE_assignment = 1; }
    static { this.RULE_simpleExpression = 2; }
    static { this.RULE_variableRef = 3; }
    static { this.RULE_functionRef = 4; }
    static { this.RULE_identifier = 5; }
    static { this.literalNames = [null, null,
        null, "'+'",
        "'-'", "'*'",
        "'/'", "'='",
        "'('", "')'"]; }
    static { this.symbolicNames = [null, "VAR",
        "LET", "PLUS",
        "MINUS", "MULTIPLY",
        "DIVIDE", "EQUAL",
        "OPEN_PAR",
        "CLOSE_PAR",
        "ID", "WS"]; }
    // tslint:disable:no-trailing-whitespace
    static { this.ruleNames = [
        "expression", "assignment", "simpleExpression", "variableRef", "functionRef",
        "identifier",
    ]; }
    get grammarFileName() { return "Expr.g4"; }
    get literalNames() { return ExprParser.literalNames; }
    get symbolicNames() { return ExprParser.symbolicNames; }
    get ruleNames() { return ExprParser.ruleNames; }
    get serializedATN() { return ExprParser._serializedATN; }
    createFailedPredicateException(predicate, message) {
        return new FailedPredicateException(this, predicate, message);
    }
    constructor(input) {
        super(input);
        this._interp = new ParserATNSimulator(this, ExprParser._ATN, ExprParser.DecisionsToDFA, new PredictionContextCache());
    }
    // @RuleVersion(0)
    expression() {
        let localctx = new ExpressionContext(this, this._ctx, this.state);
        this.enterRule(localctx, 0, ExprParser.RULE_expression);
        try {
            this.state = 14;
            this._errHandler.sync(this);
            switch (this._input.LA(1)) {
                case 1:
                case 2:
                    this.enterOuterAlt(localctx, 1);
                    {
                        this.state = 12;
                        this.assignment();
                    }
                    break;
                case 10:
                    this.enterOuterAlt(localctx, 2);
                    {
                        this.state = 13;
                        this.simpleExpression(0);
                    }
                    break;
                default:
                    throw new NoViableAltException(this);
            }
        }
        catch (re) {
            if (re instanceof RecognitionException) {
                localctx.exception = re;
                this._errHandler.reportError(this, re);
                this._errHandler.recover(this, re);
            }
            else {
                throw re;
            }
        }
        finally {
            this.exitRule();
        }
        return localctx;
    }
    // @RuleVersion(0)
    assignment() {
        let localctx = new AssignmentContext(this, this._ctx, this.state);
        this.enterRule(localctx, 2, ExprParser.RULE_assignment);
        let _la;
        try {
            this.enterOuterAlt(localctx, 1);
            {
                this.state = 16;
                _la = this._input.LA(1);
                if (!(_la === 1 || _la === 2)) {
                    this._errHandler.recoverInline(this);
                }
                else {
                    this._errHandler.reportMatch(this);
                    this.consume();
                }
                this.state = 17;
                this.match(ExprParser.ID);
                this.state = 18;
                this.match(ExprParser.EQUAL);
                this.state = 19;
                this.simpleExpression(0);
            }
        }
        catch (re) {
            if (re instanceof RecognitionException) {
                localctx.exception = re;
                this._errHandler.reportError(this, re);
                this._errHandler.recover(this, re);
            }
            else {
                throw re;
            }
        }
        finally {
            this.exitRule();
        }
        return localctx;
    }
    // @RuleVersion(0)
    simpleExpression(_p) {
        if (_p === undefined) {
            _p = 0;
        }
        let _parentctx = this._ctx;
        let _parentState = this.state;
        let localctx = new SimpleExpressionContext(this, this._ctx, _parentState);
        let _prevctx = localctx;
        let _startState = 4;
        this.enterRecursionRule(localctx, 4, ExprParser.RULE_simpleExpression, _p);
        let _la;
        try {
            let _alt;
            this.enterOuterAlt(localctx, 1);
            {
                this.state = 24;
                this._errHandler.sync(this);
                switch (this._interp.adaptivePredict(this._input, 1, this._ctx)) {
                    case 1:
                        {
                            this.state = 22;
                            this.variableRef();
                        }
                        break;
                    case 2:
                        {
                            this.state = 23;
                            this.functionRef();
                        }
                        break;
                }
                this._ctx.stop = this._input.LT(-1);
                this.state = 34;
                this._errHandler.sync(this);
                _alt = this._interp.adaptivePredict(this._input, 3, this._ctx);
                while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
                    if (_alt === 1) {
                        if (this._parseListeners != null) {
                            this.triggerExitRuleEvent();
                        }
                        _prevctx = localctx;
                        {
                            this.state = 32;
                            this._errHandler.sync(this);
                            switch (this._interp.adaptivePredict(this._input, 2, this._ctx)) {
                                case 1:
                                    {
                                        localctx = new SimpleExpressionContext(this, _parentctx, _parentState);
                                        this.pushNewRecursionContext(localctx, _startState, ExprParser.RULE_simpleExpression);
                                        this.state = 26;
                                        if (!(this.precpred(this._ctx, 4))) {
                                            throw this.createFailedPredicateException("this.precpred(this._ctx, 4)");
                                        }
                                        this.state = 27;
                                        _la = this._input.LA(1);
                                        if (!(_la === 3 || _la === 4)) {
                                            this._errHandler.recoverInline(this);
                                        }
                                        else {
                                            this._errHandler.reportMatch(this);
                                            this.consume();
                                        }
                                        this.state = 28;
                                        this.simpleExpression(5);
                                    }
                                    break;
                                case 2:
                                    {
                                        localctx = new SimpleExpressionContext(this, _parentctx, _parentState);
                                        this.pushNewRecursionContext(localctx, _startState, ExprParser.RULE_simpleExpression);
                                        this.state = 29;
                                        if (!(this.precpred(this._ctx, 3))) {
                                            throw this.createFailedPredicateException("this.precpred(this._ctx, 3)");
                                        }
                                        this.state = 30;
                                        _la = this._input.LA(1);
                                        if (!(_la === 5 || _la === 6)) {
                                            this._errHandler.recoverInline(this);
                                        }
                                        else {
                                            this._errHandler.reportMatch(this);
                                            this.consume();
                                        }
                                        this.state = 31;
                                        this.simpleExpression(4);
                                    }
                                    break;
                            }
                        }
                    }
                    this.state = 36;
                    this._errHandler.sync(this);
                    _alt = this._interp.adaptivePredict(this._input, 3, this._ctx);
                }
            }
        }
        catch (re) {
            if (re instanceof RecognitionException) {
                localctx.exception = re;
                this._errHandler.reportError(this, re);
                this._errHandler.recover(this, re);
            }
            else {
                throw re;
            }
        }
        finally {
            this.unrollRecursionContexts(_parentctx);
        }
        return localctx;
    }
    // @RuleVersion(0)
    variableRef() {
        let localctx = new VariableRefContext(this, this._ctx, this.state);
        this.enterRule(localctx, 6, ExprParser.RULE_variableRef);
        try {
            this.enterOuterAlt(localctx, 1);
            {
                this.state = 37;
                this.identifier();
            }
        }
        catch (re) {
            if (re instanceof RecognitionException) {
                localctx.exception = re;
                this._errHandler.reportError(this, re);
                this._errHandler.recover(this, re);
            }
            else {
                throw re;
            }
        }
        finally {
            this.exitRule();
        }
        return localctx;
    }
    // @RuleVersion(0)
    functionRef() {
        let localctx = new FunctionRefContext(this, this._ctx, this.state);
        this.enterRule(localctx, 8, ExprParser.RULE_functionRef);
        try {
            this.enterOuterAlt(localctx, 1);
            {
                this.state = 39;
                this.identifier();
                this.state = 40;
                this.match(ExprParser.OPEN_PAR);
                this.state = 41;
                this.match(ExprParser.CLOSE_PAR);
            }
        }
        catch (re) {
            if (re instanceof RecognitionException) {
                localctx.exception = re;
                this._errHandler.reportError(this, re);
                this._errHandler.recover(this, re);
            }
            else {
                throw re;
            }
        }
        finally {
            this.exitRule();
        }
        return localctx;
    }
    // @RuleVersion(0)
    identifier() {
        let localctx = new IdentifierContext(this, this._ctx, this.state);
        this.enterRule(localctx, 10, ExprParser.RULE_identifier);
        try {
            this.enterOuterAlt(localctx, 1);
            {
                this.state = 43;
                this.match(ExprParser.ID);
            }
        }
        catch (re) {
            if (re instanceof RecognitionException) {
                localctx.exception = re;
                this._errHandler.reportError(this, re);
                this._errHandler.recover(this, re);
            }
            else {
                throw re;
            }
        }
        finally {
            this.exitRule();
        }
        return localctx;
    }
    sempred(localctx, ruleIndex, predIndex) {
        switch (ruleIndex) {
            case 2:
                return this.simpleExpression_sempred(localctx, predIndex);
        }
        return true;
    }
    simpleExpression_sempred(localctx, predIndex) {
        switch (predIndex) {
            case 0:
                return this.precpred(this._ctx, 4);
            case 1:
                return this.precpred(this._ctx, 3);
        }
        return true;
    }
    static { this._serializedATN = [4, 1, 11, 46, 2, 0, 7, 0, 2,
        1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 1, 0, 1, 0, 3, 0, 15, 8, 0, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 2, 1, 2, 1, 2, 3, 2, 25, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 33, 8, 2, 10, 2, 12,
        2, 36, 9, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 0, 1, 4, 6, 0, 2, 4, 6, 8, 10, 0, 3, 1,
        0, 1, 2, 1, 0, 3, 4, 1, 0, 5, 6, 43, 0, 14, 1, 0, 0, 0, 2, 16, 1, 0, 0, 0, 4, 24, 1, 0, 0, 0, 6, 37, 1,
        0, 0, 0, 8, 39, 1, 0, 0, 0, 10, 43, 1, 0, 0, 0, 12, 15, 3, 2, 1, 0, 13, 15, 3, 4, 2, 0, 14, 12, 1, 0,
        0, 0, 14, 13, 1, 0, 0, 0, 15, 1, 1, 0, 0, 0, 16, 17, 7, 0, 0, 0, 17, 18, 5, 10, 0, 0, 18, 19, 5, 7, 0,
        0, 19, 20, 3, 4, 2, 0, 20, 3, 1, 0, 0, 0, 21, 22, 6, 2, -1, 0, 22, 25, 3, 6, 3, 0, 23, 25, 3, 8, 4, 0,
        24, 21, 1, 0, 0, 0, 24, 23, 1, 0, 0, 0, 25, 34, 1, 0, 0, 0, 26, 27, 10, 4, 0, 0, 27, 28, 7, 1, 0, 0,
        28, 33, 3, 4, 2, 5, 29, 30, 10, 3, 0, 0, 30, 31, 7, 2, 0, 0, 31, 33, 3, 4, 2, 4, 32, 26, 1, 0, 0, 0,
        32, 29, 1, 0, 0, 0, 33, 36, 1, 0, 0, 0, 34, 32, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 5, 1, 0, 0, 0, 36,
        34, 1, 0, 0, 0, 37, 38, 3, 10, 5, 0, 38, 7, 1, 0, 0, 0, 39, 40, 3, 10, 5, 0, 40, 41, 5, 8, 0, 0, 41,
        42, 5, 9, 0, 0, 42, 9, 1, 0, 0, 0, 43, 44, 5, 10, 0, 0, 44, 11, 1, 0, 0, 0, 4, 14, 24, 32, 34]; }
    static get _ATN() {
        if (!ExprParser.__ATN) {
            ExprParser.__ATN = new ATNDeserializer().deserialize(ExprParser._serializedATN);
        }
        return ExprParser.__ATN;
    }
    static { this.DecisionsToDFA = ExprParser._ATN.decisionToState.map((ds, index) => new DFA(ds, index)); }
}
export class ExpressionContext extends ParserRuleContext {
    constructor(parser, parent, invokingState) {
        super(parent, invokingState);
        this.parser = parser;
    }
    assignment() {
        return this.getTypedRuleContext(AssignmentContext, 0);
    }
    simpleExpression() {
        return this.getTypedRuleContext(SimpleExpressionContext, 0);
    }
    get ruleIndex() {
        return ExprParser.RULE_expression;
    }
}
export class AssignmentContext extends ParserRuleContext {
    constructor(parser, parent, invokingState) {
        super(parent, invokingState);
        this.parser = parser;
    }
    ID() {
        return this.getToken(ExprParser.ID, 0);
    }
    EQUAL() {
        return this.getToken(ExprParser.EQUAL, 0);
    }
    simpleExpression() {
        return this.getTypedRuleContext(SimpleExpressionContext, 0);
    }
    VAR() {
        return this.getToken(ExprParser.VAR, 0);
    }
    LET() {
        return this.getToken(ExprParser.LET, 0);
    }
    get ruleIndex() {
        return ExprParser.RULE_assignment;
    }
}
export class SimpleExpressionContext extends ParserRuleContext {
    constructor(parser, parent, invokingState) {
        super(parent, invokingState);
        this.parser = parser;
    }
    variableRef() {
        return this.getTypedRuleContext(VariableRefContext, 0);
    }
    functionRef() {
        return this.getTypedRuleContext(FunctionRefContext, 0);
    }
    simpleExpression_list() {
        return this.getTypedRuleContexts(SimpleExpressionContext);
    }
    simpleExpression(i) {
        return this.getTypedRuleContext(SimpleExpressionContext, i);
    }
    PLUS() {
        return this.getToken(ExprParser.PLUS, 0);
    }
    MINUS() {
        return this.getToken(ExprParser.MINUS, 0);
    }
    MULTIPLY() {
        return this.getToken(ExprParser.MULTIPLY, 0);
    }
    DIVIDE() {
        return this.getToken(ExprParser.DIVIDE, 0);
    }
    get ruleIndex() {
        return ExprParser.RULE_simpleExpression;
    }
}
export class VariableRefContext extends ParserRuleContext {
    constructor(parser, parent, invokingState) {
        super(parent, invokingState);
        this.parser = parser;
    }
    identifier() {
        return this.getTypedRuleContext(IdentifierContext, 0);
    }
    get ruleIndex() {
        return ExprParser.RULE_variableRef;
    }
}
export class FunctionRefContext extends ParserRuleContext {
    constructor(parser, parent, invokingState) {
        super(parent, invokingState);
        this.parser = parser;
    }
    identifier() {
        return this.getTypedRuleContext(IdentifierContext, 0);
    }
    OPEN_PAR() {
        return this.getToken(ExprParser.OPEN_PAR, 0);
    }
    CLOSE_PAR() {
        return this.getToken(ExprParser.CLOSE_PAR, 0);
    }
    get ruleIndex() {
        return ExprParser.RULE_functionRef;
    }
}
export class IdentifierContext extends ParserRuleContext {
    constructor(parser, parent, invokingState) {
        super(parent, invokingState);
        this.parser = parser;
    }
    ID() {
        return this.getToken(ExprParser.ID, 0);
    }
    get ruleIndex() {
        return ExprParser.RULE_identifier;
    }
}
//# sourceMappingURL=ExprParser.js.map