UNPKG

antlr-ng

Version:

Next generation ANTLR Tool

1,905 lines (1,904 loc) 200 kB
var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); import * as antlr from "antlr4ng"; class ANTLRv4Parser extends antlr.Parser { static { __name(this, "ANTLRv4Parser"); } static ACTION = 4; static ACTION_CHAR_LITERAL = 5; static ACTION_ESC = 6; static ACTION_STRING_LITERAL = 7; static ARG_ACTION = 8; static ARG_OR_CHARSET = 9; static ASSIGN = 10; static AT = 11; static CATCH = 12; static CHANNELS = 13; static COLON = 14; static COLONCOLON = 15; static COMMA = 16; static UNUSED = 17; static DOC_COMMENT = 18; static DOLLAR = 19; static DOT = 20; static ERRCHAR = 21; static ESC_SEQ = 22; static FINALLY = 23; static FRAGMENT = 24; static GRAMMAR = 25; static GT = 26; static HEX_DIGIT = 27; static ID = 28; static IMPORT = 29; static INT = 30; static LEXER = 31; static LEXER_CHAR_SET = 32; static LOCALS = 33; static LPAREN = 34; static LT = 35; static MODE = 36; static NESTED_ACTION = 37; static NLCHARS = 38; static NOT = 39; static NameChar = 40; static NameStartChar = 41; static OPTIONS = 42; static OR = 43; static PARSER = 44; static PLUS = 45; static PLUS_ASSIGN = 46; static POUND = 47; static QUESTION = 48; static RANGE = 49; static RARROW = 50; static RBRACE = 51; static RETURNS = 52; static RPAREN = 53; static RULE_REF = 54; static SEMI = 55; static SEMPRED = 56; static SRC = 57; static STAR = 58; static STRING_LITERAL = 59; static THROWS = 60; static UNUSED2 = 61; static TOKEN_REF = 62; static UNICODE_ESC = 63; static UNICODE_EXTENDED_ESC = 64; static UnicodeBOM = 65; static WS = 66; static WSCHARS = 67; static WSNLCHARS = 68; static ALT = 69; static BLOCK = 70; static CLOSURE = 71; static COMBINED = 72; static ELEMENT_OPTIONS = 73; static EPSILON = 74; static LEXER_ACTION_CALL = 75; static LEXER_ALT_ACTION = 76; static OPTIONAL = 77; static POSITIVE_CLOSURE = 78; static RULE = 79; static RULEMODIFIERS = 80; static RULES = 81; static SET = 82; static WILDCARD = 83; static BLOCK_COMMENT = 84; static LINE_COMMENT = 85; static UNTERMINATED_STRING_LITERAL = 86; static BEGIN_ARGUMENT = 87; static BEGIN_ACTION = 88; static TOKENS = 89; static LBRACE = 90; static END_ARGUMENT = 91; static UNTERMINATED_ARGUMENT = 92; static ARGUMENT_CONTENT = 93; static END_ACTION = 94; static UNTERMINATED_ACTION = 95; static ACTION_CONTENT = 96; static UNTERMINATED_CHAR_SET = 97; static PRIVATE = 98; static PROTECTED = 99; static PUBLIC = 100; static PREDICATE_OPTIONS = 101; static RULE_grammarSpec = 0; static RULE_grammarDecl = 1; static RULE_grammarType = 2; static RULE_prequelConstruct = 3; static RULE_optionsSpec = 4; static RULE_option = 5; static RULE_optionValue = 6; static RULE_delegateGrammars = 7; static RULE_delegateGrammar = 8; static RULE_tokensSpec = 9; static RULE_channelsSpec = 10; static RULE_idList = 11; static RULE_action_ = 12; static RULE_actionScopeName = 13; static RULE_actionBlock = 14; static RULE_argActionBlock = 15; static RULE_modeSpec = 16; static RULE_rules = 17; static RULE_ruleSpec = 18; static RULE_parserRuleSpec = 19; static RULE_exceptionGroup = 20; static RULE_exceptionHandler = 21; static RULE_finallyClause = 22; static RULE_rulePrequel = 23; static RULE_ruleReturns = 24; static RULE_throwsSpec = 25; static RULE_localsSpec = 26; static RULE_ruleAction = 27; static RULE_ruleModifiers = 28; static RULE_ruleModifier = 29; static RULE_ruleBlock = 30; static RULE_ruleAltList = 31; static RULE_labeledAlt = 32; static RULE_lexerRuleSpec = 33; static RULE_lexerRuleBlock = 34; static RULE_lexerAltList = 35; static RULE_lexerAlt = 36; static RULE_lexerElements = 37; static RULE_lexerElement = 38; static RULE_lexerBlock = 39; static RULE_lexerCommands = 40; static RULE_lexerCommand = 41; static RULE_lexerCommandName = 42; static RULE_lexerCommandExpr = 43; static RULE_altList = 44; static RULE_alternative = 45; static RULE_element = 46; static RULE_predicateOptions = 47; static RULE_predicateOption = 48; static RULE_labeledElement = 49; static RULE_ebnf = 50; static RULE_blockSuffix = 51; static RULE_ebnfSuffix = 52; static RULE_lexerAtom = 53; static RULE_atom = 54; static RULE_wildcard = 55; static RULE_notSet = 56; static RULE_blockSet = 57; static RULE_setElement = 58; static RULE_block = 59; static RULE_ruleref = 60; static RULE_characterRange = 61; static RULE_terminalDef = 62; static RULE_elementOptions = 63; static RULE_elementOption = 64; static RULE_identifier = 65; static RULE_qualifiedIdentifier = 66; static literalNames = [ null, null, null, null, null, null, null, null, null, null, "'='", "'@'", "'catch'", null, "':'", "'::'", "','", null, null, "'$'", "'.'", null, null, "'finally'", "'fragment'", "'grammar'", "'>'", null, null, "'import'", null, "'lexer'", null, "'locals'", "'('", "'<'", "'mode'", null, null, "'~'", null, null, null, "'|'", "'parser'", "'+'", "'+='", "'#'", "'?'", "'..'", "'->'", null, "'returns'", "')'", null, "';'", null, null, "'*'", null, "'throws'", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "'['", "'{'", null, null, null, null, null, null, null, null, null, "'private'", "'protected'", "'public'" ]; static symbolicNames = [ null, null, null, null, "ACTION", "ACTION_CHAR_LITERAL", "ACTION_ESC", "ACTION_STRING_LITERAL", "ARG_ACTION", "ARG_OR_CHARSET", "ASSIGN", "AT", "CATCH", "CHANNELS", "COLON", "COLONCOLON", "COMMA", "UNUSED", "DOC_COMMENT", "DOLLAR", "DOT", "ERRCHAR", "ESC_SEQ", "FINALLY", "FRAGMENT", "GRAMMAR", "GT", "HEX_DIGIT", "ID", "IMPORT", "INT", "LEXER", "LEXER_CHAR_SET", "LOCALS", "LPAREN", "LT", "MODE", "NESTED_ACTION", "NLCHARS", "NOT", "NameChar", "NameStartChar", "OPTIONS", "OR", "PARSER", "PLUS", "PLUS_ASSIGN", "POUND", "QUESTION", "RANGE", "RARROW", "RBRACE", "RETURNS", "RPAREN", "RULE_REF", "SEMI", "SEMPRED", "SRC", "STAR", "STRING_LITERAL", "THROWS", "UNUSED2", "TOKEN_REF", "UNICODE_ESC", "UNICODE_EXTENDED_ESC", "UnicodeBOM", "WS", "WSCHARS", "WSNLCHARS", "ALT", "BLOCK", "CLOSURE", "COMBINED", "ELEMENT_OPTIONS", "EPSILON", "LEXER_ACTION_CALL", "LEXER_ALT_ACTION", "OPTIONAL", "POSITIVE_CLOSURE", "RULE", "RULEMODIFIERS", "RULES", "SET", "WILDCARD", "BLOCK_COMMENT", "LINE_COMMENT", "UNTERMINATED_STRING_LITERAL", "BEGIN_ARGUMENT", "BEGIN_ACTION", "TOKENS", "LBRACE", "END_ARGUMENT", "UNTERMINATED_ARGUMENT", "ARGUMENT_CONTENT", "END_ACTION", "UNTERMINATED_ACTION", "ACTION_CONTENT", "UNTERMINATED_CHAR_SET", "PRIVATE", "PROTECTED", "PUBLIC", "PREDICATE_OPTIONS" ]; static ruleNames = [ "grammarSpec", "grammarDecl", "grammarType", "prequelConstruct", "optionsSpec", "option", "optionValue", "delegateGrammars", "delegateGrammar", "tokensSpec", "channelsSpec", "idList", "action_", "actionScopeName", "actionBlock", "argActionBlock", "modeSpec", "rules", "ruleSpec", "parserRuleSpec", "exceptionGroup", "exceptionHandler", "finallyClause", "rulePrequel", "ruleReturns", "throwsSpec", "localsSpec", "ruleAction", "ruleModifiers", "ruleModifier", "ruleBlock", "ruleAltList", "labeledAlt", "lexerRuleSpec", "lexerRuleBlock", "lexerAltList", "lexerAlt", "lexerElements", "lexerElement", "lexerBlock", "lexerCommands", "lexerCommand", "lexerCommandName", "lexerCommandExpr", "altList", "alternative", "element", "predicateOptions", "predicateOption", "labeledElement", "ebnf", "blockSuffix", "ebnfSuffix", "lexerAtom", "atom", "wildcard", "notSet", "blockSet", "setElement", "block", "ruleref", "characterRange", "terminalDef", "elementOptions", "elementOption", "identifier", "qualifiedIdentifier" ]; get grammarFileName() { return "ANTLRv4Parser.g4"; } get literalNames() { return ANTLRv4Parser.literalNames; } get symbolicNames() { return ANTLRv4Parser.symbolicNames; } get ruleNames() { return ANTLRv4Parser.ruleNames; } get serializedATN() { return ANTLRv4Parser._serializedATN; } createFailedPredicateException(predicate, message) { return new antlr.FailedPredicateException(this, predicate, message); } constructor(input) { super(input); this.interpreter = new antlr.ParserATNSimulator(this, ANTLRv4Parser._ATN, ANTLRv4Parser.decisionsToDFA, new antlr.PredictionContextCache()); } grammarSpec() { let localContext = new GrammarSpecContext(this.context, this.state); this.enterRule(localContext, 0, ANTLRv4Parser.RULE_grammarSpec); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 134; this.grammarDecl(); this.state = 138; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); while ((_la - 11 & ~31) === 0 && (1 << _la - 11 & 2147745797) !== 0 || _la === 89) { { { this.state = 135; this.prequelConstruct(); } } this.state = 140; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); } this.state = 141; this.rules(); this.state = 145; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); while (_la === 36) { { { this.state = 142; this.modeSpec(); } } this.state = 147; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); } this.state = 148; this.match(ANTLRv4Parser.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; } grammarDecl() { let localContext = new GrammarDeclContext(this.context, this.state); this.enterRule(localContext, 2, ANTLRv4Parser.RULE_grammarDecl); try { this.enterOuterAlt(localContext, 1); { this.state = 150; this.grammarType(); this.state = 151; this.identifier(); this.state = 152; this.match(ANTLRv4Parser.SEMI); } } 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; } grammarType() { let localContext = new GrammarTypeContext(this.context, this.state); this.enterRule(localContext, 4, ANTLRv4Parser.RULE_grammarType); try { this.state = 159; this.errorHandler.sync(this); switch (this.tokenStream.LA(1)) { case ANTLRv4Parser.LEXER: this.enterOuterAlt(localContext, 1); { this.state = 154; this.match(ANTLRv4Parser.LEXER); this.state = 155; this.match(ANTLRv4Parser.GRAMMAR); } break; case ANTLRv4Parser.PARSER: this.enterOuterAlt(localContext, 2); { this.state = 156; this.match(ANTLRv4Parser.PARSER); this.state = 157; this.match(ANTLRv4Parser.GRAMMAR); } break; case ANTLRv4Parser.GRAMMAR: this.enterOuterAlt(localContext, 3); { this.state = 158; this.match(ANTLRv4Parser.GRAMMAR); } 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; } prequelConstruct() { let localContext = new PrequelConstructContext(this.context, this.state); this.enterRule(localContext, 6, ANTLRv4Parser.RULE_prequelConstruct); try { this.state = 166; this.errorHandler.sync(this); switch (this.tokenStream.LA(1)) { case ANTLRv4Parser.OPTIONS: this.enterOuterAlt(localContext, 1); { this.state = 161; this.optionsSpec(); } break; case ANTLRv4Parser.IMPORT: this.enterOuterAlt(localContext, 2); { this.state = 162; this.delegateGrammars(); } break; case ANTLRv4Parser.TOKENS: this.enterOuterAlt(localContext, 3); { this.state = 163; this.tokensSpec(); } break; case ANTLRv4Parser.CHANNELS: this.enterOuterAlt(localContext, 4); { this.state = 164; this.channelsSpec(); } break; case ANTLRv4Parser.AT: this.enterOuterAlt(localContext, 5); { this.state = 165; this.action_(); } 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; } optionsSpec() { let localContext = new OptionsSpecContext(this.context, this.state); this.enterRule(localContext, 8, ANTLRv4Parser.RULE_optionsSpec); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 168; this.match(ANTLRv4Parser.OPTIONS); this.state = 174; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); while (_la === 54 || _la === 62) { { { this.state = 169; this.option(); this.state = 170; this.match(ANTLRv4Parser.SEMI); } } this.state = 176; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); } this.state = 177; this.match(ANTLRv4Parser.RBRACE); } } 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; } option() { let localContext = new OptionContext(this.context, this.state); this.enterRule(localContext, 10, ANTLRv4Parser.RULE_option); try { this.enterOuterAlt(localContext, 1); { this.state = 179; this.identifier(); this.state = 180; this.match(ANTLRv4Parser.ASSIGN); this.state = 181; this.optionValue(); } } 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; } optionValue() { let localContext = new OptionValueContext(this.context, this.state); this.enterRule(localContext, 12, ANTLRv4Parser.RULE_optionValue); let _la; try { this.state = 194; this.errorHandler.sync(this); switch (this.tokenStream.LA(1)) { case ANTLRv4Parser.RULE_REF: case ANTLRv4Parser.TOKEN_REF: this.enterOuterAlt(localContext, 1); { this.state = 183; this.identifier(); this.state = 188; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); while (_la === 20) { { { this.state = 184; this.match(ANTLRv4Parser.DOT); this.state = 185; this.identifier(); } } this.state = 190; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); } } break; case ANTLRv4Parser.STRING_LITERAL: this.enterOuterAlt(localContext, 2); { this.state = 191; this.match(ANTLRv4Parser.STRING_LITERAL); } break; case ANTLRv4Parser.BEGIN_ACTION: this.enterOuterAlt(localContext, 3); { this.state = 192; this.actionBlock(); } break; case ANTLRv4Parser.INT: this.enterOuterAlt(localContext, 4); { this.state = 193; this.match(ANTLRv4Parser.INT); } 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; } delegateGrammars() { let localContext = new DelegateGrammarsContext(this.context, this.state); this.enterRule(localContext, 14, ANTLRv4Parser.RULE_delegateGrammars); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 196; this.match(ANTLRv4Parser.IMPORT); this.state = 197; this.delegateGrammar(); this.state = 202; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); while (_la === 16) { { { this.state = 198; this.match(ANTLRv4Parser.COMMA); this.state = 199; this.delegateGrammar(); } } this.state = 204; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); } this.state = 205; this.match(ANTLRv4Parser.SEMI); } } 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; } delegateGrammar() { let localContext = new DelegateGrammarContext(this.context, this.state); this.enterRule(localContext, 16, ANTLRv4Parser.RULE_delegateGrammar); try { this.state = 212; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 8, this.context)) { case 1: this.enterOuterAlt(localContext, 1); { this.state = 207; this.identifier(); this.state = 208; this.match(ANTLRv4Parser.ASSIGN); this.state = 209; this.identifier(); } break; case 2: this.enterOuterAlt(localContext, 2); { this.state = 211; this.identifier(); } 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; } tokensSpec() { let localContext = new TokensSpecContext(this.context, this.state); this.enterRule(localContext, 18, ANTLRv4Parser.RULE_tokensSpec); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 214; this.match(ANTLRv4Parser.TOKENS); this.state = 216; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 54 || _la === 62) { { this.state = 215; this.idList(); } } this.state = 218; this.match(ANTLRv4Parser.RBRACE); } } 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; } channelsSpec() { let localContext = new ChannelsSpecContext(this.context, this.state); this.enterRule(localContext, 20, ANTLRv4Parser.RULE_channelsSpec); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 220; this.match(ANTLRv4Parser.CHANNELS); this.state = 222; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 54 || _la === 62) { { this.state = 221; this.idList(); } } this.state = 224; this.match(ANTLRv4Parser.RBRACE); } } 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; } idList() { let localContext = new IdListContext(this.context, this.state); this.enterRule(localContext, 22, ANTLRv4Parser.RULE_idList); let _la; try { let alternative; this.enterOuterAlt(localContext, 1); { this.state = 226; this.identifier(); this.state = 231; this.errorHandler.sync(this); alternative = this.interpreter.adaptivePredict(this.tokenStream, 11, this.context); while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { if (alternative === 1) { { { this.state = 227; this.match(ANTLRv4Parser.COMMA); this.state = 228; this.identifier(); } } } this.state = 233; this.errorHandler.sync(this); alternative = this.interpreter.adaptivePredict(this.tokenStream, 11, this.context); } this.state = 235; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 16) { { this.state = 234; this.match(ANTLRv4Parser.COMMA); } } } } 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; } action_() { let localContext = new Action_Context(this.context, this.state); this.enterRule(localContext, 24, ANTLRv4Parser.RULE_action_); try { this.enterOuterAlt(localContext, 1); { this.state = 237; this.match(ANTLRv4Parser.AT); this.state = 241; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 13, this.context)) { case 1: { this.state = 238; this.actionScopeName(); this.state = 239; this.match(ANTLRv4Parser.COLONCOLON); } break; } this.state = 243; this.identifier(); this.state = 244; this.actionBlock(); } } 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; } actionScopeName() { let localContext = new ActionScopeNameContext(this.context, this.state); this.enterRule(localContext, 26, ANTLRv4Parser.RULE_actionScopeName); try { this.state = 249; this.errorHandler.sync(this); switch (this.tokenStream.LA(1)) { case ANTLRv4Parser.RULE_REF: case ANTLRv4Parser.TOKEN_REF: this.enterOuterAlt(localContext, 1); { this.state = 246; this.identifier(); } break; case ANTLRv4Parser.LEXER: this.enterOuterAlt(localContext, 2); { this.state = 247; this.match(ANTLRv4Parser.LEXER); } break; case ANTLRv4Parser.PARSER: this.enterOuterAlt(localContext, 3); { this.state = 248; this.match(ANTLRv4Parser.PARSER); } 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; } actionBlock() { let localContext = new ActionBlockContext(this.context, this.state); this.enterRule(localContext, 28, ANTLRv4Parser.RULE_actionBlock); try { let alternative; this.enterOuterAlt(localContext, 1); { this.state = 251; this.match(ANTLRv4Parser.BEGIN_ACTION); this.state = 255; this.errorHandler.sync(this); alternative = this.interpreter.adaptivePredict(this.tokenStream, 15, this.context); while (alternative !== 1 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { if (alternative === 1 + 1) { { { this.state = 252; this.match(ANTLRv4Parser.ACTION_CONTENT); } } } this.state = 257; this.errorHandler.sync(this); alternative = this.interpreter.adaptivePredict(this.tokenStream, 15, this.context); } this.state = 258; this.match(ANTLRv4Parser.END_ACTION); } } 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; } argActionBlock() { let localContext = new ArgActionBlockContext(this.context, this.state); this.enterRule(localContext, 30, ANTLRv4Parser.RULE_argActionBlock); try { let alternative; this.enterOuterAlt(localContext, 1); { this.state = 260; this.match(ANTLRv4Parser.BEGIN_ARGUMENT); this.state = 264; this.errorHandler.sync(this); alternative = this.interpreter.adaptivePredict(this.tokenStream, 16, this.context); while (alternative !== 1 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { if (alternative === 1 + 1) { { { this.state = 261; this.match(ANTLRv4Parser.ARGUMENT_CONTENT); } } } this.state = 266; this.errorHandler.sync(this); alternative = this.interpreter.adaptivePredict(this.tokenStream, 16, this.context); } this.state = 267; this.match(ANTLRv4Parser.END_ARGUMENT); } } 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; } modeSpec() { let localContext = new ModeSpecContext(this.context, this.state); this.enterRule(localContext, 32, ANTLRv4Parser.RULE_modeSpec); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 269; this.match(ANTLRv4Parser.MODE); this.state = 270; this.identifier(); this.state = 271; this.match(ANTLRv4Parser.SEMI); this.state = 275; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); while (_la === 24 || _la === 62) { { { this.state = 272; this.lexerRuleSpec(); } } this.state = 277; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); } } } 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; } rules() { let localContext = new RulesContext(this.context, this.state); this.enterRule(localContext, 34, ANTLRv4Parser.RULE_rules); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 281; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); while (_la === 24 || _la === 54 || _la === 62 || (_la - 98 & ~31) === 0 && (1 << _la - 98 & 7) !== 0) { { { this.state = 278; this.ruleSpec(); } } this.state = 283; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); } } } 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; } ruleSpec() { let localContext = new RuleSpecContext(this.context, this.state); this.enterRule(localContext, 36, ANTLRv4Parser.RULE_ruleSpec); try { this.state = 286; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 19, this.context)) { case 1: this.enterOuterAlt(localContext, 1); { this.state = 284; this.parserRuleSpec(); } break; case 2: this.enterOuterAlt(localContext, 2); { this.state = 285; this.lexerRuleSpec(); } 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; } parserRuleSpec() { let localContext = new ParserRuleSpecContext(this.context, this.state); this.enterRule(localContext, 38, ANTLRv4Parser.RULE_parserRuleSpec); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 289; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 24 || (_la - 98 & ~31) === 0 && (1 << _la - 98 & 7) !== 0) { { this.state = 288; this.ruleModifiers(); } } this.state = 291; this.match(ANTLRv4Parser.RULE_REF); this.state = 293; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 87) { { this.state = 292; this.argActionBlock(); } } this.state = 296; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 52) { { this.state = 295; this.ruleReturns(); } } this.state = 299; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 60) { { this.state = 298; this.throwsSpec(); } } this.state = 302; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 33) { { this.state = 301; this.localsSpec(); } } this.state = 307; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); while (_la === 11 || _la === 42) { { { this.state = 304; this.rulePrequel(); } } this.state = 309; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); } this.state = 310; this.match(ANTLRv4Parser.COLON); this.state = 311; this.ruleBlock(); this.state = 312; this.match(ANTLRv4Parser.SEMI); this.state = 313; this.exceptionGroup(); } } 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; } exceptionGroup() { let localContext = new ExceptionGroupContext(this.context, this.state); this.enterRule(localContext, 40, ANTLRv4Parser.RULE_exceptionGroup); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 318; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); while (_la === 12) { { { this.state = 315; this.exceptionHandler(); } } this.state = 320; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); } this.state = 322; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 23) { { this.state = 321; this.finallyClause(); } } } } 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; } exceptionHandler() { let localContext = new ExceptionHandlerContext(this.context, this.state); this.enterRule(localContext, 42, ANTLRv4Parser.RULE_exceptionHandler); try { this.enterOuterAlt(localContext, 1); { this.state = 324; this.match(ANTLRv4Parser.CATCH); this.state = 325; this.argActionBlock(); this.state = 326; this.actionBlock(); } } 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; } finallyClause() { let localContext = new FinallyClauseContext(this.context, this.state); this.enterRule(localContext, 44, ANTLRv4Parser.RULE_finallyClause); try { this.enterOuterAlt(localContext, 1); { this.state = 328; this.match(ANTLRv4Parser.FINALLY); this.state = 329; this.actionBlock(); } } 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; } rulePrequel() { let localContext = new RulePrequelContext(this.context, this.state); this.enterRule(localContext, 46, ANTLRv4Parser.RULE_rulePrequel); try { this.state = 333; this.errorHandler.sync(this); switch (this.tokenStream.LA(1)) { case ANTLRv4Parser.OPTIONS: this.enterOuterAlt(localContext, 1); { this.state = 331; this.optionsSpec(); } break; case ANTLRv4Parser.AT: this.enterOuterAlt(localContext, 2); { this.state = 332; this.ruleAction(); } 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; } ruleReturns() { let localContext = new RuleReturnsContext(this.context, this.state); this.enterRule(localContext, 48, ANTLRv4Parser.RULE_ruleReturns); try { this.enterOuterAlt(localContext, 1); { this.state = 335; this.match(ANTLRv4Parser.RETURNS); this.state = 336; this.argActionBlock(); } } 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; } throwsSpec() { let localContext = new ThrowsSpecContext(this.context, this.state); this.enterRule(localContext, 50, ANTLRv4Parser.RULE_throwsSpec); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 338; this.match(ANTLRv4Parser.THROWS); this.state = 339; this.qualifiedIdentifier(); this.state = 344; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); while (_la === 16) { { { this.state = 340; this.match(ANTLRv4Parser.COMMA); this.state = 341; this.qualifiedIdentifier(); } } this.state = 346; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); } } } 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; } localsSpec() { let localContext = new LocalsSpecContext(this.context, this.state); this.enterRule(localContext, 52, ANTLRv4Parser.RULE_localsSpec); try { this.enterOuterAlt(localContext, 1); { this.state = 347; this.match(ANTLRv4Parser.LOCALS); this.state = 348; this.argActionBlock(); } } 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; } ruleAction() { let localContext = new RuleActionContext(this.context, this.state); this.enterRule(localContext, 54, ANTLRv4Parser.RULE_ruleAction); try { this.enterOuterAlt(localContext, 1); { this.state = 350; this.match(ANTLRv4Parser.AT); this.state = 351; this.identifier(); this.state = 352; this.actionBlock(); } } 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; } ruleModifiers() { let localContext = new RuleModifiersContext(this.context, this.state); this.enterRule(localContext, 56, ANTLRv4Parser.RULE_ruleModifiers); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 355; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); do { { { this.state = 354; this.ruleModifier(); } } this.state = 357; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); } while (_la === 24 || (_la - 98 & ~31) === 0 && (1 << _la - 98 & 7) !== 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; } ruleModifier() { let localContext = new RuleModifierContext(this.context, this.state); this.enterRule(localContext, 58, ANTLRv4Parser.RULE_ruleModifier); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 359; _la = this.tokenStream.LA(1); if (!(_la === 24 || (_la - 98 & ~31) === 0 && (1 << _la - 98 & 7) !== 0)) { this.errorHandler.recoverInline(this); } else { this.errorHandler.reportMatch(this); this.consume(); } } } 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; } ruleBlock() { let localContext = new RuleBlockContext(this.context, this.state); this.enterRule(localContext, 60, ANTLRv4Parser.RULE_ruleBlock); try { this.enterOuterAlt(localContext, 1); { this.state = 361; this.ruleAltList(); } } 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; } ruleAltList() { let localContext = new RuleAltListContext(this.context, this.state); this.enterRule(localContext, 62, ANTLRv4Parser.RULE_ruleAltList); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 363; this.labeledAlt(); this.state = 368; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); while (_la === 43) { { { this.state = 364; this.match(ANTLRv4Parser.OR); this.state = 365; this.labeledAlt(); } } this.state = 370; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); } } } 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; } labeledAlt() { let localContext = new LabeledAltContext(this.context, this.state); this.enterRule(localContext, 64, ANTLRv4Parser.RULE_labeledAlt); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 371; this.alternative(); this.state = 374; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 47) { { this.state = 372; this.match(ANTLRv4Parser.POUND); this.state = 373; this.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; } lexerRuleSpec() { let localContext = new LexerRuleSpecContext(this.context, this.state); this.enterRule(localContext, 66, ANTLRv4Parser.RULE_lexerRuleSpec); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 377; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 24) { { this.state = 376; this.match(ANTLRv4Parser.FRAGMENT); } } this.state = 379; this.match(ANTLRv4Parser.TOKEN_REF); this.state = 381; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 42) { { this.state = 380; this.optionsSpec(); } } this.state = 383; this.match(ANTLRv4Parser.COLON); this.state = 384; this.lexerRuleBlock(); this.state = 385; this.match(ANTLRv4Parser.SEMI); } } 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; } lexerRuleBlock() { let localContext = new LexerRuleBlockContext(this.context, this.state); this.enterRule(localContext, 68, ANTLRv4Parser.RULE_lexerRuleBlock); try { this.enterOuterAlt(localContext, 1); { this.state = 387; this.lexerAltList(); } } 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; } lexerAltList() { let localContext = new LexerAltListContext(this.context, this.state); this.enterRule(localContext, 70, ANTLRv4Parser.RULE_lexerAltList); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 389; this.lexerAlt(); this.state = 394; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); while (_la === 43) { { { this.state = 390; this.match(ANTLRv4Parser.OR); this.state = 391; this.lexerAlt(); } } this.state = 396; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); } } } 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; } lexerAlt() { let localContext = new LexerAltContext(this.context, this.state); this.enterRule(localContext, 72, ANTLRv4Parser.RULE_lexerAlt); let _la; try { this.state = 402; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 37, this.context)) { case 1: this.enterOuterAlt(localContext, 1); { this.state = 397; this.lexerElements(); this.state = 399; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 50) { { this.state = 398; this.lexerCommands(); } } } break; case 2: this.enterOuterAlt(localContext, 2); { } 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; } lexerElements() { let localContext = new LexerElementsContext(this.context, this.state); this.enterRule(localContext, 74, ANTLRv4Parser.RULE_lexerElements); let _la; try { this.state = 410; this.errorHandler.sync(this); switch (this.tokenStream.LA(1)) { case ANTLRv4Parser.DOT: case ANTLRv4Parser.LEXER_CHAR_SET: case ANTLRv4Parser.LPAREN: case ANTLRv4Parser.NOT: case ANTLRv4Parser.STRING_LITERAL: case ANTLRv4Parser.TOKEN_REF: case ANTLRv4Parser.BEGIN_ACTION: this.enterOuterAlt(localContext, 1); { this.state = 405; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); do { { { this.state = 404; this.lexerElement();