# Generated from winval.g4 by ANTLR 4.10.1
# encoding: utf-8
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
	from typing import TextIO
else:
	from typing.io import TextIO

def serializedATN():
    return [
        4,1,40,99,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,1,0,1,0,1,0,1,1,1,1,1,
        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,38,8,1,1,1,1,1,1,1,1,1,1,1,1,1,
        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,58,8,1,10,1,
        12,1,61,9,1,1,2,1,2,1,3,1,3,1,3,5,3,68,8,3,10,3,12,3,71,9,3,1,3,
        1,3,1,3,5,3,76,8,3,10,3,12,3,79,9,3,1,3,1,3,1,3,5,3,84,8,3,10,3,
        12,3,87,9,3,1,3,1,3,1,3,5,3,92,8,3,10,3,12,3,95,9,3,3,3,97,8,3,1,
        3,0,1,2,4,0,2,4,6,0,6,1,0,7,13,1,0,14,19,1,0,21,22,1,0,23,28,1,0,
        29,30,1,0,31,32,117,0,8,1,0,0,0,2,37,1,0,0,0,4,62,1,0,0,0,6,96,1,
        0,0,0,8,9,3,2,1,0,9,10,5,0,0,1,10,1,1,0,0,0,11,12,6,1,-1,0,12,38,
        5,36,0,0,13,38,5,37,0,0,14,38,5,39,0,0,15,38,5,34,0,0,16,38,5,38,
        0,0,17,38,3,4,2,0,18,19,3,4,2,0,19,20,5,1,0,0,20,21,3,2,1,0,21,22,
        5,2,0,0,22,38,1,0,0,0,23,24,5,1,0,0,24,25,3,6,3,0,25,26,5,2,0,0,
        26,38,1,0,0,0,27,28,5,3,0,0,28,29,3,6,3,0,29,30,5,4,0,0,30,38,1,
        0,0,0,31,32,5,5,0,0,32,33,3,2,1,0,33,34,5,6,0,0,34,38,1,0,0,0,35,
        36,7,0,0,0,36,38,3,2,1,7,37,11,1,0,0,0,37,13,1,0,0,0,37,14,1,0,0,
        0,37,15,1,0,0,0,37,16,1,0,0,0,37,17,1,0,0,0,37,18,1,0,0,0,37,23,
        1,0,0,0,37,27,1,0,0,0,37,31,1,0,0,0,37,35,1,0,0,0,38,59,1,0,0,0,
        39,40,10,6,0,0,40,41,7,1,0,0,41,58,3,2,1,7,42,43,10,5,0,0,43,44,
        5,20,0,0,44,58,3,2,1,6,45,46,10,4,0,0,46,47,7,2,0,0,47,58,3,2,1,
        5,48,49,10,3,0,0,49,50,7,3,0,0,50,58,3,2,1,4,51,52,10,2,0,0,52,53,
        7,4,0,0,53,58,3,2,1,3,54,55,10,1,0,0,55,56,7,5,0,0,56,58,3,2,1,2,
        57,39,1,0,0,0,57,42,1,0,0,0,57,45,1,0,0,0,57,48,1,0,0,0,57,51,1,
        0,0,0,57,54,1,0,0,0,58,61,1,0,0,0,59,57,1,0,0,0,59,60,1,0,0,0,60,
        3,1,0,0,0,61,59,1,0,0,0,62,63,5,35,0,0,63,5,1,0,0,0,64,69,5,36,0,
        0,65,66,5,33,0,0,66,68,5,36,0,0,67,65,1,0,0,0,68,71,1,0,0,0,69,67,
        1,0,0,0,69,70,1,0,0,0,70,97,1,0,0,0,71,69,1,0,0,0,72,77,5,37,0,0,
        73,74,5,33,0,0,74,76,5,37,0,0,75,73,1,0,0,0,76,79,1,0,0,0,77,75,
        1,0,0,0,77,78,1,0,0,0,78,97,1,0,0,0,79,77,1,0,0,0,80,85,5,39,0,0,
        81,82,5,33,0,0,82,84,5,39,0,0,83,81,1,0,0,0,84,87,1,0,0,0,85,83,
        1,0,0,0,85,86,1,0,0,0,86,97,1,0,0,0,87,85,1,0,0,0,88,93,5,35,0,0,
        89,90,5,33,0,0,90,92,5,35,0,0,91,89,1,0,0,0,92,95,1,0,0,0,93,91,
        1,0,0,0,93,94,1,0,0,0,94,97,1,0,0,0,95,93,1,0,0,0,96,64,1,0,0,0,
        96,72,1,0,0,0,96,80,1,0,0,0,96,88,1,0,0,0,97,7,1,0,0,0,8,37,57,59,
        69,77,85,93,96
    ]

