From e04ef32308ce106cf751e5c0fd47326cdc0a8b3f Mon Sep 17 00:00:00 2001 From: boolangery Date: Mon, 21 Oct 2024 14:08:13 +0200 Subject: [PATCH] wip --- luaparser/ast.py | 362 +++- luaparser/parser/LuaLexerBase.py | 67 + luaparser/parser/LuaParser.g4 | 97 +- luaparser/parser/LuaParser.interp | 17 +- luaparser/parser/LuaParser.py | 2622 +++++++++++++++---------- luaparser/parser/LuaParserListener.py | 125 +- luaparser/parser/LuaParserVisitor.py | 208 ++ luaparser/parser/transformGrammar.py | 31 + requirements.txt | 2 +- 9 files changed, 2491 insertions(+), 1040 deletions(-) create mode 100644 luaparser/parser/LuaLexerBase.py create mode 100644 luaparser/parser/LuaParserVisitor.py create mode 100644 luaparser/parser/transformGrammar.py diff --git a/luaparser/ast.py b/luaparser/ast.py index fa9ea92..53942f0 100644 --- a/luaparser/ast.py +++ b/luaparser/ast.py @@ -1,17 +1,371 @@ +import ast + from antlr4 import InputStream, CommonTokenStream +from antlr4.tree.Tree import ParseTreeVisitor, TerminalNodeImpl, ErrorNodeImpl + from luaparser.parser.LuaLexer import LuaLexer from luaparser.astnodes import * from luaparser import printers from luaparser.builder import Builder +from luaparser.parser.LuaParser import LuaParser +from luaparser.parser.LuaParserVisitor import LuaParserVisitor from luaparser.utils.visitor import * from antlr4.error.ErrorListener import ErrorListener import json from typing import Generator +def _listify(obj): + if not isinstance(obj, list): + return [obj] + else: + return obj + + +class MyVisitor(LuaParserVisitor): + # Visit a parse tree produced by LuaParser#start_. + def visitStart_(self, ctx: LuaParser.Start_Context): + return self.visitChildren(ctx) + + def visitTerminal(self, node: TerminalNodeImpl): + match node.symbol.type: + case LuaParser.EOF: + return None + case LuaParser.NAME: + return Name(node.getText()) + case _: + return node.getText() + + def visitErrorNode(self, node: ErrorNodeImpl): + return "error:" + node.getText() + + def defaultResult(self): + return None + + def aggregateResult(self, aggregate, nextResult): + if aggregate is None: + return nextResult + if type(nextResult) == list: + nextResult.append(aggregate) + return nextResult + if type(aggregate) == list: + aggregate.append(nextResult) + return aggregate + if nextResult == None: + return aggregate + return [nextResult, aggregate] + + # Visit a parse tree produced by LuaParser#chunk. + def visitChunk(self, ctx: LuaParser.ChunkContext): + return Chunk( + body=self.visitChildren(ctx) + ) + + # Visit a parse tree produced by LuaParser#block. + def visitBlock(self, ctx: LuaParser.BlockContext): + statements = [self.visit(stat) for stat in ctx.stat()] + if ctx.retstat(): + statements.append(self.visit(ctx.retstat())) + return Block( + body=statements + ) + + # Visit a parse tree produced by LuaParser#stat. + def visitStat(self, ctx: LuaParser.StatContext): + if ctx.SEMI(): + return SemiColon() + elif ctx.BREAK(): + return Break() + else: + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#assign. + def visitAssign(self, ctx: LuaParser.AssignContext): + return Assign( + targets=_listify(self.visit(ctx.varlist())), + values=_listify(self.visit(ctx.explist())), + ) + + # Visit a parse tree produced by LuaParser#goto. + def visitGoto(self, ctx: LuaParser.GotoContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#do. + def visitDo(self, ctx: LuaParser.DoContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#while. + def visitWhile(self, ctx: LuaParser.WhileContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#repeat. + def visitRepeat(self, ctx: LuaParser.RepeatContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#if. + def visitIf(self, ctx: LuaParser.IfContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#for. + def visitFor(self, ctx: LuaParser.ForContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#forin. + def visitForin(self, ctx: LuaParser.ForinContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#functiondef. + def visitFunctiondef(self, ctx: LuaParser.FunctiondefContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#localfunction. + def visitLocalfunction(self, ctx: LuaParser.LocalfunctionContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#localassign. + def visitLocalassign(self, ctx: LuaParser.LocalassignContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#attnamelist. + def visitAttnamelist(self, ctx: LuaParser.AttnamelistContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#attrib. + def visitAttrib(self, ctx: LuaParser.AttribContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#retstat. + def visitRetstat(self, ctx: LuaParser.RetstatContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#label. + def visitLabel(self, ctx: LuaParser.LabelContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#funcname. + def visitFuncname(self, ctx: LuaParser.FuncnameContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#varlist. + def visitVarlist(self, ctx: LuaParser.VarlistContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#namelist. + def visitNamelist(self, ctx: LuaParser.NamelistContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#explist. + def visitExplist(self, ctx: LuaParser.ExplistContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#exp. + def visitExp(self, ctx: LuaParser.ExpContext): + if ctx.NIL(): + return Nil() + elif ctx.FALSE(): + return FalseExpr() + elif ctx.TRUE(): + return TrueExpr() + elif ctx.DDD(): + return Dots() + else: + expressions = ctx.exp() + + if len(expressions) == 2 and ctx.CARET(): + left = self.visit(expressions[0]) + right = self.visit(expressions[1]) + return ExpoOp(left, right) + elif len(expressions) == 1: + left = self.visit(expressions[0]) + + if ctx.NOT(): + return ULNotOp(left) + elif ctx.POUND(): + return ULengthOP(left) + elif ctx.MINUS(): + return UMinusOp(left) + elif ctx.SQUIG(): + return UBNotOp(left) + elif len(expressions) == 2: + left = self.visit(expressions[0]) + right = self.visit(expressions[1]) + + if ctx.STAR(): + return MultOp(left, right) + elif ctx.SLASH(): + return FloatDivOp(left, right) + elif ctx.PER(): + return ModOp(left, right) + elif ctx.SS(): + return FloorDivOp(left, right) + elif ctx.PLUS(): + return AddOp(left, right) + elif ctx.MINUS(): + return SubOp(left, right) + elif ctx.DD(): + return Concat(left, right) + elif ctx.LT(): + return LessThanOp(left, right) + elif ctx.GT(): + return GreaterThanOp(left, right) + elif ctx.LE(): + return LessOrEqThanOp(left, right) + elif ctx.GE(): + return GreaterOrEqThanOp(left, right) + elif ctx.SQEQ(): + return NotEqToOp(left, right) + elif ctx.EE(): + return EqToOp(left, right) + elif ctx.AND(): + return AndLoOp(left, right) + elif ctx.OR(): + return OrLoOp(left, right) + elif ctx.AMP(): + return BAndOp(left, right) + elif ctx.PIPE(): + return BOrOp(left, right) + elif ctx.SQUIG(): + return BXorOp(left, right) + elif ctx.LL(): + return BShiftLOp(left, right) + elif ctx.GG(): + return BShiftROp(left, right) + else: + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#var. + def visitVar(self, ctx: LuaParser.VarContext): + if ctx.NAME(): + return Name(ctx.NAME().getText()) + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#prefixexp. + def visitPrefixexp(self, ctx: LuaParser.PrefixexpContext): + tail = self.visit(ctx.nestedtail()) + + if ctx.NAME(): # NAME nestedtail + if isinstance(tail, Index): + tail.value = self.visit(ctx.NAME()) + return tail + else: + raise Exception("Invalid tail type") + elif ctx.functioncall(): # functioncall nestedtail + raise Exception("functioncall not implemented") + else: # '(' exp ')' nestedtail + exp = self.visit(ctx.exp()) + exp.wrapped = True + # TODO: handle tail + return exp + + # Visit a parse tree produced by LuaParser#functioncall. + def visitFunctioncall(self, ctx: LuaParser.FunctioncallContext): + args = self.visit(ctx.args()) + names = ctx.NAME() + + tails = None + if ctx.tail(): + tails = [self.visit(t) for t in ctx.tail()] + + if len(names) == 1: # NAME tail* args + if isinstance(args, Call): + args.func = self.visit(names[0]) + return args + + return Call( + func=ctx.NAME(), + args=self.visit(ctx.args()), + ) + + def visitAnonfunctiondef(self, ctx: LuaParser.AnonfunctiondefContext): + return self.visitChildren(ctx) + + def visitNestedtail(self, ctx: LuaParser.NestedtailContext): + return self.visitChildren(ctx) + + def visitTail(self, ctx: LuaParser.TailContext): + if ctx.OB() and ctx.CB(): + return Index( + idx=self.visit(ctx.exp()), + value=Name(""), # value must be set in parent + notation=IndexNotation.SQUARE, + ) + else: + return Index( + idx=Name(self.visit(ctx.NAME())), + value=Name(""), # value must be set in parent + notation=IndexNotation.DOT, + ) + + # Visit a parse tree produced by LuaParser#args. + def visitArgs(self, ctx: LuaParser.ArgsContext): + if ctx.OP() and ctx.CP(): + exp_list = [] + if ctx.explist(): + exp_list = self.visit(ctx.explist()) + + return Call(None, exp_list) + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#functiondef. + def visitFunctiondef(self, ctx: LuaParser.FunctiondefContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#funcbody. + def visitFuncbody(self, ctx: LuaParser.FuncbodyContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#parlist. + def visitParlist(self, ctx: LuaParser.ParlistContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#tableconstructor. + def visitTableconstructor(self, ctx: LuaParser.TableconstructorContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#fieldlist. + def visitFieldlist(self, ctx: LuaParser.FieldlistContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#field. + def visitField(self, ctx: LuaParser.FieldContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#fieldsep. + def visitFieldsep(self, ctx: LuaParser.FieldsepContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LuaParser#number. + def visitNumber(self, ctx: LuaParser.NumberContext): + number_text = self.visitChildren(ctx) + try: + number = ast.literal_eval(number_text) + except: + # exception occurs with leading zero number: 002 + number = float(number_text) + return Number( + number, + ) + + +# Visit a parse tree produced by LuaParser#string. +def visitString(self, ctx: LuaParser.StringContext): + return self.visitChildren(ctx) + + def parse(source: str) -> Chunk: """Parse Lua source to a Chunk.""" - return Builder(source).process() + lexer = LuaLexer(InputStream(source)) + stream = CommonTokenStream(lexer) + parser = LuaParser(stream) + tree = parser.start_() + + if parser.getNumberOfSyntaxErrors() > 0: + raise SyntaxException("syntax errors") + else: + v = MyVisitor() + val = v.visit(tree) + print(val) + return val def get_token_stream(source: str) -> CommonTokenStream: @@ -354,16 +708,16 @@ def syntaxError(self, recognizer, offending_symbol, line, column, msg, e): raise SyntaxException(str(line) + ":" + str(column) + ": " + str(msg)) def reportAmbiguity( - self, recognizer, dfa, start_index, stop_index, exact, ambig_alts, configs + self, recognizer, dfa, start_index, stop_index, exact, ambig_alts, configs ): pass def reportAttemptingFullContext( - self, recognizer, dfa, start_index, stop_index, conflicting_alts, configs + self, recognizer, dfa, start_index, stop_index, conflicting_alts, configs ): pass def reportContextSensitivity( - self, recognizer, dfa, start_index, stop_index, prediction, configs + self, recognizer, dfa, start_index, stop_index, prediction, configs ): pass diff --git a/luaparser/parser/LuaLexerBase.py b/luaparser/parser/LuaLexerBase.py new file mode 100644 index 0000000..6046388 --- /dev/null +++ b/luaparser/parser/LuaLexerBase.py @@ -0,0 +1,67 @@ +from typing import TextIO +from antlr4 import * +from antlr4.Token import CommonToken +import sys +from typing import TextIO + +class LuaLexerBase(Lexer): + + def __init__(self, input: InputStream, output: TextIO = sys.stdout): + super().__init__(input, output) + self.start_line = 0 + self.start_col = 0 + + def HandleComment(self): + self.start_line = self.line + self.start_col = self.column - 2 + cs = self._input + + if cs.LA(1) == 91: # '[' + sep = self.skip_sep(cs) + if sep >= 2: + self.read_long_string(cs, sep) + return + + while cs.LA(1) != 12 and cs.LA(1) != -1: # '\n' + cs.consume() + + def read_long_string(self, cs:InputStream, sep:int): + done = False + cs.consume() + + while not done: + c = cs.LA(1) + if c == -1: + done = True + elif c == 93: # ']' + if self.skip_sep(cs) == sep: + cs.consume() + done = True + else: + if cs.LA(1) == -1: + done = True + else: + cs.consume() + + def skip_sep(self, cs:InputStream): + count = 0 + s = cs.LA(1) + cs.consume() + + while cs.LA(1) == 61: # '=' + cs.consume() + count += 1 + + if cs.LA(1) == s: + count += 2 + elif count == 0: + count = 1 + else: + count = 0 + + return count + + def IsLine1Col0(self): + cs = self._input + return cs.index == 1 + diff --git a/luaparser/parser/LuaParser.g4 b/luaparser/parser/LuaParser.g4 index aa4958c..407beb8 100644 --- a/luaparser/parser/LuaParser.g4 +++ b/luaparser/parser/LuaParser.g4 @@ -31,22 +31,67 @@ block stat : ';' - | varlist '=' explist + | assign | functioncall | label | 'break' - | 'goto' NAME - | 'do' block 'end' - | 'while' exp 'do' block 'end' - | 'repeat' block 'until' exp - | 'if' exp 'then' block ('elseif' exp 'then' block)* ('else' block)? 'end' - | 'for' NAME '=' exp ',' exp (',' exp)? 'do' block 'end' - | 'for' namelist 'in' explist 'do' block 'end' - | 'function' funcname funcbody - | 'local' 'function' NAME funcbody - | 'local' attnamelist ('=' explist)? + | goto + | do + | while + | repeat + | if + | for + | forin + | functiondef + | localfunction + | localassign ; +assign + : varlist '=' explist + ; + +goto + : 'goto' NAME + ; + +do + : 'do' block 'end' + ; + +while + : 'while' exp 'do' block 'end' + ; + +repeat + : 'repeat' block 'until' exp + ; + +if + : 'if' exp 'then' block ('elseif' exp 'then' block)* ('else' block)? 'end' + ; + +for + : 'for' NAME '=' exp ',' exp (',' exp)? 'do' block 'end' + ; + +forin + : 'for' namelist 'in' explist 'do' block 'end' + ; + +functiondef + : 'function' funcname funcbody + ; + +localfunction + : 'local' 'function' NAME funcbody + ; + +localassign + : 'local' namelist ('=' explist)? + ; + + attnamelist : NAME attrib (',' NAME attrib)* ; @@ -103,33 +148,41 @@ exp // var ::= Name | prefixexp '[' exp ']' | prefixexp '.' Name var : NAME - | prefixexp ('[' exp ']' | '.' NAME) + | prefixexp tail ; // prefixexp ::= var | functioncall | '(' exp ')' prefixexp - : NAME ('[' exp ']' | '.' NAME)* - | functioncall ('[' exp ']' | '.' NAME)* - | '(' exp ')' ('[' exp ']' | '.' NAME)* + : NAME nestedtail + | functioncall nestedtail + | '(' exp ')' nestedtail ; // functioncall ::= prefixexp args | prefixexp ':' Name args; functioncall - : NAME ('[' exp ']' | '.' NAME)* args - | functioncall ('[' exp ']' | '.' NAME)* args - | '(' exp ')' ('[' exp ']' | '.' NAME)* args - | NAME ('[' exp ']' | '.' NAME)* ':' NAME args - | functioncall ('[' exp ']' | '.' NAME)* ':' NAME args - | '(' exp ')' ('[' exp ']' | '.' NAME)* ':' NAME args + : NAME nestedtail args + | functioncall nestedtail args + | '(' exp ')' nestedtail args + | NAME nestedtail ':' NAME args + | functioncall nestedtail ':' NAME args + | '(' exp ')' nestedtail ':' NAME args ; +tail + : ('[' exp ']' | '.' NAME) + ; + +nestedtail + : tail* + ; + args : '(' explist? ')' | tableconstructor | string ; -functiondef +anonfunctiondef : 'function' funcbody ; diff --git a/luaparser/parser/LuaParser.interp b/luaparser/parser/LuaParser.interp index 6f23cf2..c0cec05 100644 --- a/luaparser/parser/LuaParser.interp +++ b/luaparser/parser/LuaParser.interp @@ -145,6 +145,17 @@ start_ chunk block stat +assign +goto +do +while +repeat +if +for +forin +functiondef +localfunction +localassign attnamelist attrib retstat @@ -157,8 +168,10 @@ exp var prefixexp functioncall +tail +nestedtail args -functiondef +anonfunctiondef funcbody parlist tableconstructor @@ -170,4 +183,4 @@ string atn: -[4, 1, 68, 472, 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, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 5, 2, 59, 8, 2, 10, 2, 12, 2, 62, 9, 2, 1, 2, 3, 2, 65, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 5, 3, 101, 8, 3, 10, 3, 12, 3, 104, 9, 3, 1, 3, 1, 3, 3, 3, 108, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 120, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 146, 8, 3, 3, 3, 148, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 5, 4, 155, 8, 4, 10, 4, 12, 4, 158, 9, 4, 1, 5, 1, 5, 1, 5, 3, 5, 163, 8, 5, 1, 6, 1, 6, 3, 6, 167, 8, 6, 1, 6, 1, 6, 3, 6, 171, 8, 6, 1, 6, 3, 6, 174, 8, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 5, 8, 183, 8, 8, 10, 8, 12, 8, 186, 9, 8, 1, 8, 1, 8, 3, 8, 190, 8, 8, 1, 9, 1, 9, 1, 9, 5, 9, 195, 8, 9, 10, 9, 12, 9, 198, 9, 9, 1, 10, 1, 10, 1, 10, 5, 10, 203, 8, 10, 10, 10, 12, 10, 206, 9, 10, 1, 11, 1, 11, 1, 11, 5, 11, 211, 8, 11, 10, 11, 12, 11, 214, 9, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 228, 8, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 5, 12, 254, 8, 12, 10, 12, 12, 12, 257, 9, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 3, 13, 267, 8, 13, 3, 13, 269, 8, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 278, 8, 14, 10, 14, 12, 14, 281, 9, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 290, 8, 14, 10, 14, 12, 14, 293, 9, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 5, 14, 304, 8, 14, 10, 14, 12, 14, 307, 9, 14, 3, 14, 309, 8, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 319, 8, 15, 10, 15, 12, 15, 322, 9, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 334, 8, 15, 10, 15, 12, 15, 337, 9, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 348, 8, 15, 10, 15, 12, 15, 351, 9, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 365, 8, 15, 10, 15, 12, 15, 368, 9, 15, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 374, 8, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 383, 8, 15, 10, 15, 12, 15, 386, 9, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 396, 8, 15, 10, 15, 12, 15, 399, 9, 15, 1, 15, 1, 15, 1, 15, 5, 15, 404, 8, 15, 10, 15, 12, 15, 407, 9, 15, 1, 16, 1, 16, 3, 16, 411, 8, 16, 1, 16, 1, 16, 1, 16, 3, 16, 416, 8, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 3, 19, 430, 8, 19, 1, 19, 1, 19, 3, 19, 434, 8, 19, 1, 20, 1, 20, 3, 20, 438, 8, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 21, 5, 21, 446, 8, 21, 10, 21, 12, 21, 449, 9, 21, 1, 21, 3, 21, 452, 8, 21, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, 464, 8, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 0, 2, 24, 30, 26, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 0, 8, 2, 0, 28, 30, 33, 33, 3, 0, 37, 38, 45, 45, 54, 54, 2, 0, 29, 29, 44, 44, 4, 0, 19, 20, 40, 41, 50, 50, 56, 56, 3, 0, 28, 28, 34, 36, 52, 52, 2, 0, 1, 1, 15, 15, 1, 0, 61, 64, 1, 0, 58, 60, 531, 0, 52, 1, 0, 0, 0, 2, 55, 1, 0, 0, 0, 4, 60, 1, 0, 0, 0, 6, 147, 1, 0, 0, 0, 8, 149, 1, 0, 0, 0, 10, 162, 1, 0, 0, 0, 12, 170, 1, 0, 0, 0, 14, 175, 1, 0, 0, 0, 16, 179, 1, 0, 0, 0, 18, 191, 1, 0, 0, 0, 20, 199, 1, 0, 0, 0, 22, 207, 1, 0, 0, 0, 24, 227, 1, 0, 0, 0, 26, 268, 1, 0, 0, 0, 28, 308, 1, 0, 0, 0, 30, 373, 1, 0, 0, 0, 32, 415, 1, 0, 0, 0, 34, 417, 1, 0, 0, 0, 36, 420, 1, 0, 0, 0, 38, 433, 1, 0, 0, 0, 40, 435, 1, 0, 0, 0, 42, 441, 1, 0, 0, 0, 44, 463, 1, 0, 0, 0, 46, 465, 1, 0, 0, 0, 48, 467, 1, 0, 0, 0, 50, 469, 1, 0, 0, 0, 52, 53, 3, 2, 1, 0, 53, 54, 5, 0, 0, 1, 54, 1, 1, 0, 0, 0, 55, 56, 3, 4, 2, 0, 56, 3, 1, 0, 0, 0, 57, 59, 3, 6, 3, 0, 58, 57, 1, 0, 0, 0, 59, 62, 1, 0, 0, 0, 60, 58, 1, 0, 0, 0, 60, 61, 1, 0, 0, 0, 61, 64, 1, 0, 0, 0, 62, 60, 1, 0, 0, 0, 63, 65, 3, 12, 6, 0, 64, 63, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 5, 1, 0, 0, 0, 66, 148, 5, 1, 0, 0, 67, 68, 3, 18, 9, 0, 68, 69, 5, 2, 0, 0, 69, 70, 3, 22, 11, 0, 70, 148, 1, 0, 0, 0, 71, 148, 3, 30, 15, 0, 72, 148, 3, 14, 7, 0, 73, 148, 5, 3, 0, 0, 74, 75, 5, 4, 0, 0, 75, 148, 5, 57, 0, 0, 76, 77, 5, 5, 0, 0, 77, 78, 3, 4, 2, 0, 78, 79, 5, 6, 0, 0, 79, 148, 1, 0, 0, 0, 80, 81, 5, 7, 0, 0, 81, 82, 3, 24, 12, 0, 82, 83, 5, 5, 0, 0, 83, 84, 3, 4, 2, 0, 84, 85, 5, 6, 0, 0, 85, 148, 1, 0, 0, 0, 86, 87, 5, 8, 0, 0, 87, 88, 3, 4, 2, 0, 88, 89, 5, 9, 0, 0, 89, 90, 3, 24, 12, 0, 90, 148, 1, 0, 0, 0, 91, 92, 5, 10, 0, 0, 92, 93, 3, 24, 12, 0, 93, 94, 5, 11, 0, 0, 94, 102, 3, 4, 2, 0, 95, 96, 5, 12, 0, 0, 96, 97, 3, 24, 12, 0, 97, 98, 5, 11, 0, 0, 98, 99, 3, 4, 2, 0, 99, 101, 1, 0, 0, 0, 100, 95, 1, 0, 0, 0, 101, 104, 1, 0, 0, 0, 102, 100, 1, 0, 0, 0, 102, 103, 1, 0, 0, 0, 103, 107, 1, 0, 0, 0, 104, 102, 1, 0, 0, 0, 105, 106, 5, 13, 0, 0, 106, 108, 3, 4, 2, 0, 107, 105, 1, 0, 0, 0, 107, 108, 1, 0, 0, 0, 108, 109, 1, 0, 0, 0, 109, 110, 5, 6, 0, 0, 110, 148, 1, 0, 0, 0, 111, 112, 5, 14, 0, 0, 112, 113, 5, 57, 0, 0, 113, 114, 5, 2, 0, 0, 114, 115, 3, 24, 12, 0, 115, 116, 5, 15, 0, 0, 116, 119, 3, 24, 12, 0, 117, 118, 5, 15, 0, 0, 118, 120, 3, 24, 12, 0, 119, 117, 1, 0, 0, 0, 119, 120, 1, 0, 0, 0, 120, 121, 1, 0, 0, 0, 121, 122, 5, 5, 0, 0, 122, 123, 3, 4, 2, 0, 123, 124, 5, 6, 0, 0, 124, 148, 1, 0, 0, 0, 125, 126, 5, 14, 0, 0, 126, 127, 3, 20, 10, 0, 127, 128, 5, 16, 0, 0, 128, 129, 3, 22, 11, 0, 129, 130, 5, 5, 0, 0, 130, 131, 3, 4, 2, 0, 131, 132, 5, 6, 0, 0, 132, 148, 1, 0, 0, 0, 133, 134, 5, 17, 0, 0, 134, 135, 3, 16, 8, 0, 135, 136, 3, 36, 18, 0, 136, 148, 1, 0, 0, 0, 137, 138, 5, 18, 0, 0, 138, 139, 5, 17, 0, 0, 139, 140, 5, 57, 0, 0, 140, 148, 3, 36, 18, 0, 141, 142, 5, 18, 0, 0, 142, 145, 3, 8, 4, 0, 143, 144, 5, 2, 0, 0, 144, 146, 3, 22, 11, 0, 145, 143, 1, 0, 0, 0, 145, 146, 1, 0, 0, 0, 146, 148, 1, 0, 0, 0, 147, 66, 1, 0, 0, 0, 147, 67, 1, 0, 0, 0, 147, 71, 1, 0, 0, 0, 147, 72, 1, 0, 0, 0, 147, 73, 1, 0, 0, 0, 147, 74, 1, 0, 0, 0, 147, 76, 1, 0, 0, 0, 147, 80, 1, 0, 0, 0, 147, 86, 1, 0, 0, 0, 147, 91, 1, 0, 0, 0, 147, 111, 1, 0, 0, 0, 147, 125, 1, 0, 0, 0, 147, 133, 1, 0, 0, 0, 147, 137, 1, 0, 0, 0, 147, 141, 1, 0, 0, 0, 148, 7, 1, 0, 0, 0, 149, 150, 5, 57, 0, 0, 150, 156, 3, 10, 5, 0, 151, 152, 5, 15, 0, 0, 152, 153, 5, 57, 0, 0, 153, 155, 3, 10, 5, 0, 154, 151, 1, 0, 0, 0, 155, 158, 1, 0, 0, 0, 156, 154, 1, 0, 0, 0, 156, 157, 1, 0, 0, 0, 157, 9, 1, 0, 0, 0, 158, 156, 1, 0, 0, 0, 159, 160, 5, 19, 0, 0, 160, 161, 5, 57, 0, 0, 161, 163, 5, 20, 0, 0, 162, 159, 1, 0, 0, 0, 162, 163, 1, 0, 0, 0, 163, 11, 1, 0, 0, 0, 164, 166, 5, 21, 0, 0, 165, 167, 3, 22, 11, 0, 166, 165, 1, 0, 0, 0, 166, 167, 1, 0, 0, 0, 167, 171, 1, 0, 0, 0, 168, 171, 5, 3, 0, 0, 169, 171, 5, 22, 0, 0, 170, 164, 1, 0, 0, 0, 170, 168, 1, 0, 0, 0, 170, 169, 1, 0, 0, 0, 171, 173, 1, 0, 0, 0, 172, 174, 5, 1, 0, 0, 173, 172, 1, 0, 0, 0, 173, 174, 1, 0, 0, 0, 174, 13, 1, 0, 0, 0, 175, 176, 5, 23, 0, 0, 176, 177, 5, 57, 0, 0, 177, 178, 5, 23, 0, 0, 178, 15, 1, 0, 0, 0, 179, 184, 5, 57, 0, 0, 180, 181, 5, 27, 0, 0, 181, 183, 5, 57, 0, 0, 182, 180, 1, 0, 0, 0, 183, 186, 1, 0, 0, 0, 184, 182, 1, 0, 0, 0, 184, 185, 1, 0, 0, 0, 185, 189, 1, 0, 0, 0, 186, 184, 1, 0, 0, 0, 187, 188, 5, 39, 0, 0, 188, 190, 5, 57, 0, 0, 189, 187, 1, 0, 0, 0, 189, 190, 1, 0, 0, 0, 190, 17, 1, 0, 0, 0, 191, 196, 3, 26, 13, 0, 192, 193, 5, 15, 0, 0, 193, 195, 3, 26, 13, 0, 194, 192, 1, 0, 0, 0, 195, 198, 1, 0, 0, 0, 196, 194, 1, 0, 0, 0, 196, 197, 1, 0, 0, 0, 197, 19, 1, 0, 0, 0, 198, 196, 1, 0, 0, 0, 199, 204, 5, 57, 0, 0, 200, 201, 5, 15, 0, 0, 201, 203, 5, 57, 0, 0, 202, 200, 1, 0, 0, 0, 203, 206, 1, 0, 0, 0, 204, 202, 1, 0, 0, 0, 204, 205, 1, 0, 0, 0, 205, 21, 1, 0, 0, 0, 206, 204, 1, 0, 0, 0, 207, 212, 3, 24, 12, 0, 208, 209, 5, 15, 0, 0, 209, 211, 3, 24, 12, 0, 210, 208, 1, 0, 0, 0, 211, 214, 1, 0, 0, 0, 212, 210, 1, 0, 0, 0, 212, 213, 1, 0, 0, 0, 213, 23, 1, 0, 0, 0, 214, 212, 1, 0, 0, 0, 215, 216, 6, 12, -1, 0, 216, 228, 5, 24, 0, 0, 217, 228, 5, 25, 0, 0, 218, 228, 5, 26, 0, 0, 219, 228, 3, 48, 24, 0, 220, 228, 3, 50, 25, 0, 221, 228, 5, 55, 0, 0, 222, 228, 3, 34, 17, 0, 223, 228, 3, 28, 14, 0, 224, 228, 3, 40, 20, 0, 225, 226, 7, 0, 0, 0, 226, 228, 3, 24, 12, 8, 227, 215, 1, 0, 0, 0, 227, 217, 1, 0, 0, 0, 227, 218, 1, 0, 0, 0, 227, 219, 1, 0, 0, 0, 227, 220, 1, 0, 0, 0, 227, 221, 1, 0, 0, 0, 227, 222, 1, 0, 0, 0, 227, 223, 1, 0, 0, 0, 227, 224, 1, 0, 0, 0, 227, 225, 1, 0, 0, 0, 228, 255, 1, 0, 0, 0, 229, 230, 10, 9, 0, 0, 230, 231, 5, 53, 0, 0, 231, 254, 3, 24, 12, 9, 232, 233, 10, 7, 0, 0, 233, 234, 7, 1, 0, 0, 234, 254, 3, 24, 12, 8, 235, 236, 10, 6, 0, 0, 236, 237, 7, 2, 0, 0, 237, 254, 3, 24, 12, 7, 238, 239, 10, 5, 0, 0, 239, 240, 5, 51, 0, 0, 240, 254, 3, 24, 12, 5, 241, 242, 10, 4, 0, 0, 242, 243, 7, 3, 0, 0, 243, 254, 3, 24, 12, 5, 244, 245, 10, 3, 0, 0, 245, 246, 5, 42, 0, 0, 246, 254, 3, 24, 12, 4, 247, 248, 10, 2, 0, 0, 248, 249, 5, 43, 0, 0, 249, 254, 3, 24, 12, 3, 250, 251, 10, 1, 0, 0, 251, 252, 7, 4, 0, 0, 252, 254, 3, 24, 12, 2, 253, 229, 1, 0, 0, 0, 253, 232, 1, 0, 0, 0, 253, 235, 1, 0, 0, 0, 253, 238, 1, 0, 0, 0, 253, 241, 1, 0, 0, 0, 253, 244, 1, 0, 0, 0, 253, 247, 1, 0, 0, 0, 253, 250, 1, 0, 0, 0, 254, 257, 1, 0, 0, 0, 255, 253, 1, 0, 0, 0, 255, 256, 1, 0, 0, 0, 256, 25, 1, 0, 0, 0, 257, 255, 1, 0, 0, 0, 258, 269, 5, 57, 0, 0, 259, 266, 3, 28, 14, 0, 260, 261, 5, 48, 0, 0, 261, 262, 3, 24, 12, 0, 262, 263, 5, 49, 0, 0, 263, 267, 1, 0, 0, 0, 264, 265, 5, 27, 0, 0, 265, 267, 5, 57, 0, 0, 266, 260, 1, 0, 0, 0, 266, 264, 1, 0, 0, 0, 267, 269, 1, 0, 0, 0, 268, 258, 1, 0, 0, 0, 268, 259, 1, 0, 0, 0, 269, 27, 1, 0, 0, 0, 270, 279, 5, 57, 0, 0, 271, 272, 5, 48, 0, 0, 272, 273, 3, 24, 12, 0, 273, 274, 5, 49, 0, 0, 274, 278, 1, 0, 0, 0, 275, 276, 5, 27, 0, 0, 276, 278, 5, 57, 0, 0, 277, 271, 1, 0, 0, 0, 277, 275, 1, 0, 0, 0, 278, 281, 1, 0, 0, 0, 279, 277, 1, 0, 0, 0, 279, 280, 1, 0, 0, 0, 280, 309, 1, 0, 0, 0, 281, 279, 1, 0, 0, 0, 282, 291, 3, 30, 15, 0, 283, 284, 5, 48, 0, 0, 284, 285, 3, 24, 12, 0, 285, 286, 5, 49, 0, 0, 286, 290, 1, 0, 0, 0, 287, 288, 5, 27, 0, 0, 288, 290, 5, 57, 0, 0, 289, 283, 1, 0, 0, 0, 289, 287, 1, 0, 0, 0, 290, 293, 1, 0, 0, 0, 291, 289, 1, 0, 0, 0, 291, 292, 1, 0, 0, 0, 292, 309, 1, 0, 0, 0, 293, 291, 1, 0, 0, 0, 294, 295, 5, 31, 0, 0, 295, 296, 3, 24, 12, 0, 296, 305, 5, 32, 0, 0, 297, 298, 5, 48, 0, 0, 298, 299, 3, 24, 12, 0, 299, 300, 5, 49, 0, 0, 300, 304, 1, 0, 0, 0, 301, 302, 5, 27, 0, 0, 302, 304, 5, 57, 0, 0, 303, 297, 1, 0, 0, 0, 303, 301, 1, 0, 0, 0, 304, 307, 1, 0, 0, 0, 305, 303, 1, 0, 0, 0, 305, 306, 1, 0, 0, 0, 306, 309, 1, 0, 0, 0, 307, 305, 1, 0, 0, 0, 308, 270, 1, 0, 0, 0, 308, 282, 1, 0, 0, 0, 308, 294, 1, 0, 0, 0, 309, 29, 1, 0, 0, 0, 310, 311, 6, 15, -1, 0, 311, 320, 5, 57, 0, 0, 312, 313, 5, 48, 0, 0, 313, 314, 3, 24, 12, 0, 314, 315, 5, 49, 0, 0, 315, 319, 1, 0, 0, 0, 316, 317, 5, 27, 0, 0, 317, 319, 5, 57, 0, 0, 318, 312, 1, 0, 0, 0, 318, 316, 1, 0, 0, 0, 319, 322, 1, 0, 0, 0, 320, 318, 1, 0, 0, 0, 320, 321, 1, 0, 0, 0, 321, 323, 1, 0, 0, 0, 322, 320, 1, 0, 0, 0, 323, 374, 3, 32, 16, 0, 324, 325, 5, 31, 0, 0, 325, 326, 3, 24, 12, 0, 326, 335, 5, 32, 0, 0, 327, 328, 5, 48, 0, 0, 328, 329, 3, 24, 12, 0, 329, 330, 5, 49, 0, 0, 330, 334, 1, 0, 0, 0, 331, 332, 5, 27, 0, 0, 332, 334, 5, 57, 0, 0, 333, 327, 1, 0, 0, 0, 333, 331, 1, 0, 0, 0, 334, 337, 1, 0, 0, 0, 335, 333, 1, 0, 0, 0, 335, 336, 1, 0, 0, 0, 336, 338, 1, 0, 0, 0, 337, 335, 1, 0, 0, 0, 338, 339, 3, 32, 16, 0, 339, 374, 1, 0, 0, 0, 340, 349, 5, 57, 0, 0, 341, 342, 5, 48, 0, 0, 342, 343, 3, 24, 12, 0, 343, 344, 5, 49, 0, 0, 344, 348, 1, 0, 0, 0, 345, 346, 5, 27, 0, 0, 346, 348, 5, 57, 0, 0, 347, 341, 1, 0, 0, 0, 347, 345, 1, 0, 0, 0, 348, 351, 1, 0, 0, 0, 349, 347, 1, 0, 0, 0, 349, 350, 1, 0, 0, 0, 350, 352, 1, 0, 0, 0, 351, 349, 1, 0, 0, 0, 352, 353, 5, 39, 0, 0, 353, 354, 5, 57, 0, 0, 354, 374, 3, 32, 16, 0, 355, 356, 5, 31, 0, 0, 356, 357, 3, 24, 12, 0, 357, 366, 5, 32, 0, 0, 358, 359, 5, 48, 0, 0, 359, 360, 3, 24, 12, 0, 360, 361, 5, 49, 0, 0, 361, 365, 1, 0, 0, 0, 362, 363, 5, 27, 0, 0, 363, 365, 5, 57, 0, 0, 364, 358, 1, 0, 0, 0, 364, 362, 1, 0, 0, 0, 365, 368, 1, 0, 0, 0, 366, 364, 1, 0, 0, 0, 366, 367, 1, 0, 0, 0, 367, 369, 1, 0, 0, 0, 368, 366, 1, 0, 0, 0, 369, 370, 5, 39, 0, 0, 370, 371, 5, 57, 0, 0, 371, 372, 3, 32, 16, 0, 372, 374, 1, 0, 0, 0, 373, 310, 1, 0, 0, 0, 373, 324, 1, 0, 0, 0, 373, 340, 1, 0, 0, 0, 373, 355, 1, 0, 0, 0, 374, 405, 1, 0, 0, 0, 375, 384, 10, 5, 0, 0, 376, 377, 5, 48, 0, 0, 377, 378, 3, 24, 12, 0, 378, 379, 5, 49, 0, 0, 379, 383, 1, 0, 0, 0, 380, 381, 5, 27, 0, 0, 381, 383, 5, 57, 0, 0, 382, 376, 1, 0, 0, 0, 382, 380, 1, 0, 0, 0, 383, 386, 1, 0, 0, 0, 384, 382, 1, 0, 0, 0, 384, 385, 1, 0, 0, 0, 385, 387, 1, 0, 0, 0, 386, 384, 1, 0, 0, 0, 387, 404, 3, 32, 16, 0, 388, 397, 10, 2, 0, 0, 389, 390, 5, 48, 0, 0, 390, 391, 3, 24, 12, 0, 391, 392, 5, 49, 0, 0, 392, 396, 1, 0, 0, 0, 393, 394, 5, 27, 0, 0, 394, 396, 5, 57, 0, 0, 395, 389, 1, 0, 0, 0, 395, 393, 1, 0, 0, 0, 396, 399, 1, 0, 0, 0, 397, 395, 1, 0, 0, 0, 397, 398, 1, 0, 0, 0, 398, 400, 1, 0, 0, 0, 399, 397, 1, 0, 0, 0, 400, 401, 5, 39, 0, 0, 401, 402, 5, 57, 0, 0, 402, 404, 3, 32, 16, 0, 403, 375, 1, 0, 0, 0, 403, 388, 1, 0, 0, 0, 404, 407, 1, 0, 0, 0, 405, 403, 1, 0, 0, 0, 405, 406, 1, 0, 0, 0, 406, 31, 1, 0, 0, 0, 407, 405, 1, 0, 0, 0, 408, 410, 5, 31, 0, 0, 409, 411, 3, 22, 11, 0, 410, 409, 1, 0, 0, 0, 410, 411, 1, 0, 0, 0, 411, 412, 1, 0, 0, 0, 412, 416, 5, 32, 0, 0, 413, 416, 3, 40, 20, 0, 414, 416, 3, 50, 25, 0, 415, 408, 1, 0, 0, 0, 415, 413, 1, 0, 0, 0, 415, 414, 1, 0, 0, 0, 416, 33, 1, 0, 0, 0, 417, 418, 5, 17, 0, 0, 418, 419, 3, 36, 18, 0, 419, 35, 1, 0, 0, 0, 420, 421, 5, 31, 0, 0, 421, 422, 3, 38, 19, 0, 422, 423, 5, 32, 0, 0, 423, 424, 3, 4, 2, 0, 424, 425, 5, 6, 0, 0, 425, 37, 1, 0, 0, 0, 426, 429, 3, 20, 10, 0, 427, 428, 5, 15, 0, 0, 428, 430, 5, 55, 0, 0, 429, 427, 1, 0, 0, 0, 429, 430, 1, 0, 0, 0, 430, 434, 1, 0, 0, 0, 431, 434, 5, 55, 0, 0, 432, 434, 1, 0, 0, 0, 433, 426, 1, 0, 0, 0, 433, 431, 1, 0, 0, 0, 433, 432, 1, 0, 0, 0, 434, 39, 1, 0, 0, 0, 435, 437, 5, 46, 0, 0, 436, 438, 3, 42, 21, 0, 437, 436, 1, 0, 0, 0, 437, 438, 1, 0, 0, 0, 438, 439, 1, 0, 0, 0, 439, 440, 5, 47, 0, 0, 440, 41, 1, 0, 0, 0, 441, 447, 3, 44, 22, 0, 442, 443, 3, 46, 23, 0, 443, 444, 3, 44, 22, 0, 444, 446, 1, 0, 0, 0, 445, 442, 1, 0, 0, 0, 446, 449, 1, 0, 0, 0, 447, 445, 1, 0, 0, 0, 447, 448, 1, 0, 0, 0, 448, 451, 1, 0, 0, 0, 449, 447, 1, 0, 0, 0, 450, 452, 3, 46, 23, 0, 451, 450, 1, 0, 0, 0, 451, 452, 1, 0, 0, 0, 452, 43, 1, 0, 0, 0, 453, 454, 5, 48, 0, 0, 454, 455, 3, 24, 12, 0, 455, 456, 5, 49, 0, 0, 456, 457, 5, 2, 0, 0, 457, 458, 3, 24, 12, 0, 458, 464, 1, 0, 0, 0, 459, 460, 5, 57, 0, 0, 460, 461, 5, 2, 0, 0, 461, 464, 3, 24, 12, 0, 462, 464, 3, 24, 12, 0, 463, 453, 1, 0, 0, 0, 463, 459, 1, 0, 0, 0, 463, 462, 1, 0, 0, 0, 464, 45, 1, 0, 0, 0, 465, 466, 7, 5, 0, 0, 466, 47, 1, 0, 0, 0, 467, 468, 7, 6, 0, 0, 468, 49, 1, 0, 0, 0, 469, 470, 7, 7, 0, 0, 470, 51, 1, 0, 0, 0, 52, 60, 64, 102, 107, 119, 145, 147, 156, 162, 166, 170, 173, 184, 189, 196, 204, 212, 227, 253, 255, 266, 268, 277, 279, 289, 291, 303, 305, 308, 318, 320, 333, 335, 347, 349, 364, 366, 373, 382, 384, 395, 397, 403, 405, 410, 415, 429, 433, 437, 447, 451, 463] \ No newline at end of file +[4, 1, 68, 435, 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, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 5, 2, 85, 8, 2, 10, 2, 12, 2, 88, 9, 2, 1, 2, 3, 2, 91, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 108, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 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, 5, 9, 141, 8, 9, 10, 9, 12, 9, 144, 9, 9, 1, 9, 1, 9, 3, 9, 148, 8, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 160, 8, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 187, 8, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 194, 8, 15, 10, 15, 12, 15, 197, 9, 15, 1, 16, 1, 16, 1, 16, 3, 16, 202, 8, 16, 1, 17, 1, 17, 3, 17, 206, 8, 17, 1, 17, 1, 17, 3, 17, 210, 8, 17, 1, 17, 3, 17, 213, 8, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 5, 19, 222, 8, 19, 10, 19, 12, 19, 225, 9, 19, 1, 19, 1, 19, 3, 19, 229, 8, 19, 1, 20, 1, 20, 1, 20, 5, 20, 234, 8, 20, 10, 20, 12, 20, 237, 9, 20, 1, 21, 1, 21, 1, 21, 5, 21, 242, 8, 21, 10, 21, 12, 21, 245, 9, 21, 1, 22, 1, 22, 1, 22, 5, 22, 250, 8, 22, 10, 22, 12, 22, 253, 9, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 3, 23, 267, 8, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 5, 23, 293, 8, 23, 10, 23, 12, 23, 296, 9, 23, 1, 24, 1, 24, 1, 24, 1, 24, 3, 24, 302, 8, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 3, 25, 314, 8, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 3, 26, 341, 8, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 5, 26, 353, 8, 26, 10, 26, 12, 26, 356, 9, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 3, 27, 364, 8, 27, 1, 28, 5, 28, 367, 8, 28, 10, 28, 12, 28, 370, 9, 28, 1, 29, 1, 29, 3, 29, 374, 8, 29, 1, 29, 1, 29, 1, 29, 3, 29, 379, 8, 29, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 3, 32, 393, 8, 32, 1, 32, 1, 32, 3, 32, 397, 8, 32, 1, 33, 1, 33, 3, 33, 401, 8, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 5, 34, 409, 8, 34, 10, 34, 12, 34, 412, 9, 34, 1, 34, 3, 34, 415, 8, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 3, 35, 427, 8, 35, 1, 36, 1, 36, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 0, 2, 46, 52, 39, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 0, 8, 2, 0, 28, 30, 33, 33, 3, 0, 37, 38, 45, 45, 54, 54, 2, 0, 29, 29, 44, 44, 4, 0, 19, 20, 40, 41, 50, 50, 56, 56, 3, 0, 28, 28, 34, 36, 52, 52, 2, 0, 1, 1, 15, 15, 1, 0, 61, 64, 1, 0, 58, 60, 464, 0, 78, 1, 0, 0, 0, 2, 81, 1, 0, 0, 0, 4, 86, 1, 0, 0, 0, 6, 107, 1, 0, 0, 0, 8, 109, 1, 0, 0, 0, 10, 113, 1, 0, 0, 0, 12, 116, 1, 0, 0, 0, 14, 120, 1, 0, 0, 0, 16, 126, 1, 0, 0, 0, 18, 131, 1, 0, 0, 0, 20, 151, 1, 0, 0, 0, 22, 165, 1, 0, 0, 0, 24, 173, 1, 0, 0, 0, 26, 177, 1, 0, 0, 0, 28, 182, 1, 0, 0, 0, 30, 188, 1, 0, 0, 0, 32, 201, 1, 0, 0, 0, 34, 209, 1, 0, 0, 0, 36, 214, 1, 0, 0, 0, 38, 218, 1, 0, 0, 0, 40, 230, 1, 0, 0, 0, 42, 238, 1, 0, 0, 0, 44, 246, 1, 0, 0, 0, 46, 266, 1, 0, 0, 0, 48, 301, 1, 0, 0, 0, 50, 313, 1, 0, 0, 0, 52, 340, 1, 0, 0, 0, 54, 363, 1, 0, 0, 0, 56, 368, 1, 0, 0, 0, 58, 378, 1, 0, 0, 0, 60, 380, 1, 0, 0, 0, 62, 383, 1, 0, 0, 0, 64, 396, 1, 0, 0, 0, 66, 398, 1, 0, 0, 0, 68, 404, 1, 0, 0, 0, 70, 426, 1, 0, 0, 0, 72, 428, 1, 0, 0, 0, 74, 430, 1, 0, 0, 0, 76, 432, 1, 0, 0, 0, 78, 79, 3, 2, 1, 0, 79, 80, 5, 0, 0, 1, 80, 1, 1, 0, 0, 0, 81, 82, 3, 4, 2, 0, 82, 3, 1, 0, 0, 0, 83, 85, 3, 6, 3, 0, 84, 83, 1, 0, 0, 0, 85, 88, 1, 0, 0, 0, 86, 84, 1, 0, 0, 0, 86, 87, 1, 0, 0, 0, 87, 90, 1, 0, 0, 0, 88, 86, 1, 0, 0, 0, 89, 91, 3, 34, 17, 0, 90, 89, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 5, 1, 0, 0, 0, 92, 108, 5, 1, 0, 0, 93, 108, 3, 8, 4, 0, 94, 108, 3, 52, 26, 0, 95, 108, 3, 36, 18, 0, 96, 108, 5, 3, 0, 0, 97, 108, 3, 10, 5, 0, 98, 108, 3, 12, 6, 0, 99, 108, 3, 14, 7, 0, 100, 108, 3, 16, 8, 0, 101, 108, 3, 18, 9, 0, 102, 108, 3, 20, 10, 0, 103, 108, 3, 22, 11, 0, 104, 108, 3, 24, 12, 0, 105, 108, 3, 26, 13, 0, 106, 108, 3, 28, 14, 0, 107, 92, 1, 0, 0, 0, 107, 93, 1, 0, 0, 0, 107, 94, 1, 0, 0, 0, 107, 95, 1, 0, 0, 0, 107, 96, 1, 0, 0, 0, 107, 97, 1, 0, 0, 0, 107, 98, 1, 0, 0, 0, 107, 99, 1, 0, 0, 0, 107, 100, 1, 0, 0, 0, 107, 101, 1, 0, 0, 0, 107, 102, 1, 0, 0, 0, 107, 103, 1, 0, 0, 0, 107, 104, 1, 0, 0, 0, 107, 105, 1, 0, 0, 0, 107, 106, 1, 0, 0, 0, 108, 7, 1, 0, 0, 0, 109, 110, 3, 40, 20, 0, 110, 111, 5, 2, 0, 0, 111, 112, 3, 44, 22, 0, 112, 9, 1, 0, 0, 0, 113, 114, 5, 4, 0, 0, 114, 115, 5, 57, 0, 0, 115, 11, 1, 0, 0, 0, 116, 117, 5, 5, 0, 0, 117, 118, 3, 4, 2, 0, 118, 119, 5, 6, 0, 0, 119, 13, 1, 0, 0, 0, 120, 121, 5, 7, 0, 0, 121, 122, 3, 46, 23, 0, 122, 123, 5, 5, 0, 0, 123, 124, 3, 4, 2, 0, 124, 125, 5, 6, 0, 0, 125, 15, 1, 0, 0, 0, 126, 127, 5, 8, 0, 0, 127, 128, 3, 4, 2, 0, 128, 129, 5, 9, 0, 0, 129, 130, 3, 46, 23, 0, 130, 17, 1, 0, 0, 0, 131, 132, 5, 10, 0, 0, 132, 133, 3, 46, 23, 0, 133, 134, 5, 11, 0, 0, 134, 142, 3, 4, 2, 0, 135, 136, 5, 12, 0, 0, 136, 137, 3, 46, 23, 0, 137, 138, 5, 11, 0, 0, 138, 139, 3, 4, 2, 0, 139, 141, 1, 0, 0, 0, 140, 135, 1, 0, 0, 0, 141, 144, 1, 0, 0, 0, 142, 140, 1, 0, 0, 0, 142, 143, 1, 0, 0, 0, 143, 147, 1, 0, 0, 0, 144, 142, 1, 0, 0, 0, 145, 146, 5, 13, 0, 0, 146, 148, 3, 4, 2, 0, 147, 145, 1, 0, 0, 0, 147, 148, 1, 0, 0, 0, 148, 149, 1, 0, 0, 0, 149, 150, 5, 6, 0, 0, 150, 19, 1, 0, 0, 0, 151, 152, 5, 14, 0, 0, 152, 153, 5, 57, 0, 0, 153, 154, 5, 2, 0, 0, 154, 155, 3, 46, 23, 0, 155, 156, 5, 15, 0, 0, 156, 159, 3, 46, 23, 0, 157, 158, 5, 15, 0, 0, 158, 160, 3, 46, 23, 0, 159, 157, 1, 0, 0, 0, 159, 160, 1, 0, 0, 0, 160, 161, 1, 0, 0, 0, 161, 162, 5, 5, 0, 0, 162, 163, 3, 4, 2, 0, 163, 164, 5, 6, 0, 0, 164, 21, 1, 0, 0, 0, 165, 166, 5, 14, 0, 0, 166, 167, 3, 42, 21, 0, 167, 168, 5, 16, 0, 0, 168, 169, 3, 44, 22, 0, 169, 170, 5, 5, 0, 0, 170, 171, 3, 4, 2, 0, 171, 172, 5, 6, 0, 0, 172, 23, 1, 0, 0, 0, 173, 174, 5, 17, 0, 0, 174, 175, 3, 38, 19, 0, 175, 176, 3, 62, 31, 0, 176, 25, 1, 0, 0, 0, 177, 178, 5, 18, 0, 0, 178, 179, 5, 17, 0, 0, 179, 180, 5, 57, 0, 0, 180, 181, 3, 62, 31, 0, 181, 27, 1, 0, 0, 0, 182, 183, 5, 18, 0, 0, 183, 186, 3, 42, 21, 0, 184, 185, 5, 2, 0, 0, 185, 187, 3, 44, 22, 0, 186, 184, 1, 0, 0, 0, 186, 187, 1, 0, 0, 0, 187, 29, 1, 0, 0, 0, 188, 189, 5, 57, 0, 0, 189, 195, 3, 32, 16, 0, 190, 191, 5, 15, 0, 0, 191, 192, 5, 57, 0, 0, 192, 194, 3, 32, 16, 0, 193, 190, 1, 0, 0, 0, 194, 197, 1, 0, 0, 0, 195, 193, 1, 0, 0, 0, 195, 196, 1, 0, 0, 0, 196, 31, 1, 0, 0, 0, 197, 195, 1, 0, 0, 0, 198, 199, 5, 19, 0, 0, 199, 200, 5, 57, 0, 0, 200, 202, 5, 20, 0, 0, 201, 198, 1, 0, 0, 0, 201, 202, 1, 0, 0, 0, 202, 33, 1, 0, 0, 0, 203, 205, 5, 21, 0, 0, 204, 206, 3, 44, 22, 0, 205, 204, 1, 0, 0, 0, 205, 206, 1, 0, 0, 0, 206, 210, 1, 0, 0, 0, 207, 210, 5, 3, 0, 0, 208, 210, 5, 22, 0, 0, 209, 203, 1, 0, 0, 0, 209, 207, 1, 0, 0, 0, 209, 208, 1, 0, 0, 0, 210, 212, 1, 0, 0, 0, 211, 213, 5, 1, 0, 0, 212, 211, 1, 0, 0, 0, 212, 213, 1, 0, 0, 0, 213, 35, 1, 0, 0, 0, 214, 215, 5, 23, 0, 0, 215, 216, 5, 57, 0, 0, 216, 217, 5, 23, 0, 0, 217, 37, 1, 0, 0, 0, 218, 223, 5, 57, 0, 0, 219, 220, 5, 27, 0, 0, 220, 222, 5, 57, 0, 0, 221, 219, 1, 0, 0, 0, 222, 225, 1, 0, 0, 0, 223, 221, 1, 0, 0, 0, 223, 224, 1, 0, 0, 0, 224, 228, 1, 0, 0, 0, 225, 223, 1, 0, 0, 0, 226, 227, 5, 39, 0, 0, 227, 229, 5, 57, 0, 0, 228, 226, 1, 0, 0, 0, 228, 229, 1, 0, 0, 0, 229, 39, 1, 0, 0, 0, 230, 235, 3, 48, 24, 0, 231, 232, 5, 15, 0, 0, 232, 234, 3, 48, 24, 0, 233, 231, 1, 0, 0, 0, 234, 237, 1, 0, 0, 0, 235, 233, 1, 0, 0, 0, 235, 236, 1, 0, 0, 0, 236, 41, 1, 0, 0, 0, 237, 235, 1, 0, 0, 0, 238, 243, 5, 57, 0, 0, 239, 240, 5, 15, 0, 0, 240, 242, 5, 57, 0, 0, 241, 239, 1, 0, 0, 0, 242, 245, 1, 0, 0, 0, 243, 241, 1, 0, 0, 0, 243, 244, 1, 0, 0, 0, 244, 43, 1, 0, 0, 0, 245, 243, 1, 0, 0, 0, 246, 251, 3, 46, 23, 0, 247, 248, 5, 15, 0, 0, 248, 250, 3, 46, 23, 0, 249, 247, 1, 0, 0, 0, 250, 253, 1, 0, 0, 0, 251, 249, 1, 0, 0, 0, 251, 252, 1, 0, 0, 0, 252, 45, 1, 0, 0, 0, 253, 251, 1, 0, 0, 0, 254, 255, 6, 23, -1, 0, 255, 267, 5, 24, 0, 0, 256, 267, 5, 25, 0, 0, 257, 267, 5, 26, 0, 0, 258, 267, 3, 74, 37, 0, 259, 267, 3, 76, 38, 0, 260, 267, 5, 55, 0, 0, 261, 267, 3, 24, 12, 0, 262, 267, 3, 50, 25, 0, 263, 267, 3, 66, 33, 0, 264, 265, 7, 0, 0, 0, 265, 267, 3, 46, 23, 8, 266, 254, 1, 0, 0, 0, 266, 256, 1, 0, 0, 0, 266, 257, 1, 0, 0, 0, 266, 258, 1, 0, 0, 0, 266, 259, 1, 0, 0, 0, 266, 260, 1, 0, 0, 0, 266, 261, 1, 0, 0, 0, 266, 262, 1, 0, 0, 0, 266, 263, 1, 0, 0, 0, 266, 264, 1, 0, 0, 0, 267, 294, 1, 0, 0, 0, 268, 269, 10, 9, 0, 0, 269, 270, 5, 53, 0, 0, 270, 293, 3, 46, 23, 9, 271, 272, 10, 7, 0, 0, 272, 273, 7, 1, 0, 0, 273, 293, 3, 46, 23, 8, 274, 275, 10, 6, 0, 0, 275, 276, 7, 2, 0, 0, 276, 293, 3, 46, 23, 7, 277, 278, 10, 5, 0, 0, 278, 279, 5, 51, 0, 0, 279, 293, 3, 46, 23, 5, 280, 281, 10, 4, 0, 0, 281, 282, 7, 3, 0, 0, 282, 293, 3, 46, 23, 5, 283, 284, 10, 3, 0, 0, 284, 285, 5, 42, 0, 0, 285, 293, 3, 46, 23, 4, 286, 287, 10, 2, 0, 0, 287, 288, 5, 43, 0, 0, 288, 293, 3, 46, 23, 3, 289, 290, 10, 1, 0, 0, 290, 291, 7, 4, 0, 0, 291, 293, 3, 46, 23, 2, 292, 268, 1, 0, 0, 0, 292, 271, 1, 0, 0, 0, 292, 274, 1, 0, 0, 0, 292, 277, 1, 0, 0, 0, 292, 280, 1, 0, 0, 0, 292, 283, 1, 0, 0, 0, 292, 286, 1, 0, 0, 0, 292, 289, 1, 0, 0, 0, 293, 296, 1, 0, 0, 0, 294, 292, 1, 0, 0, 0, 294, 295, 1, 0, 0, 0, 295, 47, 1, 0, 0, 0, 296, 294, 1, 0, 0, 0, 297, 302, 5, 57, 0, 0, 298, 299, 3, 50, 25, 0, 299, 300, 3, 54, 27, 0, 300, 302, 1, 0, 0, 0, 301, 297, 1, 0, 0, 0, 301, 298, 1, 0, 0, 0, 302, 49, 1, 0, 0, 0, 303, 304, 5, 57, 0, 0, 304, 314, 3, 56, 28, 0, 305, 306, 3, 52, 26, 0, 306, 307, 3, 56, 28, 0, 307, 314, 1, 0, 0, 0, 308, 309, 5, 31, 0, 0, 309, 310, 3, 46, 23, 0, 310, 311, 5, 32, 0, 0, 311, 312, 3, 56, 28, 0, 312, 314, 1, 0, 0, 0, 313, 303, 1, 0, 0, 0, 313, 305, 1, 0, 0, 0, 313, 308, 1, 0, 0, 0, 314, 51, 1, 0, 0, 0, 315, 316, 6, 26, -1, 0, 316, 317, 5, 57, 0, 0, 317, 318, 3, 56, 28, 0, 318, 319, 3, 58, 29, 0, 319, 341, 1, 0, 0, 0, 320, 321, 5, 31, 0, 0, 321, 322, 3, 46, 23, 0, 322, 323, 5, 32, 0, 0, 323, 324, 3, 56, 28, 0, 324, 325, 3, 58, 29, 0, 325, 341, 1, 0, 0, 0, 326, 327, 5, 57, 0, 0, 327, 328, 3, 56, 28, 0, 328, 329, 5, 39, 0, 0, 329, 330, 5, 57, 0, 0, 330, 331, 3, 58, 29, 0, 331, 341, 1, 0, 0, 0, 332, 333, 5, 31, 0, 0, 333, 334, 3, 46, 23, 0, 334, 335, 5, 32, 0, 0, 335, 336, 3, 56, 28, 0, 336, 337, 5, 39, 0, 0, 337, 338, 5, 57, 0, 0, 338, 339, 3, 58, 29, 0, 339, 341, 1, 0, 0, 0, 340, 315, 1, 0, 0, 0, 340, 320, 1, 0, 0, 0, 340, 326, 1, 0, 0, 0, 340, 332, 1, 0, 0, 0, 341, 354, 1, 0, 0, 0, 342, 343, 10, 5, 0, 0, 343, 344, 3, 56, 28, 0, 344, 345, 3, 58, 29, 0, 345, 353, 1, 0, 0, 0, 346, 347, 10, 2, 0, 0, 347, 348, 3, 56, 28, 0, 348, 349, 5, 39, 0, 0, 349, 350, 5, 57, 0, 0, 350, 351, 3, 58, 29, 0, 351, 353, 1, 0, 0, 0, 352, 342, 1, 0, 0, 0, 352, 346, 1, 0, 0, 0, 353, 356, 1, 0, 0, 0, 354, 352, 1, 0, 0, 0, 354, 355, 1, 0, 0, 0, 355, 53, 1, 0, 0, 0, 356, 354, 1, 0, 0, 0, 357, 358, 5, 48, 0, 0, 358, 359, 3, 46, 23, 0, 359, 360, 5, 49, 0, 0, 360, 364, 1, 0, 0, 0, 361, 362, 5, 27, 0, 0, 362, 364, 5, 57, 0, 0, 363, 357, 1, 0, 0, 0, 363, 361, 1, 0, 0, 0, 364, 55, 1, 0, 0, 0, 365, 367, 3, 54, 27, 0, 366, 365, 1, 0, 0, 0, 367, 370, 1, 0, 0, 0, 368, 366, 1, 0, 0, 0, 368, 369, 1, 0, 0, 0, 369, 57, 1, 0, 0, 0, 370, 368, 1, 0, 0, 0, 371, 373, 5, 31, 0, 0, 372, 374, 3, 44, 22, 0, 373, 372, 1, 0, 0, 0, 373, 374, 1, 0, 0, 0, 374, 375, 1, 0, 0, 0, 375, 379, 5, 32, 0, 0, 376, 379, 3, 66, 33, 0, 377, 379, 3, 76, 38, 0, 378, 371, 1, 0, 0, 0, 378, 376, 1, 0, 0, 0, 378, 377, 1, 0, 0, 0, 379, 59, 1, 0, 0, 0, 380, 381, 5, 17, 0, 0, 381, 382, 3, 62, 31, 0, 382, 61, 1, 0, 0, 0, 383, 384, 5, 31, 0, 0, 384, 385, 3, 64, 32, 0, 385, 386, 5, 32, 0, 0, 386, 387, 3, 4, 2, 0, 387, 388, 5, 6, 0, 0, 388, 63, 1, 0, 0, 0, 389, 392, 3, 42, 21, 0, 390, 391, 5, 15, 0, 0, 391, 393, 5, 55, 0, 0, 392, 390, 1, 0, 0, 0, 392, 393, 1, 0, 0, 0, 393, 397, 1, 0, 0, 0, 394, 397, 5, 55, 0, 0, 395, 397, 1, 0, 0, 0, 396, 389, 1, 0, 0, 0, 396, 394, 1, 0, 0, 0, 396, 395, 1, 0, 0, 0, 397, 65, 1, 0, 0, 0, 398, 400, 5, 46, 0, 0, 399, 401, 3, 68, 34, 0, 400, 399, 1, 0, 0, 0, 400, 401, 1, 0, 0, 0, 401, 402, 1, 0, 0, 0, 402, 403, 5, 47, 0, 0, 403, 67, 1, 0, 0, 0, 404, 410, 3, 70, 35, 0, 405, 406, 3, 72, 36, 0, 406, 407, 3, 70, 35, 0, 407, 409, 1, 0, 0, 0, 408, 405, 1, 0, 0, 0, 409, 412, 1, 0, 0, 0, 410, 408, 1, 0, 0, 0, 410, 411, 1, 0, 0, 0, 411, 414, 1, 0, 0, 0, 412, 410, 1, 0, 0, 0, 413, 415, 3, 72, 36, 0, 414, 413, 1, 0, 0, 0, 414, 415, 1, 0, 0, 0, 415, 69, 1, 0, 0, 0, 416, 417, 5, 48, 0, 0, 417, 418, 3, 46, 23, 0, 418, 419, 5, 49, 0, 0, 419, 420, 5, 2, 0, 0, 420, 421, 3, 46, 23, 0, 421, 427, 1, 0, 0, 0, 422, 423, 5, 57, 0, 0, 423, 424, 5, 2, 0, 0, 424, 427, 3, 46, 23, 0, 425, 427, 3, 46, 23, 0, 426, 416, 1, 0, 0, 0, 426, 422, 1, 0, 0, 0, 426, 425, 1, 0, 0, 0, 427, 71, 1, 0, 0, 0, 428, 429, 7, 5, 0, 0, 429, 73, 1, 0, 0, 0, 430, 431, 7, 6, 0, 0, 431, 75, 1, 0, 0, 0, 432, 433, 7, 7, 0, 0, 433, 77, 1, 0, 0, 0, 35, 86, 90, 107, 142, 147, 159, 186, 195, 201, 205, 209, 212, 223, 228, 235, 243, 251, 266, 292, 294, 301, 313, 340, 352, 354, 363, 368, 373, 378, 392, 396, 400, 410, 414, 426] \ No newline at end of file diff --git a/luaparser/parser/LuaParser.py b/luaparser/parser/LuaParser.py index d9cd20c..e0ba3f7 100644 --- a/luaparser/parser/LuaParser.py +++ b/luaparser/parser/LuaParser.py @@ -10,184 +10,165 @@ def serializedATN(): return [ - 4,1,68,472,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, + 4,1,68,435,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,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20, - 7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,1,0,1,0,1, - 0,1,1,1,1,1,2,5,2,59,8,2,10,2,12,2,62,9,2,1,2,3,2,65,8,2,1,3,1,3, - 1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3, - 1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3, - 5,3,101,8,3,10,3,12,3,104,9,3,1,3,1,3,3,3,108,8,3,1,3,1,3,1,3,1, - 3,1,3,1,3,1,3,1,3,1,3,1,3,3,3,120,8,3,1,3,1,3,1,3,1,3,1,3,1,3,1, - 3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1, - 3,1,3,3,3,146,8,3,3,3,148,8,3,1,4,1,4,1,4,1,4,1,4,5,4,155,8,4,10, - 4,12,4,158,9,4,1,5,1,5,1,5,3,5,163,8,5,1,6,1,6,3,6,167,8,6,1,6,1, - 6,3,6,171,8,6,1,6,3,6,174,8,6,1,7,1,7,1,7,1,7,1,8,1,8,1,8,5,8,183, - 8,8,10,8,12,8,186,9,8,1,8,1,8,3,8,190,8,8,1,9,1,9,1,9,5,9,195,8, - 9,10,9,12,9,198,9,9,1,10,1,10,1,10,5,10,203,8,10,10,10,12,10,206, - 9,10,1,11,1,11,1,11,5,11,211,8,11,10,11,12,11,214,9,11,1,12,1,12, - 1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,3,12,228,8,12, - 1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12, - 1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,5,12,254, - 8,12,10,12,12,12,257,9,12,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13, - 3,13,267,8,13,3,13,269,8,13,1,14,1,14,1,14,1,14,1,14,1,14,1,14,5, - 14,278,8,14,10,14,12,14,281,9,14,1,14,1,14,1,14,1,14,1,14,1,14,1, - 14,5,14,290,8,14,10,14,12,14,293,9,14,1,14,1,14,1,14,1,14,1,14,1, - 14,1,14,1,14,1,14,5,14,304,8,14,10,14,12,14,307,9,14,3,14,309,8, - 14,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,5,15,319,8,15,10,15,12, - 15,322,9,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,5, - 15,334,8,15,10,15,12,15,337,9,15,1,15,1,15,1,15,1,15,1,15,1,15,1, - 15,1,15,1,15,5,15,348,8,15,10,15,12,15,351,9,15,1,15,1,15,1,15,1, - 15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,5,15,365,8,15,10,15,12, - 15,368,9,15,1,15,1,15,1,15,1,15,3,15,374,8,15,1,15,1,15,1,15,1,15, - 1,15,1,15,1,15,5,15,383,8,15,10,15,12,15,386,9,15,1,15,1,15,1,15, - 1,15,1,15,1,15,1,15,1,15,5,15,396,8,15,10,15,12,15,399,9,15,1,15, - 1,15,1,15,5,15,404,8,15,10,15,12,15,407,9,15,1,16,1,16,3,16,411, - 8,16,1,16,1,16,1,16,3,16,416,8,16,1,17,1,17,1,17,1,18,1,18,1,18, - 1,18,1,18,1,18,1,19,1,19,1,19,3,19,430,8,19,1,19,1,19,3,19,434,8, - 19,1,20,1,20,3,20,438,8,20,1,20,1,20,1,21,1,21,1,21,1,21,5,21,446, - 8,21,10,21,12,21,449,9,21,1,21,3,21,452,8,21,1,22,1,22,1,22,1,22, - 1,22,1,22,1,22,1,22,1,22,1,22,3,22,464,8,22,1,23,1,23,1,24,1,24, - 1,25,1,25,1,25,0,2,24,30,26,0,2,4,6,8,10,12,14,16,18,20,22,24,26, - 28,30,32,34,36,38,40,42,44,46,48,50,0,8,2,0,28,30,33,33,3,0,37,38, - 45,45,54,54,2,0,29,29,44,44,4,0,19,20,40,41,50,50,56,56,3,0,28,28, - 34,36,52,52,2,0,1,1,15,15,1,0,61,64,1,0,58,60,531,0,52,1,0,0,0,2, - 55,1,0,0,0,4,60,1,0,0,0,6,147,1,0,0,0,8,149,1,0,0,0,10,162,1,0,0, - 0,12,170,1,0,0,0,14,175,1,0,0,0,16,179,1,0,0,0,18,191,1,0,0,0,20, - 199,1,0,0,0,22,207,1,0,0,0,24,227,1,0,0,0,26,268,1,0,0,0,28,308, - 1,0,0,0,30,373,1,0,0,0,32,415,1,0,0,0,34,417,1,0,0,0,36,420,1,0, - 0,0,38,433,1,0,0,0,40,435,1,0,0,0,42,441,1,0,0,0,44,463,1,0,0,0, - 46,465,1,0,0,0,48,467,1,0,0,0,50,469,1,0,0,0,52,53,3,2,1,0,53,54, - 5,0,0,1,54,1,1,0,0,0,55,56,3,4,2,0,56,3,1,0,0,0,57,59,3,6,3,0,58, - 57,1,0,0,0,59,62,1,0,0,0,60,58,1,0,0,0,60,61,1,0,0,0,61,64,1,0,0, - 0,62,60,1,0,0,0,63,65,3,12,6,0,64,63,1,0,0,0,64,65,1,0,0,0,65,5, - 1,0,0,0,66,148,5,1,0,0,67,68,3,18,9,0,68,69,5,2,0,0,69,70,3,22,11, - 0,70,148,1,0,0,0,71,148,3,30,15,0,72,148,3,14,7,0,73,148,5,3,0,0, - 74,75,5,4,0,0,75,148,5,57,0,0,76,77,5,5,0,0,77,78,3,4,2,0,78,79, - 5,6,0,0,79,148,1,0,0,0,80,81,5,7,0,0,81,82,3,24,12,0,82,83,5,5,0, - 0,83,84,3,4,2,0,84,85,5,6,0,0,85,148,1,0,0,0,86,87,5,8,0,0,87,88, - 3,4,2,0,88,89,5,9,0,0,89,90,3,24,12,0,90,148,1,0,0,0,91,92,5,10, - 0,0,92,93,3,24,12,0,93,94,5,11,0,0,94,102,3,4,2,0,95,96,5,12,0,0, - 96,97,3,24,12,0,97,98,5,11,0,0,98,99,3,4,2,0,99,101,1,0,0,0,100, - 95,1,0,0,0,101,104,1,0,0,0,102,100,1,0,0,0,102,103,1,0,0,0,103,107, - 1,0,0,0,104,102,1,0,0,0,105,106,5,13,0,0,106,108,3,4,2,0,107,105, - 1,0,0,0,107,108,1,0,0,0,108,109,1,0,0,0,109,110,5,6,0,0,110,148, - 1,0,0,0,111,112,5,14,0,0,112,113,5,57,0,0,113,114,5,2,0,0,114,115, - 3,24,12,0,115,116,5,15,0,0,116,119,3,24,12,0,117,118,5,15,0,0,118, - 120,3,24,12,0,119,117,1,0,0,0,119,120,1,0,0,0,120,121,1,0,0,0,121, - 122,5,5,0,0,122,123,3,4,2,0,123,124,5,6,0,0,124,148,1,0,0,0,125, - 126,5,14,0,0,126,127,3,20,10,0,127,128,5,16,0,0,128,129,3,22,11, - 0,129,130,5,5,0,0,130,131,3,4,2,0,131,132,5,6,0,0,132,148,1,0,0, - 0,133,134,5,17,0,0,134,135,3,16,8,0,135,136,3,36,18,0,136,148,1, - 0,0,0,137,138,5,18,0,0,138,139,5,17,0,0,139,140,5,57,0,0,140,148, - 3,36,18,0,141,142,5,18,0,0,142,145,3,8,4,0,143,144,5,2,0,0,144,146, - 3,22,11,0,145,143,1,0,0,0,145,146,1,0,0,0,146,148,1,0,0,0,147,66, - 1,0,0,0,147,67,1,0,0,0,147,71,1,0,0,0,147,72,1,0,0,0,147,73,1,0, - 0,0,147,74,1,0,0,0,147,76,1,0,0,0,147,80,1,0,0,0,147,86,1,0,0,0, - 147,91,1,0,0,0,147,111,1,0,0,0,147,125,1,0,0,0,147,133,1,0,0,0,147, - 137,1,0,0,0,147,141,1,0,0,0,148,7,1,0,0,0,149,150,5,57,0,0,150,156, - 3,10,5,0,151,152,5,15,0,0,152,153,5,57,0,0,153,155,3,10,5,0,154, - 151,1,0,0,0,155,158,1,0,0,0,156,154,1,0,0,0,156,157,1,0,0,0,157, - 9,1,0,0,0,158,156,1,0,0,0,159,160,5,19,0,0,160,161,5,57,0,0,161, - 163,5,20,0,0,162,159,1,0,0,0,162,163,1,0,0,0,163,11,1,0,0,0,164, - 166,5,21,0,0,165,167,3,22,11,0,166,165,1,0,0,0,166,167,1,0,0,0,167, - 171,1,0,0,0,168,171,5,3,0,0,169,171,5,22,0,0,170,164,1,0,0,0,170, - 168,1,0,0,0,170,169,1,0,0,0,171,173,1,0,0,0,172,174,5,1,0,0,173, - 172,1,0,0,0,173,174,1,0,0,0,174,13,1,0,0,0,175,176,5,23,0,0,176, - 177,5,57,0,0,177,178,5,23,0,0,178,15,1,0,0,0,179,184,5,57,0,0,180, - 181,5,27,0,0,181,183,5,57,0,0,182,180,1,0,0,0,183,186,1,0,0,0,184, - 182,1,0,0,0,184,185,1,0,0,0,185,189,1,0,0,0,186,184,1,0,0,0,187, - 188,5,39,0,0,188,190,5,57,0,0,189,187,1,0,0,0,189,190,1,0,0,0,190, - 17,1,0,0,0,191,196,3,26,13,0,192,193,5,15,0,0,193,195,3,26,13,0, - 194,192,1,0,0,0,195,198,1,0,0,0,196,194,1,0,0,0,196,197,1,0,0,0, - 197,19,1,0,0,0,198,196,1,0,0,0,199,204,5,57,0,0,200,201,5,15,0,0, - 201,203,5,57,0,0,202,200,1,0,0,0,203,206,1,0,0,0,204,202,1,0,0,0, - 204,205,1,0,0,0,205,21,1,0,0,0,206,204,1,0,0,0,207,212,3,24,12,0, - 208,209,5,15,0,0,209,211,3,24,12,0,210,208,1,0,0,0,211,214,1,0,0, - 0,212,210,1,0,0,0,212,213,1,0,0,0,213,23,1,0,0,0,214,212,1,0,0,0, - 215,216,6,12,-1,0,216,228,5,24,0,0,217,228,5,25,0,0,218,228,5,26, - 0,0,219,228,3,48,24,0,220,228,3,50,25,0,221,228,5,55,0,0,222,228, - 3,34,17,0,223,228,3,28,14,0,224,228,3,40,20,0,225,226,7,0,0,0,226, - 228,3,24,12,8,227,215,1,0,0,0,227,217,1,0,0,0,227,218,1,0,0,0,227, - 219,1,0,0,0,227,220,1,0,0,0,227,221,1,0,0,0,227,222,1,0,0,0,227, - 223,1,0,0,0,227,224,1,0,0,0,227,225,1,0,0,0,228,255,1,0,0,0,229, - 230,10,9,0,0,230,231,5,53,0,0,231,254,3,24,12,9,232,233,10,7,0,0, - 233,234,7,1,0,0,234,254,3,24,12,8,235,236,10,6,0,0,236,237,7,2,0, - 0,237,254,3,24,12,7,238,239,10,5,0,0,239,240,5,51,0,0,240,254,3, - 24,12,5,241,242,10,4,0,0,242,243,7,3,0,0,243,254,3,24,12,5,244,245, - 10,3,0,0,245,246,5,42,0,0,246,254,3,24,12,4,247,248,10,2,0,0,248, - 249,5,43,0,0,249,254,3,24,12,3,250,251,10,1,0,0,251,252,7,4,0,0, - 252,254,3,24,12,2,253,229,1,0,0,0,253,232,1,0,0,0,253,235,1,0,0, - 0,253,238,1,0,0,0,253,241,1,0,0,0,253,244,1,0,0,0,253,247,1,0,0, - 0,253,250,1,0,0,0,254,257,1,0,0,0,255,253,1,0,0,0,255,256,1,0,0, - 0,256,25,1,0,0,0,257,255,1,0,0,0,258,269,5,57,0,0,259,266,3,28,14, - 0,260,261,5,48,0,0,261,262,3,24,12,0,262,263,5,49,0,0,263,267,1, - 0,0,0,264,265,5,27,0,0,265,267,5,57,0,0,266,260,1,0,0,0,266,264, - 1,0,0,0,267,269,1,0,0,0,268,258,1,0,0,0,268,259,1,0,0,0,269,27,1, - 0,0,0,270,279,5,57,0,0,271,272,5,48,0,0,272,273,3,24,12,0,273,274, - 5,49,0,0,274,278,1,0,0,0,275,276,5,27,0,0,276,278,5,57,0,0,277,271, - 1,0,0,0,277,275,1,0,0,0,278,281,1,0,0,0,279,277,1,0,0,0,279,280, - 1,0,0,0,280,309,1,0,0,0,281,279,1,0,0,0,282,291,3,30,15,0,283,284, - 5,48,0,0,284,285,3,24,12,0,285,286,5,49,0,0,286,290,1,0,0,0,287, - 288,5,27,0,0,288,290,5,57,0,0,289,283,1,0,0,0,289,287,1,0,0,0,290, - 293,1,0,0,0,291,289,1,0,0,0,291,292,1,0,0,0,292,309,1,0,0,0,293, - 291,1,0,0,0,294,295,5,31,0,0,295,296,3,24,12,0,296,305,5,32,0,0, - 297,298,5,48,0,0,298,299,3,24,12,0,299,300,5,49,0,0,300,304,1,0, - 0,0,301,302,5,27,0,0,302,304,5,57,0,0,303,297,1,0,0,0,303,301,1, - 0,0,0,304,307,1,0,0,0,305,303,1,0,0,0,305,306,1,0,0,0,306,309,1, - 0,0,0,307,305,1,0,0,0,308,270,1,0,0,0,308,282,1,0,0,0,308,294,1, - 0,0,0,309,29,1,0,0,0,310,311,6,15,-1,0,311,320,5,57,0,0,312,313, - 5,48,0,0,313,314,3,24,12,0,314,315,5,49,0,0,315,319,1,0,0,0,316, - 317,5,27,0,0,317,319,5,57,0,0,318,312,1,0,0,0,318,316,1,0,0,0,319, - 322,1,0,0,0,320,318,1,0,0,0,320,321,1,0,0,0,321,323,1,0,0,0,322, - 320,1,0,0,0,323,374,3,32,16,0,324,325,5,31,0,0,325,326,3,24,12,0, - 326,335,5,32,0,0,327,328,5,48,0,0,328,329,3,24,12,0,329,330,5,49, - 0,0,330,334,1,0,0,0,331,332,5,27,0,0,332,334,5,57,0,0,333,327,1, - 0,0,0,333,331,1,0,0,0,334,337,1,0,0,0,335,333,1,0,0,0,335,336,1, - 0,0,0,336,338,1,0,0,0,337,335,1,0,0,0,338,339,3,32,16,0,339,374, - 1,0,0,0,340,349,5,57,0,0,341,342,5,48,0,0,342,343,3,24,12,0,343, - 344,5,49,0,0,344,348,1,0,0,0,345,346,5,27,0,0,346,348,5,57,0,0,347, - 341,1,0,0,0,347,345,1,0,0,0,348,351,1,0,0,0,349,347,1,0,0,0,349, - 350,1,0,0,0,350,352,1,0,0,0,351,349,1,0,0,0,352,353,5,39,0,0,353, - 354,5,57,0,0,354,374,3,32,16,0,355,356,5,31,0,0,356,357,3,24,12, - 0,357,366,5,32,0,0,358,359,5,48,0,0,359,360,3,24,12,0,360,361,5, - 49,0,0,361,365,1,0,0,0,362,363,5,27,0,0,363,365,5,57,0,0,364,358, - 1,0,0,0,364,362,1,0,0,0,365,368,1,0,0,0,366,364,1,0,0,0,366,367, - 1,0,0,0,367,369,1,0,0,0,368,366,1,0,0,0,369,370,5,39,0,0,370,371, - 5,57,0,0,371,372,3,32,16,0,372,374,1,0,0,0,373,310,1,0,0,0,373,324, - 1,0,0,0,373,340,1,0,0,0,373,355,1,0,0,0,374,405,1,0,0,0,375,384, - 10,5,0,0,376,377,5,48,0,0,377,378,3,24,12,0,378,379,5,49,0,0,379, - 383,1,0,0,0,380,381,5,27,0,0,381,383,5,57,0,0,382,376,1,0,0,0,382, - 380,1,0,0,0,383,386,1,0,0,0,384,382,1,0,0,0,384,385,1,0,0,0,385, - 387,1,0,0,0,386,384,1,0,0,0,387,404,3,32,16,0,388,397,10,2,0,0,389, - 390,5,48,0,0,390,391,3,24,12,0,391,392,5,49,0,0,392,396,1,0,0,0, - 393,394,5,27,0,0,394,396,5,57,0,0,395,389,1,0,0,0,395,393,1,0,0, - 0,396,399,1,0,0,0,397,395,1,0,0,0,397,398,1,0,0,0,398,400,1,0,0, - 0,399,397,1,0,0,0,400,401,5,39,0,0,401,402,5,57,0,0,402,404,3,32, - 16,0,403,375,1,0,0,0,403,388,1,0,0,0,404,407,1,0,0,0,405,403,1,0, - 0,0,405,406,1,0,0,0,406,31,1,0,0,0,407,405,1,0,0,0,408,410,5,31, - 0,0,409,411,3,22,11,0,410,409,1,0,0,0,410,411,1,0,0,0,411,412,1, - 0,0,0,412,416,5,32,0,0,413,416,3,40,20,0,414,416,3,50,25,0,415,408, - 1,0,0,0,415,413,1,0,0,0,415,414,1,0,0,0,416,33,1,0,0,0,417,418,5, - 17,0,0,418,419,3,36,18,0,419,35,1,0,0,0,420,421,5,31,0,0,421,422, - 3,38,19,0,422,423,5,32,0,0,423,424,3,4,2,0,424,425,5,6,0,0,425,37, - 1,0,0,0,426,429,3,20,10,0,427,428,5,15,0,0,428,430,5,55,0,0,429, - 427,1,0,0,0,429,430,1,0,0,0,430,434,1,0,0,0,431,434,5,55,0,0,432, - 434,1,0,0,0,433,426,1,0,0,0,433,431,1,0,0,0,433,432,1,0,0,0,434, - 39,1,0,0,0,435,437,5,46,0,0,436,438,3,42,21,0,437,436,1,0,0,0,437, - 438,1,0,0,0,438,439,1,0,0,0,439,440,5,47,0,0,440,41,1,0,0,0,441, - 447,3,44,22,0,442,443,3,46,23,0,443,444,3,44,22,0,444,446,1,0,0, - 0,445,442,1,0,0,0,446,449,1,0,0,0,447,445,1,0,0,0,447,448,1,0,0, - 0,448,451,1,0,0,0,449,447,1,0,0,0,450,452,3,46,23,0,451,450,1,0, - 0,0,451,452,1,0,0,0,452,43,1,0,0,0,453,454,5,48,0,0,454,455,3,24, - 12,0,455,456,5,49,0,0,456,457,5,2,0,0,457,458,3,24,12,0,458,464, - 1,0,0,0,459,460,5,57,0,0,460,461,5,2,0,0,461,464,3,24,12,0,462,464, - 3,24,12,0,463,453,1,0,0,0,463,459,1,0,0,0,463,462,1,0,0,0,464,45, - 1,0,0,0,465,466,7,5,0,0,466,47,1,0,0,0,467,468,7,6,0,0,468,49,1, - 0,0,0,469,470,7,7,0,0,470,51,1,0,0,0,52,60,64,102,107,119,145,147, - 156,162,166,170,173,184,189,196,204,212,227,253,255,266,268,277, - 279,289,291,303,305,308,318,320,333,335,347,349,364,366,373,382, - 384,395,397,403,405,410,415,429,433,437,447,451,463 + 7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26, + 2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33, + 7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,1,0,1,0,1, + 0,1,1,1,1,1,2,5,2,85,8,2,10,2,12,2,88,9,2,1,2,3,2,91,8,2,1,3,1,3, + 1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,3,3,108,8,3, + 1,4,1,4,1,4,1,4,1,5,1,5,1,5,1,6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,7, + 1,7,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,5,9, + 141,8,9,10,9,12,9,144,9,9,1,9,1,9,3,9,148,8,9,1,9,1,9,1,10,1,10, + 1,10,1,10,1,10,1,10,1,10,1,10,3,10,160,8,10,1,10,1,10,1,10,1,10, + 1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,13, + 1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,14,3,14,187,8,14,1,15,1,15, + 1,15,1,15,1,15,5,15,194,8,15,10,15,12,15,197,9,15,1,16,1,16,1,16, + 3,16,202,8,16,1,17,1,17,3,17,206,8,17,1,17,1,17,3,17,210,8,17,1, + 17,3,17,213,8,17,1,18,1,18,1,18,1,18,1,19,1,19,1,19,5,19,222,8,19, + 10,19,12,19,225,9,19,1,19,1,19,3,19,229,8,19,1,20,1,20,1,20,5,20, + 234,8,20,10,20,12,20,237,9,20,1,21,1,21,1,21,5,21,242,8,21,10,21, + 12,21,245,9,21,1,22,1,22,1,22,5,22,250,8,22,10,22,12,22,253,9,22, + 1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,3,23, + 267,8,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23, + 1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23, + 5,23,293,8,23,10,23,12,23,296,9,23,1,24,1,24,1,24,1,24,3,24,302, + 8,24,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,3,25,314, + 8,25,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26, + 1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26, + 3,26,341,8,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26, + 5,26,353,8,26,10,26,12,26,356,9,26,1,27,1,27,1,27,1,27,1,27,1,27, + 3,27,364,8,27,1,28,5,28,367,8,28,10,28,12,28,370,9,28,1,29,1,29, + 3,29,374,8,29,1,29,1,29,1,29,3,29,379,8,29,1,30,1,30,1,30,1,31,1, + 31,1,31,1,31,1,31,1,31,1,32,1,32,1,32,3,32,393,8,32,1,32,1,32,3, + 32,397,8,32,1,33,1,33,3,33,401,8,33,1,33,1,33,1,34,1,34,1,34,1,34, + 5,34,409,8,34,10,34,12,34,412,9,34,1,34,3,34,415,8,34,1,35,1,35, + 1,35,1,35,1,35,1,35,1,35,1,35,1,35,1,35,3,35,427,8,35,1,36,1,36, + 1,37,1,37,1,38,1,38,1,38,0,2,46,52,39,0,2,4,6,8,10,12,14,16,18,20, + 22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64, + 66,68,70,72,74,76,0,8,2,0,28,30,33,33,3,0,37,38,45,45,54,54,2,0, + 29,29,44,44,4,0,19,20,40,41,50,50,56,56,3,0,28,28,34,36,52,52,2, + 0,1,1,15,15,1,0,61,64,1,0,58,60,464,0,78,1,0,0,0,2,81,1,0,0,0,4, + 86,1,0,0,0,6,107,1,0,0,0,8,109,1,0,0,0,10,113,1,0,0,0,12,116,1,0, + 0,0,14,120,1,0,0,0,16,126,1,0,0,0,18,131,1,0,0,0,20,151,1,0,0,0, + 22,165,1,0,0,0,24,173,1,0,0,0,26,177,1,0,0,0,28,182,1,0,0,0,30,188, + 1,0,0,0,32,201,1,0,0,0,34,209,1,0,0,0,36,214,1,0,0,0,38,218,1,0, + 0,0,40,230,1,0,0,0,42,238,1,0,0,0,44,246,1,0,0,0,46,266,1,0,0,0, + 48,301,1,0,0,0,50,313,1,0,0,0,52,340,1,0,0,0,54,363,1,0,0,0,56,368, + 1,0,0,0,58,378,1,0,0,0,60,380,1,0,0,0,62,383,1,0,0,0,64,396,1,0, + 0,0,66,398,1,0,0,0,68,404,1,0,0,0,70,426,1,0,0,0,72,428,1,0,0,0, + 74,430,1,0,0,0,76,432,1,0,0,0,78,79,3,2,1,0,79,80,5,0,0,1,80,1,1, + 0,0,0,81,82,3,4,2,0,82,3,1,0,0,0,83,85,3,6,3,0,84,83,1,0,0,0,85, + 88,1,0,0,0,86,84,1,0,0,0,86,87,1,0,0,0,87,90,1,0,0,0,88,86,1,0,0, + 0,89,91,3,34,17,0,90,89,1,0,0,0,90,91,1,0,0,0,91,5,1,0,0,0,92,108, + 5,1,0,0,93,108,3,8,4,0,94,108,3,52,26,0,95,108,3,36,18,0,96,108, + 5,3,0,0,97,108,3,10,5,0,98,108,3,12,6,0,99,108,3,14,7,0,100,108, + 3,16,8,0,101,108,3,18,9,0,102,108,3,20,10,0,103,108,3,22,11,0,104, + 108,3,24,12,0,105,108,3,26,13,0,106,108,3,28,14,0,107,92,1,0,0,0, + 107,93,1,0,0,0,107,94,1,0,0,0,107,95,1,0,0,0,107,96,1,0,0,0,107, + 97,1,0,0,0,107,98,1,0,0,0,107,99,1,0,0,0,107,100,1,0,0,0,107,101, + 1,0,0,0,107,102,1,0,0,0,107,103,1,0,0,0,107,104,1,0,0,0,107,105, + 1,0,0,0,107,106,1,0,0,0,108,7,1,0,0,0,109,110,3,40,20,0,110,111, + 5,2,0,0,111,112,3,44,22,0,112,9,1,0,0,0,113,114,5,4,0,0,114,115, + 5,57,0,0,115,11,1,0,0,0,116,117,5,5,0,0,117,118,3,4,2,0,118,119, + 5,6,0,0,119,13,1,0,0,0,120,121,5,7,0,0,121,122,3,46,23,0,122,123, + 5,5,0,0,123,124,3,4,2,0,124,125,5,6,0,0,125,15,1,0,0,0,126,127,5, + 8,0,0,127,128,3,4,2,0,128,129,5,9,0,0,129,130,3,46,23,0,130,17,1, + 0,0,0,131,132,5,10,0,0,132,133,3,46,23,0,133,134,5,11,0,0,134,142, + 3,4,2,0,135,136,5,12,0,0,136,137,3,46,23,0,137,138,5,11,0,0,138, + 139,3,4,2,0,139,141,1,0,0,0,140,135,1,0,0,0,141,144,1,0,0,0,142, + 140,1,0,0,0,142,143,1,0,0,0,143,147,1,0,0,0,144,142,1,0,0,0,145, + 146,5,13,0,0,146,148,3,4,2,0,147,145,1,0,0,0,147,148,1,0,0,0,148, + 149,1,0,0,0,149,150,5,6,0,0,150,19,1,0,0,0,151,152,5,14,0,0,152, + 153,5,57,0,0,153,154,5,2,0,0,154,155,3,46,23,0,155,156,5,15,0,0, + 156,159,3,46,23,0,157,158,5,15,0,0,158,160,3,46,23,0,159,157,1,0, + 0,0,159,160,1,0,0,0,160,161,1,0,0,0,161,162,5,5,0,0,162,163,3,4, + 2,0,163,164,5,6,0,0,164,21,1,0,0,0,165,166,5,14,0,0,166,167,3,42, + 21,0,167,168,5,16,0,0,168,169,3,44,22,0,169,170,5,5,0,0,170,171, + 3,4,2,0,171,172,5,6,0,0,172,23,1,0,0,0,173,174,5,17,0,0,174,175, + 3,38,19,0,175,176,3,62,31,0,176,25,1,0,0,0,177,178,5,18,0,0,178, + 179,5,17,0,0,179,180,5,57,0,0,180,181,3,62,31,0,181,27,1,0,0,0,182, + 183,5,18,0,0,183,186,3,42,21,0,184,185,5,2,0,0,185,187,3,44,22,0, + 186,184,1,0,0,0,186,187,1,0,0,0,187,29,1,0,0,0,188,189,5,57,0,0, + 189,195,3,32,16,0,190,191,5,15,0,0,191,192,5,57,0,0,192,194,3,32, + 16,0,193,190,1,0,0,0,194,197,1,0,0,0,195,193,1,0,0,0,195,196,1,0, + 0,0,196,31,1,0,0,0,197,195,1,0,0,0,198,199,5,19,0,0,199,200,5,57, + 0,0,200,202,5,20,0,0,201,198,1,0,0,0,201,202,1,0,0,0,202,33,1,0, + 0,0,203,205,5,21,0,0,204,206,3,44,22,0,205,204,1,0,0,0,205,206,1, + 0,0,0,206,210,1,0,0,0,207,210,5,3,0,0,208,210,5,22,0,0,209,203,1, + 0,0,0,209,207,1,0,0,0,209,208,1,0,0,0,210,212,1,0,0,0,211,213,5, + 1,0,0,212,211,1,0,0,0,212,213,1,0,0,0,213,35,1,0,0,0,214,215,5,23, + 0,0,215,216,5,57,0,0,216,217,5,23,0,0,217,37,1,0,0,0,218,223,5,57, + 0,0,219,220,5,27,0,0,220,222,5,57,0,0,221,219,1,0,0,0,222,225,1, + 0,0,0,223,221,1,0,0,0,223,224,1,0,0,0,224,228,1,0,0,0,225,223,1, + 0,0,0,226,227,5,39,0,0,227,229,5,57,0,0,228,226,1,0,0,0,228,229, + 1,0,0,0,229,39,1,0,0,0,230,235,3,48,24,0,231,232,5,15,0,0,232,234, + 3,48,24,0,233,231,1,0,0,0,234,237,1,0,0,0,235,233,1,0,0,0,235,236, + 1,0,0,0,236,41,1,0,0,0,237,235,1,0,0,0,238,243,5,57,0,0,239,240, + 5,15,0,0,240,242,5,57,0,0,241,239,1,0,0,0,242,245,1,0,0,0,243,241, + 1,0,0,0,243,244,1,0,0,0,244,43,1,0,0,0,245,243,1,0,0,0,246,251,3, + 46,23,0,247,248,5,15,0,0,248,250,3,46,23,0,249,247,1,0,0,0,250,253, + 1,0,0,0,251,249,1,0,0,0,251,252,1,0,0,0,252,45,1,0,0,0,253,251,1, + 0,0,0,254,255,6,23,-1,0,255,267,5,24,0,0,256,267,5,25,0,0,257,267, + 5,26,0,0,258,267,3,74,37,0,259,267,3,76,38,0,260,267,5,55,0,0,261, + 267,3,24,12,0,262,267,3,50,25,0,263,267,3,66,33,0,264,265,7,0,0, + 0,265,267,3,46,23,8,266,254,1,0,0,0,266,256,1,0,0,0,266,257,1,0, + 0,0,266,258,1,0,0,0,266,259,1,0,0,0,266,260,1,0,0,0,266,261,1,0, + 0,0,266,262,1,0,0,0,266,263,1,0,0,0,266,264,1,0,0,0,267,294,1,0, + 0,0,268,269,10,9,0,0,269,270,5,53,0,0,270,293,3,46,23,9,271,272, + 10,7,0,0,272,273,7,1,0,0,273,293,3,46,23,8,274,275,10,6,0,0,275, + 276,7,2,0,0,276,293,3,46,23,7,277,278,10,5,0,0,278,279,5,51,0,0, + 279,293,3,46,23,5,280,281,10,4,0,0,281,282,7,3,0,0,282,293,3,46, + 23,5,283,284,10,3,0,0,284,285,5,42,0,0,285,293,3,46,23,4,286,287, + 10,2,0,0,287,288,5,43,0,0,288,293,3,46,23,3,289,290,10,1,0,0,290, + 291,7,4,0,0,291,293,3,46,23,2,292,268,1,0,0,0,292,271,1,0,0,0,292, + 274,1,0,0,0,292,277,1,0,0,0,292,280,1,0,0,0,292,283,1,0,0,0,292, + 286,1,0,0,0,292,289,1,0,0,0,293,296,1,0,0,0,294,292,1,0,0,0,294, + 295,1,0,0,0,295,47,1,0,0,0,296,294,1,0,0,0,297,302,5,57,0,0,298, + 299,3,50,25,0,299,300,3,54,27,0,300,302,1,0,0,0,301,297,1,0,0,0, + 301,298,1,0,0,0,302,49,1,0,0,0,303,304,5,57,0,0,304,314,3,56,28, + 0,305,306,3,52,26,0,306,307,3,56,28,0,307,314,1,0,0,0,308,309,5, + 31,0,0,309,310,3,46,23,0,310,311,5,32,0,0,311,312,3,56,28,0,312, + 314,1,0,0,0,313,303,1,0,0,0,313,305,1,0,0,0,313,308,1,0,0,0,314, + 51,1,0,0,0,315,316,6,26,-1,0,316,317,5,57,0,0,317,318,3,56,28,0, + 318,319,3,58,29,0,319,341,1,0,0,0,320,321,5,31,0,0,321,322,3,46, + 23,0,322,323,5,32,0,0,323,324,3,56,28,0,324,325,3,58,29,0,325,341, + 1,0,0,0,326,327,5,57,0,0,327,328,3,56,28,0,328,329,5,39,0,0,329, + 330,5,57,0,0,330,331,3,58,29,0,331,341,1,0,0,0,332,333,5,31,0,0, + 333,334,3,46,23,0,334,335,5,32,0,0,335,336,3,56,28,0,336,337,5,39, + 0,0,337,338,5,57,0,0,338,339,3,58,29,0,339,341,1,0,0,0,340,315,1, + 0,0,0,340,320,1,0,0,0,340,326,1,0,0,0,340,332,1,0,0,0,341,354,1, + 0,0,0,342,343,10,5,0,0,343,344,3,56,28,0,344,345,3,58,29,0,345,353, + 1,0,0,0,346,347,10,2,0,0,347,348,3,56,28,0,348,349,5,39,0,0,349, + 350,5,57,0,0,350,351,3,58,29,0,351,353,1,0,0,0,352,342,1,0,0,0,352, + 346,1,0,0,0,353,356,1,0,0,0,354,352,1,0,0,0,354,355,1,0,0,0,355, + 53,1,0,0,0,356,354,1,0,0,0,357,358,5,48,0,0,358,359,3,46,23,0,359, + 360,5,49,0,0,360,364,1,0,0,0,361,362,5,27,0,0,362,364,5,57,0,0,363, + 357,1,0,0,0,363,361,1,0,0,0,364,55,1,0,0,0,365,367,3,54,27,0,366, + 365,1,0,0,0,367,370,1,0,0,0,368,366,1,0,0,0,368,369,1,0,0,0,369, + 57,1,0,0,0,370,368,1,0,0,0,371,373,5,31,0,0,372,374,3,44,22,0,373, + 372,1,0,0,0,373,374,1,0,0,0,374,375,1,0,0,0,375,379,5,32,0,0,376, + 379,3,66,33,0,377,379,3,76,38,0,378,371,1,0,0,0,378,376,1,0,0,0, + 378,377,1,0,0,0,379,59,1,0,0,0,380,381,5,17,0,0,381,382,3,62,31, + 0,382,61,1,0,0,0,383,384,5,31,0,0,384,385,3,64,32,0,385,386,5,32, + 0,0,386,387,3,4,2,0,387,388,5,6,0,0,388,63,1,0,0,0,389,392,3,42, + 21,0,390,391,5,15,0,0,391,393,5,55,0,0,392,390,1,0,0,0,392,393,1, + 0,0,0,393,397,1,0,0,0,394,397,5,55,0,0,395,397,1,0,0,0,396,389,1, + 0,0,0,396,394,1,0,0,0,396,395,1,0,0,0,397,65,1,0,0,0,398,400,5,46, + 0,0,399,401,3,68,34,0,400,399,1,0,0,0,400,401,1,0,0,0,401,402,1, + 0,0,0,402,403,5,47,0,0,403,67,1,0,0,0,404,410,3,70,35,0,405,406, + 3,72,36,0,406,407,3,70,35,0,407,409,1,0,0,0,408,405,1,0,0,0,409, + 412,1,0,0,0,410,408,1,0,0,0,410,411,1,0,0,0,411,414,1,0,0,0,412, + 410,1,0,0,0,413,415,3,72,36,0,414,413,1,0,0,0,414,415,1,0,0,0,415, + 69,1,0,0,0,416,417,5,48,0,0,417,418,3,46,23,0,418,419,5,49,0,0,419, + 420,5,2,0,0,420,421,3,46,23,0,421,427,1,0,0,0,422,423,5,57,0,0,423, + 424,5,2,0,0,424,427,3,46,23,0,425,427,3,46,23,0,426,416,1,0,0,0, + 426,422,1,0,0,0,426,425,1,0,0,0,427,71,1,0,0,0,428,429,7,5,0,0,429, + 73,1,0,0,0,430,431,7,6,0,0,431,75,1,0,0,0,432,433,7,7,0,0,433,77, + 1,0,0,0,35,86,90,107,142,147,159,186,195,201,205,209,212,223,228, + 235,243,251,266,292,294,301,313,340,352,354,363,368,373,378,392, + 396,400,410,414,426 ] class LuaParser ( Parser ): @@ -227,34 +208,50 @@ class LuaParser ( Parser ): RULE_chunk = 1 RULE_block = 2 RULE_stat = 3 - RULE_attnamelist = 4 - RULE_attrib = 5 - RULE_retstat = 6 - RULE_label = 7 - RULE_funcname = 8 - RULE_varlist = 9 - RULE_namelist = 10 - RULE_explist = 11 - RULE_exp = 12 - RULE_var = 13 - RULE_prefixexp = 14 - RULE_functioncall = 15 - RULE_args = 16 - RULE_functiondef = 17 - RULE_funcbody = 18 - RULE_parlist = 19 - RULE_tableconstructor = 20 - RULE_fieldlist = 21 - RULE_field = 22 - RULE_fieldsep = 23 - RULE_number = 24 - RULE_string = 25 - - ruleNames = [ "start_", "chunk", "block", "stat", "attnamelist", "attrib", + RULE_assign = 4 + RULE_goto = 5 + RULE_do = 6 + RULE_while = 7 + RULE_repeat = 8 + RULE_if = 9 + RULE_for = 10 + RULE_forin = 11 + RULE_functiondef = 12 + RULE_localfunction = 13 + RULE_localassign = 14 + RULE_attnamelist = 15 + RULE_attrib = 16 + RULE_retstat = 17 + RULE_label = 18 + RULE_funcname = 19 + RULE_varlist = 20 + RULE_namelist = 21 + RULE_explist = 22 + RULE_exp = 23 + RULE_var = 24 + RULE_prefixexp = 25 + RULE_functioncall = 26 + RULE_tail = 27 + RULE_nestedtail = 28 + RULE_args = 29 + RULE_anonfunctiondef = 30 + RULE_funcbody = 31 + RULE_parlist = 32 + RULE_tableconstructor = 33 + RULE_fieldlist = 34 + RULE_field = 35 + RULE_fieldsep = 36 + RULE_number = 37 + RULE_string = 38 + + ruleNames = [ "start_", "chunk", "block", "stat", "assign", "goto", + "do", "while", "repeat", "if", "for", "forin", "functiondef", + "localfunction", "localassign", "attnamelist", "attrib", "retstat", "label", "funcname", "varlist", "namelist", "explist", "exp", "var", "prefixexp", "functioncall", - "args", "functiondef", "funcbody", "parlist", "tableconstructor", - "fieldlist", "field", "fieldsep", "number", "string" ] + "tail", "nestedtail", "args", "anonfunctiondef", "funcbody", + "parlist", "tableconstructor", "fieldlist", "field", + "fieldsep", "number", "string" ] EOF = Token.EOF SEMI=1 @@ -360,6 +357,12 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitStart_" ): listener.exitStart_(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitStart_" ): + return visitor.visitStart_(self) + else: + return visitor.visitChildren(self) + @@ -369,9 +372,9 @@ def start_(self): self.enterRule(localctx, 0, self.RULE_start_) try: self.enterOuterAlt(localctx, 1) - self.state = 52 + self.state = 78 self.chunk() - self.state = 53 + self.state = 79 self.match(LuaParser.EOF) except RecognitionException as re: localctx.exception = re @@ -404,6 +407,12 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitChunk" ): listener.exitChunk(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitChunk" ): + return visitor.visitChunk(self) + else: + return visitor.visitChildren(self) + @@ -413,7 +422,7 @@ def chunk(self): self.enterRule(localctx, 2, self.RULE_chunk) try: self.enterOuterAlt(localctx, 1) - self.state = 55 + self.state = 81 self.block() except RecognitionException as re: localctx.exception = re @@ -453,6 +462,12 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitBlock" ): listener.exitBlock(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitBlock" ): + return visitor.visitBlock(self) + else: + return visitor.visitChildren(self) + @@ -463,22 +478,22 @@ def block(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 60 + self.state = 86 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,0,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: - self.state = 57 + self.state = 83 self.stat() - self.state = 62 + self.state = 88 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,0,self._ctx) - self.state = 64 + self.state = 90 self._errHandler.sync(self) _la = self._input.LA(1) if (((_la) & ~0x3f) == 0 and ((1 << _la) & 6291464) != 0): - self.state = 63 + self.state = 89 self.retstat() @@ -501,6 +516,196 @@ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): def SEMI(self): return self.getToken(LuaParser.SEMI, 0) + def assign(self): + return self.getTypedRuleContext(LuaParser.AssignContext,0) + + + def functioncall(self): + return self.getTypedRuleContext(LuaParser.FunctioncallContext,0) + + + def label(self): + return self.getTypedRuleContext(LuaParser.LabelContext,0) + + + def BREAK(self): + return self.getToken(LuaParser.BREAK, 0) + + def goto(self): + return self.getTypedRuleContext(LuaParser.GotoContext,0) + + + def do(self): + return self.getTypedRuleContext(LuaParser.DoContext,0) + + + def while_(self): + return self.getTypedRuleContext(LuaParser.WhileContext,0) + + + def repeat(self): + return self.getTypedRuleContext(LuaParser.RepeatContext,0) + + + def if_(self): + return self.getTypedRuleContext(LuaParser.IfContext,0) + + + def for_(self): + return self.getTypedRuleContext(LuaParser.ForContext,0) + + + def forin(self): + return self.getTypedRuleContext(LuaParser.ForinContext,0) + + + def functiondef(self): + return self.getTypedRuleContext(LuaParser.FunctiondefContext,0) + + + def localfunction(self): + return self.getTypedRuleContext(LuaParser.LocalfunctionContext,0) + + + def localassign(self): + return self.getTypedRuleContext(LuaParser.LocalassignContext,0) + + + def getRuleIndex(self): + return LuaParser.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 accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitStat" ): + return visitor.visitStat(self) + else: + return visitor.visitChildren(self) + + + + + def stat(self): + + localctx = LuaParser.StatContext(self, self._ctx, self.state) + self.enterRule(localctx, 6, self.RULE_stat) + try: + self.state = 107 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,2,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 92 + self.match(LuaParser.SEMI) + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 93 + self.assign() + pass + + elif la_ == 3: + self.enterOuterAlt(localctx, 3) + self.state = 94 + self.functioncall(0) + pass + + elif la_ == 4: + self.enterOuterAlt(localctx, 4) + self.state = 95 + self.label() + pass + + elif la_ == 5: + self.enterOuterAlt(localctx, 5) + self.state = 96 + self.match(LuaParser.BREAK) + pass + + elif la_ == 6: + self.enterOuterAlt(localctx, 6) + self.state = 97 + self.goto() + pass + + elif la_ == 7: + self.enterOuterAlt(localctx, 7) + self.state = 98 + self.do() + pass + + elif la_ == 8: + self.enterOuterAlt(localctx, 8) + self.state = 99 + self.while_() + pass + + elif la_ == 9: + self.enterOuterAlt(localctx, 9) + self.state = 100 + self.repeat() + pass + + elif la_ == 10: + self.enterOuterAlt(localctx, 10) + self.state = 101 + self.if_() + pass + + elif la_ == 11: + self.enterOuterAlt(localctx, 11) + self.state = 102 + self.for_() + pass + + elif la_ == 12: + self.enterOuterAlt(localctx, 12) + self.state = 103 + self.forin() + pass + + elif la_ == 13: + self.enterOuterAlt(localctx, 13) + self.state = 104 + self.functiondef() + pass + + elif la_ == 14: + self.enterOuterAlt(localctx, 14) + self.state = 105 + self.localfunction() + pass + + elif la_ == 15: + self.enterOuterAlt(localctx, 15) + self.state = 106 + self.localassign() + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class AssignContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + def varlist(self): return self.getTypedRuleContext(LuaParser.VarlistContext,0) @@ -512,16 +717,53 @@ def explist(self): return self.getTypedRuleContext(LuaParser.ExplistContext,0) - def functioncall(self): - return self.getTypedRuleContext(LuaParser.FunctioncallContext,0) + def getRuleIndex(self): + return LuaParser.RULE_assign + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterAssign" ): + listener.enterAssign(self) - def label(self): - return self.getTypedRuleContext(LuaParser.LabelContext,0) + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitAssign" ): + listener.exitAssign(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitAssign" ): + return visitor.visitAssign(self) + else: + return visitor.visitChildren(self) - def BREAK(self): - return self.getToken(LuaParser.BREAK, 0) + + + + def assign(self): + + localctx = LuaParser.AssignContext(self, self._ctx, self.state) + self.enterRule(localctx, 8, self.RULE_assign) + try: + self.enterOuterAlt(localctx, 1) + self.state = 109 + self.varlist() + self.state = 110 + self.match(LuaParser.EQ) + self.state = 111 + self.explist() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class GotoContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser def GOTO(self): return self.getToken(LuaParser.GOTO, 0) @@ -529,317 +771,715 @@ def GOTO(self): def NAME(self): return self.getToken(LuaParser.NAME, 0) + def getRuleIndex(self): + return LuaParser.RULE_goto + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterGoto" ): + listener.enterGoto(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitGoto" ): + listener.exitGoto(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitGoto" ): + return visitor.visitGoto(self) + else: + return visitor.visitChildren(self) + + + + + def goto(self): + + localctx = LuaParser.GotoContext(self, self._ctx, self.state) + self.enterRule(localctx, 10, self.RULE_goto) + try: + self.enterOuterAlt(localctx, 1) + self.state = 113 + self.match(LuaParser.GOTO) + self.state = 114 + self.match(LuaParser.NAME) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class DoContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + def DO(self): return self.getToken(LuaParser.DO, 0) - def block(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(LuaParser.BlockContext) - else: - return self.getTypedRuleContext(LuaParser.BlockContext,i) + def block(self): + return self.getTypedRuleContext(LuaParser.BlockContext,0) def END(self): return self.getToken(LuaParser.END, 0) - def WHILE(self): - return self.getToken(LuaParser.WHILE, 0) + def getRuleIndex(self): + return LuaParser.RULE_do - def exp(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(LuaParser.ExpContext) + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDo" ): + listener.enterDo(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDo" ): + listener.exitDo(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitDo" ): + return visitor.visitDo(self) else: - return self.getTypedRuleContext(LuaParser.ExpContext,i) + return visitor.visitChildren(self) - def REPEAT(self): - return self.getToken(LuaParser.REPEAT, 0) - def UNTIL(self): - return self.getToken(LuaParser.UNTIL, 0) - def IF(self): - return self.getToken(LuaParser.IF, 0) + def do(self): - def THEN(self, i:int=None): - if i is None: - return self.getTokens(LuaParser.THEN) - else: - return self.getToken(LuaParser.THEN, i) + localctx = LuaParser.DoContext(self, self._ctx, self.state) + self.enterRule(localctx, 12, self.RULE_do) + try: + self.enterOuterAlt(localctx, 1) + self.state = 116 + self.match(LuaParser.DO) + self.state = 117 + self.block() + self.state = 118 + self.match(LuaParser.END) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx - def ELSEIF(self, i:int=None): - if i is None: - return self.getTokens(LuaParser.ELSEIF) - else: - return self.getToken(LuaParser.ELSEIF, i) - def ELSE(self): + class WhileContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def WHILE(self): + return self.getToken(LuaParser.WHILE, 0) + + def exp(self): + return self.getTypedRuleContext(LuaParser.ExpContext,0) + + + def DO(self): + return self.getToken(LuaParser.DO, 0) + + def block(self): + return self.getTypedRuleContext(LuaParser.BlockContext,0) + + + def END(self): + return self.getToken(LuaParser.END, 0) + + def getRuleIndex(self): + return LuaParser.RULE_while + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterWhile" ): + listener.enterWhile(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitWhile" ): + listener.exitWhile(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitWhile" ): + return visitor.visitWhile(self) + else: + return visitor.visitChildren(self) + + + + + def while_(self): + + localctx = LuaParser.WhileContext(self, self._ctx, self.state) + self.enterRule(localctx, 14, self.RULE_while) + try: + self.enterOuterAlt(localctx, 1) + self.state = 120 + self.match(LuaParser.WHILE) + self.state = 121 + self.exp(0) + self.state = 122 + self.match(LuaParser.DO) + self.state = 123 + self.block() + self.state = 124 + self.match(LuaParser.END) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class RepeatContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def REPEAT(self): + return self.getToken(LuaParser.REPEAT, 0) + + def block(self): + return self.getTypedRuleContext(LuaParser.BlockContext,0) + + + def UNTIL(self): + return self.getToken(LuaParser.UNTIL, 0) + + def exp(self): + return self.getTypedRuleContext(LuaParser.ExpContext,0) + + + def getRuleIndex(self): + return LuaParser.RULE_repeat + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterRepeat" ): + listener.enterRepeat(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitRepeat" ): + listener.exitRepeat(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitRepeat" ): + return visitor.visitRepeat(self) + else: + return visitor.visitChildren(self) + + + + + def repeat(self): + + localctx = LuaParser.RepeatContext(self, self._ctx, self.state) + self.enterRule(localctx, 16, self.RULE_repeat) + try: + self.enterOuterAlt(localctx, 1) + self.state = 126 + self.match(LuaParser.REPEAT) + self.state = 127 + self.block() + self.state = 128 + self.match(LuaParser.UNTIL) + self.state = 129 + self.exp(0) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class IfContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def IF(self): + return self.getToken(LuaParser.IF, 0) + + def exp(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(LuaParser.ExpContext) + else: + return self.getTypedRuleContext(LuaParser.ExpContext,i) + + + def THEN(self, i:int=None): + if i is None: + return self.getTokens(LuaParser.THEN) + else: + return self.getToken(LuaParser.THEN, i) + + def block(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(LuaParser.BlockContext) + else: + return self.getTypedRuleContext(LuaParser.BlockContext,i) + + + def END(self): + return self.getToken(LuaParser.END, 0) + + def ELSEIF(self, i:int=None): + if i is None: + return self.getTokens(LuaParser.ELSEIF) + else: + return self.getToken(LuaParser.ELSEIF, i) + + def ELSE(self): return self.getToken(LuaParser.ELSE, 0) + def getRuleIndex(self): + return LuaParser.RULE_if + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterIf" ): + listener.enterIf(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitIf" ): + listener.exitIf(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitIf" ): + return visitor.visitIf(self) + else: + return visitor.visitChildren(self) + + + + + def if_(self): + + localctx = LuaParser.IfContext(self, self._ctx, self.state) + self.enterRule(localctx, 18, self.RULE_if) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 131 + self.match(LuaParser.IF) + self.state = 132 + self.exp(0) + self.state = 133 + self.match(LuaParser.THEN) + self.state = 134 + self.block() + self.state = 142 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==12: + self.state = 135 + self.match(LuaParser.ELSEIF) + self.state = 136 + self.exp(0) + self.state = 137 + self.match(LuaParser.THEN) + self.state = 138 + self.block() + self.state = 144 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 147 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==13: + self.state = 145 + self.match(LuaParser.ELSE) + self.state = 146 + self.block() + + + self.state = 149 + self.match(LuaParser.END) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ForContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + def FOR(self): return self.getToken(LuaParser.FOR, 0) + def NAME(self): + return self.getToken(LuaParser.NAME, 0) + + def EQ(self): + return self.getToken(LuaParser.EQ, 0) + + def exp(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(LuaParser.ExpContext) + else: + return self.getTypedRuleContext(LuaParser.ExpContext,i) + + def COMMA(self, i:int=None): if i is None: return self.getTokens(LuaParser.COMMA) else: return self.getToken(LuaParser.COMMA, i) - def namelist(self): - return self.getTypedRuleContext(LuaParser.NamelistContext,0) + def DO(self): + return self.getToken(LuaParser.DO, 0) + + def block(self): + return self.getTypedRuleContext(LuaParser.BlockContext,0) + + + def END(self): + return self.getToken(LuaParser.END, 0) + + def getRuleIndex(self): + return LuaParser.RULE_for + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFor" ): + listener.enterFor(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFor" ): + listener.exitFor(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitFor" ): + return visitor.visitFor(self) + else: + return visitor.visitChildren(self) + + + + + def for_(self): + + localctx = LuaParser.ForContext(self, self._ctx, self.state) + self.enterRule(localctx, 20, self.RULE_for) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 151 + self.match(LuaParser.FOR) + self.state = 152 + self.match(LuaParser.NAME) + self.state = 153 + self.match(LuaParser.EQ) + self.state = 154 + self.exp(0) + self.state = 155 + self.match(LuaParser.COMMA) + self.state = 156 + self.exp(0) + self.state = 159 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==15: + self.state = 157 + self.match(LuaParser.COMMA) + self.state = 158 + self.exp(0) + + + self.state = 161 + self.match(LuaParser.DO) + self.state = 162 + self.block() + self.state = 163 + self.match(LuaParser.END) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ForinContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def FOR(self): + return self.getToken(LuaParser.FOR, 0) + + def namelist(self): + return self.getTypedRuleContext(LuaParser.NamelistContext,0) + + + def IN(self): + return self.getToken(LuaParser.IN, 0) + + def explist(self): + return self.getTypedRuleContext(LuaParser.ExplistContext,0) + + + def DO(self): + return self.getToken(LuaParser.DO, 0) + + def block(self): + return self.getTypedRuleContext(LuaParser.BlockContext,0) + + + def END(self): + return self.getToken(LuaParser.END, 0) + + def getRuleIndex(self): + return LuaParser.RULE_forin + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterForin" ): + listener.enterForin(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitForin" ): + listener.exitForin(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitForin" ): + return visitor.visitForin(self) + else: + return visitor.visitChildren(self) + + + + + def forin(self): + + localctx = LuaParser.ForinContext(self, self._ctx, self.state) + self.enterRule(localctx, 22, self.RULE_forin) + try: + self.enterOuterAlt(localctx, 1) + self.state = 165 + self.match(LuaParser.FOR) + self.state = 166 + self.namelist() + self.state = 167 + self.match(LuaParser.IN) + self.state = 168 + self.explist() + self.state = 169 + self.match(LuaParser.DO) + self.state = 170 + self.block() + self.state = 171 + self.match(LuaParser.END) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class FunctiondefContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def FUNCTION(self): + return self.getToken(LuaParser.FUNCTION, 0) + + def funcname(self): + return self.getTypedRuleContext(LuaParser.FuncnameContext,0) + + + def funcbody(self): + return self.getTypedRuleContext(LuaParser.FuncbodyContext,0) + + + def getRuleIndex(self): + return LuaParser.RULE_functiondef + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFunctiondef" ): + listener.enterFunctiondef(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFunctiondef" ): + listener.exitFunctiondef(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitFunctiondef" ): + return visitor.visitFunctiondef(self) + else: + return visitor.visitChildren(self) + + + + + def functiondef(self): + + localctx = LuaParser.FunctiondefContext(self, self._ctx, self.state) + self.enterRule(localctx, 24, self.RULE_functiondef) + try: + self.enterOuterAlt(localctx, 1) + self.state = 173 + self.match(LuaParser.FUNCTION) + self.state = 174 + self.funcname() + self.state = 175 + self.funcbody() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + class LocalfunctionContext(ParserRuleContext): + __slots__ = 'parser' - def IN(self): - return self.getToken(LuaParser.IN, 0) + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def LOCAL(self): + return self.getToken(LuaParser.LOCAL, 0) def FUNCTION(self): return self.getToken(LuaParser.FUNCTION, 0) - def funcname(self): - return self.getTypedRuleContext(LuaParser.FuncnameContext,0) - + def NAME(self): + return self.getToken(LuaParser.NAME, 0) def funcbody(self): return self.getTypedRuleContext(LuaParser.FuncbodyContext,0) - def LOCAL(self): - return self.getToken(LuaParser.LOCAL, 0) - - def attnamelist(self): - return self.getTypedRuleContext(LuaParser.AttnamelistContext,0) - - def getRuleIndex(self): - return LuaParser.RULE_stat + return LuaParser.RULE_localfunction def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterStat" ): - listener.enterStat(self) + if hasattr( listener, "enterLocalfunction" ): + listener.enterLocalfunction(self) def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitStat" ): - listener.exitStat(self) - - + if hasattr( listener, "exitLocalfunction" ): + listener.exitLocalfunction(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitLocalfunction" ): + return visitor.visitLocalfunction(self) + else: + return visitor.visitChildren(self) - def stat(self): - localctx = LuaParser.StatContext(self, self._ctx, self.state) - self.enterRule(localctx, 6, self.RULE_stat) - self._la = 0 # Token type - try: - self.state = 147 - self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,6,self._ctx) - if la_ == 1: - self.enterOuterAlt(localctx, 1) - self.state = 66 - self.match(LuaParser.SEMI) - pass - elif la_ == 2: - self.enterOuterAlt(localctx, 2) - self.state = 67 - self.varlist() - self.state = 68 - self.match(LuaParser.EQ) - self.state = 69 - self.explist() - pass - elif la_ == 3: - self.enterOuterAlt(localctx, 3) - self.state = 71 - self.functioncall(0) - pass + def localfunction(self): - elif la_ == 4: - self.enterOuterAlt(localctx, 4) - self.state = 72 - self.label() - pass + localctx = LuaParser.LocalfunctionContext(self, self._ctx, self.state) + self.enterRule(localctx, 26, self.RULE_localfunction) + try: + self.enterOuterAlt(localctx, 1) + self.state = 177 + self.match(LuaParser.LOCAL) + self.state = 178 + self.match(LuaParser.FUNCTION) + self.state = 179 + self.match(LuaParser.NAME) + self.state = 180 + self.funcbody() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx - elif la_ == 5: - self.enterOuterAlt(localctx, 5) - self.state = 73 - self.match(LuaParser.BREAK) - pass - elif la_ == 6: - self.enterOuterAlt(localctx, 6) - self.state = 74 - self.match(LuaParser.GOTO) - self.state = 75 - self.match(LuaParser.NAME) - pass + class LocalassignContext(ParserRuleContext): + __slots__ = 'parser' - elif la_ == 7: - self.enterOuterAlt(localctx, 7) - self.state = 76 - self.match(LuaParser.DO) - self.state = 77 - self.block() - self.state = 78 - self.match(LuaParser.END) - pass + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser - elif la_ == 8: - self.enterOuterAlt(localctx, 8) - self.state = 80 - self.match(LuaParser.WHILE) - self.state = 81 - self.exp(0) - self.state = 82 - self.match(LuaParser.DO) - self.state = 83 - self.block() - self.state = 84 - self.match(LuaParser.END) - pass + def LOCAL(self): + return self.getToken(LuaParser.LOCAL, 0) - elif la_ == 9: - self.enterOuterAlt(localctx, 9) - self.state = 86 - self.match(LuaParser.REPEAT) - self.state = 87 - self.block() - self.state = 88 - self.match(LuaParser.UNTIL) - self.state = 89 - self.exp(0) - pass + def namelist(self): + return self.getTypedRuleContext(LuaParser.NamelistContext,0) - elif la_ == 10: - self.enterOuterAlt(localctx, 10) - self.state = 91 - self.match(LuaParser.IF) - self.state = 92 - self.exp(0) - self.state = 93 - self.match(LuaParser.THEN) - self.state = 94 - self.block() - self.state = 102 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==12: - self.state = 95 - self.match(LuaParser.ELSEIF) - self.state = 96 - self.exp(0) - self.state = 97 - self.match(LuaParser.THEN) - self.state = 98 - self.block() - self.state = 104 - self._errHandler.sync(self) - _la = self._input.LA(1) - self.state = 107 - self._errHandler.sync(self) - _la = self._input.LA(1) - if _la==13: - self.state = 105 - self.match(LuaParser.ELSE) - self.state = 106 - self.block() + def EQ(self): + return self.getToken(LuaParser.EQ, 0) + def explist(self): + return self.getTypedRuleContext(LuaParser.ExplistContext,0) - self.state = 109 - self.match(LuaParser.END) - pass - elif la_ == 11: - self.enterOuterAlt(localctx, 11) - self.state = 111 - self.match(LuaParser.FOR) - self.state = 112 - self.match(LuaParser.NAME) - self.state = 113 - self.match(LuaParser.EQ) - self.state = 114 - self.exp(0) - self.state = 115 - self.match(LuaParser.COMMA) - self.state = 116 - self.exp(0) - self.state = 119 - self._errHandler.sync(self) - _la = self._input.LA(1) - if _la==15: - self.state = 117 - self.match(LuaParser.COMMA) - self.state = 118 - self.exp(0) + def getRuleIndex(self): + return LuaParser.RULE_localassign + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterLocalassign" ): + listener.enterLocalassign(self) - self.state = 121 - self.match(LuaParser.DO) - self.state = 122 - self.block() - self.state = 123 - self.match(LuaParser.END) - pass + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitLocalassign" ): + listener.exitLocalassign(self) - elif la_ == 12: - self.enterOuterAlt(localctx, 12) - self.state = 125 - self.match(LuaParser.FOR) - self.state = 126 - self.namelist() - self.state = 127 - self.match(LuaParser.IN) - self.state = 128 - self.explist() - self.state = 129 - self.match(LuaParser.DO) - self.state = 130 - self.block() - self.state = 131 - self.match(LuaParser.END) - pass + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitLocalassign" ): + return visitor.visitLocalassign(self) + else: + return visitor.visitChildren(self) - elif la_ == 13: - self.enterOuterAlt(localctx, 13) - self.state = 133 - self.match(LuaParser.FUNCTION) - self.state = 134 - self.funcname() - self.state = 135 - self.funcbody() - pass - elif la_ == 14: - self.enterOuterAlt(localctx, 14) - self.state = 137 - self.match(LuaParser.LOCAL) - self.state = 138 - self.match(LuaParser.FUNCTION) - self.state = 139 - self.match(LuaParser.NAME) - self.state = 140 - self.funcbody() - pass - elif la_ == 15: - self.enterOuterAlt(localctx, 15) - self.state = 141 - self.match(LuaParser.LOCAL) - self.state = 142 - self.attnamelist() - self.state = 145 - self._errHandler.sync(self) - _la = self._input.LA(1) - if _la==2: - self.state = 143 - self.match(LuaParser.EQ) - self.state = 144 - self.explist() + def localassign(self): - pass + localctx = LuaParser.LocalassignContext(self, self._ctx, self.state) + self.enterRule(localctx, 28, self.RULE_localassign) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 182 + self.match(LuaParser.LOCAL) + self.state = 183 + self.namelist() + self.state = 186 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==2: + self.state = 184 + self.match(LuaParser.EQ) + self.state = 185 + self.explist() except RecognitionException as re: @@ -888,31 +1528,37 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitAttnamelist" ): listener.exitAttnamelist(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitAttnamelist" ): + return visitor.visitAttnamelist(self) + else: + return visitor.visitChildren(self) + def attnamelist(self): localctx = LuaParser.AttnamelistContext(self, self._ctx, self.state) - self.enterRule(localctx, 8, self.RULE_attnamelist) + self.enterRule(localctx, 30, self.RULE_attnamelist) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 149 + self.state = 188 self.match(LuaParser.NAME) - self.state = 150 + self.state = 189 self.attrib() - self.state = 156 + self.state = 195 self._errHandler.sync(self) _la = self._input.LA(1) while _la==15: - self.state = 151 + self.state = 190 self.match(LuaParser.COMMA) - self.state = 152 + self.state = 191 self.match(LuaParser.NAME) - self.state = 153 + self.state = 192 self.attrib() - self.state = 158 + self.state = 197 self._errHandler.sync(self) _la = self._input.LA(1) @@ -952,25 +1598,31 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitAttrib" ): listener.exitAttrib(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitAttrib" ): + return visitor.visitAttrib(self) + else: + return visitor.visitChildren(self) + def attrib(self): localctx = LuaParser.AttribContext(self, self._ctx, self.state) - self.enterRule(localctx, 10, self.RULE_attrib) + self.enterRule(localctx, 32, self.RULE_attrib) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 162 + self.state = 201 self._errHandler.sync(self) _la = self._input.LA(1) if _la==19: - self.state = 159 + self.state = 198 self.match(LuaParser.LT) - self.state = 160 + self.state = 199 self.match(LuaParser.NAME) - self.state = 161 + self.state = 200 self.match(LuaParser.GT) @@ -1017,47 +1669,53 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitRetstat" ): listener.exitRetstat(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitRetstat" ): + return visitor.visitRetstat(self) + else: + return visitor.visitChildren(self) + def retstat(self): localctx = LuaParser.RetstatContext(self, self._ctx, self.state) - self.enterRule(localctx, 12, self.RULE_retstat) + self.enterRule(localctx, 34, self.RULE_retstat) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 170 + self.state = 209 self._errHandler.sync(self) token = self._input.LA(1) if token in [21]: - self.state = 164 + self.state = 203 self.match(LuaParser.RETURN) - self.state = 166 + self.state = 205 self._errHandler.sync(self) _la = self._input.LA(1) if ((((_la - 17)) & ~0x3f) == 0 and ((1 << (_la - 17)) & 280650879957889) != 0): - self.state = 165 + self.state = 204 self.explist() pass elif token in [3]: - self.state = 168 + self.state = 207 self.match(LuaParser.BREAK) pass elif token in [22]: - self.state = 169 + self.state = 208 self.match(LuaParser.CONTINUE) pass else: raise NoViableAltException(self) - self.state = 173 + self.state = 212 self._errHandler.sync(self) _la = self._input.LA(1) if _la==1: - self.state = 172 + self.state = 211 self.match(LuaParser.SEMI) @@ -1097,20 +1755,26 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitLabel" ): listener.exitLabel(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitLabel" ): + return visitor.visitLabel(self) + else: + return visitor.visitChildren(self) + def label(self): localctx = LuaParser.LabelContext(self, self._ctx, self.state) - self.enterRule(localctx, 14, self.RULE_label) + self.enterRule(localctx, 36, self.RULE_label) try: self.enterOuterAlt(localctx, 1) - self.state = 175 + self.state = 214 self.match(LuaParser.CC) - self.state = 176 + self.state = 215 self.match(LuaParser.NAME) - self.state = 177 + self.state = 216 self.match(LuaParser.CC) except RecognitionException as re: localctx.exception = re @@ -1154,37 +1818,43 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitFuncname" ): listener.exitFuncname(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitFuncname" ): + return visitor.visitFuncname(self) + else: + return visitor.visitChildren(self) + def funcname(self): localctx = LuaParser.FuncnameContext(self, self._ctx, self.state) - self.enterRule(localctx, 16, self.RULE_funcname) + self.enterRule(localctx, 38, self.RULE_funcname) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 179 + self.state = 218 self.match(LuaParser.NAME) - self.state = 184 + self.state = 223 self._errHandler.sync(self) _la = self._input.LA(1) while _la==27: - self.state = 180 + self.state = 219 self.match(LuaParser.DOT) - self.state = 181 + self.state = 220 self.match(LuaParser.NAME) - self.state = 186 + self.state = 225 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 189 + self.state = 228 self._errHandler.sync(self) _la = self._input.LA(1) if _la==39: - self.state = 187 + self.state = 226 self.match(LuaParser.COL) - self.state = 188 + self.state = 227 self.match(LuaParser.NAME) @@ -1228,27 +1898,33 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitVarlist" ): listener.exitVarlist(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitVarlist" ): + return visitor.visitVarlist(self) + else: + return visitor.visitChildren(self) + def varlist(self): localctx = LuaParser.VarlistContext(self, self._ctx, self.state) - self.enterRule(localctx, 18, self.RULE_varlist) + self.enterRule(localctx, 40, self.RULE_varlist) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 191 + self.state = 230 self.var() - self.state = 196 + self.state = 235 self._errHandler.sync(self) _la = self._input.LA(1) while _la==15: - self.state = 192 + self.state = 231 self.match(LuaParser.COMMA) - self.state = 193 + self.state = 232 self.var() - self.state = 198 + self.state = 237 self._errHandler.sync(self) _la = self._input.LA(1) @@ -1291,27 +1967,33 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitNamelist" ): listener.exitNamelist(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitNamelist" ): + return visitor.visitNamelist(self) + else: + return visitor.visitChildren(self) + def namelist(self): localctx = LuaParser.NamelistContext(self, self._ctx, self.state) - self.enterRule(localctx, 20, self.RULE_namelist) + self.enterRule(localctx, 42, self.RULE_namelist) try: self.enterOuterAlt(localctx, 1) - self.state = 199 + self.state = 238 self.match(LuaParser.NAME) - self.state = 204 + self.state = 243 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,15,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: - self.state = 200 + self.state = 239 self.match(LuaParser.COMMA) - self.state = 201 + self.state = 240 self.match(LuaParser.NAME) - self.state = 206 + self.state = 245 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,15,self._ctx) @@ -1355,27 +2037,33 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitExplist" ): listener.exitExplist(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitExplist" ): + return visitor.visitExplist(self) + else: + return visitor.visitChildren(self) + def explist(self): localctx = LuaParser.ExplistContext(self, self._ctx, self.state) - self.enterRule(localctx, 22, self.RULE_explist) + self.enterRule(localctx, 44, self.RULE_explist) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 207 + self.state = 246 self.exp(0) - self.state = 212 + self.state = 251 self._errHandler.sync(self) _la = self._input.LA(1) while _la==15: - self.state = 208 + self.state = 247 self.match(LuaParser.COMMA) - self.state = 209 + self.state = 248 self.exp(0) - self.state = 214 + self.state = 253 self._errHandler.sync(self) _la = self._input.LA(1) @@ -1514,6 +2202,12 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitExp" ): listener.exitExp(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitExp" ): + return visitor.visitExp(self) + else: + return visitor.visitChildren(self) + def exp(self, _p:int=0): @@ -1521,66 +2215,66 @@ def exp(self, _p:int=0): _parentState = self.state localctx = LuaParser.ExpContext(self, self._ctx, _parentState) _prevctx = localctx - _startState = 24 - self.enterRecursionRule(localctx, 24, self.RULE_exp, _p) + _startState = 46 + self.enterRecursionRule(localctx, 46, self.RULE_exp, _p) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 227 + self.state = 266 self._errHandler.sync(self) token = self._input.LA(1) if token in [24]: - self.state = 216 + self.state = 255 self.match(LuaParser.NIL) pass elif token in [25]: - self.state = 217 + self.state = 256 self.match(LuaParser.FALSE) pass elif token in [26]: - self.state = 218 + self.state = 257 self.match(LuaParser.TRUE) pass elif token in [61, 62, 63, 64]: - self.state = 219 + self.state = 258 self.number() pass elif token in [58, 59, 60]: - self.state = 220 + self.state = 259 self.string() pass elif token in [55]: - self.state = 221 + self.state = 260 self.match(LuaParser.DDD) pass elif token in [17]: - self.state = 222 + self.state = 261 self.functiondef() pass elif token in [31, 57]: - self.state = 223 + self.state = 262 self.prefixexp() pass elif token in [46]: - self.state = 224 + self.state = 263 self.tableconstructor() pass elif token in [28, 29, 30, 33]: - self.state = 225 + self.state = 264 _la = self._input.LA(1) if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 10468982784) != 0)): self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() - self.state = 226 + self.state = 265 self.exp(8) pass else: raise NoViableAltException(self) self._ctx.stop = self._input.LT(-1) - self.state = 255 + self.state = 294 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,19,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: @@ -1588,139 +2282,139 @@ def exp(self, _p:int=0): if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx - self.state = 253 + self.state = 292 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,18,self._ctx) if la_ == 1: localctx = LuaParser.ExpContext(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_exp) - self.state = 229 + self.state = 268 if not self.precpred(self._ctx, 9): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 9)") - self.state = 230 + self.state = 269 self.match(LuaParser.CARET) - self.state = 231 + self.state = 270 self.exp(9) pass elif la_ == 2: localctx = LuaParser.ExpContext(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_exp) - self.state = 232 + self.state = 271 if not self.precpred(self._ctx, 7): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 7)") - self.state = 233 + self.state = 272 _la = self._input.LA(1) if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 18049995198431232) != 0)): self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() - self.state = 234 + self.state = 273 self.exp(8) pass elif la_ == 3: localctx = LuaParser.ExpContext(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_exp) - self.state = 235 + self.state = 274 if not self.precpred(self._ctx, 6): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 6)") - self.state = 236 + self.state = 275 _la = self._input.LA(1) if not(_la==29 or _la==44): self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() - self.state = 237 + self.state = 276 self.exp(7) pass elif la_ == 4: localctx = LuaParser.ExpContext(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_exp) - self.state = 238 + self.state = 277 if not self.precpred(self._ctx, 5): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 5)") - self.state = 239 + self.state = 278 self.match(LuaParser.DD) - self.state = 240 + self.state = 279 self.exp(5) pass elif la_ == 5: localctx = LuaParser.ExpContext(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_exp) - self.state = 241 + self.state = 280 if not self.precpred(self._ctx, 4): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 4)") - self.state = 242 + self.state = 281 _la = self._input.LA(1) if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 73186792481226752) != 0)): self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() - self.state = 243 + self.state = 282 self.exp(5) pass elif la_ == 6: localctx = LuaParser.ExpContext(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_exp) - self.state = 244 + self.state = 283 if not self.precpred(self._ctx, 3): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 3)") - self.state = 245 + self.state = 284 self.match(LuaParser.AND) - self.state = 246 + self.state = 285 self.exp(4) pass elif la_ == 7: localctx = LuaParser.ExpContext(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_exp) - self.state = 247 + self.state = 286 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 2)") - self.state = 248 + self.state = 287 self.match(LuaParser.OR) - self.state = 249 + self.state = 288 self.exp(3) pass elif la_ == 8: localctx = LuaParser.ExpContext(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_exp) - self.state = 250 + self.state = 289 if not self.precpred(self._ctx, 1): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 1)") - self.state = 251 + self.state = 290 _la = self._input.LA(1) if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 4503720154890240) != 0)): self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() - self.state = 252 + self.state = 291 self.exp(2) pass - self.state = 257 + self.state = 296 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,19,self._ctx) @@ -1747,18 +2441,9 @@ def prefixexp(self): return self.getTypedRuleContext(LuaParser.PrefixexpContext,0) - def OB(self): - return self.getToken(LuaParser.OB, 0) - - def exp(self): - return self.getTypedRuleContext(LuaParser.ExpContext,0) - - - def CB(self): - return self.getToken(LuaParser.CB, 0) + def tail(self): + return self.getTypedRuleContext(LuaParser.TailContext,0) - def DOT(self): - return self.getToken(LuaParser.DOT, 0) def getRuleIndex(self): return LuaParser.RULE_var @@ -1771,47 +2456,35 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitVar" ): listener.exitVar(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitVar" ): + return visitor.visitVar(self) + else: + return visitor.visitChildren(self) + def var(self): localctx = LuaParser.VarContext(self, self._ctx, self.state) - self.enterRule(localctx, 26, self.RULE_var) + self.enterRule(localctx, 48, self.RULE_var) try: - self.state = 268 + self.state = 301 self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,21,self._ctx) + la_ = self._interp.adaptivePredict(self._input,20,self._ctx) if la_ == 1: self.enterOuterAlt(localctx, 1) - self.state = 258 + self.state = 297 self.match(LuaParser.NAME) pass elif la_ == 2: self.enterOuterAlt(localctx, 2) - self.state = 259 + self.state = 298 self.prefixexp() - self.state = 266 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [48]: - self.state = 260 - self.match(LuaParser.OB) - self.state = 261 - self.exp(0) - self.state = 262 - self.match(LuaParser.CB) - pass - elif token in [27]: - self.state = 264 - self.match(LuaParser.DOT) - self.state = 265 - self.match(LuaParser.NAME) - pass - else: - raise NoViableAltException(self) - + self.state = 299 + self.tail() pass @@ -1828,39 +2501,15 @@ class PrefixexpContext(ParserRuleContext): __slots__ = 'parser' def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - def NAME(self, i:int=None): - if i is None: - return self.getTokens(LuaParser.NAME) - else: - return self.getToken(LuaParser.NAME, i) - - def OB(self, i:int=None): - if i is None: - return self.getTokens(LuaParser.OB) - else: - return self.getToken(LuaParser.OB, i) - - def exp(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(LuaParser.ExpContext) - else: - return self.getTypedRuleContext(LuaParser.ExpContext,i) + super().__init__(parent, invokingState) + self.parser = parser + def NAME(self): + return self.getToken(LuaParser.NAME, 0) - def CB(self, i:int=None): - if i is None: - return self.getTokens(LuaParser.CB) - else: - return self.getToken(LuaParser.CB, i) + def nestedtail(self): + return self.getTypedRuleContext(LuaParser.NestedtailContext,0) - def DOT(self, i:int=None): - if i is None: - return self.getTokens(LuaParser.DOT) - else: - return self.getToken(LuaParser.DOT, i) def functioncall(self): return self.getTypedRuleContext(LuaParser.FunctioncallContext,0) @@ -1869,6 +2518,10 @@ def functioncall(self): def OP(self): return self.getToken(LuaParser.OP, 0) + def exp(self): + return self.getTypedRuleContext(LuaParser.ExpContext,0) + + def CP(self): return self.getToken(LuaParser.CP, 0) @@ -1883,124 +2536,49 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitPrefixexp" ): listener.exitPrefixexp(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitPrefixexp" ): + return visitor.visitPrefixexp(self) + else: + return visitor.visitChildren(self) + def prefixexp(self): localctx = LuaParser.PrefixexpContext(self, self._ctx, self.state) - self.enterRule(localctx, 28, self.RULE_prefixexp) + self.enterRule(localctx, 50, self.RULE_prefixexp) try: - self.state = 308 + self.state = 313 self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,28,self._ctx) + la_ = self._interp.adaptivePredict(self._input,21,self._ctx) if la_ == 1: self.enterOuterAlt(localctx, 1) - self.state = 270 + self.state = 303 self.match(LuaParser.NAME) - self.state = 279 - self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,23,self._ctx) - while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: - if _alt==1: - self.state = 277 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [48]: - self.state = 271 - self.match(LuaParser.OB) - self.state = 272 - self.exp(0) - self.state = 273 - self.match(LuaParser.CB) - pass - elif token in [27]: - self.state = 275 - self.match(LuaParser.DOT) - self.state = 276 - self.match(LuaParser.NAME) - pass - else: - raise NoViableAltException(self) - - self.state = 281 - self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,23,self._ctx) - + self.state = 304 + self.nestedtail() pass elif la_ == 2: self.enterOuterAlt(localctx, 2) - self.state = 282 + self.state = 305 self.functioncall(0) - self.state = 291 - self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,25,self._ctx) - while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: - if _alt==1: - self.state = 289 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [48]: - self.state = 283 - self.match(LuaParser.OB) - self.state = 284 - self.exp(0) - self.state = 285 - self.match(LuaParser.CB) - pass - elif token in [27]: - self.state = 287 - self.match(LuaParser.DOT) - self.state = 288 - self.match(LuaParser.NAME) - pass - else: - raise NoViableAltException(self) - - self.state = 293 - self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,25,self._ctx) - + self.state = 306 + self.nestedtail() pass elif la_ == 3: self.enterOuterAlt(localctx, 3) - self.state = 294 + self.state = 308 self.match(LuaParser.OP) - self.state = 295 + self.state = 309 self.exp(0) - self.state = 296 + self.state = 310 self.match(LuaParser.CP) - self.state = 305 - self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,27,self._ctx) - while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: - if _alt==1: - self.state = 303 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [48]: - self.state = 297 - self.match(LuaParser.OB) - self.state = 298 - self.exp(0) - self.state = 299 - self.match(LuaParser.CB) - pass - elif token in [27]: - self.state = 301 - self.match(LuaParser.DOT) - self.state = 302 - self.match(LuaParser.NAME) - pass - else: - raise NoViableAltException(self) - - self.state = 307 - self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,27,self._ctx) - + self.state = 311 + self.nestedtail() pass @@ -2026,38 +2604,21 @@ def NAME(self, i:int=None): else: return self.getToken(LuaParser.NAME, i) - def args(self): - return self.getTypedRuleContext(LuaParser.ArgsContext,0) - - - def OB(self, i:int=None): - if i is None: - return self.getTokens(LuaParser.OB) - else: - return self.getToken(LuaParser.OB, i) - - def exp(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(LuaParser.ExpContext) - else: - return self.getTypedRuleContext(LuaParser.ExpContext,i) + def nestedtail(self): + return self.getTypedRuleContext(LuaParser.NestedtailContext,0) - def CB(self, i:int=None): - if i is None: - return self.getTokens(LuaParser.CB) - else: - return self.getToken(LuaParser.CB, i) + def args(self): + return self.getTypedRuleContext(LuaParser.ArgsContext,0) - def DOT(self, i:int=None): - if i is None: - return self.getTokens(LuaParser.DOT) - else: - return self.getToken(LuaParser.DOT, i) def OP(self): return self.getToken(LuaParser.OP, 0) + def exp(self): + return self.getTypedRuleContext(LuaParser.ExpContext,0) + + def CP(self): return self.getToken(LuaParser.CP, 0) @@ -2079,6 +2640,12 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitFunctioncall" ): listener.exitFunctioncall(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitFunctioncall" ): + return visitor.visitFunctioncall(self) + else: + return visitor.visitChildren(self) + def functioncall(self, _p:int=0): @@ -2086,269 +2653,112 @@ def functioncall(self, _p:int=0): _parentState = self.state localctx = LuaParser.FunctioncallContext(self, self._ctx, _parentState) _prevctx = localctx - _startState = 30 - self.enterRecursionRule(localctx, 30, self.RULE_functioncall, _p) - self._la = 0 # Token type + _startState = 52 + self.enterRecursionRule(localctx, 52, self.RULE_functioncall, _p) try: self.enterOuterAlt(localctx, 1) - self.state = 373 + self.state = 340 self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,37,self._ctx) + la_ = self._interp.adaptivePredict(self._input,22,self._ctx) if la_ == 1: - self.state = 311 + self.state = 316 self.match(LuaParser.NAME) - self.state = 320 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==27 or _la==48: - self.state = 318 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [48]: - self.state = 312 - self.match(LuaParser.OB) - self.state = 313 - self.exp(0) - self.state = 314 - self.match(LuaParser.CB) - pass - elif token in [27]: - self.state = 316 - self.match(LuaParser.DOT) - self.state = 317 - self.match(LuaParser.NAME) - pass - else: - raise NoViableAltException(self) - - self.state = 322 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 323 + self.state = 317 + self.nestedtail() + self.state = 318 self.args() pass elif la_ == 2: - self.state = 324 + self.state = 320 self.match(LuaParser.OP) - self.state = 325 + self.state = 321 self.exp(0) - self.state = 326 + self.state = 322 self.match(LuaParser.CP) - self.state = 335 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==27 or _la==48: - self.state = 333 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [48]: - self.state = 327 - self.match(LuaParser.OB) - self.state = 328 - self.exp(0) - self.state = 329 - self.match(LuaParser.CB) - pass - elif token in [27]: - self.state = 331 - self.match(LuaParser.DOT) - self.state = 332 - self.match(LuaParser.NAME) - pass - else: - raise NoViableAltException(self) - - self.state = 337 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 338 + self.state = 323 + self.nestedtail() + self.state = 324 self.args() pass elif la_ == 3: - self.state = 340 + self.state = 326 self.match(LuaParser.NAME) - self.state = 349 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==27 or _la==48: - self.state = 347 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [48]: - self.state = 341 - self.match(LuaParser.OB) - self.state = 342 - self.exp(0) - self.state = 343 - self.match(LuaParser.CB) - pass - elif token in [27]: - self.state = 345 - self.match(LuaParser.DOT) - self.state = 346 - self.match(LuaParser.NAME) - pass - else: - raise NoViableAltException(self) - - self.state = 351 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 352 + self.state = 327 + self.nestedtail() + self.state = 328 self.match(LuaParser.COL) - self.state = 353 + self.state = 329 self.match(LuaParser.NAME) - self.state = 354 + self.state = 330 self.args() pass elif la_ == 4: - self.state = 355 + self.state = 332 self.match(LuaParser.OP) - self.state = 356 + self.state = 333 self.exp(0) - self.state = 357 + self.state = 334 self.match(LuaParser.CP) - self.state = 366 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==27 or _la==48: - self.state = 364 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [48]: - self.state = 358 - self.match(LuaParser.OB) - self.state = 359 - self.exp(0) - self.state = 360 - self.match(LuaParser.CB) - pass - elif token in [27]: - self.state = 362 - self.match(LuaParser.DOT) - self.state = 363 - self.match(LuaParser.NAME) - pass - else: - raise NoViableAltException(self) - - self.state = 368 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 369 + self.state = 335 + self.nestedtail() + self.state = 336 self.match(LuaParser.COL) - self.state = 370 + self.state = 337 self.match(LuaParser.NAME) - self.state = 371 + self.state = 338 self.args() pass self._ctx.stop = self._input.LT(-1) - self.state = 405 + self.state = 354 self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,43,self._ctx) + _alt = self._interp.adaptivePredict(self._input,24,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 = 403 + self.state = 352 self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,42,self._ctx) + la_ = self._interp.adaptivePredict(self._input,23,self._ctx) if la_ == 1: localctx = LuaParser.FunctioncallContext(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_functioncall) - self.state = 375 + self.state = 342 if not self.precpred(self._ctx, 5): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 5)") - self.state = 384 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==27 or _la==48: - self.state = 382 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [48]: - self.state = 376 - self.match(LuaParser.OB) - self.state = 377 - self.exp(0) - self.state = 378 - self.match(LuaParser.CB) - pass - elif token in [27]: - self.state = 380 - self.match(LuaParser.DOT) - self.state = 381 - self.match(LuaParser.NAME) - pass - else: - raise NoViableAltException(self) - - self.state = 386 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 387 + self.state = 343 + self.nestedtail() + self.state = 344 self.args() pass elif la_ == 2: localctx = LuaParser.FunctioncallContext(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_functioncall) - self.state = 388 + self.state = 346 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 2)") - self.state = 397 - self._errHandler.sync(self) - _la = self._input.LA(1) - while _la==27 or _la==48: - self.state = 395 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [48]: - self.state = 389 - self.match(LuaParser.OB) - self.state = 390 - self.exp(0) - self.state = 391 - self.match(LuaParser.CB) - pass - elif token in [27]: - self.state = 393 - self.match(LuaParser.DOT) - self.state = 394 - self.match(LuaParser.NAME) - pass - else: - raise NoViableAltException(self) - - self.state = 399 - self._errHandler.sync(self) - _la = self._input.LA(1) - - self.state = 400 + self.state = 347 + self.nestedtail() + self.state = 348 self.match(LuaParser.COL) - self.state = 401 + self.state = 349 self.match(LuaParser.NAME) - self.state = 402 + self.state = 350 self.args() pass - self.state = 407 + self.state = 356 self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,43,self._ctx) + _alt = self._interp.adaptivePredict(self._input,24,self._ctx) except RecognitionException as re: localctx.exception = re @@ -2359,6 +2769,144 @@ def functioncall(self, _p:int=0): return localctx + class TailContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def OB(self): + return self.getToken(LuaParser.OB, 0) + + def exp(self): + return self.getTypedRuleContext(LuaParser.ExpContext,0) + + + def CB(self): + return self.getToken(LuaParser.CB, 0) + + def DOT(self): + return self.getToken(LuaParser.DOT, 0) + + def NAME(self): + return self.getToken(LuaParser.NAME, 0) + + def getRuleIndex(self): + return LuaParser.RULE_tail + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterTail" ): + listener.enterTail(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitTail" ): + listener.exitTail(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitTail" ): + return visitor.visitTail(self) + else: + return visitor.visitChildren(self) + + + + + def tail(self): + + localctx = LuaParser.TailContext(self, self._ctx, self.state) + self.enterRule(localctx, 54, self.RULE_tail) + try: + self.enterOuterAlt(localctx, 1) + self.state = 363 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [48]: + self.state = 357 + self.match(LuaParser.OB) + self.state = 358 + self.exp(0) + self.state = 359 + self.match(LuaParser.CB) + pass + elif token in [27]: + self.state = 361 + self.match(LuaParser.DOT) + self.state = 362 + self.match(LuaParser.NAME) + 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 NestedtailContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def tail(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(LuaParser.TailContext) + else: + return self.getTypedRuleContext(LuaParser.TailContext,i) + + + def getRuleIndex(self): + return LuaParser.RULE_nestedtail + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterNestedtail" ): + listener.enterNestedtail(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitNestedtail" ): + listener.exitNestedtail(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitNestedtail" ): + return visitor.visitNestedtail(self) + else: + return visitor.visitChildren(self) + + + + + def nestedtail(self): + + localctx = LuaParser.NestedtailContext(self, self._ctx, self.state) + self.enterRule(localctx, 56, self.RULE_nestedtail) + try: + self.enterOuterAlt(localctx, 1) + self.state = 368 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,26,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 365 + self.tail() + self.state = 370 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,26,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + class ArgsContext(ParserRuleContext): __slots__ = 'parser' @@ -2395,41 +2943,47 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitArgs" ): listener.exitArgs(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitArgs" ): + return visitor.visitArgs(self) + else: + return visitor.visitChildren(self) + def args(self): localctx = LuaParser.ArgsContext(self, self._ctx, self.state) - self.enterRule(localctx, 32, self.RULE_args) + self.enterRule(localctx, 58, self.RULE_args) self._la = 0 # Token type try: - self.state = 415 + self.state = 378 self._errHandler.sync(self) token = self._input.LA(1) if token in [31]: self.enterOuterAlt(localctx, 1) - self.state = 408 + self.state = 371 self.match(LuaParser.OP) - self.state = 410 + self.state = 373 self._errHandler.sync(self) _la = self._input.LA(1) if ((((_la - 17)) & ~0x3f) == 0 and ((1 << (_la - 17)) & 280650879957889) != 0): - self.state = 409 + self.state = 372 self.explist() - self.state = 412 + self.state = 375 self.match(LuaParser.CP) pass elif token in [46]: self.enterOuterAlt(localctx, 2) - self.state = 413 + self.state = 376 self.tableconstructor() pass elif token in [58, 59, 60]: self.enterOuterAlt(localctx, 3) - self.state = 414 + self.state = 377 self.string() pass else: @@ -2444,7 +2998,7 @@ def args(self): return localctx - class FunctiondefContext(ParserRuleContext): + class AnonfunctiondefContext(ParserRuleContext): __slots__ = 'parser' def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): @@ -2459,28 +3013,34 @@ def funcbody(self): def getRuleIndex(self): - return LuaParser.RULE_functiondef + return LuaParser.RULE_anonfunctiondef def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterFunctiondef" ): - listener.enterFunctiondef(self) + if hasattr( listener, "enterAnonfunctiondef" ): + listener.enterAnonfunctiondef(self) def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitFunctiondef" ): - listener.exitFunctiondef(self) + if hasattr( listener, "exitAnonfunctiondef" ): + listener.exitAnonfunctiondef(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitAnonfunctiondef" ): + return visitor.visitAnonfunctiondef(self) + else: + return visitor.visitChildren(self) - def functiondef(self): - localctx = LuaParser.FunctiondefContext(self, self._ctx, self.state) - self.enterRule(localctx, 34, self.RULE_functiondef) + def anonfunctiondef(self): + + localctx = LuaParser.AnonfunctiondefContext(self, self._ctx, self.state) + self.enterRule(localctx, 60, self.RULE_anonfunctiondef) try: self.enterOuterAlt(localctx, 1) - self.state = 417 + self.state = 380 self.match(LuaParser.FUNCTION) - self.state = 418 + self.state = 381 self.funcbody() except RecognitionException as re: localctx.exception = re @@ -2526,24 +3086,30 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitFuncbody" ): listener.exitFuncbody(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitFuncbody" ): + return visitor.visitFuncbody(self) + else: + return visitor.visitChildren(self) + def funcbody(self): localctx = LuaParser.FuncbodyContext(self, self._ctx, self.state) - self.enterRule(localctx, 36, self.RULE_funcbody) + self.enterRule(localctx, 62, self.RULE_funcbody) try: self.enterOuterAlt(localctx, 1) - self.state = 420 + self.state = 383 self.match(LuaParser.OP) - self.state = 421 + self.state = 384 self.parlist() - self.state = 422 + self.state = 385 self.match(LuaParser.CP) - self.state = 423 + self.state = 386 self.block() - self.state = 424 + self.state = 387 self.match(LuaParser.END) except RecognitionException as re: localctx.exception = re @@ -2582,36 +3148,42 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitParlist" ): listener.exitParlist(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitParlist" ): + return visitor.visitParlist(self) + else: + return visitor.visitChildren(self) + def parlist(self): localctx = LuaParser.ParlistContext(self, self._ctx, self.state) - self.enterRule(localctx, 38, self.RULE_parlist) + self.enterRule(localctx, 64, self.RULE_parlist) self._la = 0 # Token type try: - self.state = 433 + self.state = 396 self._errHandler.sync(self) token = self._input.LA(1) if token in [57]: self.enterOuterAlt(localctx, 1) - self.state = 426 + self.state = 389 self.namelist() - self.state = 429 + self.state = 392 self._errHandler.sync(self) _la = self._input.LA(1) if _la==15: - self.state = 427 + self.state = 390 self.match(LuaParser.COMMA) - self.state = 428 + self.state = 391 self.match(LuaParser.DDD) pass elif token in [55]: self.enterOuterAlt(localctx, 2) - self.state = 431 + self.state = 394 self.match(LuaParser.DDD) pass elif token in [32]: @@ -2658,27 +3230,33 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitTableconstructor" ): listener.exitTableconstructor(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitTableconstructor" ): + return visitor.visitTableconstructor(self) + else: + return visitor.visitChildren(self) + def tableconstructor(self): localctx = LuaParser.TableconstructorContext(self, self._ctx, self.state) - self.enterRule(localctx, 40, self.RULE_tableconstructor) + self.enterRule(localctx, 66, self.RULE_tableconstructor) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 435 + self.state = 398 self.match(LuaParser.OCU) - self.state = 437 + self.state = 400 self._errHandler.sync(self) _la = self._input.LA(1) if ((((_la - 17)) & ~0x3f) == 0 and ((1 << (_la - 17)) & 280653027441537) != 0): - self.state = 436 + self.state = 399 self.fieldlist() - self.state = 439 + self.state = 402 self.match(LuaParser.CCU) except RecognitionException as re: localctx.exception = re @@ -2721,36 +3299,42 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitFieldlist" ): listener.exitFieldlist(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitFieldlist" ): + return visitor.visitFieldlist(self) + else: + return visitor.visitChildren(self) + def fieldlist(self): localctx = LuaParser.FieldlistContext(self, self._ctx, self.state) - self.enterRule(localctx, 42, self.RULE_fieldlist) + self.enterRule(localctx, 68, self.RULE_fieldlist) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 441 + self.state = 404 self.field() - self.state = 447 + self.state = 410 self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,49,self._ctx) + _alt = self._interp.adaptivePredict(self._input,32,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: - self.state = 442 + self.state = 405 self.fieldsep() - self.state = 443 + self.state = 406 self.field() - self.state = 449 + self.state = 412 self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,49,self._ctx) + _alt = self._interp.adaptivePredict(self._input,32,self._ctx) - self.state = 451 + self.state = 414 self._errHandler.sync(self) _la = self._input.LA(1) if _la==1 or _la==15: - self.state = 450 + self.state = 413 self.fieldsep() @@ -2800,44 +3384,50 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitField" ): listener.exitField(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitField" ): + return visitor.visitField(self) + else: + return visitor.visitChildren(self) + def field(self): localctx = LuaParser.FieldContext(self, self._ctx, self.state) - self.enterRule(localctx, 44, self.RULE_field) + self.enterRule(localctx, 70, self.RULE_field) try: - self.state = 463 + self.state = 426 self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,51,self._ctx) + la_ = self._interp.adaptivePredict(self._input,34,self._ctx) if la_ == 1: self.enterOuterAlt(localctx, 1) - self.state = 453 + self.state = 416 self.match(LuaParser.OB) - self.state = 454 + self.state = 417 self.exp(0) - self.state = 455 + self.state = 418 self.match(LuaParser.CB) - self.state = 456 + self.state = 419 self.match(LuaParser.EQ) - self.state = 457 + self.state = 420 self.exp(0) pass elif la_ == 2: self.enterOuterAlt(localctx, 2) - self.state = 459 + self.state = 422 self.match(LuaParser.NAME) - self.state = 460 + self.state = 423 self.match(LuaParser.EQ) - self.state = 461 + self.state = 424 self.exp(0) pass elif la_ == 3: self.enterOuterAlt(localctx, 3) - self.state = 462 + self.state = 425 self.exp(0) pass @@ -2875,17 +3465,23 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitFieldsep" ): listener.exitFieldsep(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitFieldsep" ): + return visitor.visitFieldsep(self) + else: + return visitor.visitChildren(self) + def fieldsep(self): localctx = LuaParser.FieldsepContext(self, self._ctx, self.state) - self.enterRule(localctx, 46, self.RULE_fieldsep) + self.enterRule(localctx, 72, self.RULE_fieldsep) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 465 + self.state = 428 _la = self._input.LA(1) if not(_la==1 or _la==15): self._errHandler.recoverInline(self) @@ -2931,17 +3527,23 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitNumber" ): listener.exitNumber(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitNumber" ): + return visitor.visitNumber(self) + else: + return visitor.visitChildren(self) + def number(self): localctx = LuaParser.NumberContext(self, self._ctx, self.state) - self.enterRule(localctx, 48, self.RULE_number) + self.enterRule(localctx, 74, self.RULE_number) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 467 + self.state = 430 _la = self._input.LA(1) if not(((((_la - 61)) & ~0x3f) == 0 and ((1 << (_la - 61)) & 15) != 0)): self._errHandler.recoverInline(self) @@ -2984,17 +3586,23 @@ def exitRule(self, listener:ParseTreeListener): if hasattr( listener, "exitString" ): listener.exitString(self) + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitString" ): + return visitor.visitString(self) + else: + return visitor.visitChildren(self) + def string(self): localctx = LuaParser.StringContext(self, self._ctx, self.state) - self.enterRule(localctx, 50, self.RULE_string) + self.enterRule(localctx, 76, self.RULE_string) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 469 + self.state = 432 _la = self._input.LA(1) if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 2017612633061982208) != 0)): self._errHandler.recoverInline(self) @@ -3014,8 +3622,8 @@ def string(self): def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int): if self._predicates == None: self._predicates = dict() - self._predicates[12] = self.exp_sempred - self._predicates[15] = self.functioncall_sempred + self._predicates[23] = self.exp_sempred + self._predicates[26] = self.functioncall_sempred pred = self._predicates.get(ruleIndex, None) if pred is None: raise Exception("No predicate with index:" + str(ruleIndex)) diff --git a/luaparser/parser/LuaParserListener.py b/luaparser/parser/LuaParserListener.py index 575b9a6..ffe69ac 100644 --- a/luaparser/parser/LuaParserListener.py +++ b/luaparser/parser/LuaParserListener.py @@ -44,6 +44,105 @@ def exitStat(self, ctx:LuaParser.StatContext): pass + # Enter a parse tree produced by LuaParser#assign. + def enterAssign(self, ctx:LuaParser.AssignContext): + pass + + # Exit a parse tree produced by LuaParser#assign. + def exitAssign(self, ctx:LuaParser.AssignContext): + pass + + + # Enter a parse tree produced by LuaParser#goto. + def enterGoto(self, ctx:LuaParser.GotoContext): + pass + + # Exit a parse tree produced by LuaParser#goto. + def exitGoto(self, ctx:LuaParser.GotoContext): + pass + + + # Enter a parse tree produced by LuaParser#do. + def enterDo(self, ctx:LuaParser.DoContext): + pass + + # Exit a parse tree produced by LuaParser#do. + def exitDo(self, ctx:LuaParser.DoContext): + pass + + + # Enter a parse tree produced by LuaParser#while. + def enterWhile(self, ctx:LuaParser.WhileContext): + pass + + # Exit a parse tree produced by LuaParser#while. + def exitWhile(self, ctx:LuaParser.WhileContext): + pass + + + # Enter a parse tree produced by LuaParser#repeat. + def enterRepeat(self, ctx:LuaParser.RepeatContext): + pass + + # Exit a parse tree produced by LuaParser#repeat. + def exitRepeat(self, ctx:LuaParser.RepeatContext): + pass + + + # Enter a parse tree produced by LuaParser#if. + def enterIf(self, ctx:LuaParser.IfContext): + pass + + # Exit a parse tree produced by LuaParser#if. + def exitIf(self, ctx:LuaParser.IfContext): + pass + + + # Enter a parse tree produced by LuaParser#for. + def enterFor(self, ctx:LuaParser.ForContext): + pass + + # Exit a parse tree produced by LuaParser#for. + def exitFor(self, ctx:LuaParser.ForContext): + pass + + + # Enter a parse tree produced by LuaParser#forin. + def enterForin(self, ctx:LuaParser.ForinContext): + pass + + # Exit a parse tree produced by LuaParser#forin. + def exitForin(self, ctx:LuaParser.ForinContext): + pass + + + # Enter a parse tree produced by LuaParser#functiondef. + def enterFunctiondef(self, ctx:LuaParser.FunctiondefContext): + pass + + # Exit a parse tree produced by LuaParser#functiondef. + def exitFunctiondef(self, ctx:LuaParser.FunctiondefContext): + pass + + + # Enter a parse tree produced by LuaParser#localfunction. + def enterLocalfunction(self, ctx:LuaParser.LocalfunctionContext): + pass + + # Exit a parse tree produced by LuaParser#localfunction. + def exitLocalfunction(self, ctx:LuaParser.LocalfunctionContext): + pass + + + # Enter a parse tree produced by LuaParser#localassign. + def enterLocalassign(self, ctx:LuaParser.LocalassignContext): + pass + + # Exit a parse tree produced by LuaParser#localassign. + def exitLocalassign(self, ctx:LuaParser.LocalassignContext): + pass + + # Enter a parse tree produced by LuaParser#attnamelist. def enterAttnamelist(self, ctx:LuaParser.AttnamelistContext): pass @@ -152,6 +251,24 @@ def exitFunctioncall(self, ctx:LuaParser.FunctioncallContext): pass + # Enter a parse tree produced by LuaParser#tail. + def enterTail(self, ctx:LuaParser.TailContext): + pass + + # Exit a parse tree produced by LuaParser#tail. + def exitTail(self, ctx:LuaParser.TailContext): + pass + + + # Enter a parse tree produced by LuaParser#nestedtail. + def enterNestedtail(self, ctx:LuaParser.NestedtailContext): + pass + + # Exit a parse tree produced by LuaParser#nestedtail. + def exitNestedtail(self, ctx:LuaParser.NestedtailContext): + pass + + # Enter a parse tree produced by LuaParser#args. def enterArgs(self, ctx:LuaParser.ArgsContext): pass @@ -161,12 +278,12 @@ def exitArgs(self, ctx:LuaParser.ArgsContext): pass - # Enter a parse tree produced by LuaParser#functiondef. - def enterFunctiondef(self, ctx:LuaParser.FunctiondefContext): + # Enter a parse tree produced by LuaParser#anonfunctiondef. + def enterAnonfunctiondef(self, ctx:LuaParser.AnonfunctiondefContext): pass - # Exit a parse tree produced by LuaParser#functiondef. - def exitFunctiondef(self, ctx:LuaParser.FunctiondefContext): + # Exit a parse tree produced by LuaParser#anonfunctiondef. + def exitAnonfunctiondef(self, ctx:LuaParser.AnonfunctiondefContext): pass diff --git a/luaparser/parser/LuaParserVisitor.py b/luaparser/parser/LuaParserVisitor.py new file mode 100644 index 0000000..3eb570c --- /dev/null +++ b/luaparser/parser/LuaParserVisitor.py @@ -0,0 +1,208 @@ +# Generated from luaparser/parser/LuaParser.g4 by ANTLR 4.13.2 +from antlr4 import * +if "." in __name__: + from .LuaParser import LuaParser +else: + from LuaParser import LuaParser + +# This class defines a complete generic visitor for a parse tree produced by LuaParser. + +class LuaParserVisitor(ParseTreeVisitor): + + # Visit a parse tree produced by LuaParser#start_. + def visitStart_(self, ctx:LuaParser.Start_Context): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#chunk. + def visitChunk(self, ctx:LuaParser.ChunkContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#block. + def visitBlock(self, ctx:LuaParser.BlockContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#stat. + def visitStat(self, ctx:LuaParser.StatContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#assign. + def visitAssign(self, ctx:LuaParser.AssignContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#goto. + def visitGoto(self, ctx:LuaParser.GotoContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#do. + def visitDo(self, ctx:LuaParser.DoContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#while. + def visitWhile(self, ctx:LuaParser.WhileContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#repeat. + def visitRepeat(self, ctx:LuaParser.RepeatContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#if. + def visitIf(self, ctx:LuaParser.IfContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#for. + def visitFor(self, ctx:LuaParser.ForContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#forin. + def visitForin(self, ctx:LuaParser.ForinContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#functiondef. + def visitFunctiondef(self, ctx:LuaParser.FunctiondefContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#localfunction. + def visitLocalfunction(self, ctx:LuaParser.LocalfunctionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#localassign. + def visitLocalassign(self, ctx:LuaParser.LocalassignContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#attnamelist. + def visitAttnamelist(self, ctx:LuaParser.AttnamelistContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#attrib. + def visitAttrib(self, ctx:LuaParser.AttribContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#retstat. + def visitRetstat(self, ctx:LuaParser.RetstatContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#label. + def visitLabel(self, ctx:LuaParser.LabelContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#funcname. + def visitFuncname(self, ctx:LuaParser.FuncnameContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#varlist. + def visitVarlist(self, ctx:LuaParser.VarlistContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#namelist. + def visitNamelist(self, ctx:LuaParser.NamelistContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#explist. + def visitExplist(self, ctx:LuaParser.ExplistContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#exp. + def visitExp(self, ctx:LuaParser.ExpContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#var. + def visitVar(self, ctx:LuaParser.VarContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#prefixexp. + def visitPrefixexp(self, ctx:LuaParser.PrefixexpContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#functioncall. + def visitFunctioncall(self, ctx:LuaParser.FunctioncallContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#tail. + def visitTail(self, ctx:LuaParser.TailContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#nestedtail. + def visitNestedtail(self, ctx:LuaParser.NestedtailContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#args. + def visitArgs(self, ctx:LuaParser.ArgsContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#anonfunctiondef. + def visitAnonfunctiondef(self, ctx:LuaParser.AnonfunctiondefContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#funcbody. + def visitFuncbody(self, ctx:LuaParser.FuncbodyContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#parlist. + def visitParlist(self, ctx:LuaParser.ParlistContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#tableconstructor. + def visitTableconstructor(self, ctx:LuaParser.TableconstructorContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#fieldlist. + def visitFieldlist(self, ctx:LuaParser.FieldlistContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#field. + def visitField(self, ctx:LuaParser.FieldContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#fieldsep. + def visitFieldsep(self, ctx:LuaParser.FieldsepContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#number. + def visitNumber(self, ctx:LuaParser.NumberContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LuaParser#string. + def visitString(self, ctx:LuaParser.StringContext): + return self.visitChildren(ctx) + + + +del LuaParser \ No newline at end of file diff --git a/luaparser/parser/transformGrammar.py b/luaparser/parser/transformGrammar.py new file mode 100644 index 0000000..d91d97a --- /dev/null +++ b/luaparser/parser/transformGrammar.py @@ -0,0 +1,31 @@ +import sys, os, re, shutil +from glob import glob +from pathlib import Path + +def main(argv): + for file in glob("./*.g4"): + fix(file) + +def fix(file_path): + print("Altering " + file_path) + if not os.path.exists(file_path): + print(f"Could not find file: {file_path}") + sys.exit(1) + parts = os.path.split(file_path) + file_name = parts[-1] + + shutil.move(file_path, file_path + ".bak") + input_file = open(file_path + ".bak",'r') + output_file = open(file_path, 'w') + for x in input_file: + if 'this.' in x: + x = x.replace('this.', 'self.') + output_file.write(x) + output_file.flush() + + print("Writing ...") + input_file.close() + output_file.close() + +if __name__ == '__main__': + main(sys.argv) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 011b54b..1f6c65e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ antlr4-python3-runtime==4.13.2 -multimethod \ No newline at end of file +multimethod