# Generated from Expr.g4 by ANTLR 4.13.2
# encoding: utf-8
import sys
from io import StringIO

from antlr4 import *

if sys.version_info[1] > 5:
    from typing import TextIO
else:
    from typing.io import TextIO


def serializedATN():
    return [
        4,
        1,
        18,
        140,
        2,
        0,
        7,
        0,
        2,
        1,
        7,
        1,
        2,
        2,
        7,
        2,
        2,
        3,
        7,
        3,
        2,
        4,
        7,
        4,
        2,
        5,
        7,
        5,
        2,
        6,
        7,
        6,
        1,
        0,
        1,
        0,
        1,
        0,
        1,
        0,
        1,
        1,
        1,
        1,
        1,
        1,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        3,
        2,
        79,
        8,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        1,
        2,
        5,
        2,
        90,
        8,
        2,
        10,
        2,
        12,
        2,
        93,
        9,
        2,
        1,
        3,
        1,
        3,
        3,
        3,
        97,
        8,
        3,
        1,
        4,
        1,
        4,
        3,
        4,
        101,
        8,
        4,
        1,
        5,
        1,
        5,
        1,
        5,
        1,
        5,
        1,
        5,
        1,
        5,
        1,
        5,
        1,
        5,
        3,
        5,
        111,
        8,
        5,
        1,
        5,
        1,
        5,
        1,
        5,
        1,
        5,
        1,
        5,
        1,
        5,
        5,
        5,
        119,
        8,
        5,
        10,
        5,
        12,
        5,
        122,
        9,
        5,
        1,
        6,
        1,
        6,
        1,
        6,
        1,
        6,
        1,
        6,
        1,
        6,
        3,
        6,
        130,
        8,
        6,
        1,
        6,
        1,
        6,
        1,
        6,
        5,
        6,
        135,
        8,
        6,
        10,
        6,
        12,
        6,
        138,
        9,
        6,
        1,
        6,
        0,
        3,
        4,
        10,
        12,
        7,
        0,
        2,
        4,
        6,
        8,
        10,
        12,
        0,
        2,
        1,
        0,
        5,
        6,
        2,
        0,
        2,
        2,
        7,
        7,
        153,
        0,
        14,
        1,
        0,
        0,
        0,
        2,
        18,
        1,
        0,
        0,
        0,
        4,
        78,
        1,
        0,
        0,
        0,
        6,
        96,
        1,
        0,
        0,
        0,
        8,
        98,
        1,
        0,
        0,
        0,
        10,
        110,
        1,
        0,
        0,
        0,
        12,
        129,
        1,
        0,
        0,
        0,
        14,
        15,
        5,
        16,
        0,
        0,
        15,
        16,
        5,
        1,
        0,
        0,
        16,
        17,
        5,
        16,
        0,
        0,
        17,
        1,
        1,
        0,
        0,
        0,
        18,
        19,
        3,
        4,
        2,
        0,
        19,
        20,
        5,
        0,
        0,
        1,
        20,
        3,
        1,
        0,
        0,
        0,
        21,
        22,
        6,
        2,
        -1,
        0,
        22,
        79,
        3,
        6,
        3,
        0,
        23,
        79,
        3,
        0,
        0,
        0,
        24,
        25,
        5,
        2,
        0,
        0,
        25,
        79,
        3,
        4,
        2,
        13,
        26,
        27,
        5,
        3,
        0,
        0,
        27,
        28,
        3,
        4,
        2,
        0,
        28,
        29,
        5,
        4,
        0,
        0,
        29,
        79,
        1,
        0,
        0,
        0,
        30,
        31,
        5,
        8,
        0,
        0,
        31,
        32,
        5,
        3,
        0,
        0,
        32,
        33,
        3,
        4,
        2,
        0,
        33,
        34,
        5,
        4,
        0,
        0,
        34,
        79,
        1,
        0,
        0,
        0,
        35,
        36,
        5,
        9,
        0,
        0,
        36,
        37,
        5,
        3,
        0,
        0,
        37,
        38,
        3,
        0,
        0,
        0,
        38,
        39,
        5,
        4,
        0,
        0,
        39,
        79,
        1,
        0,
        0,
        0,
        40,
        41,
        5,
        8,
        0,
        0,
        41,
        42,
        5,
        3,
        0,
        0,
        42,
        43,
        3,
        8,
        4,
        0,
        43,
        44,
        5,
        10,
        0,
        0,
        44,
        45,
        3,
        8,
        4,
        0,
        45,
        46,
        5,
        11,
        0,
        0,
        46,
        47,
        3,
        4,
        2,
        0,
        47,
        48,
        5,
        4,
        0,
        0,
        48,
        79,
        1,
        0,
        0,
        0,
        49,
        50,
        5,
        16,
        0,
        0,
        50,
        51,
        5,
        3,
        0,
        0,
        51,
        52,
        3,
        4,
        2,
        0,
        52,
        53,
        5,
        4,
        0,
        0,
        53,
        79,
        1,
        0,
        0,
        0,
        54,
        55,
        5,
        16,
        0,
        0,
        55,
        56,
        5,
        12,
        0,
        0,
        56,
        57,
        3,
        8,
        4,
        0,
        57,
        58,
        5,
        13,
        0,
        0,
        58,
        79,
        1,
        0,
        0,
        0,
        59,
        60,
        5,
        16,
        0,
        0,
        60,
        61,
        5,
        12,
        0,
        0,
        61,
        62,
        3,
        4,
        2,
        0,
        62,
        63,
        5,
        13,
        0,
        0,
        63,
        79,
        1,
        0,
        0,
        0,
        64,
        65,
        5,
        3,
        0,
        0,
        65,
        66,
        3,
        4,
        2,
        0,
        66,
        67,
        5,
        4,
        0,
        0,
        67,
        68,
        5,
        12,
        0,
        0,
        68,
        69,
        3,
        8,
        4,
        0,
        69,
        70,
        5,
        13,
        0,
        0,
        70,
        79,
        1,
        0,
        0,
        0,
        71,
        72,
        5,
        3,
        0,
        0,
        72,
        73,
        3,
        4,
        2,
        0,
        73,
        74,
        5,
        4,
        0,
        0,
        74,
        75,
        5,
        12,
        0,
        0,
        75,
        76,
        3,
        4,
        2,
        0,
        76,
        77,
        5,
        13,
        0,
        0,
        77,
        79,
        1,
        0,
        0,
        0,
        78,
        21,
        1,
        0,
        0,
        0,
        78,
        23,
        1,
        0,
        0,
        0,
        78,
        24,
        1,
        0,
        0,
        0,
        78,
        26,
        1,
        0,
        0,
        0,
        78,
        30,
        1,
        0,
        0,
        0,
        78,
        35,
        1,
        0,
        0,
        0,
        78,
        40,
        1,
        0,
        0,
        0,
        78,
        49,
        1,
        0,
        0,
        0,
        78,
        54,
        1,
        0,
        0,
        0,
        78,
        59,
        1,
        0,
        0,
        0,
        78,
        64,
        1,
        0,
        0,
        0,
        78,
        71,
        1,
        0,
        0,
        0,
        79,
        91,
        1,
        0,
        0,
        0,
        80,
        81,
        10,
        11,
        0,
        0,
        81,
        82,
        7,
        0,
        0,
        0,
        82,
        90,
        3,
        4,
        2,
        12,
        83,
        84,
        10,
        10,
        0,
        0,
        84,
        85,
        7,
        1,
        0,
        0,
        85,
        90,
        3,
        4,
        2,
        11,
        86,
        87,
        10,
        9,
        0,
        0,
        87,
        88,
        5,
        17,
        0,
        0,
        88,
        90,
        3,
        4,
        2,
        10,
        89,
        80,
        1,
        0,
        0,
        0,
        89,
        83,
        1,
        0,
        0,
        0,
        89,
        86,
        1,
        0,
        0,
        0,
        90,
        93,
        1,
        0,
        0,
        0,
        91,
        89,
        1,
        0,
        0,
        0,
        91,
        92,
        1,
        0,
        0,
        0,
        92,
        5,
        1,
        0,
        0,
        0,
        93,
        91,
        1,
        0,
        0,
        0,
        94,
        97,
        5,
        14,
        0,
        0,
        95,
        97,
        5,
        16,
        0,
        0,
        96,
        94,
        1,
        0,
        0,
        0,
        96,
        95,
        1,
        0,
        0,
        0,
        97,
        7,
        1,
        0,
        0,
        0,
        98,
        100,
        5,
        15,
        0,
        0,
        99,
        101,
        3,
        10,
        5,
        0,
        100,
        99,
        1,
        0,
        0,
        0,
        100,
        101,
        1,
        0,
        0,
        0,
        101,
        9,
        1,
        0,
        0,
        0,
        102,
        103,
        6,
        5,
        -1,
        0,
        103,
        104,
        7,
        1,
        0,
        0,
        104,
        111,
        3,
        6,
        3,
        0,
        105,
        106,
        7,
        1,
        0,
        0,
        106,
        107,
        5,
        3,
        0,
        0,
        107,
        108,
        3,
        4,
        2,
        0,
        108,
        109,
        5,
        4,
        0,
        0,
        109,
        111,
        1,
        0,
        0,
        0,
        110,
        102,
        1,
        0,
        0,
        0,
        110,
        105,
        1,
        0,
        0,
        0,
        111,
        120,
        1,
        0,
        0,
        0,
        112,
        113,
        10,
        4,
        0,
        0,
        113,
        114,
        7,
        0,
        0,
        0,
        114,
        119,
        3,
        12,
        6,
        0,
        115,
        116,
        10,
        3,
        0,
        0,
        116,
        117,
        7,
        1,
        0,
        0,
        117,
        119,
        3,
        12,
        6,
        0,
        118,
        112,
        1,
        0,
        0,
        0,
        118,
        115,
        1,
        0,
        0,
        0,
        119,
        122,
        1,
        0,
        0,
        0,
        120,
        118,
        1,
        0,
        0,
        0,
        120,
        121,
        1,
        0,
        0,
        0,
        121,
        11,
        1,
        0,
        0,
        0,
        122,
        120,
        1,
        0,
        0,
        0,
        123,
        124,
        6,
        6,
        -1,
        0,
        124,
        125,
        5,
        3,
        0,
        0,
        125,
        126,
        3,
        4,
        2,
        0,
        126,
        127,
        5,
        4,
        0,
        0,
        127,
        130,
        1,
        0,
        0,
        0,
        128,
        130,
        3,
        6,
        3,
        0,
        129,
        123,
        1,
        0,
        0,
        0,
        129,
        128,
        1,
        0,
        0,
        0,
        130,
        136,
        1,
        0,
        0,
        0,
        131,
        132,
        10,
        3,
        0,
        0,
        132,
        133,
        7,
        0,
        0,
        0,
        133,
        135,
        3,
        12,
        6,
        4,
        134,
        131,
        1,
        0,
        0,
        0,
        135,
        138,
        1,
        0,
        0,
        0,
        136,
        134,
        1,
        0,
        0,
        0,
        136,
        137,
        1,
        0,
        0,
        0,
        137,
        13,
        1,
        0,
        0,
        0,
        138,
        136,
        1,
        0,
        0,
        0,
        10,
        78,
        89,
        91,
        96,
        100,
        110,
        118,
        120,
        129,
        136,
    ]