class winvalParser ( Parser ):

    grammarFileName = "winval.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'['", "']'", "'{'", "'}'", "'('", "')'", 
                     "'defined'", "'len'", "'prefix'", "'suffix'", "'basename'", 
                     "'splitext'", "'not'", "'+'", "'-'", "'*'", "'/'", 
                     "'**'", "'%'", "'in'", "'|'", "'&'", "'>'", "'>='", 
                     "'=='", "'<='", "'<'", "'!='", "'or'", "'and'", "'->'", 
                     "'<->'", "','" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "BOOL", "VARIABLE", "INT", 
                      "FLOAT", "EMPTY_SET", "STRING", "WS" ]

    RULE_constraint = 0
    RULE_expr = 1
    RULE_variable = 2
    RULE_elements = 3

    ruleNames =  [ "constraint", "expr", "variable", "elements" ]

    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
    T__13=14
    T__14=15
    T__15=16
    T__16=17
    T__17=18
    T__18=19
    T__19=20
    T__20=21
    T__21=22
    T__22=23
    T__23=24
    T__24=25
    T__25=26
    T__26=27
    T__27=28
    T__28=29
    T__29=30
    T__30=31
    T__31=32
    T__32=33
    BOOL=34
    VARIABLE=35
    INT=36
    FLOAT=37
    EMPTY_SET=38
    STRING=39
    WS=40

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




    class ConstraintContext(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(winvalParser.ExprContext,0)


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

        def getRuleIndex(self):
            return winvalParser.RULE_constraint

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterConstraint" ):
                listener.enterConstraint(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitConstraint" ):
                listener.exitConstraint(self)

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




    def constraint(self):

        localctx = winvalParser.ConstraintContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_constraint)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 8
            self.expr(0)
            self.state = 9
            self.match(winvalParser.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 winvalParser.RULE_expr

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


    class AccessExprContext(ExprContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a winvalParser.ExprContext
            super().__init__(parser)
            self.struct = None # VariableContext
            self.key = None # ExprContext
            self.copyFrom(ctx)

        def variable(self):
            return self.getTypedRuleContext(winvalParser.VariableContext,0)

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


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterAccessExpr" ):
                listener.enterAccessExpr(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitAccessExpr" ):
                listener.exitAccessExpr(self)

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


    class StringExprContext(ExprContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a winvalParser.ExprContext
            super().__init__(parser)
            self.atom = None # Token
            self.copyFrom(ctx)

        def STRING(self):
            return self.getToken(winvalParser.STRING, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStringExpr" ):
                listener.enterStringExpr(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitStringExpr" ):
                listener.exitStringExpr(self)

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


    class BoolExprContext(ExprContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a winvalParser.ExprContext
            super().__init__(parser)
            self.atom = None # Token
            self.copyFrom(ctx)

        def BOOL(self):
            return self.getToken(winvalParser.BOOL, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBoolExpr" ):
                listener.enterBoolExpr(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBoolExpr" ):
                listener.exitBoolExpr(self)

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


    class FloatExprContext(ExprContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a winvalParser.ExprContext
            super().__init__(parser)
            self.atom = None # Token
            self.copyFrom(ctx)

        def FLOAT(self):
            return self.getToken(winvalParser.FLOAT, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFloatExpr" ):
                listener.enterFloatExpr(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFloatExpr" ):
                listener.exitFloatExpr(self)

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


    class SetExprContext(ExprContext):

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

        def elements(self):
            return self.getTypedRuleContext(winvalParser.ElementsContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterSetExpr" ):
                listener.enterSetExpr(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitSetExpr" ):
                listener.exitSetExpr(self)

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


    class VariableExprContext(ExprContext):

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

        def variable(self):
            return self.getTypedRuleContext(winvalParser.VariableContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterVariableExpr" ):
                listener.enterVariableExpr(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitVariableExpr" ):
                listener.exitVariableExpr(self)

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


    class IntExprContext(ExprContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a winvalParser.ExprContext
            super().__init__(parser)
            self.atom = None # Token
            self.copyFrom(ctx)

        def INT(self):
            return self.getToken(winvalParser.INT, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterIntExpr" ):
                listener.enterIntExpr(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitIntExpr" ):
                listener.exitIntExpr(self)

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


    class ListExprContext(ExprContext):

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

        def elements(self):
            return self.getTypedRuleContext(winvalParser.ElementsContext,0)


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterListExpr" ):
                listener.enterListExpr(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitListExpr" ):
                listener.exitListExpr(self)

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


    class EmptySetExprContext(ExprContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a winvalParser.ExprContext
            super().__init__(parser)
            self.atom = None # Token
            self.copyFrom(ctx)

        def EMPTY_SET(self):
            return self.getToken(winvalParser.EMPTY_SET, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEmptySetExpr" ):
                listener.enterEmptySetExpr(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEmptySetExpr" ):
                listener.exitEmptySetExpr(self)

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


    class ParenExprContext(ExprContext):

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

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


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterParenExpr" ):
                listener.enterParenExpr(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitParenExpr" ):
                listener.exitParenExpr(self)

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


    class InfixExprContext(ExprContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a winvalParser.ExprContext
            super().__init__(parser)
            self.left = None # ExprContext
            self.op = None # Token
            self.right = None # ExprContext
            self.copyFrom(ctx)

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


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterInfixExpr" ):
                listener.enterInfixExpr(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitInfixExpr" ):
                listener.exitInfixExpr(self)

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


    class PrefixExprContext(ExprContext):

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

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


        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterPrefixExpr" ):
                listener.enterPrefixExpr(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitPrefixExpr" ):
                listener.exitPrefixExpr(self)

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



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

                self.state = 12
                localctx.atom = self.match(winvalParser.INT)
                pass

            elif la_ == 2:
                localctx = winvalParser.FloatExprContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 13
                localctx.atom = self.match(winvalParser.FLOAT)
                pass

            elif la_ == 3:
                localctx = winvalParser.StringExprContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 14
                localctx.atom = self.match(winvalParser.STRING)
                pass

            elif la_ == 4:
                localctx = winvalParser.BoolExprContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 15
                localctx.atom = self.match(winvalParser.BOOL)
                pass

            elif la_ == 5:
                localctx = winvalParser.EmptySetExprContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 16
                localctx.atom = self.match(winvalParser.EMPTY_SET)
                pass

            elif la_ == 6:
                localctx = winvalParser.VariableExprContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 17
                self.variable()
                pass

            elif la_ == 7:
                localctx = winvalParser.AccessExprContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 18
                localctx.struct = self.variable()
                self.state = 19
                self.match(winvalParser.T__0)
                self.state = 20
                localctx.key = self.expr(0)
                self.state = 21
                self.match(winvalParser.T__1)
                pass

            elif la_ == 8:
                localctx = winvalParser.ListExprContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 23
                self.match(winvalParser.T__0)
                self.state = 24
                self.elements()
                self.state = 25
                self.match(winvalParser.T__1)
                pass

            elif la_ == 9:
                localctx = winvalParser.SetExprContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 27
                self.match(winvalParser.T__2)
                self.state = 28
                self.elements()
                self.state = 29
                self.match(winvalParser.T__3)
                pass

            elif la_ == 10:
                localctx = winvalParser.ParenExprContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 31
                self.match(winvalParser.T__4)
                self.state = 32
                self.expr(0)
                self.state = 33
                self.match(winvalParser.T__5)
                pass

            elif la_ == 11:
                localctx = winvalParser.PrefixExprContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 35
                localctx.op = self._input.LT(1)
                _la = self._input.LA(1)
                if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << winvalParser.T__6) | (1 << winvalParser.T__7) | (1 << winvalParser.T__8) | (1 << winvalParser.T__9) | (1 << winvalParser.T__10) | (1 << winvalParser.T__11) | (1 << winvalParser.T__12))) != 0)):
                    localctx.op = self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 36
                localctx.operand = self.expr(7)
                pass


            self._ctx.stop = self._input.LT(-1)
            self.state = 59
            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 = 57
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,1,self._ctx)
                    if la_ == 1:
                        localctx = winvalParser.InfixExprContext(self, winvalParser.ExprContext(self, _parentctx, _parentState))
                        localctx.left = _prevctx
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 39
                        if not self.precpred(self._ctx, 6):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 6)")
                        self.state = 40
                        localctx.op = self._input.LT(1)
                        _la = self._input.LA(1)
                        if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << winvalParser.T__13) | (1 << winvalParser.T__14) | (1 << winvalParser.T__15) | (1 << winvalParser.T__16) | (1 << winvalParser.T__17) | (1 << winvalParser.T__18))) != 0)):
                            localctx.op = self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 41
                        localctx.right = self.expr(7)
                        pass

                    elif la_ == 2:
                        localctx = winvalParser.InfixExprContext(self, winvalParser.ExprContext(self, _parentctx, _parentState))
                        localctx.left = _prevctx
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 42
                        if not self.precpred(self._ctx, 5):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 5)")
                        self.state = 43
                        localctx.op = self.match(winvalParser.T__19)
                        self.state = 44
                        localctx.right = self.expr(6)
                        pass

                    elif la_ == 3:
                        localctx = winvalParser.InfixExprContext(self, winvalParser.ExprContext(self, _parentctx, _parentState))
                        localctx.left = _prevctx
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 45
                        if not self.precpred(self._ctx, 4):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 4)")
                        self.state = 46
                        localctx.op = self._input.LT(1)
                        _la = self._input.LA(1)
                        if not(_la==winvalParser.T__20 or _la==winvalParser.T__21):
                            localctx.op = self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 47
                        localctx.right = self.expr(5)
                        pass

                    elif la_ == 4:
                        localctx = winvalParser.InfixExprContext(self, winvalParser.ExprContext(self, _parentctx, _parentState))
                        localctx.left = _prevctx
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 48
                        if not self.precpred(self._ctx, 3):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 3)")
                        self.state = 49
                        localctx.op = self._input.LT(1)
                        _la = self._input.LA(1)
                        if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << winvalParser.T__22) | (1 << winvalParser.T__23) | (1 << winvalParser.T__24) | (1 << winvalParser.T__25) | (1 << winvalParser.T__26) | (1 << winvalParser.T__27))) != 0)):
                            localctx.op = self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 50
                        localctx.right = self.expr(4)
                        pass

                    elif la_ == 5:
                        localctx = winvalParser.InfixExprContext(self, winvalParser.ExprContext(self, _parentctx, _parentState))
                        localctx.left = _prevctx
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 51
                        if not self.precpred(self._ctx, 2):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                        self.state = 52
                        localctx.op = self._input.LT(1)
                        _la = self._input.LA(1)
                        if not(_la==winvalParser.T__28 or _la==winvalParser.T__29):
                            localctx.op = self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 53
                        localctx.right = self.expr(3)
                        pass

                    elif la_ == 6:
                        localctx = winvalParser.InfixExprContext(self, winvalParser.ExprContext(self, _parentctx, _parentState))
                        localctx.left = _prevctx
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 54
                        if not self.precpred(self._ctx, 1):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                        self.state = 55
                        localctx.op = self._input.LT(1)
                        _la = self._input.LA(1)
                        if not(_la==winvalParser.T__30 or _la==winvalParser.T__31):
                            localctx.op = self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 56
                        localctx.right = self.expr(2)
                        pass

             
                self.state = 61
                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 VariableContext(ParserRuleContext):
        __slots__ = 'parser'

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


        def getRuleIndex(self):
            return winvalParser.RULE_variable

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



    class VariableExpr2Context(VariableContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a winvalParser.VariableContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def VARIABLE(self):
            return self.getToken(winvalParser.VARIABLE, 0)

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterVariableExpr2" ):
                listener.enterVariableExpr2(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitVariableExpr2" ):
                listener.exitVariableExpr2(self)

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



    def variable(self):

        localctx = winvalParser.VariableContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_variable)
        try:
            localctx = winvalParser.VariableExpr2Context(self, localctx)
            self.enterOuterAlt(localctx, 1)
            self.state = 62
            self.match(winvalParser.VARIABLE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ElementsContext(ParserRuleContext):
        __slots__ = 'parser'

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

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

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

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

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

        def getRuleIndex(self):
            return winvalParser.RULE_elements

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterElements" ):
                listener.enterElements(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitElements" ):
                listener.exitElements(self)

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




    def elements(self):

        localctx = winvalParser.ElementsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_elements)
        self._la = 0 # Token type
        try:
            self.state = 96
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [winvalParser.INT]:
                self.enterOuterAlt(localctx, 1)
                self.state = 64
                self.match(winvalParser.INT)
                self.state = 69
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==winvalParser.T__32:
                    self.state = 65
                    self.match(winvalParser.T__32)

                    self.state = 66
                    self.match(winvalParser.INT)
                    self.state = 71
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                pass
            elif token in [winvalParser.FLOAT]:
                self.enterOuterAlt(localctx, 2)
                self.state = 72
                self.match(winvalParser.FLOAT)
                self.state = 77
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==winvalParser.T__32:
                    self.state = 73
                    self.match(winvalParser.T__32)

                    self.state = 74
                    self.match(winvalParser.FLOAT)
                    self.state = 79
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                pass
            elif token in [winvalParser.STRING]:
                self.enterOuterAlt(localctx, 3)
                self.state = 80
                self.match(winvalParser.STRING)
                self.state = 85
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==winvalParser.T__32:
                    self.state = 81
                    self.match(winvalParser.T__32)

                    self.state = 82
                    self.match(winvalParser.STRING)
                    self.state = 87
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                pass
            elif token in [winvalParser.VARIABLE]:
                self.enterOuterAlt(localctx, 4)
                self.state = 88
                self.match(winvalParser.VARIABLE)
                self.state = 93
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==winvalParser.T__32:
                    self.state = 89
                    self.match(winvalParser.T__32)

                    self.state = 90
                    self.match(winvalParser.VARIABLE)
                    self.state = 95
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                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



    def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int):
        if self._predicates == None:
            self._predicates = dict()
        self._predicates[1] = self.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, 6)
         

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

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

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

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

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




