# Generated from Drawer.g4 by ANTLR 4.13.2
# 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,32,192,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,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,
        2,14,7,14,2,15,7,15,1,0,1,0,1,0,5,0,36,8,0,10,0,12,0,39,9,0,1,1,
        1,1,1,1,1,1,1,1,1,1,1,1,3,1,48,8,1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,
        2,1,3,1,3,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,5,1,5,1,5,1,
        5,1,6,1,6,1,6,1,6,1,7,1,7,3,7,80,8,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,
        1,7,1,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,9,1,9,1,9,
        1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,
        1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,
        1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,
        1,9,1,9,1,9,3,9,156,8,9,1,10,1,10,1,11,1,11,1,11,1,11,1,11,3,11,
        165,8,11,1,11,1,11,1,11,1,11,1,11,1,11,5,11,173,8,11,10,11,12,11,
        176,9,11,1,12,1,12,1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,14,
        1,15,1,15,1,15,1,15,0,1,22,16,0,2,4,6,8,10,12,14,16,18,20,22,24,
        26,28,30,0,5,1,0,10,11,1,0,17,18,1,0,28,29,1,0,24,25,1,0,26,27,195,
        0,37,1,0,0,0,2,47,1,0,0,0,4,49,1,0,0,0,6,57,1,0,0,0,8,61,1,0,0,0,
        10,69,1,0,0,0,12,73,1,0,0,0,14,79,1,0,0,0,16,94,1,0,0,0,18,155,1,
        0,0,0,20,157,1,0,0,0,22,164,1,0,0,0,24,177,1,0,0,0,26,179,1,0,0,
        0,28,183,1,0,0,0,30,188,1,0,0,0,32,33,3,2,1,0,33,34,5,1,0,0,34,36,
        1,0,0,0,35,32,1,0,0,0,36,39,1,0,0,0,37,35,1,0,0,0,37,38,1,0,0,0,
        38,1,1,0,0,0,39,37,1,0,0,0,40,48,3,4,2,0,41,48,3,6,3,0,42,48,3,8,
        4,0,43,48,3,10,5,0,44,48,3,14,7,0,45,48,3,16,8,0,46,48,3,12,6,0,
        47,40,1,0,0,0,47,41,1,0,0,0,47,42,1,0,0,0,47,43,1,0,0,0,47,44,1,
        0,0,0,47,45,1,0,0,0,47,46,1,0,0,0,48,3,1,0,0,0,49,50,5,2,0,0,50,
        51,5,3,0,0,51,52,5,4,0,0,52,53,3,22,11,0,53,54,5,5,0,0,54,55,3,22,
        11,0,55,56,5,6,0,0,56,5,1,0,0,0,57,58,5,7,0,0,58,59,5,3,0,0,59,60,
        3,22,11,0,60,7,1,0,0,0,61,62,5,8,0,0,62,63,5,3,0,0,63,64,5,4,0,0,
        64,65,3,22,11,0,65,66,5,5,0,0,66,67,3,22,11,0,67,68,5,6,0,0,68,9,
        1,0,0,0,69,70,5,9,0,0,70,71,5,3,0,0,71,72,3,18,9,0,72,11,1,0,0,0,
        73,74,7,0,0,0,74,75,5,3,0,0,75,76,3,22,11,0,76,13,1,0,0,0,77,78,
        5,12,0,0,78,80,5,28,0,0,79,77,1,0,0,0,79,80,1,0,0,0,80,81,1,0,0,
        0,81,82,5,13,0,0,82,83,3,22,11,0,83,84,5,14,0,0,84,85,3,22,11,0,
        85,86,5,15,0,0,86,87,3,22,11,0,87,88,5,16,0,0,88,89,5,4,0,0,89,90,
        3,22,11,0,90,91,5,5,0,0,91,92,3,22,11,0,92,93,5,6,0,0,93,15,1,0,
        0,0,94,95,5,16,0,0,95,96,5,4,0,0,96,97,3,22,11,0,97,98,5,5,0,0,98,
        99,3,22,11,0,99,100,5,6,0,0,100,17,1,0,0,0,101,156,5,28,0,0,102,
        103,7,1,0,0,103,104,5,28,0,0,104,156,7,1,0,0,105,106,5,4,0,0,106,
        107,3,22,11,0,107,108,5,5,0,0,108,109,3,22,11,0,109,110,5,5,0,0,
        110,111,3,22,11,0,111,112,5,6,0,0,112,156,1,0,0,0,113,114,5,19,0,
        0,114,115,5,4,0,0,115,116,3,22,11,0,116,117,5,5,0,0,117,118,3,22,
        11,0,118,119,5,5,0,0,119,120,3,22,11,0,120,121,5,6,0,0,121,156,1,
        0,0,0,122,123,5,20,0,0,123,124,5,4,0,0,124,125,3,22,11,0,125,126,
        5,5,0,0,126,127,3,22,11,0,127,128,5,5,0,0,128,129,3,22,11,0,129,
        130,5,5,0,0,130,131,3,22,11,0,131,132,5,6,0,0,132,156,1,0,0,0,133,
        134,5,21,0,0,134,135,5,4,0,0,135,136,3,22,11,0,136,137,5,5,0,0,137,
        138,3,22,11,0,138,139,5,5,0,0,139,140,3,22,11,0,140,141,5,6,0,0,
        141,156,1,0,0,0,142,143,5,22,0,0,143,144,5,4,0,0,144,145,3,22,11,
        0,145,146,5,5,0,0,146,147,3,22,11,0,147,148,5,5,0,0,148,149,3,22,
        11,0,149,150,5,5,0,0,150,151,3,22,11,0,151,152,5,6,0,0,152,156,1,
        0,0,0,153,154,5,23,0,0,154,156,5,30,0,0,155,101,1,0,0,0,155,102,
        1,0,0,0,155,105,1,0,0,0,155,113,1,0,0,0,155,122,1,0,0,0,155,133,
        1,0,0,0,155,142,1,0,0,0,155,153,1,0,0,0,156,19,1,0,0,0,157,158,7,
        2,0,0,158,21,1,0,0,0,159,160,6,11,-1,0,160,165,3,24,12,0,161,165,
        3,26,13,0,162,165,3,28,14,0,163,165,3,30,15,0,164,159,1,0,0,0,164,
        161,1,0,0,0,164,162,1,0,0,0,164,163,1,0,0,0,165,174,1,0,0,0,166,
        167,10,2,0,0,167,168,7,3,0,0,168,173,3,22,11,3,169,170,10,1,0,0,
        170,171,7,4,0,0,171,173,3,22,11,2,172,166,1,0,0,0,172,169,1,0,0,
        0,173,176,1,0,0,0,174,172,1,0,0,0,174,175,1,0,0,0,175,23,1,0,0,0,
        176,174,1,0,0,0,177,178,3,20,10,0,178,25,1,0,0,0,179,180,5,4,0,0,
        180,181,3,22,11,0,181,182,5,6,0,0,182,27,1,0,0,0,183,184,5,28,0,
        0,184,185,5,4,0,0,185,186,3,22,11,0,186,187,5,6,0,0,187,29,1,0,0,
        0,188,189,7,4,0,0,189,190,3,22,11,0,190,31,1,0,0,0,7,37,47,79,155,
        164,172,174
    ]