class ExprParser(Parser):
    grammarFileName = "Expr.g4"

    atn = ATNDeserializer().deserialize(serializedATN())

    decisionsToDFA = [DFA(ds, i) for i, ds in enumerate(atn.decisionToState)]

    sharedContextCache = PredictionContextCache()

    literalNames = [
        "<INVALID>",
        "'.'",
        "'-'",
        "'('",
        "')'",
        "'/'",
        "'*'",
        "'+'",
        "'sum'",
        "'sum_connections'",
        "'..'",
        "','",
        "'['",
        "']'",
        "<INVALID>",
        "'t'",
    ]

    symbolicNames = [
        "<INVALID>",
        "<INVALID>",
        "<INVALID>",
        "<INVALID>",
        "<INVALID>",
        "<INVALID>",
        "<INVALID>",
        "<INVALID>",
        "<INVALID>",
        "<INVALID>",
        "<INVALID>",
        "<INVALID>",
        "<INVALID>",
        "<INVALID>",
        "NUMBER",
        "TIME",
        "IDENTIFIER",
        "COMPARISON",
        "WS",
    ]

    RULE_portFieldExpr = 0
    RULE_fullexpr = 1
    RULE_expr = 2
    RULE_atom = 3
    RULE_shift = 4
    RULE_shift_expr = 5
    RULE_right_expr = 6

    ruleNames = [
        "portFieldExpr",
        "fullexpr",
        "expr",
        "atom",
        "shift",
        "shift_expr",
        "right_expr",
    ]

    EOF = Token.EOF
    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
    NUMBER = 14
    TIME = 15
    IDENTIFIER = 16
    COMPARISON = 17
    WS = 18

    def __init__(self, input: TokenStream, output: TextIO = sys.stdout):
        super().__init__(input, output)
        self.checkVersion("4.13.2")
        self._interp = ParserATNSimulator(
            self, self.atn, self.decisionsToDFA, self.sharedContextCache
        )
        self._predicates = None

    class PortFieldExprContext(ParserRuleContext):
        __slots__ = "parser"

        def __init__(
            self, parser, parent: ParserRuleContext = None, invokingState: int = -1
        ):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENTIFIER(self, i: int = None):
            if i is None:
                return self.getTokens(ExprParser.IDENTIFIER)
            else:
                return self.getToken(ExprParser.IDENTIFIER, i)

        def getRuleIndex(self):
            return ExprParser.RULE_portFieldExpr

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitPortFieldExpr"):
                return visitor.visitPortFieldExpr(self)
            else:
                return visitor.visitChildren(self)

    def portFieldExpr(self):
        localctx = ExprParser.PortFieldExprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_portFieldExpr)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 14
            self.match(ExprParser.IDENTIFIER)
            self.state = 15
            self.match(ExprParser.T__0)
            self.state = 16
            self.match(ExprParser.IDENTIFIER)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class FullexprContext(ParserRuleContext):
        __slots__ = "parser"

        def __init__(
            self, parser, parent: ParserRuleContext = None, invokingState: int = -1
        ):
            super().__init__(parent, invokingState)
            self.parser = parser

        def expr(self):
            return self.getTypedRuleContext(ExprParser.ExprContext, 0)

        def EOF(self):
            return self.getToken(ExprParser.EOF, 0)

        def getRuleIndex(self):
            return ExprParser.RULE_fullexpr

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitFullexpr"):
                return visitor.visitFullexpr(self)
            else:
                return visitor.visitChildren(self)

    def fullexpr(self):
        localctx = ExprParser.FullexprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_fullexpr)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 18
            self.expr(0)
            self.state = 19
            self.match(ExprParser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class ExprContext(ParserRuleContext):
        __slots__ = "parser"

        def __init__(
            self, parser, parent: ParserRuleContext = None, invokingState: int = -1
        ):
            super().__init__(parent, invokingState)
            self.parser = parser

        def getRuleIndex(self):
            return ExprParser.RULE_expr

        def copyFrom(self, ctx: ParserRuleContext):
            super().copyFrom(ctx)

    class PortFieldSumContext(ExprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.ExprContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def portFieldExpr(self):
            return self.getTypedRuleContext(ExprParser.PortFieldExprContext, 0)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitPortFieldSum"):
                return visitor.visitPortFieldSum(self)
            else:
                return visitor.visitChildren(self)

    class NegationContext(ExprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.ExprContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expr(self):
            return self.getTypedRuleContext(ExprParser.ExprContext, 0)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitNegation"):
                return visitor.visitNegation(self)
            else:
                return visitor.visitChildren(self)

    class UnsignedAtomContext(ExprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.ExprContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def atom(self):
            return self.getTypedRuleContext(ExprParser.AtomContext, 0)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitUnsignedAtom"):
                return visitor.visitUnsignedAtom(self)
            else:
                return visitor.visitChildren(self)

    class ExpressionContext(ExprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.ExprContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expr(self):
            return self.getTypedRuleContext(ExprParser.ExprContext, 0)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitExpression"):
                return visitor.visitExpression(self)
            else:
                return visitor.visitChildren(self)

    class ComparisonContext(ExprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.ExprContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expr(self, i: int = None):
            if i is None:
                return self.getTypedRuleContexts(ExprParser.ExprContext)
            else:
                return self.getTypedRuleContext(ExprParser.ExprContext, i)

        def COMPARISON(self):
            return self.getToken(ExprParser.COMPARISON, 0)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitComparison"):
                return visitor.visitComparison(self)
            else:
                return visitor.visitChildren(self)

    class AllTimeSumContext(ExprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.ExprContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expr(self):
            return self.getTypedRuleContext(ExprParser.ExprContext, 0)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitAllTimeSum"):
                return visitor.visitAllTimeSum(self)
            else:
                return visitor.visitChildren(self)

    class TimeIndexExprContext(ExprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.ExprContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expr(self, i: int = None):
            if i is None:
                return self.getTypedRuleContexts(ExprParser.ExprContext)
            else:
                return self.getTypedRuleContext(ExprParser.ExprContext, i)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitTimeIndexExpr"):
                return visitor.visitTimeIndexExpr(self)
            else:
                return visitor.visitChildren(self)

    class AddsubContext(ExprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.ExprContext
            super().__init__(parser)
            self.op = None  # Token
            self.copyFrom(ctx)

        def expr(self, i: int = None):
            if i is None:
                return self.getTypedRuleContexts(ExprParser.ExprContext)
            else:
                return self.getTypedRuleContext(ExprParser.ExprContext, i)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitAddsub"):
                return visitor.visitAddsub(self)
            else:
                return visitor.visitChildren(self)

    class TimeShiftExprContext(ExprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.ExprContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expr(self):
            return self.getTypedRuleContext(ExprParser.ExprContext, 0)

        def shift(self):
            return self.getTypedRuleContext(ExprParser.ShiftContext, 0)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitTimeShiftExpr"):
                return visitor.visitTimeShiftExpr(self)
            else:
                return visitor.visitChildren(self)

    class PortFieldContext(ExprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.ExprContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def portFieldExpr(self):
            return self.getTypedRuleContext(ExprParser.PortFieldExprContext, 0)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitPortField"):
                return visitor.visitPortField(self)
            else:
                return visitor.visitChildren(self)

    class MuldivContext(ExprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.ExprContext
            super().__init__(parser)
            self.op = None  # Token
            self.copyFrom(ctx)

        def expr(self, i: int = None):
            if i is None:
                return self.getTypedRuleContexts(ExprParser.ExprContext)
            else:
                return self.getTypedRuleContext(ExprParser.ExprContext, i)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitMuldiv"):
                return visitor.visitMuldiv(self)
            else:
                return visitor.visitChildren(self)

    class TimeSumContext(ExprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.ExprContext
            super().__init__(parser)
            self.from_ = None  # ShiftContext
            self.to = None  # ShiftContext
            self.copyFrom(ctx)

        def expr(self):
            return self.getTypedRuleContext(ExprParser.ExprContext, 0)

        def shift(self, i: int = None):
            if i is None:
                return self.getTypedRuleContexts(ExprParser.ShiftContext)
            else:
                return self.getTypedRuleContext(ExprParser.ShiftContext, i)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitTimeSum"):
                return visitor.visitTimeSum(self)
            else:
                return visitor.visitChildren(self)

    class TimeIndexContext(ExprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.ExprContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def IDENTIFIER(self):
            return self.getToken(ExprParser.IDENTIFIER, 0)

        def expr(self):
            return self.getTypedRuleContext(ExprParser.ExprContext, 0)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitTimeIndex"):
                return visitor.visitTimeIndex(self)
            else:
                return visitor.visitChildren(self)

    class TimeShiftContext(ExprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.ExprContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def IDENTIFIER(self):
            return self.getToken(ExprParser.IDENTIFIER, 0)

        def shift(self):
            return self.getTypedRuleContext(ExprParser.ShiftContext, 0)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitTimeShift"):
                return visitor.visitTimeShift(self)
            else:
                return visitor.visitChildren(self)

    class FunctionContext(ExprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.ExprContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def IDENTIFIER(self):
            return self.getToken(ExprParser.IDENTIFIER, 0)

        def expr(self):
            return self.getTypedRuleContext(ExprParser.ExprContext, 0)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitFunction"):
                return visitor.visitFunction(self)
            else:
                return visitor.visitChildren(self)

    def expr(self, _p: int = 0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = ExprParser.ExprContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 4
        self.enterRecursionRule(localctx, 4, self.RULE_expr, _p)
        self._la = 0  # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 78
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input, 0, self._ctx)
            if la_ == 1:
                localctx = ExprParser.UnsignedAtomContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx

                self.state = 22
                self.atom()
                pass

            elif la_ == 2:
                localctx = ExprParser.PortFieldContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 23
                self.portFieldExpr()
                pass

            elif la_ == 3:
                localctx = ExprParser.NegationContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 24
                self.match(ExprParser.T__1)
                self.state = 25
                self.expr(13)
                pass

            elif la_ == 4:
                localctx = ExprParser.ExpressionContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 26
                self.match(ExprParser.T__2)
                self.state = 27
                self.expr(0)
                self.state = 28
                self.match(ExprParser.T__3)
                pass

            elif la_ == 5:
                localctx = ExprParser.AllTimeSumContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 30
                self.match(ExprParser.T__7)
                self.state = 31
                self.match(ExprParser.T__2)
                self.state = 32
                self.expr(0)
                self.state = 33
                self.match(ExprParser.T__3)
                pass

            elif la_ == 6:
                localctx = ExprParser.PortFieldSumContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 35
                self.match(ExprParser.T__8)
                self.state = 36
                self.match(ExprParser.T__2)
                self.state = 37
                self.portFieldExpr()
                self.state = 38
                self.match(ExprParser.T__3)
                pass

            elif la_ == 7:
                localctx = ExprParser.TimeSumContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 40
                self.match(ExprParser.T__7)
                self.state = 41
                self.match(ExprParser.T__2)
                self.state = 42
                localctx.from_ = self.shift()
                self.state = 43
                self.match(ExprParser.T__9)
                self.state = 44
                localctx.to = self.shift()
                self.state = 45
                self.match(ExprParser.T__10)
                self.state = 46
                self.expr(0)
                self.state = 47
                self.match(ExprParser.T__3)
                pass

            elif la_ == 8:
                localctx = ExprParser.FunctionContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 49
                self.match(ExprParser.IDENTIFIER)
                self.state = 50
                self.match(ExprParser.T__2)
                self.state = 51
                self.expr(0)
                self.state = 52
                self.match(ExprParser.T__3)
                pass

            elif la_ == 9:
                localctx = ExprParser.TimeShiftContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 54
                self.match(ExprParser.IDENTIFIER)
                self.state = 55
                self.match(ExprParser.T__11)
                self.state = 56
                self.shift()
                self.state = 57
                self.match(ExprParser.T__12)
                pass

            elif la_ == 10:
                localctx = ExprParser.TimeIndexContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 59
                self.match(ExprParser.IDENTIFIER)
                self.state = 60
                self.match(ExprParser.T__11)
                self.state = 61
                self.expr(0)
                self.state = 62
                self.match(ExprParser.T__12)
                pass

            elif la_ == 11:
                localctx = ExprParser.TimeShiftExprContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 64
                self.match(ExprParser.T__2)
                self.state = 65
                self.expr(0)
                self.state = 66
                self.match(ExprParser.T__3)
                self.state = 67
                self.match(ExprParser.T__11)
                self.state = 68
                self.shift()
                self.state = 69
                self.match(ExprParser.T__12)
                pass

            elif la_ == 12:
                localctx = ExprParser.TimeIndexExprContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 71
                self.match(ExprParser.T__2)
                self.state = 72
                self.expr(0)
                self.state = 73
                self.match(ExprParser.T__3)
                self.state = 74
                self.match(ExprParser.T__11)
                self.state = 75
                self.expr(0)
                self.state = 76
                self.match(ExprParser.T__12)
                pass

            self._ctx.stop = self._input.LT(-1)
            self.state = 91
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input, 2, self._ctx)
            while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER:
                if _alt == 1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    self.state = 89
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input, 1, self._ctx)
                    if la_ == 1:
                        localctx = ExprParser.MuldivContext(
                            self, ExprParser.ExprContext(self, _parentctx, _parentState)
                        )
                        self.pushNewRecursionContext(
                            localctx, _startState, self.RULE_expr
                        )
                        self.state = 80
                        if not self.precpred(self._ctx, 11):
                            from antlr4.error.Errors import FailedPredicateException

                            raise FailedPredicateException(
                                self, "self.precpred(self._ctx, 11)"
                            )
                        self.state = 81
                        localctx.op = self._input.LT(1)
                        _la = self._input.LA(1)
                        if not (_la == 5 or _la == 6):
                            localctx.op = self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 82
                        self.expr(12)
                        pass

                    elif la_ == 2:
                        localctx = ExprParser.AddsubContext(
                            self, ExprParser.ExprContext(self, _parentctx, _parentState)
                        )
                        self.pushNewRecursionContext(
                            localctx, _startState, self.RULE_expr
                        )
                        self.state = 83
                        if not self.precpred(self._ctx, 10):
                            from antlr4.error.Errors import FailedPredicateException

                            raise FailedPredicateException(
                                self, "self.precpred(self._ctx, 10)"
                            )
                        self.state = 84
                        localctx.op = self._input.LT(1)
                        _la = self._input.LA(1)
                        if not (_la == 2 or _la == 7):
                            localctx.op = self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 85
                        self.expr(11)
                        pass

                    elif la_ == 3:
                        localctx = ExprParser.ComparisonContext(
                            self, ExprParser.ExprContext(self, _parentctx, _parentState)
                        )
                        self.pushNewRecursionContext(
                            localctx, _startState, self.RULE_expr
                        )
                        self.state = 86
                        if not self.precpred(self._ctx, 9):
                            from antlr4.error.Errors import FailedPredicateException

                            raise FailedPredicateException(
                                self, "self.precpred(self._ctx, 9)"
                            )
                        self.state = 87
                        self.match(ExprParser.COMPARISON)
                        self.state = 88
                        self.expr(10)
                        pass

                self.state = 93
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input, 2, self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.unrollRecursionContexts(_parentctx)
        return localctx

    class AtomContext(ParserRuleContext):
        __slots__ = "parser"

        def __init__(
            self, parser, parent: ParserRuleContext = None, invokingState: int = -1
        ):
            super().__init__(parent, invokingState)
            self.parser = parser

        def getRuleIndex(self):
            return ExprParser.RULE_atom

        def copyFrom(self, ctx: ParserRuleContext):
            super().copyFrom(ctx)

    class NumberContext(AtomContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.AtomContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def NUMBER(self):
            return self.getToken(ExprParser.NUMBER, 0)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitNumber"):
                return visitor.visitNumber(self)
            else:
                return visitor.visitChildren(self)

    class IdentifierContext(AtomContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.AtomContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def IDENTIFIER(self):
            return self.getToken(ExprParser.IDENTIFIER, 0)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitIdentifier"):
                return visitor.visitIdentifier(self)
            else:
                return visitor.visitChildren(self)

    def atom(self):
        localctx = ExprParser.AtomContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_atom)
        try:
            self.state = 96
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [14]:
                localctx = ExprParser.NumberContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 94
                self.match(ExprParser.NUMBER)
                pass
            elif token in [16]:
                localctx = ExprParser.IdentifierContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 95
                self.match(ExprParser.IDENTIFIER)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class ShiftContext(ParserRuleContext):
        __slots__ = "parser"

        def __init__(
            self, parser, parent: ParserRuleContext = None, invokingState: int = -1
        ):
            super().__init__(parent, invokingState)
            self.parser = parser

        def TIME(self):
            return self.getToken(ExprParser.TIME, 0)

        def shift_expr(self):
            return self.getTypedRuleContext(ExprParser.Shift_exprContext, 0)

        def getRuleIndex(self):
            return ExprParser.RULE_shift

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitShift"):
                return visitor.visitShift(self)
            else:
                return visitor.visitChildren(self)

    def shift(self):
        localctx = ExprParser.ShiftContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_shift)
        self._la = 0  # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 98
            self.match(ExprParser.TIME)
            self.state = 100
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la == 2 or _la == 7:
                self.state = 99
                self.shift_expr(0)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class Shift_exprContext(ParserRuleContext):
        __slots__ = "parser"

        def __init__(
            self, parser, parent: ParserRuleContext = None, invokingState: int = -1
        ):
            super().__init__(parent, invokingState)
            self.parser = parser

        def getRuleIndex(self):
            return ExprParser.RULE_shift_expr

        def copyFrom(self, ctx: ParserRuleContext):
            super().copyFrom(ctx)

    class SignedAtomContext(Shift_exprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.Shift_exprContext
            super().__init__(parser)
            self.op = None  # Token
            self.copyFrom(ctx)

        def atom(self):
            return self.getTypedRuleContext(ExprParser.AtomContext, 0)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitSignedAtom"):
                return visitor.visitSignedAtom(self)
            else:
                return visitor.visitChildren(self)

    class SignedExpressionContext(Shift_exprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.Shift_exprContext
            super().__init__(parser)
            self.op = None  # Token
            self.copyFrom(ctx)

        def expr(self):
            return self.getTypedRuleContext(ExprParser.ExprContext, 0)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitSignedExpression"):
                return visitor.visitSignedExpression(self)
            else:
                return visitor.visitChildren(self)

    class ShiftMuldivContext(Shift_exprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.Shift_exprContext
            super().__init__(parser)
            self.op = None  # Token
            self.copyFrom(ctx)

        def shift_expr(self):
            return self.getTypedRuleContext(ExprParser.Shift_exprContext, 0)

        def right_expr(self):
            return self.getTypedRuleContext(ExprParser.Right_exprContext, 0)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitShiftMuldiv"):
                return visitor.visitShiftMuldiv(self)
            else:
                return visitor.visitChildren(self)

    class ShiftAddsubContext(Shift_exprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.Shift_exprContext
            super().__init__(parser)
            self.op = None  # Token
            self.copyFrom(ctx)

        def shift_expr(self):
            return self.getTypedRuleContext(ExprParser.Shift_exprContext, 0)

        def right_expr(self):
            return self.getTypedRuleContext(ExprParser.Right_exprContext, 0)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitShiftAddsub"):
                return visitor.visitShiftAddsub(self)
            else:
                return visitor.visitChildren(self)

    def shift_expr(self, _p: int = 0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = ExprParser.Shift_exprContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 10
        self.enterRecursionRule(localctx, 10, self.RULE_shift_expr, _p)
        self._la = 0  # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 110
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input, 5, self._ctx)
            if la_ == 1:
                localctx = ExprParser.SignedAtomContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx

                self.state = 103
                localctx.op = self._input.LT(1)
                _la = self._input.LA(1)
                if not (_la == 2 or _la == 7):
                    localctx.op = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 104
                self.atom()
                pass

            elif la_ == 2:
                localctx = ExprParser.SignedExpressionContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 105
                localctx.op = self._input.LT(1)
                _la = self._input.LA(1)
                if not (_la == 2 or _la == 7):
                    localctx.op = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 106
                self.match(ExprParser.T__2)
                self.state = 107
                self.expr(0)
                self.state = 108
                self.match(ExprParser.T__3)
                pass

            self._ctx.stop = self._input.LT(-1)
            self.state = 120
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input, 7, self._ctx)
            while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER:
                if _alt == 1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    self.state = 118
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input, 6, self._ctx)
                    if la_ == 1:
                        localctx = ExprParser.ShiftMuldivContext(
                            self,
                            ExprParser.Shift_exprContext(
                                self, _parentctx, _parentState
                            ),
                        )
                        self.pushNewRecursionContext(
                            localctx, _startState, self.RULE_shift_expr
                        )
                        self.state = 112
                        if not self.precpred(self._ctx, 4):
                            from antlr4.error.Errors import FailedPredicateException

                            raise FailedPredicateException(
                                self, "self.precpred(self._ctx, 4)"
                            )
                        self.state = 113
                        localctx.op = self._input.LT(1)
                        _la = self._input.LA(1)
                        if not (_la == 5 or _la == 6):
                            localctx.op = self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 114
                        self.right_expr(0)
                        pass

                    elif la_ == 2:
                        localctx = ExprParser.ShiftAddsubContext(
                            self,
                            ExprParser.Shift_exprContext(
                                self, _parentctx, _parentState
                            ),
                        )
                        self.pushNewRecursionContext(
                            localctx, _startState, self.RULE_shift_expr
                        )
                        self.state = 115
                        if not self.precpred(self._ctx, 3):
                            from antlr4.error.Errors import FailedPredicateException

                            raise FailedPredicateException(
                                self, "self.precpred(self._ctx, 3)"
                            )
                        self.state = 116
                        localctx.op = self._input.LT(1)
                        _la = self._input.LA(1)
                        if not (_la == 2 or _la == 7):
                            localctx.op = self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 117
                        self.right_expr(0)
                        pass

                self.state = 122
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input, 7, self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.unrollRecursionContexts(_parentctx)
        return localctx

    class Right_exprContext(ParserRuleContext):
        __slots__ = "parser"

        def __init__(
            self, parser, parent: ParserRuleContext = None, invokingState: int = -1
        ):
            super().__init__(parent, invokingState)
            self.parser = parser

        def getRuleIndex(self):
            return ExprParser.RULE_right_expr

        def copyFrom(self, ctx: ParserRuleContext):
            super().copyFrom(ctx)

    class RightExpressionContext(Right_exprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.Right_exprContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def expr(self):
            return self.getTypedRuleContext(ExprParser.ExprContext, 0)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitRightExpression"):
                return visitor.visitRightExpression(self)
            else:
                return visitor.visitChildren(self)

    class RightMuldivContext(Right_exprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.Right_exprContext
            super().__init__(parser)
            self.op = None  # Token
            self.copyFrom(ctx)

        def right_expr(self, i: int = None):
            if i is None:
                return self.getTypedRuleContexts(ExprParser.Right_exprContext)
            else:
                return self.getTypedRuleContext(ExprParser.Right_exprContext, i)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitRightMuldiv"):
                return visitor.visitRightMuldiv(self)
            else:
                return visitor.visitChildren(self)

    class RightAtomContext(Right_exprContext):
        def __init__(
            self, parser, ctx: ParserRuleContext
        ):  # actually a ExprParser.Right_exprContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def atom(self):
            return self.getTypedRuleContext(ExprParser.AtomContext, 0)

        def accept(self, visitor: ParseTreeVisitor):
            if hasattr(visitor, "visitRightAtom"):
                return visitor.visitRightAtom(self)
            else:
                return visitor.visitChildren(self)

    def right_expr(self, _p: int = 0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = ExprParser.Right_exprContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 12
        self.enterRecursionRule(localctx, 12, self.RULE_right_expr, _p)
        self._la = 0  # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 129
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [3]:
                localctx = ExprParser.RightExpressionContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx

                self.state = 124
                self.match(ExprParser.T__2)
                self.state = 125
                self.expr(0)
                self.state = 126
                self.match(ExprParser.T__3)
                pass
            elif token in [14, 16]:
                localctx = ExprParser.RightAtomContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 128
                self.atom()
                pass
            else:
                raise NoViableAltException(self)

            self._ctx.stop = self._input.LT(-1)
            self.state = 136
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input, 9, self._ctx)
            while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER:
                if _alt == 1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = ExprParser.RightMuldivContext(
                        self,
                        ExprParser.Right_exprContext(self, _parentctx, _parentState),
                    )
                    self.pushNewRecursionContext(
                        localctx, _startState, self.RULE_right_expr
                    )
                    self.state = 131
                    if not self.precpred(self._ctx, 3):
                        from antlr4.error.Errors import FailedPredicateException

                        raise FailedPredicateException(
                            self, "self.precpred(self._ctx, 3)"
                        )
                    self.state = 132
                    localctx.op = self._input.LT(1)
                    _la = self._input.LA(1)
                    if not (_la == 5 or _la == 6):
                        localctx.op = self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()
                    self.state = 133
                    self.right_expr(4)
                self.state = 138
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input, 9, self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.unrollRecursionContexts(_parentctx)
        return localctx

    def sempred(self, localctx: RuleContext, ruleIndex: int, predIndex: int):
        if self._predicates == None:
            self._predicates = dict()
        self._predicates[2] = self.expr_sempred
        self._predicates[5] = self.shift_expr_sempred
        self._predicates[6] = self.right_expr_sempred
        pred = self._predicates.get(ruleIndex, None)
        if pred is None:
            raise Exception("No predicate with index:" + str(ruleIndex))
        else:
            return pred(localctx, predIndex)

    def expr_sempred(self, localctx: ExprContext, predIndex: int):
        if predIndex == 0:
            return self.precpred(self._ctx, 11)

        if predIndex == 1:
            return self.precpred(self._ctx, 10)

        if predIndex == 2:
            return self.precpred(self._ctx, 9)

    def shift_expr_sempred(self, localctx: Shift_exprContext, predIndex: int):
        if predIndex == 3:
            return self.precpred(self._ctx, 4)

        if predIndex == 4:
            return self.precpred(self._ctx, 3)

    def right_expr_sempred(self, localctx: Right_exprContext, predIndex: int):
        if predIndex == 5:
            return self.precpred(self._ctx, 3)
