antlr-ng
Version:
Next generation ANTLR Tool
1,879 lines • 186 kB
JavaScript
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 ARG_ACTION = 5;
static ARG_OR_CHARSET = 6;
static ASSIGN = 7;
static RULE_REF = 8;
static SEMPRED = 9;
static STRING_LITERAL = 10;
static TOKEN_REF = 11;
static UNICODE_ESC = 12;
static UNICODE_EXTENDED_ESC = 13;
static WS = 14;
static ALT = 15;
static BLOCK = 16;
static CLOSURE = 17;
static ELEMENT_OPTIONS = 18;
static EPSILON = 19;
static LEXER_ACTION_CALL = 20;
static LEXER_ALT_ACTION = 21;
static OPTIONAL = 22;
static POSITIVE_CLOSURE = 23;
static RULE = 24;
static RULEMODIFIERS = 25;
static RULES = 26;
static SET = 27;
static WILDCARD = 28;
static DOC_COMMENT = 29;
static BLOCK_COMMENT = 30;
static LINE_COMMENT = 31;
static INT = 32;
static UNTERMINATED_STRING_LITERAL = 33;
static BEGIN_ARGUMENT = 34;
static OPTIONS = 35;
static TOKENS = 36;
static CHANNELS = 37;
static IMPORT = 38;
static FRAGMENT = 39;
static LEXER = 40;
static PARSER = 41;
static GRAMMAR = 42;
static PROTECTED = 43;
static PUBLIC = 44;
static PRIVATE = 45;
static RETURNS = 46;
static LOCALS = 47;
static THROWS = 48;
static CATCH = 49;
static FINALLY = 50;
static MODE = 51;
static COLON = 52;
static COLONCOLON = 53;
static COMMA = 54;
static SEMI = 55;
static LPAREN = 56;
static RPAREN = 57;
static RBRACE = 58;
static RARROW = 59;
static LT = 60;
static GT = 61;
static QUESTION = 62;
static STAR = 63;
static PLUS_ASSIGN = 64;
static PLUS = 65;
static OR = 66;
static DOLLAR = 67;
static RANGE = 68;
static DOT = 69;
static AT = 70;
static POUND = 71;
static NOT = 72;
static ID = 73;
static END_ARGUMENT = 74;
static UNTERMINATED_ARGUMENT = 75;
static ARGUMENT_CONTENT = 76;
static LEXER_CHAR_SET = 77;
static UNTERMINATED_CHAR_SET = 78;
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,
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,
"'import'",
"'fragment'",
"'lexer'",
"'parser'",
"'grammar'",
"'protected'",
"'public'",
"'private'",
"'returns'",
"'locals'",
"'throws'",
"'catch'",
"'finally'",
"'mode'",
"':'",
"'::'",
"','",
"';'",
"'('",
"')'",
"'}'",
"'->'",
"'<'",
"'>'",
"'?'",
"'*'",
"'+='",
"'+'",
"'|'",
"'$'",
"'..'",
"'.'",
"'@'",
"'#'",
"'~'"
];
static symbolicNames = [
null,
null,
null,
null,
"ACTION",
"ARG_ACTION",
"ARG_OR_CHARSET",
"ASSIGN",
"RULE_REF",
"SEMPRED",
"STRING_LITERAL",
"TOKEN_REF",
"UNICODE_ESC",
"UNICODE_EXTENDED_ESC",
"WS",
"ALT",
"BLOCK",
"CLOSURE",
"ELEMENT_OPTIONS",
"EPSILON",
"LEXER_ACTION_CALL",
"LEXER_ALT_ACTION",
"OPTIONAL",
"POSITIVE_CLOSURE",
"RULE",
"RULEMODIFIERS",
"RULES",
"SET",
"WILDCARD",
"DOC_COMMENT",
"BLOCK_COMMENT",
"LINE_COMMENT",
"INT",
"UNTERMINATED_STRING_LITERAL",
"BEGIN_ARGUMENT",
"OPTIONS",
"TOKENS",
"CHANNELS",
"IMPORT",
"FRAGMENT",
"LEXER",
"PARSER",
"GRAMMAR",
"PROTECTED",
"PUBLIC",
"PRIVATE",
"RETURNS",
"LOCALS",
"THROWS",
"CATCH",
"FINALLY",
"MODE",
"COLON",
"COLONCOLON",
"COMMA",
"SEMI",
"LPAREN",
"RPAREN",
"RBRACE",
"RARROW",
"LT",
"GT",
"QUESTION",
"STAR",
"PLUS_ASSIGN",
"PLUS",
"OR",
"DOLLAR",
"RANGE",
"DOT",
"AT",
"POUND",
"NOT",
"ID",
"END_ARGUMENT",
"UNTERMINATED_ARGUMENT",
"ARGUMENT_CONTENT",
"LEXER_CHAR_SET",
"UNTERMINATED_CHAR_SET"
];
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 - 35 & ~31) === 0 && (1 << _la - 35 & 15) !== 0 || _la === 70) {
{
{
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 === 51) {
{
{
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 === 8 || _la === 11) {
{
{
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 === 69) {
{
{
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.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 === 54) {
{
{
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 === 8 || _la === 11) {
{
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 === 8 || _la === 11) {
{
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 === 54) {
{
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 {
this.enterOuterAlt(localContext, 1);
{
this.state = 251;
this.match(ANTLRv4Parser.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 = 253;
this.match(ANTLRv4Parser.BEGIN_ARGUMENT);
this.state = 257;
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 = 254;
this.match(ANTLRv4Parser.ARGUMENT_CONTENT);
}
}
}
this.state = 259;
this.errorHandler.sync(this);
alternative = this.interpreter.adaptivePredict(this.tokenStream, 15, this.context);
}
this.state = 260;
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 = 262;
this.match(ANTLRv4Parser.MODE);
this.state = 263;
this.identifier();
this.state = 264;
this.match(ANTLRv4Parser.SEMI);
this.state = 268;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
while (_la === 11 || _la === 39) {
{
{
this.state = 265;
this.lexerRuleSpec();
}
}
this.state = 270;
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 = 274;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
while (_la === 8 || _la === 11 || (_la - 39 & ~31) === 0 && (1 << _la - 39 & 113) !== 0) {
{
{
this.state = 271;
this.ruleSpec();
}
}
this.state = 276;
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 = 279;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 18, this.context)) {
case 1:
this.enterOuterAlt(localContext, 1);
{
this.state = 277;
this.parserRuleSpec();
}
break;
case 2:
this.enterOuterAlt(localContext, 2);
{
this.state = 278;
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 = 282;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if ((_la - 39 & ~31) === 0 && (1 << _la - 39 & 113) !== 0) {
{
this.state = 281;
this.ruleModifiers();
}
}
this.state = 284;
this.match(ANTLRv4Parser.RULE_REF);
this.state = 286;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 34) {
{
this.state = 285;
this.argActionBlock();
}
}
this.state = 289;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 46) {
{
this.state = 288;
this.ruleReturns();
}
}
this.state = 292;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 48) {
{
this.state = 291;
this.throwsSpec();
}
}
this.state = 295;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 47) {
{
this.state = 294;
this.localsSpec();
}
}
this.state = 300;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
while (_la === 35 || _la === 70) {
{
{
this.state = 297;
this.rulePrequel();
}
}
this.state = 302;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
}
this.state = 303;
this.match(ANTLRv4Parser.COLON);
this.state = 304;
this.ruleBlock();
this.state = 305;
this.match(ANTLRv4Parser.SEMI);
this.state = 306;
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 = 311;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
while (_la === 49) {
{
{
this.state = 308;
this.exceptionHandler();
}
}
this.state = 313;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
}
this.state = 315;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 50) {
{
this.state = 314;
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 = 317;
this.match(ANTLRv4Parser.CATCH);
this.state = 318;
this.argActionBlock();
this.state = 319;
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 = 321;
this.match(ANTLRv4Parser.FINALLY);
this.state = 322;
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 = 326;
this.errorHandler.sync(this);
switch (this.tokenStream.LA(1)) {
case ANTLRv4Parser.OPTIONS:
this.enterOuterAlt(localContext, 1);
{
this.state = 324;
this.optionsSpec();
}
break;
case ANTLRv4Parser.AT:
this.enterOuterAlt(localContext, 2);
{
this.state = 325;
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 = 328;
this.match(ANTLRv4Parser.RETURNS);
this.state = 329;
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 = 331;
this.match(ANTLRv4Parser.THROWS);
this.state = 332;
this.qualifiedIdentifier();
this.state = 337;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
while (_la === 54) {
{
{
this.state = 333;
this.match(ANTLRv4Parser.COMMA);
this.state = 334;
this.qualifiedIdentifier();
}
}
this.state = 339;
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 = 340;
this.match(ANTLRv4Parser.LOCALS);
this.state = 341;
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 = 343;
this.match(ANTLRv4Parser.AT);
this.state = 344;
this.identifier();
this.state = 345;
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 = 348;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
do {
{
{
this.state = 347;
this.ruleModifier();
}
}
this.state = 350;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
} while ((_la - 39 & ~31) === 0 && (1 << _la - 39 & 113) !== 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 = 352;
_la = this.tokenStream.LA(1);
if (!((_la - 39 & ~31) === 0 && (1 << _la - 39 & 113) !== 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 = 354;
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 = 356;
this.labeledAlt();
this.state = 361;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
while (_la === 66) {
{
{
this.state = 357;
this.match(ANTLRv4Parser.OR);
this.state = 358;
this.labeledAlt();
}
}
this.state = 363;
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 = 364;
this.alternative();
this.state = 367;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 71) {
{
this.state = 365;
this.match(ANTLRv4Parser.POUND);
this.state = 366;
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 = 370;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 39) {
{
this.state = 369;
this.match(ANTLRv4Parser.FRAGMENT);
}
}
this.state = 372;
this.match(ANTLRv4Parser.TOKEN_REF);
this.state = 374;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 35) {
{
this.state = 373;
this.optionsSpec();
}
}
this.state = 376;
this.match(ANTLRv4Parser.COLON);
this.state = 377;
this.lexerRuleBlock();
this.state = 378;
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 = 380;
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 = 382;
this.lexerAlt();
this.state = 387;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
while (_la === 66) {
{
{
this.state = 383;
this.match(ANTLRv4Parser.OR);
this.state = 384;
this.lexerAlt();
}
}
this.state = 389;
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 = 395;
this.errorHandler.sync(this);
switch (this.interpreter.adaptivePredict(this.tokenStream, 36, this.context)) {
case 1:
this.enterOuterAlt(localContext, 1);
{
this.state = 390;
this.lexerElements();
this.state = 392;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if (_la === 59) {
{
this.state = 391;
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 = 403;
this.errorHandler.sync(this);
switch (this.tokenStream.LA(1)) {
case ANTLRv4Parser.ACTION:
case ANTLRv4Parser.STRING_LITERAL:
case ANTLRv4Parser.TOKEN_REF:
case ANTLRv4Parser.LPAREN:
case ANTLRv4Parser.DOT:
case ANTLRv4Parser.NOT:
case ANTLRv4Parser.LEXER_CHAR_SET:
this.enterOuterAlt(localContext, 1);
{
this.state = 398;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
do {
{
{
this.state = 397;
this.lexerElement();
}
}
this.state = 400;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
} while ((_la & ~31) === 0 && (1 << _la & 3088) !== 0 || (_la - 56 & ~31) === 0 && (1 << _la - 56 & 2170881) !== 0);
}
break;
case ANTLRv4Parser.SEMI:
case ANTLRv4Parser.RPAREN:
case ANTLRv4Parser.RARROW:
case ANTLRv4Parser.OR:
this.enterOuterAlt(localContext, 2);
{
}
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;
}
lexerElement() {
let localContext = new LexerElementContext(this.context, this.state);
this.enterRule(localContext, 76, ANTLRv4Parser.RULE_lexerElement);
let _la;
try {
this.state = 417;
this.errorHandler.sync(this);
switch (this.tokenStream.LA(1)) {
case ANTLRv4Parser.STRING_LITERAL:
case ANTLRv4Parser.TOKEN_REF:
case ANTLRv4Parser.DOT:
case ANTLRv4Parser.NOT:
case ANTLRv4Parser.LEXER_CHAR_SET:
this.enterOuterAlt(localContext, 1);
{
this.state = 405;
this.lexerAtom();
this.state = 407;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if ((_la - 62 & ~31) === 0 && (1 << _la - 62 & 11) !== 0) {
{
this.state = 406;
this.ebnfSuffix();
}
}
}
break;
case ANTLRv4Parser.LPAREN:
this.enterOuterAlt(localContext, 2);
{
this.state = 409;
this.lexerBlock();
this.state = 411;
this.errorHandler.sync(this);
_la = this.tokenStream.LA(1);
if ((_la - 6