class DrawerParser ( Parser ):

    grammarFileName = "Drawer.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "';'", "'origin'", "'is'", "'('", "','", 
                     "')'", "'rot'", "'scale'", "'color'", "'pixsize'", 
                     "'pixelsize'", "'for'", "'from'", "'to'", "'step'", 
                     "'draw'", "'\"'", "'''", "'rgb'", "'rgba'", "'hsl'", 
                     "'hsla'", "'#'", "'*'", "'/'", "'+'", "'-'" ]

    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>", 
                      "ID", "NUM", "HEX", "WS", "COM" ]

    RULE_prog = 0
    RULE_stat = 1
    RULE_originStat = 2
    RULE_rotStat = 3
    RULE_scaleStat = 4
    RULE_colorStat = 5
    RULE_pixsizeStat = 6
    RULE_forStat = 7
    RULE_drawStat = 8
    RULE_colorLit = 9
    RULE_value = 10
    RULE_expr = 11
    RULE_valueExpr = 12
    RULE_wrappedExpr = 13
    RULE_funcCallExpr = 14
    RULE_sigExpr = 15

    ruleNames =  [ "prog", "stat", "originStat", "rotStat", "scaleStat", 
                   "colorStat", "pixsizeStat", "forStat", "drawStat", "colorLit", 
                   "value", "expr", "valueExpr", "wrappedExpr", "funcCallExpr", 
                   "sigExpr" ]

    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
    ID=28
    NUM=29
    HEX=30
    WS=31
    COM=32

    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 ProgContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def stat(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(DrawerParser.StatContext)
            else:
                return self.getTypedRuleContext(DrawerParser.StatContext,i)


        def getRuleIndex(self):
            return DrawerParser.RULE_prog

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

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




    def prog(self):

        localctx = DrawerParser.ProgContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_prog)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 37
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & 81796) != 0):
                self.state = 32
                self.stat()
                self.state = 33
                self.match(DrawerParser.T__0)
                self.state = 39
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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


    class StatContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def originStat(self):
            return self.getTypedRuleContext(DrawerParser.OriginStatContext,0)


        def rotStat(self):
            return self.getTypedRuleContext(DrawerParser.RotStatContext,0)


        def scaleStat(self):
            return self.getTypedRuleContext(DrawerParser.ScaleStatContext,0)


        def colorStat(self):
            return self.getTypedRuleContext(DrawerParser.ColorStatContext,0)


        def forStat(self):
            return self.getTypedRuleContext(DrawerParser.ForStatContext,0)


        def drawStat(self):
            return self.getTypedRuleContext(DrawerParser.DrawStatContext,0)


        def pixsizeStat(self):
            return self.getTypedRuleContext(DrawerParser.PixsizeStatContext,0)


        def getRuleIndex(self):
            return DrawerParser.RULE_stat

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

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




    def stat(self):

        localctx = DrawerParser.StatContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_stat)
        try:
            self.state = 47
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [2]:
                self.enterOuterAlt(localctx, 1)
                self.state = 40
                self.originStat()
                pass
            elif token in [7]:
                self.enterOuterAlt(localctx, 2)
                self.state = 41
                self.rotStat()
                pass
            elif token in [8]:
                self.enterOuterAlt(localctx, 3)
                self.state = 42
                self.scaleStat()
                pass
            elif token in [9]:
                self.enterOuterAlt(localctx, 4)
                self.state = 43
                self.colorStat()
                pass
            elif token in [12, 13]:
                self.enterOuterAlt(localctx, 5)
                self.state = 44
                self.forStat()
                pass
            elif token in [16]:
                self.enterOuterAlt(localctx, 6)
                self.state = 45
                self.drawStat()
                pass
            elif token in [10, 11]:
                self.enterOuterAlt(localctx, 7)
                self.state = 46
                self.pixsizeStat()
                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 OriginStatContext(ParserRuleContext):
        __slots__ = 'parser'

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

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


        def getRuleIndex(self):
            return DrawerParser.RULE_originStat

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

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




    def originStat(self):

        localctx = DrawerParser.OriginStatContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_originStat)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 49
            self.match(DrawerParser.T__1)
            self.state = 50
            self.match(DrawerParser.T__2)
            self.state = 51
            self.match(DrawerParser.T__3)
            self.state = 52
            localctx.x = self.expr(0)
            self.state = 53
            self.match(DrawerParser.T__4)
            self.state = 54
            localctx.y = self.expr(0)
            self.state = 55
            self.match(DrawerParser.T__5)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class RotStatContext(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(DrawerParser.ExprContext,0)


        def getRuleIndex(self):
            return DrawerParser.RULE_rotStat

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

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




    def rotStat(self):

        localctx = DrawerParser.RotStatContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_rotStat)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 57
            self.match(DrawerParser.T__6)
            self.state = 58
            self.match(DrawerParser.T__2)
            self.state = 59
            self.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 ScaleStatContext(ParserRuleContext):
        __slots__ = 'parser'

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

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


        def getRuleIndex(self):
            return DrawerParser.RULE_scaleStat

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

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




    def scaleStat(self):

        localctx = DrawerParser.ScaleStatContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_scaleStat)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 61
            self.match(DrawerParser.T__7)
            self.state = 62
            self.match(DrawerParser.T__2)
            self.state = 63
            self.match(DrawerParser.T__3)
            self.state = 64
            localctx.x = self.expr(0)
            self.state = 65
            self.match(DrawerParser.T__4)
            self.state = 66
            localctx.y = self.expr(0)
            self.state = 67
            self.match(DrawerParser.T__5)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ColorStatContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def colorLit(self):
            return self.getTypedRuleContext(DrawerParser.ColorLitContext,0)


        def getRuleIndex(self):
            return DrawerParser.RULE_colorStat

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

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




    def colorStat(self):

        localctx = DrawerParser.ColorStatContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_colorStat)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 69
            self.match(DrawerParser.T__8)
            self.state = 70
            self.match(DrawerParser.T__2)
            self.state = 71
            localctx.color = self.colorLit()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class PixsizeStatContext(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(DrawerParser.ExprContext,0)


        def getRuleIndex(self):
            return DrawerParser.RULE_pixsizeStat

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

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




    def pixsizeStat(self):

        localctx = DrawerParser.PixsizeStatContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_pixsizeStat)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 73
            _la = self._input.LA(1)
            if not(_la==10 or _la==11):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 74
            self.match(DrawerParser.T__2)
            self.state = 75
            self.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 ForStatContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.dec = None # Token
            self.start = None # ExprContext
            self.end = None # ExprContext
            self.step = None # ExprContext
            self.x = None # ExprContext
            self.y = None # ExprContext

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


        def ID(self):
            return self.getToken(DrawerParser.ID, 0)

        def getRuleIndex(self):
            return DrawerParser.RULE_forStat

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

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




    def forStat(self):

        localctx = DrawerParser.ForStatContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_forStat)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 79
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==12:
                self.state = 77
                self.match(DrawerParser.T__11)
                self.state = 78
                localctx.dec = self.match(DrawerParser.ID)


            self.state = 81
            self.match(DrawerParser.T__12)
            self.state = 82
            localctx.start = self.expr(0)
            self.state = 83
            self.match(DrawerParser.T__13)
            self.state = 84
            localctx.end = self.expr(0)
            self.state = 85
            self.match(DrawerParser.T__14)
            self.state = 86
            localctx.step = self.expr(0)
            self.state = 87
            self.match(DrawerParser.T__15)
            self.state = 88
            self.match(DrawerParser.T__3)
            self.state = 89
            localctx.x = self.expr(0)
            self.state = 90
            self.match(DrawerParser.T__4)
            self.state = 91
            localctx.y = self.expr(0)
            self.state = 92
            self.match(DrawerParser.T__5)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DrawStatContext(ParserRuleContext):
        __slots__ = 'parser'

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

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


        def getRuleIndex(self):
            return DrawerParser.RULE_drawStat

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

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




    def drawStat(self):

        localctx = DrawerParser.DrawStatContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_drawStat)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 94
            self.match(DrawerParser.T__15)
            self.state = 95
            self.match(DrawerParser.T__3)
            self.state = 96
            localctx.x = self.expr(0)
            self.state = 97
            self.match(DrawerParser.T__4)
            self.state = 98
            localctx.y = self.expr(0)
            self.state = 99
            self.match(DrawerParser.T__5)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ColorLitContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser
            self.name = None # Token
            self.red = None # ExprContext
            self.green = None # ExprContext
            self.blue = None # ExprContext
            self.alpha = None # ExprContext
            self.hue = None # ExprContext
            self.saturation = None # ExprContext
            self.lightness = None # ExprContext

        def ID(self):
            return self.getToken(DrawerParser.ID, 0)

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


        def HEX(self):
            return self.getToken(DrawerParser.HEX, 0)

        def getRuleIndex(self):
            return DrawerParser.RULE_colorLit

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

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




    def colorLit(self):

        localctx = DrawerParser.ColorLitContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_colorLit)
        self._la = 0 # Token type
        try:
            self.state = 155
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [28]:
                self.enterOuterAlt(localctx, 1)
                self.state = 101
                localctx.name = self.match(DrawerParser.ID)
                pass
            elif token in [17, 18]:
                self.enterOuterAlt(localctx, 2)
                self.state = 102
                _la = self._input.LA(1)
                if not(_la==17 or _la==18):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 103
                localctx.name = self.match(DrawerParser.ID)
                self.state = 104
                _la = self._input.LA(1)
                if not(_la==17 or _la==18):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                pass
            elif token in [4]:
                self.enterOuterAlt(localctx, 3)
                self.state = 105
                self.match(DrawerParser.T__3)
                self.state = 106
                localctx.red = self.expr(0)
                self.state = 107
                self.match(DrawerParser.T__4)
                self.state = 108
                localctx.green = self.expr(0)
                self.state = 109
                self.match(DrawerParser.T__4)
                self.state = 110
                localctx.blue = self.expr(0)
                self.state = 111
                self.match(DrawerParser.T__5)
                pass
            elif token in [19]:
                self.enterOuterAlt(localctx, 4)
                self.state = 113
                self.match(DrawerParser.T__18)
                self.state = 114
                self.match(DrawerParser.T__3)
                self.state = 115
                localctx.red = self.expr(0)
                self.state = 116
                self.match(DrawerParser.T__4)
                self.state = 117
                localctx.green = self.expr(0)
                self.state = 118
                self.match(DrawerParser.T__4)
                self.state = 119
                localctx.blue = self.expr(0)
                self.state = 120
                self.match(DrawerParser.T__5)
                pass
            elif token in [20]:
                self.enterOuterAlt(localctx, 5)
                self.state = 122
                self.match(DrawerParser.T__19)
                self.state = 123
                self.match(DrawerParser.T__3)
                self.state = 124
                localctx.red = self.expr(0)
                self.state = 125
                self.match(DrawerParser.T__4)
                self.state = 126
                localctx.green = self.expr(0)
                self.state = 127
                self.match(DrawerParser.T__4)
                self.state = 128
                localctx.blue = self.expr(0)
                self.state = 129
                self.match(DrawerParser.T__4)
                self.state = 130
                localctx.alpha = self.expr(0)
                self.state = 131
                self.match(DrawerParser.T__5)
                pass
            elif token in [21]:
                self.enterOuterAlt(localctx, 6)
                self.state = 133
                self.match(DrawerParser.T__20)
                self.state = 134
                self.match(DrawerParser.T__3)
                self.state = 135
                localctx.hue = self.expr(0)
                self.state = 136
                self.match(DrawerParser.T__4)
                self.state = 137
                localctx.saturation = self.expr(0)
                self.state = 138
                self.match(DrawerParser.T__4)
                self.state = 139
                localctx.lightness = self.expr(0)
                self.state = 140
                self.match(DrawerParser.T__5)
                pass
            elif token in [22]:
                self.enterOuterAlt(localctx, 7)
                self.state = 142
                self.match(DrawerParser.T__21)
                self.state = 143
                self.match(DrawerParser.T__3)
                self.state = 144
                localctx.hue = self.expr(0)
                self.state = 145
                self.match(DrawerParser.T__4)
                self.state = 146
                localctx.saturation = self.expr(0)
                self.state = 147
                self.match(DrawerParser.T__4)
                self.state = 148
                localctx.lightness = self.expr(0)
                self.state = 149
                self.match(DrawerParser.T__4)
                self.state = 150
                localctx.alpha = self.expr(0)
                self.state = 151
                self.match(DrawerParser.T__5)
                pass
            elif token in [23]:
                self.enterOuterAlt(localctx, 8)
                self.state = 153
                self.match(DrawerParser.T__22)
                self.state = 154
                self.match(DrawerParser.HEX)
                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 ValueContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def NUM(self):
            return self.getToken(DrawerParser.NUM, 0)

        def ID(self):
            return self.getToken(DrawerParser.ID, 0)

        def getRuleIndex(self):
            return DrawerParser.RULE_value

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

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




    def value(self):

        localctx = DrawerParser.ValueContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_value)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 157
            _la = self._input.LA(1)
            if not(_la==28 or _la==29):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        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
            self.op2 = None # Token
            self.op1 = None # Token

        def valueExpr(self):
            return self.getTypedRuleContext(DrawerParser.ValueExprContext,0)


        def wrappedExpr(self):
            return self.getTypedRuleContext(DrawerParser.WrappedExprContext,0)


        def funcCallExpr(self):
            return self.getTypedRuleContext(DrawerParser.FuncCallExprContext,0)


        def sigExpr(self):
            return self.getTypedRuleContext(DrawerParser.SigExprContext,0)


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


        def getRuleIndex(self):
            return DrawerParser.RULE_expr

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

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



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

            elif la_ == 2:
                self.state = 161
                self.wrappedExpr()
                pass

            elif la_ == 3:
                self.state = 162
                self.funcCallExpr()
                pass

            elif la_ == 4:
                self.state = 163
                self.sigExpr()
                pass


            self._ctx.stop = self._input.LT(-1)
            self.state = 174
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,6,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 = 172
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,5,self._ctx)
                    if la_ == 1:
                        localctx = DrawerParser.ExprContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 166
                        if not self.precpred(self._ctx, 2):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                        self.state = 167
                        localctx.op2 = self._input.LT(1)
                        _la = self._input.LA(1)
                        if not(_la==24 or _la==25):
                            localctx.op2 = self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 168
                        self.expr(3)
                        pass

                    elif la_ == 2:
                        localctx = DrawerParser.ExprContext(self, _parentctx, _parentState)
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_expr)
                        self.state = 169
                        if not self.precpred(self._ctx, 1):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                        self.state = 170
                        localctx.op1 = self._input.LT(1)
                        _la = self._input.LA(1)
                        if not(_la==26 or _la==27):
                            localctx.op1 = self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()
                        self.state = 171
                        self.expr(2)
                        pass

             
                self.state = 176
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,6,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 ValueExprContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def value(self):
            return self.getTypedRuleContext(DrawerParser.ValueContext,0)


        def getRuleIndex(self):
            return DrawerParser.RULE_valueExpr

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

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




    def valueExpr(self):

        localctx = DrawerParser.ValueExprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_valueExpr)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 177
            self.value()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class WrappedExprContext(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(DrawerParser.ExprContext,0)


        def getRuleIndex(self):
            return DrawerParser.RULE_wrappedExpr

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

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




    def wrappedExpr(self):

        localctx = DrawerParser.WrappedExprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_wrappedExpr)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 179
            self.match(DrawerParser.T__3)
            self.state = 180
            self.expr(0)
            self.state = 181
            self.match(DrawerParser.T__5)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class FuncCallExprContext(ParserRuleContext):
        __slots__ = 'parser'

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

        def ID(self):
            return self.getToken(DrawerParser.ID, 0)

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


        def getRuleIndex(self):
            return DrawerParser.RULE_funcCallExpr

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

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




    def funcCallExpr(self):

        localctx = DrawerParser.FuncCallExprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_funcCallExpr)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 183
            self.match(DrawerParser.ID)
            self.state = 184
            self.match(DrawerParser.T__3)
            self.state = 185
            self.expr(0)
            self.state = 186
            self.match(DrawerParser.T__5)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class SigExprContext(ParserRuleContext):
        __slots__ = 'parser'

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

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


        def getRuleIndex(self):
            return DrawerParser.RULE_sigExpr

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

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




    def sigExpr(self):

        localctx = DrawerParser.SigExprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_sigExpr)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 188
            localctx.sig = self._input.LT(1)
            _la = self._input.LA(1)
            if not(_la==26 or _la==27):
                localctx.sig = self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 189
            self.expr(0)
        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[11] = 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, 2)
         

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




