UNPKG

@maniascript/parser

Version:
1,345 lines 399 kB
import * as antlr from "antlr4ng"; import { Token } from "antlr4ng"; import { ManiaScriptParserListener } from "./ManiaScriptParserListener.js"; import { ManiaScriptParserVisitor } from "./ManiaScriptParserVisitor.js"; export class ManiaScriptParser extends antlr.Parser { static CLASS = 1; static SINGLE_LINE_COMMENT = 2; static MULTI_LINES_COMMENT = 3; static KEYWORD_ASSERT = 4; static KEYWORD_AS = 5; static KEYWORD_BREAK = 6; static KEYWORD_CASE = 7; static KEYWORD_CAST = 8; static KEYWORD_CONTINUE = 9; static KEYWORD_DECLARE = 10; static KEYWORD_LET = 11; static KEYWORD_DEFAULT = 12; static KEYWORD_DUMPTYPE = 13; static KEYWORD_DUMP = 14; static KEYWORD_ELSE = 15; static KEYWORD_FOREACH = 16; static KEYWORD_FOR = 17; static KEYWORD_IF = 18; static KEYWORD_IN = 19; static KEYWORD_IS = 20; static KEYWORD_LOG = 21; static KEYWORD_MAIN = 22; static KEYWORD_MEANWHILE = 23; static KEYWORD_RETURN = 24; static KEYWORD_REVERSE = 25; static KEYWORD_SLEEP = 26; static KEYWORD_SWITCHTYPE = 27; static KEYWORD_SWITCH = 28; static KEYWORD_TUNINGEND = 29; static KEYWORD_TUNINGMARK = 30; static KEYWORD_TUNINGSTART = 31; static KEYWORD_WAIT = 32; static KEYWORD_WHILE = 33; static KEYWORD_YIELD = 34; static KEYWORD_NOW = 35; static KEYWORD_THIS = 36; static LABEL_PLUS = 37; static LABEL_MINUS = 38; static LABEL_STAR = 39; static OPERATOR_ASSIGN = 40; static OPERATOR_SEMICOLON = 41; static OPERATOR_PLUS = 42; static OPERATOR_MINUS = 43; static OPERATOR_MULTIPLY = 44; static OPERATOR_DIVIDE = 45; static OPERATOR_MODULO = 46; static OPERATOR_OPEN_TEXT_TRIPLE = 47; static OPERATOR_CLOSE_INTERPOLATION = 48; static OPERATOR_OPEN_INTERPOLATION_ERROR = 49; static OPERATOR_CLOSE_INTERPOLATION_ERROR = 50; static OPERATOR_OPEN_TEXT_SINGLE = 51; static OPERATOR_OPEN_PAREN = 52; static OPERATOR_CLOSE_PAREN = 53; static OPERATOR_OPEN_BRACKET = 54; static OPERATOR_CLOSE_BRACKET = 55; static OPERATOR_OPEN_BRACE = 56; static OPERATOR_CLOSE_BRACE = 57; static OPERATOR_CONCAT = 58; static OPERATOR_COMMA = 59; static OPERATOR_DOUBLECOLON = 60; static OPERATOR_COLON = 61; static OPERATOR_DOT = 62; static OPERATOR_NOT = 63; static OPERATOR_LESSTHAN = 64; static OPERATOR_MORETHAN = 65; static OPERATOR_LESSTHANEQUAL = 66; static OPERATOR_MORETHANEQUAL = 67; static OPERATOR_EQUAL = 68; static OPERATOR_NOTEQUAL = 69; static OPERATOR_AND = 70; static OPERATOR_OR = 71; static OPERATOR_MULTIPLYASSIGN = 72; static OPERATOR_DIVIDEASSIGN = 73; static OPERATOR_PLUSASSIGN = 74; static OPERATOR_MINUSASSIGN = 75; static OPERATOR_MODULOASSIGN = 76; static OPERATOR_ARROWASSIGN = 77; static OPERATOR_CONCATASSIGN = 78; static OPERATOR_TEXTTRANSLATE = 79; static OPERATOR_ARROW = 80; static TYPE_BOOLEAN = 81; static TYPE_IDENT = 82; static TYPE_INT2 = 83; static TYPE_INT3 = 84; static TYPE_INTEGER = 85; static TYPE_REAL = 86; static TYPE_TEXT = 87; static TYPE_VEC2 = 88; static TYPE_VEC3 = 89; static TYPE_VOID = 90; static STORAGESPECIFIER_CLOUD = 91; static STORAGESPECIFIER_METADATA = 92; static STORAGESPECIFIER_NETREAD = 93; static STORAGESPECIFIER_NETWRITE = 94; static STORAGESPECIFIER_PERSISTENT = 95; static LITERAL_REAL = 96; static LITERAL_INTEGER = 97; static LITERAL_BOOLEAN = 98; static LITERAL_NULL = 99; static LITERAL_NULLID = 100; static DIRECTIVE_REQUIRE_CONTEXT = 101; static DIRECTIVE_EXTENDS = 102; static DIRECTIVE_INCLUDE = 103; static DIRECTIVE_SETTING = 104; static DIRECTIVE_COMMAND = 105; static DIRECTIVE_STRUCT = 106; static DIRECTIVE_CONST = 107; static IDENTIFIER = 108; static WHITESPACES = 109; static LINE_TERMINATOR = 110; static UNKNOWN = 111; static OPERATOR_CLOSE_TEXT_TRIPLE = 112; static OPERATOR_OPEN_INTERPOLATION = 113; static PART_TEXT_TRIPLE = 114; static PART_TEXT_TRIPLE_QUOTE = 115; static PART_TEXT_TRIPLE_BRACE = 116; static OPERATOR_CLOSE_TEXT_SINGLE = 117; static PART_TEXT_SINGLE = 118; static RULE_program = 0; static RULE_programContent = 1; static RULE_directives = 2; static RULE_directive = 3; static RULE_requireContextDirective = 4; static RULE_extendsDirective = 5; static RULE_extendsPath = 6; static RULE_includeDirective = 7; static RULE_includePath = 8; static RULE_includeAlias = 9; static RULE_namespaceDefinition = 10; static RULE_settingDirective = 11; static RULE_settingName = 12; static RULE_commandDirective = 13; static RULE_commandName = 14; static RULE_structDirective = 15; static RULE_structDeclaration = 16; static RULE_structMembers = 17; static RULE_structMember = 18; static RULE_structAliasing = 19; static RULE_namespaceName = 20; static RULE_structName = 21; static RULE_constDirective = 22; static RULE_constDeclaration = 23; static RULE_constAliasing = 24; static RULE_constName = 25; static RULE_declarations = 26; static RULE_declaration = 27; static RULE_variableDeclaration = 28; static RULE_variableName = 29; static RULE_initializer = 30; static RULE_functionDeclaration = 31; static RULE_functionName = 32; static RULE_parameters = 33; static RULE_parameter = 34; static RULE_labelDeclaration = 35; static RULE_labelName = 36; static RULE_mainStatement = 37; static RULE_block = 38; static RULE_statements = 39; static RULE_statement = 40; static RULE_expressionStatement = 41; static RULE_assignmentStatement = 42; static RULE_returnStatement = 43; static RULE_labelStatement = 44; static RULE_labelInsert = 45; static RULE_labelOverwrite = 46; static RULE_assertStatement = 47; static RULE_foreachStatement = 48; static RULE_forStatement = 49; static RULE_whileStatement = 50; static RULE_meanwhileStatement = 51; static RULE_breakStatement = 52; static RULE_continueStatement = 53; static RULE_switchStatement = 54; static RULE_switchClauseList = 55; static RULE_switchCase = 56; static RULE_switchDefault = 57; static RULE_switchtypeStatement = 58; static RULE_switchtypeClauseList = 59; static RULE_switchtypeCase = 60; static RULE_switchtypeDefault = 61; static RULE_conditionalStatement = 62; static RULE_ifBranch = 63; static RULE_elseIfBranch = 64; static RULE_elseBranch = 65; static RULE_logStatement = 66; static RULE_sleepStatement = 67; static RULE_tuningstartStatement = 68; static RULE_tuningendStatement = 69; static RULE_tuningmarkStatement = 70; static RULE_waitStatement = 71; static RULE_yieldStatement = 72; static RULE_expression = 73; static RULE_functionCall = 74; static RULE_arguments = 75; static RULE_argument = 76; static RULE_textInterpolation = 77; static RULE_structure = 78; static RULE_structureMemberInitializationList = 79; static RULE_structureMemberInitialization = 80; static RULE_structMemberName = 81; static RULE_structIdentifier = 82; static RULE_array = 83; static RULE_associativeArray = 84; static RULE_simpleArray = 85; static RULE_emptyArray = 86; static RULE_identifier = 87; static RULE_literal = 88; static RULE_textLiteral = 89; static RULE_textTranslatedLiteral = 90; static RULE_textBaseLiteral = 91; static RULE_textSingleQuoteLiteral = 92; static RULE_textTripleQuoteLiteral = 93; static RULE_enumLiteral = 94; static RULE_vector = 95; static RULE_parenthesis = 96; static RULE_type = 97; static RULE_initializerType = 98; static RULE_baseType = 99; static RULE_simpleType = 100; static RULE_enumType = 101; static RULE_customType = 102; static RULE_arrayType = 103; static RULE_arrayTypeDimension = 104; static RULE_assignmentOperator = 105; static RULE_storageSpecifier = 106; static RULE_identifierAlias = 107; static RULE_textAlias = 108; static RULE_className = 109; static RULE_objectMemberName = 110; static RULE_enumName = 111; static RULE_enumValue = 112; static literalNames = [ null, null, null, null, "'assert'", "'as'", "'break'", "'case'", "'cast'", "'continue'", "'declare'", "'let'", "'default'", "'dumptype'", "'dump'", "'else'", "'foreach'", "'for'", "'if'", "'in'", "'is'", "'log'", "'main'", "'meanwhile'", "'return'", "'reverse'", "'sleep'", "'switchtype'", "'switch'", "'tuningend'", "'tuningmark'", "'tuningstart'", "'wait'", "'while'", "'yield'", "'Now'", "'This'", "'+++'", "'---'", "'***'", "'='", "';'", "'+'", "'-'", "'*'", "'/'", "'%'", null, null, "'{{{'", "'}}}'", null, "'('", "')'", "'['", "']'", null, "'}'", "'^'", "','", "'::'", "':'", "'.'", "'!'", "'<'", "'>'", "'<='", "'>='", "'=='", "'!='", "'&&'", "'||'", "'*='", "'/='", "'+='", "'-='", "'%='", "'<=>'", "'^='", "'_('", "'=>'", "'Boolean'", "'Ident'", "'Int2'", "'Int3'", "'Integer'", "'Real'", "'Text'", "'Vec2'", "'Vec3'", "'Void'", "'cloud'", "'metadata'", "'netread'", "'netwrite'", "'persistent'", null, null, null, "'Null'", "'NullId'", "'#RequireContext'", "'#Extends'", "'#Include'", "'#Setting'", "'#Command'", "'#Struct'", "'#Const'" ]; static symbolicNames = [ null, "CLASS", "SINGLE_LINE_COMMENT", "MULTI_LINES_COMMENT", "KEYWORD_ASSERT", "KEYWORD_AS", "KEYWORD_BREAK", "KEYWORD_CASE", "KEYWORD_CAST", "KEYWORD_CONTINUE", "KEYWORD_DECLARE", "KEYWORD_LET", "KEYWORD_DEFAULT", "KEYWORD_DUMPTYPE", "KEYWORD_DUMP", "KEYWORD_ELSE", "KEYWORD_FOREACH", "KEYWORD_FOR", "KEYWORD_IF", "KEYWORD_IN", "KEYWORD_IS", "KEYWORD_LOG", "KEYWORD_MAIN", "KEYWORD_MEANWHILE", "KEYWORD_RETURN", "KEYWORD_REVERSE", "KEYWORD_SLEEP", "KEYWORD_SWITCHTYPE", "KEYWORD_SWITCH", "KEYWORD_TUNINGEND", "KEYWORD_TUNINGMARK", "KEYWORD_TUNINGSTART", "KEYWORD_WAIT", "KEYWORD_WHILE", "KEYWORD_YIELD", "KEYWORD_NOW", "KEYWORD_THIS", "LABEL_PLUS", "LABEL_MINUS", "LABEL_STAR", "OPERATOR_ASSIGN", "OPERATOR_SEMICOLON", "OPERATOR_PLUS", "OPERATOR_MINUS", "OPERATOR_MULTIPLY", "OPERATOR_DIVIDE", "OPERATOR_MODULO", "OPERATOR_OPEN_TEXT_TRIPLE", "OPERATOR_CLOSE_INTERPOLATION", "OPERATOR_OPEN_INTERPOLATION_ERROR", "OPERATOR_CLOSE_INTERPOLATION_ERROR", "OPERATOR_OPEN_TEXT_SINGLE", "OPERATOR_OPEN_PAREN", "OPERATOR_CLOSE_PAREN", "OPERATOR_OPEN_BRACKET", "OPERATOR_CLOSE_BRACKET", "OPERATOR_OPEN_BRACE", "OPERATOR_CLOSE_BRACE", "OPERATOR_CONCAT", "OPERATOR_COMMA", "OPERATOR_DOUBLECOLON", "OPERATOR_COLON", "OPERATOR_DOT", "OPERATOR_NOT", "OPERATOR_LESSTHAN", "OPERATOR_MORETHAN", "OPERATOR_LESSTHANEQUAL", "OPERATOR_MORETHANEQUAL", "OPERATOR_EQUAL", "OPERATOR_NOTEQUAL", "OPERATOR_AND", "OPERATOR_OR", "OPERATOR_MULTIPLYASSIGN", "OPERATOR_DIVIDEASSIGN", "OPERATOR_PLUSASSIGN", "OPERATOR_MINUSASSIGN", "OPERATOR_MODULOASSIGN", "OPERATOR_ARROWASSIGN", "OPERATOR_CONCATASSIGN", "OPERATOR_TEXTTRANSLATE", "OPERATOR_ARROW", "TYPE_BOOLEAN", "TYPE_IDENT", "TYPE_INT2", "TYPE_INT3", "TYPE_INTEGER", "TYPE_REAL", "TYPE_TEXT", "TYPE_VEC2", "TYPE_VEC3", "TYPE_VOID", "STORAGESPECIFIER_CLOUD", "STORAGESPECIFIER_METADATA", "STORAGESPECIFIER_NETREAD", "STORAGESPECIFIER_NETWRITE", "STORAGESPECIFIER_PERSISTENT", "LITERAL_REAL", "LITERAL_INTEGER", "LITERAL_BOOLEAN", "LITERAL_NULL", "LITERAL_NULLID", "DIRECTIVE_REQUIRE_CONTEXT", "DIRECTIVE_EXTENDS", "DIRECTIVE_INCLUDE", "DIRECTIVE_SETTING", "DIRECTIVE_COMMAND", "DIRECTIVE_STRUCT", "DIRECTIVE_CONST", "IDENTIFIER", "WHITESPACES", "LINE_TERMINATOR", "UNKNOWN", "OPERATOR_CLOSE_TEXT_TRIPLE", "OPERATOR_OPEN_INTERPOLATION", "PART_TEXT_TRIPLE", "PART_TEXT_TRIPLE_QUOTE", "PART_TEXT_TRIPLE_BRACE", "OPERATOR_CLOSE_TEXT_SINGLE", "PART_TEXT_SINGLE" ]; static ruleNames = [ "program", "programContent", "directives", "directive", "requireContextDirective", "extendsDirective", "extendsPath", "includeDirective", "includePath", "includeAlias", "namespaceDefinition", "settingDirective", "settingName", "commandDirective", "commandName", "structDirective", "structDeclaration", "structMembers", "structMember", "structAliasing", "namespaceName", "structName", "constDirective", "constDeclaration", "constAliasing", "constName", "declarations", "declaration", "variableDeclaration", "variableName", "initializer", "functionDeclaration", "functionName", "parameters", "parameter", "labelDeclaration", "labelName", "mainStatement", "block", "statements", "statement", "expressionStatement", "assignmentStatement", "returnStatement", "labelStatement", "labelInsert", "labelOverwrite", "assertStatement", "foreachStatement", "forStatement", "whileStatement", "meanwhileStatement", "breakStatement", "continueStatement", "switchStatement", "switchClauseList", "switchCase", "switchDefault", "switchtypeStatement", "switchtypeClauseList", "switchtypeCase", "switchtypeDefault", "conditionalStatement", "ifBranch", "elseIfBranch", "elseBranch", "logStatement", "sleepStatement", "tuningstartStatement", "tuningendStatement", "tuningmarkStatement", "waitStatement", "yieldStatement", "expression", "functionCall", "arguments", "argument", "textInterpolation", "structure", "structureMemberInitializationList", "structureMemberInitialization", "structMemberName", "structIdentifier", "array", "associativeArray", "simpleArray", "emptyArray", "identifier", "literal", "textLiteral", "textTranslatedLiteral", "textBaseLiteral", "textSingleQuoteLiteral", "textTripleQuoteLiteral", "enumLiteral", "vector", "parenthesis", "type", "initializerType", "baseType", "simpleType", "enumType", "customType", "arrayType", "arrayTypeDimension", "assignmentOperator", "storageSpecifier", "identifierAlias", "textAlias", "className", "objectMemberName", "enumName", "enumValue", ]; get grammarFileName() { return "ManiaScriptParser.g4"; } get literalNames() { return ManiaScriptParser.literalNames; } get symbolicNames() { return ManiaScriptParser.symbolicNames; } get ruleNames() { return ManiaScriptParser.ruleNames; } get serializedATN() { return ManiaScriptParser._serializedATN; } createFailedPredicateException(predicate, message) { return new antlr.FailedPredicateException(this, predicate, message); } canBeAccessed(ctx) { return (ctx === undefined || (ctx instanceof IdentifierExpressionContext && ctx.identifier().namespaceName()?.IDENTIFIER().symbol === undefined) || ctx instanceof ThisExpressionContext || ctx instanceof FunctionCallExpressionContext || ctx instanceof AsExpressionContext || ctx instanceof ParenthesisExpressionContext || ctx instanceof IndexAccessExpressionContext || ctx instanceof DotAccessExpressionContext); } notAnArrayErrorMessage(ctx) { return (ctx === undefined) ? 'undefined is not an array' : `${ctx.getText()} is not an array`; } notAnObjectErrorMessage(ctx) { return (ctx === undefined) ? 'undefined is not an object' : `${ctx.getText()} is not an object`; } constructor(input) { super(input); this.interpreter = new antlr.ParserATNSimulator(this, ManiaScriptParser._ATN, ManiaScriptParser.decisionsToDFA, new antlr.PredictionContextCache()); } program() { let localContext = new ProgramContext(this.context, this.state); this.enterRule(localContext, 0, ManiaScriptParser.RULE_program); try { this.enterOuterAlt(localContext, 1); { this.state = 226; this.programContent(); this.state = 227; this.match(ManiaScriptParser.EOF); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } programContent() { let localContext = new ProgramContentContext(this.context, this.state); this.enterRule(localContext, 2, ManiaScriptParser.RULE_programContent); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 230; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (((((_la - 101)) & ~0x1F) === 0 && ((1 << (_la - 101)) & 127) !== 0)) { { this.state = 229; this.directives(); } } this.state = 233; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 3074) !== 0) || _la === 39 || _la === 60 || ((((_la - 81)) & ~0x1F) === 0 && ((1 << (_la - 81)) & 134218751) !== 0)) { { this.state = 232; this.declarations(); } } this.state = 236; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 22) { { this.state = 235; this.mainStatement(); } } } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } directives() { let localContext = new DirectivesContext(this.context, this.state); this.enterRule(localContext, 4, ManiaScriptParser.RULE_directives); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 239; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); do { { { this.state = 238; this.directive(); } } this.state = 241; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); } while (((((_la - 101)) & ~0x1F) === 0 && ((1 << (_la - 101)) & 127) !== 0)); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } directive() { let localContext = new DirectiveContext(this.context, this.state); this.enterRule(localContext, 6, ManiaScriptParser.RULE_directive); try { this.state = 250; this.errorHandler.sync(this); switch (this.tokenStream.LA(1)) { case ManiaScriptParser.DIRECTIVE_REQUIRE_CONTEXT: this.enterOuterAlt(localContext, 1); { this.state = 243; this.requireContextDirective(); } break; case ManiaScriptParser.DIRECTIVE_EXTENDS: this.enterOuterAlt(localContext, 2); { this.state = 244; this.extendsDirective(); } break; case ManiaScriptParser.DIRECTIVE_INCLUDE: this.enterOuterAlt(localContext, 3); { this.state = 245; this.includeDirective(); } break; case ManiaScriptParser.DIRECTIVE_SETTING: this.enterOuterAlt(localContext, 4); { this.state = 246; this.settingDirective(); } break; case ManiaScriptParser.DIRECTIVE_COMMAND: this.enterOuterAlt(localContext, 5); { this.state = 247; this.commandDirective(); } break; case ManiaScriptParser.DIRECTIVE_STRUCT: this.enterOuterAlt(localContext, 6); { this.state = 248; this.structDirective(); } break; case ManiaScriptParser.DIRECTIVE_CONST: this.enterOuterAlt(localContext, 7); { this.state = 249; this.constDirective(); } break; default: throw new antlr.NoViableAltException(this); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } requireContextDirective() { let localContext = new RequireContextDirectiveContext(this.context, this.state); this.enterRule(localContext, 8, ManiaScriptParser.RULE_requireContextDirective); try { this.enterOuterAlt(localContext, 1); { this.state = 252; this.match(ManiaScriptParser.DIRECTIVE_REQUIRE_CONTEXT); this.state = 253; this.className(); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } extendsDirective() { let localContext = new ExtendsDirectiveContext(this.context, this.state); this.enterRule(localContext, 10, ManiaScriptParser.RULE_extendsDirective); try { this.enterOuterAlt(localContext, 1); { this.state = 255; this.match(ManiaScriptParser.DIRECTIVE_EXTENDS); this.state = 256; this.extendsPath(); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } extendsPath() { let localContext = new ExtendsPathContext(this.context, this.state); this.enterRule(localContext, 12, ManiaScriptParser.RULE_extendsPath); try { this.enterOuterAlt(localContext, 1); { this.state = 258; this.textLiteral(); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } includeDirective() { let localContext = new IncludeDirectiveContext(this.context, this.state); this.enterRule(localContext, 14, ManiaScriptParser.RULE_includeDirective); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 260; this.match(ManiaScriptParser.DIRECTIVE_INCLUDE); this.state = 261; this.includePath(); this.state = 263; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 5) { { this.state = 262; this.includeAlias(); } } } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } includePath() { let localContext = new IncludePathContext(this.context, this.state); this.enterRule(localContext, 16, ManiaScriptParser.RULE_includePath); try { this.enterOuterAlt(localContext, 1); { this.state = 265; this.textLiteral(); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } includeAlias() { let localContext = new IncludeAliasContext(this.context, this.state); this.enterRule(localContext, 18, ManiaScriptParser.RULE_includeAlias); try { this.enterOuterAlt(localContext, 1); { this.state = 267; this.match(ManiaScriptParser.KEYWORD_AS); this.state = 268; this.namespaceDefinition(); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } namespaceDefinition() { let localContext = new NamespaceDefinitionContext(this.context, this.state); this.enterRule(localContext, 20, ManiaScriptParser.RULE_namespaceDefinition); try { this.enterOuterAlt(localContext, 1); { this.state = 270; this.match(ManiaScriptParser.IDENTIFIER); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } settingDirective() { let localContext = new SettingDirectiveContext(this.context, this.state); this.enterRule(localContext, 22, ManiaScriptParser.RULE_settingDirective); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 272; this.match(ManiaScriptParser.DIRECTIVE_SETTING); this.state = 273; this.settingName(); this.state = 276; this.errorHandler.sync(this); switch (this.tokenStream.LA(1)) { case ManiaScriptParser.CLASS: case ManiaScriptParser.OPERATOR_MINUS: case ManiaScriptParser.OPERATOR_OPEN_TEXT_TRIPLE: case ManiaScriptParser.OPERATOR_OPEN_TEXT_SINGLE: case ManiaScriptParser.OPERATOR_DOUBLECOLON: case ManiaScriptParser.OPERATOR_TEXTTRANSLATE: case ManiaScriptParser.LITERAL_REAL: case ManiaScriptParser.LITERAL_INTEGER: case ManiaScriptParser.LITERAL_BOOLEAN: case ManiaScriptParser.LITERAL_NULL: case ManiaScriptParser.LITERAL_NULLID: case ManiaScriptParser.IDENTIFIER: { this.state = 274; this.literal(); } break; case ManiaScriptParser.OPERATOR_LESSTHAN: { this.state = 275; this.vector(); } break; default: throw new antlr.NoViableAltException(this); } this.state = 279; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 5) { { this.state = 278; this.textAlias(); } } } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } settingName() { let localContext = new SettingNameContext(this.context, this.state); this.enterRule(localContext, 24, ManiaScriptParser.RULE_settingName); try { this.enterOuterAlt(localContext, 1); { this.state = 281; this.match(ManiaScriptParser.IDENTIFIER); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } commandDirective() { let localContext = new CommandDirectiveContext(this.context, this.state); this.enterRule(localContext, 26, ManiaScriptParser.RULE_commandDirective); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 283; this.match(ManiaScriptParser.DIRECTIVE_COMMAND); this.state = 284; this.commandName(); this.state = 285; this.match(ManiaScriptParser.OPERATOR_OPEN_PAREN); this.state = 286; this.type_(); this.state = 287; this.match(ManiaScriptParser.OPERATOR_CLOSE_PAREN); this.state = 289; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 5) { { this.state = 288; this.textAlias(); } } } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } commandName() { let localContext = new CommandNameContext(this.context, this.state); this.enterRule(localContext, 28, ManiaScriptParser.RULE_commandName); try { this.enterOuterAlt(localContext, 1); { this.state = 291; this.match(ManiaScriptParser.IDENTIFIER); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } structDirective() { let localContext = new StructDirectiveContext(this.context, this.state); this.enterRule(localContext, 30, ManiaScriptParser.RULE_structDirective); try { this.state = 295; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 9, this.context)) { case 1: this.enterOuterAlt(localContext, 1); { this.state = 293; this.structDeclaration(); } break; case 2: this.enterOuterAlt(localContext, 2); { this.state = 294; this.structAliasing(); } break; } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } structDeclaration() { let localContext = new StructDeclarationContext(this.context, this.state); this.enterRule(localContext, 32, ManiaScriptParser.RULE_structDeclaration); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 297; this.match(ManiaScriptParser.DIRECTIVE_STRUCT); this.state = 298; this.match(ManiaScriptParser.IDENTIFIER); this.state = 299; this.match(ManiaScriptParser.OPERATOR_OPEN_BRACE); this.state = 301; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 1 || ((((_la - 60)) & ~0x1F) === 0 && ((1 << (_la - 60)) & 2145386497) !== 0) || _la === 108) { { this.state = 300; this.structMembers(); } } this.state = 303; this.match(ManiaScriptParser.OPERATOR_CLOSE_BRACE); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } structMembers() { let localContext = new StructMembersContext(this.context, this.state); this.enterRule(localContext, 34, ManiaScriptParser.RULE_structMembers); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 306; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); do { { { this.state = 305; this.structMember(); } } this.state = 308; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); } while (_la === 1 || ((((_la - 60)) & ~0x1F) === 0 && ((1 << (_la - 60)) & 2145386497) !== 0) || _la === 108); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } structMember() { let localContext = new StructMemberContext(this.context, this.state); this.enterRule(localContext, 36, ManiaScriptParser.RULE_structMember); try { this.enterOuterAlt(localContext, 1); { this.state = 310; this.type_(); this.state = 311; this.match(ManiaScriptParser.IDENTIFIER); this.state = 312; this.match(ManiaScriptParser.OPERATOR_SEMICOLON); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } structAliasing() { let localContext = new StructAliasingContext(this.context, this.state); this.enterRule(localContext, 38, ManiaScriptParser.RULE_structAliasing); try { this.enterOuterAlt(localContext, 1); { this.state = 314; this.match(ManiaScriptParser.DIRECTIVE_STRUCT); this.state = 315; this.namespaceName(); this.state = 316; this.match(ManiaScriptParser.OPERATOR_DOUBLECOLON); this.state = 317; this.structName(); this.state = 318; this.identifierAlias(); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } namespaceName() { let localContext = new NamespaceNameContext(this.context, this.state); this.enterRule(localContext, 40, ManiaScriptParser.RULE_namespaceName); try { this.enterOuterAlt(localContext, 1); { this.state = 320; this.match(ManiaScriptParser.IDENTIFIER); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } structName() { let localContext = new StructNameContext(this.context, this.state); this.enterRule(localContext, 42, ManiaScriptParser.RULE_structName); try { this.enterOuterAlt(localContext, 1); { this.state = 322; this.match(ManiaScriptParser.IDENTIFIER); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } constDirective() { let localContext = new ConstDirectiveContext(this.context, this.state); this.enterRule(localContext, 44, ManiaScriptParser.RULE_constDirective); try { this.state = 326; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 12, this.context)) { case 1: this.enterOuterAlt(localContext, 1); { this.state = 324; this.constDeclaration(); } break; case 2: this.enterOuterAlt(localContext, 2); { this.state = 325; this.constAliasing(); } break; } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } constDeclaration() { let localContext = new ConstDeclarationContext(this.context, this.state); this.enterRule(localContext, 46, ManiaScriptParser.RULE_constDeclaration); try { this.enterOuterAlt(localContext, 1); { this.state = 328; this.match(ManiaScriptParser.DIRECTIVE_CONST); this.state = 329; localContext._name = this.match(ManiaScriptParser.IDENTIFIER); this.state = 334; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 13, this.context)) { case 1: { this.state = 330; this.literal(); } break; case 2: { this.state = 331; this.vector(); } break; case 3: { this.state = 332; this.array(); } break; case 4: { this.state = 333; this.structure(); } break; } } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } constAliasing() { let localContext = new ConstAliasingContext(this.context, this.state); this.enterRule(localContext, 48, ManiaScriptParser.RULE_constAliasing); try { this.enterOuterAlt(localContext, 1); { this.state = 336; this.match(ManiaScriptParser.DIRECTIVE_CONST); this.state = 337; this.namespaceName(); this.state = 338; this.match(ManiaScriptParser.OPERATOR_DOUBLECOLON); this.state = 339; this.constName(); this.state = 340; this.identifierAlias(); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } constName() { let localContext = new ConstNameContext(this.context, this.state); this.enterRule(localContext, 50, ManiaScriptParser.RULE_constName); try { this.enterOuterAlt(localContext, 1); { this.state = 342; this.match(ManiaScriptParser.IDENTIFIER); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } declarations() { let localContext = new DeclarationsContext(this.context, this.state); this.enterRule(localContext, 52, ManiaScriptParser.RULE_declarations); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 345; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); do { { { this.state = 344; this.declaration(); } } this.state = 347; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); } while ((((_la) & ~0x1F) === 0 && ((1 << _la) & 3074) !== 0) || _la === 39 || _la === 60 || ((((_la - 81)) & ~0x1F) === 0 && ((1 << (_la - 81)) & 134218751) !== 0)); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } declaration() { let localContext = new DeclarationContext(this.context, this.state); this.enterRule(localContext, 54, ManiaScriptParser.RULE_declaration); try { this.state = 352; this.errorHandler.sync(this); switch (this.tokenStream.LA(1)) { case ManiaScriptParser.KEYWORD_DECLARE: case ManiaScriptParser.KEYWORD_LET: this.enterOuterAlt(localContext, 1); { this.state = 349; this.variableDeclaration(); } break; case ManiaScriptParser.CLASS: case ManiaScriptParser.OPERATOR_DOUBLECOLON: case ManiaScriptParser.TYPE_BOOLEAN: case ManiaScriptParser.TYPE_IDENT: case ManiaScriptParser.TYPE_INT2: case ManiaScriptParser.TYPE_INT3: case ManiaScriptParser.TYPE_INTEGER: case ManiaScriptParser.TYPE_REAL: case ManiaScriptParser.TYPE_TEXT: case ManiaScriptParser.TYPE_VEC2: case ManiaScriptParser.TYPE_VEC3: case ManiaScriptParser.TYPE_VOID: case ManiaScriptParser.IDENTIFIER: this.enterOuterAlt(localContext, 2); { this.state = 350; this.functionDeclaration(); } break; case ManiaScriptParser.LABEL_STAR: this.enterOuterAlt(localContext, 3); { this.state = 351; this.labelDeclaration(); } break; default: throw new antlr.NoViableAltException(this); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } variableDeclaration() { let localContext = new VariableDeclarationContext(this.context, this.state); this.enterRule(localContext, 56, ManiaScriptParser.RULE_variableDeclaration); let _la; try { this.state = 396; this.errorHandler.sync