diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8408ea7..bd24b7c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -102,13 +102,60 @@ jobs: # awk: accumulate sum by test time in seconds run: grep --color=never -e '--- PASS:' -e '--- FAIL:' test.log | sed 's/[:()]//g' | awk '{print $2,$3,$4}' | sort -t' ' -nk3 -r | awk '{sum += $3; print $1,$2,$3,sum"s"}' + antlr-grammar-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check for grammar file changes + id: check-grammar-changes + run: | + if [ "${{ github.event_name }}" = "pull_request" ]; then + CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}..HEAD) + else + CHANGED_FILES=$(git diff --name-only HEAD~1..HEAD) + fi + + # Check if any .g4 files or tools/grammar/ files changed (Go target only) + if echo "$CHANGED_FILES" | grep -E '\.(g4)$|^tools/grammar/'; then + echo "grammar_changed=true" >> $GITHUB_OUTPUT + echo "Grammar files or tools/grammar/ changed, running Go ANTLR tests" + else + echo "grammar_changed=false" >> $GITHUB_OUTPUT + echo "No grammar file changes detected, skipping ANTLR tests" + fi + + - uses: actions/setup-go@v5 + if: steps.check-grammar-changes.outputs.grammar_changed == 'true' + with: + go-version-file: go.mod + cache-dependency-path: go.sum + + - name: Run Go ANTLR grammar tests + if: steps.check-grammar-changes.outputs.grammar_changed == 'true' + working-directory: tools/grammar + run: go test -p=8 -timeout 30m -ldflags "-w -s" -v ./... | tee test.log; exit ${PIPESTATUS[0]} + + - name: Pretty print grammar tests running time + if: steps.check-grammar-changes.outputs.grammar_changed == 'true' + working-directory: tools/grammar + # grep: filter out lines like "--- PASS: Test (15.04s)" + # sed: remove unnecessary characters + # awk: re-format lines to "PASS: Test (15.04s)" + # sort: cut into columns by delimiter ' ' (single space) and sort by column 3 (test time in seconds) as numeric type in reverse order (largest comes first) + # awk: accumulate sum by test time in seconds + run: grep --color=never -e '--- PASS:' -e '--- FAIL:' test.log | sed 's/[:()]//g' | awk '{print $2,$3,$4}' | sort -t' ' -nk3 -r | awk '{sum += $3; print $1,$2,$3,sum"s"}' + all-tests-passed: runs-on: ubuntu-latest - # This job needs both detect-changes and go-tests - needs: [detect-changes, go-tests] + # This job needs detect-changes, go-tests, and antlr-grammar-tests + needs: [detect-changes, go-tests, antlr-grammar-tests] # This condition is key: # - Run if no files were changed (the 'go-tests' job was skipped). # - Or run if the 'go-tests' job (the whole matrix) succeeded. + # - And run if antlr-grammar-tests succeeded or was skipped. if: success() || needs.detect-changes.outputs.any_changed == 'false' steps: - name: Report overall status diff --git a/.gitignore b/.gitignore index 8587834..0164ae3 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,5 @@ go.work.sum **/*.interp **/*.tokens +# node_modules +**/node_modules/ diff --git a/tools/grammar/ANTLRv4Lexer.g4 b/tools/grammar/ANTLRv4Lexer.g4 new file mode 100644 index 0000000..0f0e9df --- /dev/null +++ b/tools/grammar/ANTLRv4Lexer.g4 @@ -0,0 +1,455 @@ +/* + * [The "BSD license"] Copyright (c) 2012-2015 Terence Parr Copyright (c) 2012-2015 Sam Harwell + * Copyright (c) 2015 Gerald Rosenberg All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions + * and the following disclaimer. 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. 3. The name of the author may not be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * A grammar for ANTLR v4 implemented using v4 syntax + * + * Modified 2015.06.16 gbr -- update for compatibility with Antlr v4.5 + */ + +// $antlr-format alignTrailingComments on, columnLimit 130, minEmptyLines 1, maxEmptyLinesToKeep 1, reflowComments off +// $antlr-format useTab off, allowShortRulesOnASingleLine off, allowShortBlocksOnASingleLine on, alignSemicolons hanging +// $antlr-format alignColons hanging + +// ====================================================== +// Lexer specification +// ====================================================== + +lexer grammar ANTLRv4Lexer; + +options { + superClass = LexerAdaptor; + + // Using a predefined list of tokens here to ensure the same order of the tokens as they were defined + // in the old ANTLR3 tree parsers (to avoid having to change the tree parsers code). + // The actual values of the tokens doesn't matter, but the order does. + // tokenVocab = predefined; + // + // Instead of declaring predefined.tokens, which messes up the Maven tester for grammars-v4, + // we define the total order of token type values. This should work because it was stated + // that the "actual values of the tokens doesn't matter, but the order does." Declaring them + // in the tokensSpec section preserves the total order. +} + +// Insert here @header for lexer. + +// Standard set of fragments +tokens { + ACTION, + ARG_ACTION, + ARG_OR_CHARSET, + ASSIGN, + LEXER_CHAR_SET, + 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 +} + +channels { + OFF_CHANNEL, + COMMENT +} + +// ------------------------- +// Comments + +DOC_COMMENT + : '/**' .*? ('*/' | EOF) -> channel (COMMENT) + ; + +BLOCK_COMMENT + : '/*' .*? ('*/' | EOF) -> channel (COMMENT) + ; + +LINE_COMMENT + : '//' ~ [\r\n]* -> channel (COMMENT) + ; + +// ------------------------- +// Integer + +INT + : '0' + | [1-9] [0-9]* + ; + +// ------------------------- +// Literal string +// +// ANTLR makes no distinction between a single character literal and a +// multi-character string. All literals are single quote delimited and +// may contain unicode escape sequences of the form \uxxxx, where x +// is a valid hexadecimal number (per Unicode standard). +STRING_LITERAL + : '\'' (ESC_SEQUENCE | ~ ['\r\n\\])* '\'' + ; + +UNTERMINATED_STRING_LITERAL + : '\'' (ESC_SEQUENCE | ~ ['\r\n\\])* + ; + +// ------------------------- +// Arguments +// +// Certain argument lists, such as those specifying call parameters +// to a rule invocation, or input parameters to a rule specification +// are contained within square brackets. +BEGIN_ARGUMENT + : '[' { l.HandleBeginArgument(); } + ; + +// Many language targets use {} as block delimiters and so we +// must recursively match {} delimited blocks to balance the +// braces. Additionally, we must make some assumptions about +// literal string representation in the target language. We assume +// that they are delimited by ' or " and so consume these +// in their own alts so as not to inadvertently match {}. +ACTION + : NESTED_ACTION + ; + +fragment NESTED_ACTION + : // Action and other blocks start with opening { + '{' ( + NESTED_ACTION // embedded {} block + | STRING_LITERAL // single quoted string + | DoubleQuoteLiteral // double quoted string + | TripleQuoteLiteral // string literal with triple quotes + | BacktickQuoteLiteral // backtick quoted string + | '/*' .*? '*/' // block comment + | '//' ~[\r\n]* // line comment + | '\\' . // Escape sequence + | ~( + '\\' + | '"' + | '\'' + | '`' + | '{' + ) // Some other single character that is not handled above + )*? '}' + ; + +// ------------------------- +// Keywords +// +// 'options', 'tokens', and 'channels' are considered keywords +// but only when followed by '{', and considered as a single token. +// Otherwise, the symbols are tokenized as RULE_REF and allowed as +// an identifier in a labeledElement. +OPTIONS + : 'options' WS* '{' + ; + +TOKENS + : 'tokens' WS* '{' + ; + +CHANNELS + : 'channels' WS* '{' + ; + +IMPORT + : 'import' + ; + +FRAGMENT + : 'fragment' + ; + +LEXER + : 'lexer' + ; + +PARSER + : 'parser' + ; + +GRAMMAR + : 'grammar' + ; + +PROTECTED + : 'protected' + ; + +PUBLIC + : 'public' + ; + +PRIVATE + : 'private' + ; + +RETURNS + : 'returns' + ; + +LOCALS + : 'locals' + ; + +THROWS + : 'throws' + ; + +CATCH + : 'catch' + ; + +FINALLY + : 'finally' + ; + +MODE + : 'mode' + ; + +// ------------------------- +// Punctuation + +COLON + : ':' + ; + +COLONCOLON + : '::' + ; + +COMMA + : ',' + ; + +SEMI + : ';' + ; + +LPAREN + : '(' + ; + +RPAREN + : ')' + ; + +RBRACE + : '}' + ; + +RARROW + : '->' + ; + +LT + : '<' + ; + +GT + : '>' + ; + +ASSIGN + : '=' + ; + +QUESTION + : '?' + ; + +STAR + : '*' + ; + +PLUS_ASSIGN + : '+=' + ; + +PLUS + : '+' + ; + +OR + : '|' + ; + +DOLLAR + : '$' + ; + +RANGE + : '..' + ; + +DOT + : '.' + ; + +AT + : '@' + ; + +POUND + : '#' + ; + +NOT + : '~' + ; + +// ------------------------- +// Identifiers - allows unicode rule/token names + +ID + : NameStartChar NameChar* + ; + +// ------------------------- +// Whitespace + +WS + : [ \t\r\n\f]+ -> channel (OFF_CHANNEL) + ; + +// ====================================================== +// Lexer modes +// ------------------------- +// Arguments +mode Argument; + +// E.g., [int x, List a[]] +NESTED_ARGUMENT + : '[' -> type (ARGUMENT_CONTENT), pushMode (Argument) + ; + +ARGUMENT_ESCAPE + : '\\' . -> type (ARGUMENT_CONTENT) + ; + +ARGUMENT_STRING_LITERAL + : DoubleQuoteLiteral -> type (ARGUMENT_CONTENT) + ; + +ARGUMENT_CHAR_LITERAL + : STRING_LITERAL -> type (ARGUMENT_CONTENT) + ; + +END_ARGUMENT + : ']' { l.HandleEndArgument(); } + ; + +// added this to return non-EOF token type here. EOF does something weird +UNTERMINATED_ARGUMENT + : EOF -> popMode + ; + +ARGUMENT_CONTENT + : . + ; + +// ------------------------- +mode LexerCharSet; + +LEXER_CHAR_SET_BODY + : (~ [\]\\] | '\\' .)+ -> more + ; + +LEXER_CHAR_SET + : ']' -> popMode + ; + +UNTERMINATED_CHAR_SET + : EOF -> popMode + ; + +// ------------------------------------------------------------------------------ +// Grammar specific Keywords, Punctuation, etc. + +fragment ESC_SEQUENCE + : '\\' ([btnfr"'\\] | UnicodeESC | . | EOF) + ; + +fragment HexDigit + : [0-9a-fA-F] + ; + +fragment UnicodeESC + : 'u' (HexDigit (HexDigit (HexDigit HexDigit?)?)?)? + ; + +fragment DoubleQuoteLiteral + : '"' (ESC_SEQUENCE | ~["\r\n\\])*? '"' + ; + +fragment TripleQuoteLiteral + : '"""' (ESC_SEQUENCE | .)*? '"""' + ; + +fragment BacktickQuoteLiteral + : '`' (ESC_SEQUENCE | ~["\r\n\\])*? '`' + ; + +// ----------------------------------- +// Character ranges + +fragment NameChar + : NameStartChar + | '0' .. '9' + | '_' + | '\u00B7' + | '\u0300' .. '\u036F' + | '\u203F' .. '\u2040' + ; + +fragment NameStartChar + : 'A' .. 'Z' + | 'a' .. 'z' + | '\u00C0' .. '\u00D6' + | '\u00D8' .. '\u00F6' + | '\u00F8' .. '\u02FF' + | '\u0370' .. '\u037D' + | '\u037F' .. '\u1FFF' + | '\u200C' .. '\u200D' + | '\u2070' .. '\u218F' + | '\u2C00' .. '\u2FEF' + | '\u3001' .. '\uD7FF' + | '\uF900' .. '\uFDCF' + | '\uFDF0' .. '\uFFFD' + // ignores | ['\u10000-'\uEFFFF] + ; \ No newline at end of file diff --git a/tools/grammar/ANTLRv4Parser.g4 b/tools/grammar/ANTLRv4Parser.g4 new file mode 100644 index 0000000..566df8b --- /dev/null +++ b/tools/grammar/ANTLRv4Parser.g4 @@ -0,0 +1,406 @@ +/* + * [The "BSD license"] Copyright (c) 2012-2014 Terence Parr Copyright (c) 2012-2014 Sam Harwell + * Copyright (c) 2015 Gerald Rosenberg All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions + * and the following disclaimer. 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. 3. The name of the author may not be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* A grammar for ANTLR v4 written in ANTLR v4. + * + * Modified 2015.06.16 gbr -- update for compatibility with Antlr v4.5 -- add mode for channels -- + * moved members to LexerAdaptor -- move fragments to imports + */ + +// $antlr-format alignTrailingComments on, columnLimit 130, minEmptyLines 1, maxEmptyLinesToKeep 1, reflowComments off +// $antlr-format useTab off, allowShortRulesOnASingleLine off, allowShortBlocksOnASingleLine on, alignSemicolons hanging +// $antlr-format alignColons hanging + +parser grammar ANTLRv4Parser; + +options { + tokenVocab = ANTLRv4Lexer; +} + +// The main entry point for parsing a v4 grammar. +grammarSpec + : grammarDecl prequelConstruct* rules modeSpec* EOF + ; + +grammarDecl + : grammarType identifier SEMI + ; + +grammarType + : LEXER GRAMMAR + | PARSER GRAMMAR + | GRAMMAR + ; + +// This is the list of all constructs that can be declared before +// the set of rules that compose the grammar, and is invoked 0..n +// times by the grammarPrequel rule. + +prequelConstruct + : optionsSpec + | delegateGrammars + | tokensSpec + | channelsSpec + | action_ + ; + +// ------------ +// Options - things that affect analysis and/or code generation + +optionsSpec + : OPTIONS (option SEMI)* RBRACE + ; + +option + : identifier ASSIGN optionValue + ; + +optionValue + : identifier (DOT identifier)* + | STRING_LITERAL + | actionBlock + | INT + ; + +// ------------ +// Delegates + +delegateGrammars + : IMPORT delegateGrammar (COMMA delegateGrammar)* SEMI + ; + +delegateGrammar + : identifier ASSIGN identifier + | identifier + ; + +// ------------ +// Tokens & Channels + +tokensSpec + : TOKENS idList? RBRACE + ; + +channelsSpec + : CHANNELS idList? RBRACE + ; + +idList + : identifier (COMMA identifier)* COMMA? + ; + +// Match stuff like @parser::members {int i;} + +action_ + : AT (actionScopeName COLONCOLON)? identifier actionBlock + ; + +// Scope names could collide with keywords; allow them as ids for action scopes + +actionScopeName + : identifier + | LEXER + | PARSER + ; + +actionBlock + : ACTION + ; + +argActionBlock + : BEGIN_ARGUMENT ARGUMENT_CONTENT*? END_ARGUMENT + ; + +modeSpec + : MODE identifier SEMI lexerRuleSpec* + ; + +rules + : ruleSpec* + ; + +ruleSpec + : parserRuleSpec + | lexerRuleSpec + ; + +parserRuleSpec + : ruleModifiers? RULE_REF argActionBlock? ruleReturns? throwsSpec? localsSpec? rulePrequel* COLON ruleBlock SEMI + exceptionGroup + ; + +exceptionGroup + : exceptionHandler* finallyClause? + ; + +exceptionHandler + : CATCH argActionBlock actionBlock + ; + +finallyClause + : FINALLY actionBlock + ; + +rulePrequel + : optionsSpec + | ruleAction + ; + +ruleReturns + : RETURNS argActionBlock + ; + +// -------------- +// Exception spec +throwsSpec + : THROWS qualifiedIdentifier (COMMA qualifiedIdentifier)* + ; + +localsSpec + : LOCALS argActionBlock + ; + +/** Match stuff like @init {int i;} */ +ruleAction + : AT identifier actionBlock + ; + +ruleModifiers + : ruleModifier+ + ; + +// An individual access modifier for a rule. The 'fragment' modifier +// is an internal indication for lexer rules that they do not match +// from the input but are like subroutines for other lexer rules to +// reuse for certain lexical patterns. The other modifiers are passed +// to the code generation templates and may be ignored by the template +// if they are of no use in that language. + +ruleModifier + : PUBLIC + | PRIVATE + | PROTECTED + | FRAGMENT + ; + +ruleBlock + : ruleAltList + ; + +ruleAltList + : labeledAlt (OR labeledAlt)* + ; + +labeledAlt + : alternative (POUND identifier)? + ; + +// -------------------- +// Lexer rules + +lexerRuleSpec + : FRAGMENT? TOKEN_REF optionsSpec? COLON lexerRuleBlock SEMI + ; + +lexerRuleBlock + : lexerAltList + ; + +lexerAltList + : lexerAlt (OR lexerAlt)* + ; + +lexerAlt + : lexerElements lexerCommands? + | + // explicitly allow empty alts + ; + +lexerElements + : lexerElement+ + | + ; + +lexerElement + : lexerAtom ebnfSuffix? + | lexerBlock ebnfSuffix? + | actionBlock QUESTION? + ; + +// but preds can be anywhere + +lexerBlock + : LPAREN lexerAltList RPAREN + ; + +// E.g., channel(HIDDEN), skip, more, mode(INSIDE), push(INSIDE), pop + +lexerCommands + : RARROW lexerCommand (COMMA lexerCommand)* + ; + +lexerCommand + : lexerCommandName LPAREN lexerCommandExpr RPAREN + | lexerCommandName + ; + +lexerCommandName + : identifier + | MODE + ; + +lexerCommandExpr + : identifier + | INT + ; + +// -------------------- +// Rule Alts + +altList + : alternative (OR alternative)* + ; + +alternative + : elementOptions? element+ + | + // explicitly allow empty alts + ; + +element + : labeledElement (ebnfSuffix |) + | atom (ebnfSuffix |) + | ebnf + | actionBlock QUESTION? predicateOptions? + ; + +predicateOptions + : LT predicateOption (COMMA predicateOption)* GT + ; + +predicateOption + : elementOption + | identifier ASSIGN (actionBlock | INT | STRING_LITERAL) + ; + +labeledElement + : identifier (ASSIGN | PLUS_ASSIGN) (atom | block) + ; + +// -------------------- +// EBNF and blocks + +ebnf + : block blockSuffix? + ; + +blockSuffix + : ebnfSuffix + ; + +ebnfSuffix + : QUESTION QUESTION? + | STAR QUESTION? + | PLUS QUESTION? + ; + +lexerAtom + : characterRange + | terminalDef + | notSet + | LEXER_CHAR_SET + | wildcard + ; + +atom + : terminalDef + | ruleref + | notSet + | wildcard + ; + +wildcard + : DOT elementOptions? + ; + +// -------------------- +// Inverted element set +notSet + : NOT setElement + | NOT blockSet + ; + +blockSet + : LPAREN setElement (OR setElement)* RPAREN + ; + +setElement + : TOKEN_REF elementOptions? + | STRING_LITERAL elementOptions? + | characterRange + | LEXER_CHAR_SET + ; + +// ------------- +// Grammar Block +block + : LPAREN (optionsSpec? ruleAction* COLON)? altList RPAREN + ; + +// ---------------- +// Parser rule ref +ruleref + : RULE_REF argActionBlock? elementOptions? + ; + +// --------------- +// Character Range +characterRange + : STRING_LITERAL RANGE STRING_LITERAL + ; + +terminalDef + : TOKEN_REF elementOptions? + | STRING_LITERAL elementOptions? + ; + +// Terminals may be adorned with certain options when +// reference in the grammar: TOK<,,,> +elementOptions + : LT elementOption (COMMA elementOption)* GT + ; + +elementOption + : qualifiedIdentifier + | identifier ASSIGN (qualifiedIdentifier | STRING_LITERAL | INT) + ; + +identifier + : RULE_REF + | TOKEN_REF + ; + +qualifiedIdentifier + : identifier (DOT identifier)* + ; \ No newline at end of file diff --git a/tools/grammar/Makefile b/tools/grammar/Makefile new file mode 100644 index 0000000..199c486 --- /dev/null +++ b/tools/grammar/Makefile @@ -0,0 +1,9 @@ +all: build test + +build: + antlr -Dlanguage=Go -package grammar -visitor -o . ANTLRv4Lexer.g4 ANTLRv4Parser.g4 + @echo "Applying LexerAdaptor fix..." + sed -i '' 's/l\.BaseLexer = antlr\.NewBaseLexer(input)/l.LexerAdaptor = *NewLexerAdaptor(input)/' antlrv4_lexer.go + +test: + go test -v . diff --git a/tools/grammar/README.md b/tools/grammar/README.md new file mode 100644 index 0000000..2641250 --- /dev/null +++ b/tools/grammar/README.md @@ -0,0 +1,36 @@ +# ANTLR v4 Grammar Parser + +A Go implementation to parse ANTLR v4 grammar files (`.g4` files) in this repository. + +## Source + +The lexer and parser grammars come from: https://github.com/antlr/grammars-v4/blob/master/antlr/antlr4 + +## Why Custom NextToken()? + +We added `func (l *LexerAdaptor) NextToken() antlr.Token` in `lexer_adaptor.go` because: + +- ANTLR grammar parsing requires context-sensitive lexing +- Need to convert `ID` tokens to `TOKEN_REF` (uppercase) or `RULE_REF` (lowercase) +- Go ANTLR doesn't automatically call `Emit()` like Java ANTLR does +- Go tokens are immutable, so we use a `TokenTypeWrapper` to override token types + +## Why Sed Command in Makefile? + +We added this sed command in the Makefile: +```bash +sed -i '' 's/l\.BaseLexer = antlr\.NewBaseLexer(input)/l.LexerAdaptor = *NewLexerAdaptor(input)/' antlrv4_lexer.go +``` + +Because: +- ANTLR code generation creates `l.BaseLexer = antlr.NewBaseLexer(input)` +- We need `l.LexerAdaptor = *NewLexerAdaptor(input)` to use our custom lexer +- This automatically fixes the generated constructor after each regeneration + +## Usage + +```bash +make build # Generate parser and apply fixes +make test # Test all .g4 files in repository (should show 100% success) +make all # Build and test +``` \ No newline at end of file diff --git a/tools/grammar/antlrv4_lexer.go b/tools/grammar/antlrv4_lexer.go new file mode 100644 index 0000000..098b07a --- /dev/null +++ b/tools/grammar/antlrv4_lexer.go @@ -0,0 +1,505 @@ +// Code generated from ANTLRv4Lexer.g4 by ANTLR 4.13.2. DO NOT EDIT. + +package grammar + +import ( + "fmt" + "github.com/antlr4-go/antlr/v4" + "sync" + "unicode" +) + +// Suppress unused import error +var _ = fmt.Printf +var _ = sync.Once{} +var _ = unicode.IsLetter + +type ANTLRv4Lexer struct { + LexerAdaptor + channelNames []string + modeNames []string + // TODO: EOF string +} + +var ANTLRv4LexerLexerStaticData struct { + once sync.Once + serializedATN []int32 + ChannelNames []string + ModeNames []string + LiteralNames []string + SymbolicNames []string + RuleNames []string + PredictionContextCache *antlr.PredictionContextCache + atn *antlr.ATN + decisionToDFA []*antlr.DFA +} + +func antlrv4lexerLexerInit() { + staticData := &ANTLRv4LexerLexerStaticData + staticData.ChannelNames = []string{ + "DEFAULT_TOKEN_CHANNEL", "HIDDEN", "OFF_CHANNEL", "COMMENT", + } + staticData.ModeNames = []string{ + "DEFAULT_MODE", "Argument", "LexerCharSet", + } + staticData.LiteralNames = []string{ + "", "", "", "", "'='", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "'['", "", + "", "", "'import'", "'fragment'", "'lexer'", "'parser'", "'grammar'", + "'protected'", "'public'", "'private'", "'returns'", "'locals'", "'throws'", + "'catch'", "'finally'", "'mode'", "':'", "'::'", "','", "';'", "'('", + "')'", "'}'", "'->'", "'<'", "'>'", "'?'", "'*'", "'+='", "'+'", "'|'", + "'$'", "'..'", "'.'", "'@'", "'#'", "'~'", + } + staticData.SymbolicNames = []string{ + "", "ACTION", "ARG_ACTION", "ARG_OR_CHARSET", "ASSIGN", "LEXER_CHAR_SET", + "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", "UNTERMINATED_CHAR_SET", + } + staticData.RuleNames = []string{ + "DOC_COMMENT", "BLOCK_COMMENT", "LINE_COMMENT", "INT", "STRING_LITERAL", + "UNTERMINATED_STRING_LITERAL", "BEGIN_ARGUMENT", "ACTION", "NESTED_ACTION", + "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", "ASSIGN", "QUESTION", + "STAR", "PLUS_ASSIGN", "PLUS", "OR", "DOLLAR", "RANGE", "DOT", "AT", + "POUND", "NOT", "ID", "WS", "NESTED_ARGUMENT", "ARGUMENT_ESCAPE", "ARGUMENT_STRING_LITERAL", + "ARGUMENT_CHAR_LITERAL", "END_ARGUMENT", "UNTERMINATED_ARGUMENT", "ARGUMENT_CONTENT", + "LEXER_CHAR_SET_BODY", "LEXER_CHAR_SET", "UNTERMINATED_CHAR_SET", "ESC_SEQUENCE", + "HexDigit", "UnicodeESC", "DoubleQuoteLiteral", "TripleQuoteLiteral", + "BacktickQuoteLiteral", "NameChar", "NameStartChar", + } + staticData.PredictionContextCache = antlr.NewPredictionContextCache() + staticData.serializedATN = []int32{ + 4, 0, 75, 572, 6, -1, 6, -1, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, + 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, + 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, + 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, + 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, + 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, + 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, + 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, + 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, + 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, + 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, + 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, + 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, + 66, 2, 67, 7, 67, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 5, 0, 145, 8, 0, 10, 0, + 12, 0, 148, 9, 0, 1, 0, 1, 0, 1, 0, 3, 0, 153, 8, 0, 1, 0, 1, 0, 1, 1, + 1, 1, 1, 1, 1, 1, 5, 1, 161, 8, 1, 10, 1, 12, 1, 164, 9, 1, 1, 1, 1, 1, + 1, 1, 3, 1, 169, 8, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 177, 8, + 2, 10, 2, 12, 2, 180, 9, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 5, 3, 187, 8, + 3, 10, 3, 12, 3, 190, 9, 3, 3, 3, 192, 8, 3, 1, 4, 1, 4, 1, 4, 5, 4, 197, + 8, 4, 10, 4, 12, 4, 200, 9, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 5, 5, 207, + 8, 5, 10, 5, 12, 5, 210, 9, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, + 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 5, 8, 227, 8, 8, 10, 8, + 12, 8, 230, 9, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 5, 8, 238, 8, 8, + 10, 8, 12, 8, 241, 9, 8, 1, 8, 1, 8, 1, 8, 5, 8, 246, 8, 8, 10, 8, 12, + 8, 249, 9, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, + 9, 1, 9, 5, 9, 262, 8, 9, 10, 9, 12, 9, 265, 9, 9, 1, 9, 1, 9, 1, 10, 1, + 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 5, 10, 277, 8, 10, 10, 10, + 12, 10, 280, 9, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, + 11, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 294, 8, 11, 10, 11, 12, 11, 297, + 9, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, + 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, + 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, + 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, + 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, + 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, + 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, + 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 22, + 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1, + 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, + 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, 1, 29, 1, + 30, 1, 30, 1, 31, 1, 31, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, + 1, 35, 1, 35, 1, 36, 1, 36, 1, 37, 1, 37, 1, 38, 1, 38, 1, 39, 1, 39, 1, + 39, 1, 40, 1, 40, 1, 41, 1, 41, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 44, + 1, 44, 1, 45, 1, 45, 1, 46, 1, 46, 1, 47, 1, 47, 1, 48, 1, 48, 5, 48, 454, + 8, 48, 10, 48, 12, 48, 457, 9, 48, 1, 49, 4, 49, 460, 8, 49, 11, 49, 12, + 49, 461, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 51, 1, 51, + 1, 51, 1, 51, 1, 51, 1, 52, 1, 52, 1, 52, 1, 52, 1, 53, 1, 53, 1, 53, 1, + 53, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 57, + 1, 57, 1, 57, 4, 57, 496, 8, 57, 11, 57, 12, 57, 497, 1, 57, 1, 57, 1, + 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, + 1, 60, 1, 60, 3, 60, 515, 8, 60, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, 1, + 62, 1, 62, 3, 62, 524, 8, 62, 3, 62, 526, 8, 62, 3, 62, 528, 8, 62, 3, + 62, 530, 8, 62, 1, 63, 1, 63, 1, 63, 5, 63, 535, 8, 63, 10, 63, 12, 63, + 538, 9, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 5, + 64, 548, 8, 64, 10, 64, 12, 64, 551, 9, 64, 1, 64, 1, 64, 1, 64, 1, 64, + 1, 65, 1, 65, 1, 65, 5, 65, 560, 8, 65, 10, 65, 12, 65, 563, 9, 65, 1, + 65, 1, 65, 1, 66, 1, 66, 3, 66, 569, 8, 66, 1, 67, 1, 67, 7, 146, 162, + 228, 247, 536, 549, 561, 0, 68, 3, 27, 5, 28, 7, 29, 9, 30, 11, 8, 13, + 31, 15, 32, 17, 1, 19, 0, 21, 33, 23, 34, 25, 35, 27, 36, 29, 37, 31, 38, + 33, 39, 35, 40, 37, 41, 39, 42, 41, 43, 43, 44, 45, 45, 47, 46, 49, 47, + 51, 48, 53, 49, 55, 50, 57, 51, 59, 52, 61, 53, 63, 54, 65, 55, 67, 56, + 69, 57, 71, 58, 73, 59, 75, 4, 77, 60, 79, 61, 81, 62, 83, 63, 85, 64, + 87, 65, 89, 66, 91, 67, 93, 68, 95, 69, 97, 70, 99, 71, 101, 12, 103, 0, + 105, 0, 107, 0, 109, 0, 111, 72, 113, 73, 115, 74, 117, 0, 119, 5, 121, + 75, 123, 0, 125, 0, 127, 0, 129, 0, 131, 0, 133, 0, 135, 0, 137, 0, 3, + 0, 1, 2, 12, 2, 0, 10, 10, 13, 13, 1, 0, 49, 57, 1, 0, 48, 57, 4, 0, 10, + 10, 13, 13, 39, 39, 92, 92, 5, 0, 34, 34, 39, 39, 92, 92, 96, 96, 123, + 123, 3, 0, 9, 10, 12, 13, 32, 32, 1, 0, 92, 93, 8, 0, 34, 34, 39, 39, 92, + 92, 98, 98, 102, 102, 110, 110, 114, 114, 116, 116, 3, 0, 48, 57, 65, 70, + 97, 102, 4, 0, 10, 10, 13, 13, 34, 34, 92, 92, 5, 0, 48, 57, 95, 95, 183, + 183, 768, 879, 8255, 8256, 13, 0, 65, 90, 97, 122, 192, 214, 216, 246, + 248, 767, 880, 893, 895, 8191, 8204, 8205, 8304, 8591, 11264, 12271, 12289, + 55295, 63744, 64975, 65008, 65533, 603, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, + 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, + 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, + 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, + 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, + 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, + 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, + 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, + 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, + 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 0, 77, + 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, + 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, 0, 0, 0, 91, 1, 0, 0, 0, + 0, 93, 1, 0, 0, 0, 0, 95, 1, 0, 0, 0, 0, 97, 1, 0, 0, 0, 0, 99, 1, 0, 0, + 0, 0, 101, 1, 0, 0, 0, 1, 103, 1, 0, 0, 0, 1, 105, 1, 0, 0, 0, 1, 107, + 1, 0, 0, 0, 1, 109, 1, 0, 0, 0, 1, 111, 1, 0, 0, 0, 1, 113, 1, 0, 0, 0, + 1, 115, 1, 0, 0, 0, 2, 117, 1, 0, 0, 0, 2, 119, 1, 0, 0, 0, 2, 121, 1, + 0, 0, 0, 3, 139, 1, 0, 0, 0, 5, 156, 1, 0, 0, 0, 7, 172, 1, 0, 0, 0, 9, + 191, 1, 0, 0, 0, 11, 193, 1, 0, 0, 0, 13, 203, 1, 0, 0, 0, 15, 211, 1, + 0, 0, 0, 17, 214, 1, 0, 0, 0, 19, 216, 1, 0, 0, 0, 21, 252, 1, 0, 0, 0, + 23, 268, 1, 0, 0, 0, 25, 283, 1, 0, 0, 0, 27, 300, 1, 0, 0, 0, 29, 307, + 1, 0, 0, 0, 31, 316, 1, 0, 0, 0, 33, 322, 1, 0, 0, 0, 35, 329, 1, 0, 0, + 0, 37, 337, 1, 0, 0, 0, 39, 347, 1, 0, 0, 0, 41, 354, 1, 0, 0, 0, 43, 362, + 1, 0, 0, 0, 45, 370, 1, 0, 0, 0, 47, 377, 1, 0, 0, 0, 49, 384, 1, 0, 0, + 0, 51, 390, 1, 0, 0, 0, 53, 398, 1, 0, 0, 0, 55, 403, 1, 0, 0, 0, 57, 405, + 1, 0, 0, 0, 59, 408, 1, 0, 0, 0, 61, 410, 1, 0, 0, 0, 63, 412, 1, 0, 0, + 0, 65, 414, 1, 0, 0, 0, 67, 416, 1, 0, 0, 0, 69, 418, 1, 0, 0, 0, 71, 421, + 1, 0, 0, 0, 73, 423, 1, 0, 0, 0, 75, 425, 1, 0, 0, 0, 77, 427, 1, 0, 0, + 0, 79, 429, 1, 0, 0, 0, 81, 431, 1, 0, 0, 0, 83, 434, 1, 0, 0, 0, 85, 436, + 1, 0, 0, 0, 87, 438, 1, 0, 0, 0, 89, 440, 1, 0, 0, 0, 91, 443, 1, 0, 0, + 0, 93, 445, 1, 0, 0, 0, 95, 447, 1, 0, 0, 0, 97, 449, 1, 0, 0, 0, 99, 451, + 1, 0, 0, 0, 101, 459, 1, 0, 0, 0, 103, 465, 1, 0, 0, 0, 105, 470, 1, 0, + 0, 0, 107, 475, 1, 0, 0, 0, 109, 479, 1, 0, 0, 0, 111, 483, 1, 0, 0, 0, + 113, 486, 1, 0, 0, 0, 115, 490, 1, 0, 0, 0, 117, 495, 1, 0, 0, 0, 119, + 501, 1, 0, 0, 0, 121, 505, 1, 0, 0, 0, 123, 509, 1, 0, 0, 0, 125, 516, + 1, 0, 0, 0, 127, 518, 1, 0, 0, 0, 129, 531, 1, 0, 0, 0, 131, 541, 1, 0, + 0, 0, 133, 556, 1, 0, 0, 0, 135, 568, 1, 0, 0, 0, 137, 570, 1, 0, 0, 0, + 139, 140, 5, 47, 0, 0, 140, 141, 5, 42, 0, 0, 141, 142, 5, 42, 0, 0, 142, + 146, 1, 0, 0, 0, 143, 145, 9, 0, 0, 0, 144, 143, 1, 0, 0, 0, 145, 148, + 1, 0, 0, 0, 146, 147, 1, 0, 0, 0, 146, 144, 1, 0, 0, 0, 147, 152, 1, 0, + 0, 0, 148, 146, 1, 0, 0, 0, 149, 150, 5, 42, 0, 0, 150, 153, 5, 47, 0, + 0, 151, 153, 5, 0, 0, 1, 152, 149, 1, 0, 0, 0, 152, 151, 1, 0, 0, 0, 153, + 154, 1, 0, 0, 0, 154, 155, 6, 0, 0, 0, 155, 4, 1, 0, 0, 0, 156, 157, 5, + 47, 0, 0, 157, 158, 5, 42, 0, 0, 158, 162, 1, 0, 0, 0, 159, 161, 9, 0, + 0, 0, 160, 159, 1, 0, 0, 0, 161, 164, 1, 0, 0, 0, 162, 163, 1, 0, 0, 0, + 162, 160, 1, 0, 0, 0, 163, 168, 1, 0, 0, 0, 164, 162, 1, 0, 0, 0, 165, + 166, 5, 42, 0, 0, 166, 169, 5, 47, 0, 0, 167, 169, 5, 0, 0, 1, 168, 165, + 1, 0, 0, 0, 168, 167, 1, 0, 0, 0, 169, 170, 1, 0, 0, 0, 170, 171, 6, 1, + 0, 0, 171, 6, 1, 0, 0, 0, 172, 173, 5, 47, 0, 0, 173, 174, 5, 47, 0, 0, + 174, 178, 1, 0, 0, 0, 175, 177, 8, 0, 0, 0, 176, 175, 1, 0, 0, 0, 177, + 180, 1, 0, 0, 0, 178, 176, 1, 0, 0, 0, 178, 179, 1, 0, 0, 0, 179, 181, + 1, 0, 0, 0, 180, 178, 1, 0, 0, 0, 181, 182, 6, 2, 0, 0, 182, 8, 1, 0, 0, + 0, 183, 192, 5, 48, 0, 0, 184, 188, 7, 1, 0, 0, 185, 187, 7, 2, 0, 0, 186, + 185, 1, 0, 0, 0, 187, 190, 1, 0, 0, 0, 188, 186, 1, 0, 0, 0, 188, 189, + 1, 0, 0, 0, 189, 192, 1, 0, 0, 0, 190, 188, 1, 0, 0, 0, 191, 183, 1, 0, + 0, 0, 191, 184, 1, 0, 0, 0, 192, 10, 1, 0, 0, 0, 193, 198, 5, 39, 0, 0, + 194, 197, 3, 123, 60, 0, 195, 197, 8, 3, 0, 0, 196, 194, 1, 0, 0, 0, 196, + 195, 1, 0, 0, 0, 197, 200, 1, 0, 0, 0, 198, 196, 1, 0, 0, 0, 198, 199, + 1, 0, 0, 0, 199, 201, 1, 0, 0, 0, 200, 198, 1, 0, 0, 0, 201, 202, 5, 39, + 0, 0, 202, 12, 1, 0, 0, 0, 203, 208, 5, 39, 0, 0, 204, 207, 3, 123, 60, + 0, 205, 207, 8, 3, 0, 0, 206, 204, 1, 0, 0, 0, 206, 205, 1, 0, 0, 0, 207, + 210, 1, 0, 0, 0, 208, 206, 1, 0, 0, 0, 208, 209, 1, 0, 0, 0, 209, 14, 1, + 0, 0, 0, 210, 208, 1, 0, 0, 0, 211, 212, 5, 91, 0, 0, 212, 213, 6, 6, 1, + 0, 213, 16, 1, 0, 0, 0, 214, 215, 3, 19, 8, 0, 215, 18, 1, 0, 0, 0, 216, + 247, 5, 123, 0, 0, 217, 246, 3, 19, 8, 0, 218, 246, 3, 11, 4, 0, 219, 246, + 3, 129, 63, 0, 220, 246, 3, 131, 64, 0, 221, 246, 3, 133, 65, 0, 222, 223, + 5, 47, 0, 0, 223, 224, 5, 42, 0, 0, 224, 228, 1, 0, 0, 0, 225, 227, 9, + 0, 0, 0, 226, 225, 1, 0, 0, 0, 227, 230, 1, 0, 0, 0, 228, 229, 1, 0, 0, + 0, 228, 226, 1, 0, 0, 0, 229, 231, 1, 0, 0, 0, 230, 228, 1, 0, 0, 0, 231, + 232, 5, 42, 0, 0, 232, 246, 5, 47, 0, 0, 233, 234, 5, 47, 0, 0, 234, 235, + 5, 47, 0, 0, 235, 239, 1, 0, 0, 0, 236, 238, 8, 0, 0, 0, 237, 236, 1, 0, + 0, 0, 238, 241, 1, 0, 0, 0, 239, 237, 1, 0, 0, 0, 239, 240, 1, 0, 0, 0, + 240, 246, 1, 0, 0, 0, 241, 239, 1, 0, 0, 0, 242, 243, 5, 92, 0, 0, 243, + 246, 9, 0, 0, 0, 244, 246, 8, 4, 0, 0, 245, 217, 1, 0, 0, 0, 245, 218, + 1, 0, 0, 0, 245, 219, 1, 0, 0, 0, 245, 220, 1, 0, 0, 0, 245, 221, 1, 0, + 0, 0, 245, 222, 1, 0, 0, 0, 245, 233, 1, 0, 0, 0, 245, 242, 1, 0, 0, 0, + 245, 244, 1, 0, 0, 0, 246, 249, 1, 0, 0, 0, 247, 248, 1, 0, 0, 0, 247, + 245, 1, 0, 0, 0, 248, 250, 1, 0, 0, 0, 249, 247, 1, 0, 0, 0, 250, 251, + 5, 125, 0, 0, 251, 20, 1, 0, 0, 0, 252, 253, 5, 111, 0, 0, 253, 254, 5, + 112, 0, 0, 254, 255, 5, 116, 0, 0, 255, 256, 5, 105, 0, 0, 256, 257, 5, + 111, 0, 0, 257, 258, 5, 110, 0, 0, 258, 259, 5, 115, 0, 0, 259, 263, 1, + 0, 0, 0, 260, 262, 3, 101, 49, 0, 261, 260, 1, 0, 0, 0, 262, 265, 1, 0, + 0, 0, 263, 261, 1, 0, 0, 0, 263, 264, 1, 0, 0, 0, 264, 266, 1, 0, 0, 0, + 265, 263, 1, 0, 0, 0, 266, 267, 5, 123, 0, 0, 267, 22, 1, 0, 0, 0, 268, + 269, 5, 116, 0, 0, 269, 270, 5, 111, 0, 0, 270, 271, 5, 107, 0, 0, 271, + 272, 5, 101, 0, 0, 272, 273, 5, 110, 0, 0, 273, 274, 5, 115, 0, 0, 274, + 278, 1, 0, 0, 0, 275, 277, 3, 101, 49, 0, 276, 275, 1, 0, 0, 0, 277, 280, + 1, 0, 0, 0, 278, 276, 1, 0, 0, 0, 278, 279, 1, 0, 0, 0, 279, 281, 1, 0, + 0, 0, 280, 278, 1, 0, 0, 0, 281, 282, 5, 123, 0, 0, 282, 24, 1, 0, 0, 0, + 283, 284, 5, 99, 0, 0, 284, 285, 5, 104, 0, 0, 285, 286, 5, 97, 0, 0, 286, + 287, 5, 110, 0, 0, 287, 288, 5, 110, 0, 0, 288, 289, 5, 101, 0, 0, 289, + 290, 5, 108, 0, 0, 290, 291, 5, 115, 0, 0, 291, 295, 1, 0, 0, 0, 292, 294, + 3, 101, 49, 0, 293, 292, 1, 0, 0, 0, 294, 297, 1, 0, 0, 0, 295, 293, 1, + 0, 0, 0, 295, 296, 1, 0, 0, 0, 296, 298, 1, 0, 0, 0, 297, 295, 1, 0, 0, + 0, 298, 299, 5, 123, 0, 0, 299, 26, 1, 0, 0, 0, 300, 301, 5, 105, 0, 0, + 301, 302, 5, 109, 0, 0, 302, 303, 5, 112, 0, 0, 303, 304, 5, 111, 0, 0, + 304, 305, 5, 114, 0, 0, 305, 306, 5, 116, 0, 0, 306, 28, 1, 0, 0, 0, 307, + 308, 5, 102, 0, 0, 308, 309, 5, 114, 0, 0, 309, 310, 5, 97, 0, 0, 310, + 311, 5, 103, 0, 0, 311, 312, 5, 109, 0, 0, 312, 313, 5, 101, 0, 0, 313, + 314, 5, 110, 0, 0, 314, 315, 5, 116, 0, 0, 315, 30, 1, 0, 0, 0, 316, 317, + 5, 108, 0, 0, 317, 318, 5, 101, 0, 0, 318, 319, 5, 120, 0, 0, 319, 320, + 5, 101, 0, 0, 320, 321, 5, 114, 0, 0, 321, 32, 1, 0, 0, 0, 322, 323, 5, + 112, 0, 0, 323, 324, 5, 97, 0, 0, 324, 325, 5, 114, 0, 0, 325, 326, 5, + 115, 0, 0, 326, 327, 5, 101, 0, 0, 327, 328, 5, 114, 0, 0, 328, 34, 1, + 0, 0, 0, 329, 330, 5, 103, 0, 0, 330, 331, 5, 114, 0, 0, 331, 332, 5, 97, + 0, 0, 332, 333, 5, 109, 0, 0, 333, 334, 5, 109, 0, 0, 334, 335, 5, 97, + 0, 0, 335, 336, 5, 114, 0, 0, 336, 36, 1, 0, 0, 0, 337, 338, 5, 112, 0, + 0, 338, 339, 5, 114, 0, 0, 339, 340, 5, 111, 0, 0, 340, 341, 5, 116, 0, + 0, 341, 342, 5, 101, 0, 0, 342, 343, 5, 99, 0, 0, 343, 344, 5, 116, 0, + 0, 344, 345, 5, 101, 0, 0, 345, 346, 5, 100, 0, 0, 346, 38, 1, 0, 0, 0, + 347, 348, 5, 112, 0, 0, 348, 349, 5, 117, 0, 0, 349, 350, 5, 98, 0, 0, + 350, 351, 5, 108, 0, 0, 351, 352, 5, 105, 0, 0, 352, 353, 5, 99, 0, 0, + 353, 40, 1, 0, 0, 0, 354, 355, 5, 112, 0, 0, 355, 356, 5, 114, 0, 0, 356, + 357, 5, 105, 0, 0, 357, 358, 5, 118, 0, 0, 358, 359, 5, 97, 0, 0, 359, + 360, 5, 116, 0, 0, 360, 361, 5, 101, 0, 0, 361, 42, 1, 0, 0, 0, 362, 363, + 5, 114, 0, 0, 363, 364, 5, 101, 0, 0, 364, 365, 5, 116, 0, 0, 365, 366, + 5, 117, 0, 0, 366, 367, 5, 114, 0, 0, 367, 368, 5, 110, 0, 0, 368, 369, + 5, 115, 0, 0, 369, 44, 1, 0, 0, 0, 370, 371, 5, 108, 0, 0, 371, 372, 5, + 111, 0, 0, 372, 373, 5, 99, 0, 0, 373, 374, 5, 97, 0, 0, 374, 375, 5, 108, + 0, 0, 375, 376, 5, 115, 0, 0, 376, 46, 1, 0, 0, 0, 377, 378, 5, 116, 0, + 0, 378, 379, 5, 104, 0, 0, 379, 380, 5, 114, 0, 0, 380, 381, 5, 111, 0, + 0, 381, 382, 5, 119, 0, 0, 382, 383, 5, 115, 0, 0, 383, 48, 1, 0, 0, 0, + 384, 385, 5, 99, 0, 0, 385, 386, 5, 97, 0, 0, 386, 387, 5, 116, 0, 0, 387, + 388, 5, 99, 0, 0, 388, 389, 5, 104, 0, 0, 389, 50, 1, 0, 0, 0, 390, 391, + 5, 102, 0, 0, 391, 392, 5, 105, 0, 0, 392, 393, 5, 110, 0, 0, 393, 394, + 5, 97, 0, 0, 394, 395, 5, 108, 0, 0, 395, 396, 5, 108, 0, 0, 396, 397, + 5, 121, 0, 0, 397, 52, 1, 0, 0, 0, 398, 399, 5, 109, 0, 0, 399, 400, 5, + 111, 0, 0, 400, 401, 5, 100, 0, 0, 401, 402, 5, 101, 0, 0, 402, 54, 1, + 0, 0, 0, 403, 404, 5, 58, 0, 0, 404, 56, 1, 0, 0, 0, 405, 406, 5, 58, 0, + 0, 406, 407, 5, 58, 0, 0, 407, 58, 1, 0, 0, 0, 408, 409, 5, 44, 0, 0, 409, + 60, 1, 0, 0, 0, 410, 411, 5, 59, 0, 0, 411, 62, 1, 0, 0, 0, 412, 413, 5, + 40, 0, 0, 413, 64, 1, 0, 0, 0, 414, 415, 5, 41, 0, 0, 415, 66, 1, 0, 0, + 0, 416, 417, 5, 125, 0, 0, 417, 68, 1, 0, 0, 0, 418, 419, 5, 45, 0, 0, + 419, 420, 5, 62, 0, 0, 420, 70, 1, 0, 0, 0, 421, 422, 5, 60, 0, 0, 422, + 72, 1, 0, 0, 0, 423, 424, 5, 62, 0, 0, 424, 74, 1, 0, 0, 0, 425, 426, 5, + 61, 0, 0, 426, 76, 1, 0, 0, 0, 427, 428, 5, 63, 0, 0, 428, 78, 1, 0, 0, + 0, 429, 430, 5, 42, 0, 0, 430, 80, 1, 0, 0, 0, 431, 432, 5, 43, 0, 0, 432, + 433, 5, 61, 0, 0, 433, 82, 1, 0, 0, 0, 434, 435, 5, 43, 0, 0, 435, 84, + 1, 0, 0, 0, 436, 437, 5, 124, 0, 0, 437, 86, 1, 0, 0, 0, 438, 439, 5, 36, + 0, 0, 439, 88, 1, 0, 0, 0, 440, 441, 5, 46, 0, 0, 441, 442, 5, 46, 0, 0, + 442, 90, 1, 0, 0, 0, 443, 444, 5, 46, 0, 0, 444, 92, 1, 0, 0, 0, 445, 446, + 5, 64, 0, 0, 446, 94, 1, 0, 0, 0, 447, 448, 5, 35, 0, 0, 448, 96, 1, 0, + 0, 0, 449, 450, 5, 126, 0, 0, 450, 98, 1, 0, 0, 0, 451, 455, 3, 137, 67, + 0, 452, 454, 3, 135, 66, 0, 453, 452, 1, 0, 0, 0, 454, 457, 1, 0, 0, 0, + 455, 453, 1, 0, 0, 0, 455, 456, 1, 0, 0, 0, 456, 100, 1, 0, 0, 0, 457, + 455, 1, 0, 0, 0, 458, 460, 7, 5, 0, 0, 459, 458, 1, 0, 0, 0, 460, 461, + 1, 0, 0, 0, 461, 459, 1, 0, 0, 0, 461, 462, 1, 0, 0, 0, 462, 463, 1, 0, + 0, 0, 463, 464, 6, 49, 2, 0, 464, 102, 1, 0, 0, 0, 465, 466, 5, 91, 0, + 0, 466, 467, 1, 0, 0, 0, 467, 468, 6, 50, 3, 0, 468, 469, 6, 50, 4, 0, + 469, 104, 1, 0, 0, 0, 470, 471, 5, 92, 0, 0, 471, 472, 9, 0, 0, 0, 472, + 473, 1, 0, 0, 0, 473, 474, 6, 51, 3, 0, 474, 106, 1, 0, 0, 0, 475, 476, + 3, 129, 63, 0, 476, 477, 1, 0, 0, 0, 477, 478, 6, 52, 3, 0, 478, 108, 1, + 0, 0, 0, 479, 480, 3, 11, 4, 0, 480, 481, 1, 0, 0, 0, 481, 482, 6, 53, + 3, 0, 482, 110, 1, 0, 0, 0, 483, 484, 5, 93, 0, 0, 484, 485, 6, 54, 5, + 0, 485, 112, 1, 0, 0, 0, 486, 487, 5, 0, 0, 1, 487, 488, 1, 0, 0, 0, 488, + 489, 6, 55, 6, 0, 489, 114, 1, 0, 0, 0, 490, 491, 9, 0, 0, 0, 491, 116, + 1, 0, 0, 0, 492, 496, 8, 6, 0, 0, 493, 494, 5, 92, 0, 0, 494, 496, 9, 0, + 0, 0, 495, 492, 1, 0, 0, 0, 495, 493, 1, 0, 0, 0, 496, 497, 1, 0, 0, 0, + 497, 495, 1, 0, 0, 0, 497, 498, 1, 0, 0, 0, 498, 499, 1, 0, 0, 0, 499, + 500, 6, 57, 7, 0, 500, 118, 1, 0, 0, 0, 501, 502, 5, 93, 0, 0, 502, 503, + 1, 0, 0, 0, 503, 504, 6, 58, 6, 0, 504, 120, 1, 0, 0, 0, 505, 506, 5, 0, + 0, 1, 506, 507, 1, 0, 0, 0, 507, 508, 6, 59, 6, 0, 508, 122, 1, 0, 0, 0, + 509, 514, 5, 92, 0, 0, 510, 515, 7, 7, 0, 0, 511, 515, 3, 127, 62, 0, 512, + 515, 9, 0, 0, 0, 513, 515, 5, 0, 0, 1, 514, 510, 1, 0, 0, 0, 514, 511, + 1, 0, 0, 0, 514, 512, 1, 0, 0, 0, 514, 513, 1, 0, 0, 0, 515, 124, 1, 0, + 0, 0, 516, 517, 7, 8, 0, 0, 517, 126, 1, 0, 0, 0, 518, 529, 5, 117, 0, + 0, 519, 527, 3, 125, 61, 0, 520, 525, 3, 125, 61, 0, 521, 523, 3, 125, + 61, 0, 522, 524, 3, 125, 61, 0, 523, 522, 1, 0, 0, 0, 523, 524, 1, 0, 0, + 0, 524, 526, 1, 0, 0, 0, 525, 521, 1, 0, 0, 0, 525, 526, 1, 0, 0, 0, 526, + 528, 1, 0, 0, 0, 527, 520, 1, 0, 0, 0, 527, 528, 1, 0, 0, 0, 528, 530, + 1, 0, 0, 0, 529, 519, 1, 0, 0, 0, 529, 530, 1, 0, 0, 0, 530, 128, 1, 0, + 0, 0, 531, 536, 5, 34, 0, 0, 532, 535, 3, 123, 60, 0, 533, 535, 8, 9, 0, + 0, 534, 532, 1, 0, 0, 0, 534, 533, 1, 0, 0, 0, 535, 538, 1, 0, 0, 0, 536, + 537, 1, 0, 0, 0, 536, 534, 1, 0, 0, 0, 537, 539, 1, 0, 0, 0, 538, 536, + 1, 0, 0, 0, 539, 540, 5, 34, 0, 0, 540, 130, 1, 0, 0, 0, 541, 542, 5, 34, + 0, 0, 542, 543, 5, 34, 0, 0, 543, 544, 5, 34, 0, 0, 544, 549, 1, 0, 0, + 0, 545, 548, 3, 123, 60, 0, 546, 548, 9, 0, 0, 0, 547, 545, 1, 0, 0, 0, + 547, 546, 1, 0, 0, 0, 548, 551, 1, 0, 0, 0, 549, 550, 1, 0, 0, 0, 549, + 547, 1, 0, 0, 0, 550, 552, 1, 0, 0, 0, 551, 549, 1, 0, 0, 0, 552, 553, + 5, 34, 0, 0, 553, 554, 5, 34, 0, 0, 554, 555, 5, 34, 0, 0, 555, 132, 1, + 0, 0, 0, 556, 561, 5, 96, 0, 0, 557, 560, 3, 123, 60, 0, 558, 560, 8, 9, + 0, 0, 559, 557, 1, 0, 0, 0, 559, 558, 1, 0, 0, 0, 560, 563, 1, 0, 0, 0, + 561, 562, 1, 0, 0, 0, 561, 559, 1, 0, 0, 0, 562, 564, 1, 0, 0, 0, 563, + 561, 1, 0, 0, 0, 564, 565, 5, 96, 0, 0, 565, 134, 1, 0, 0, 0, 566, 569, + 3, 137, 67, 0, 567, 569, 7, 10, 0, 0, 568, 566, 1, 0, 0, 0, 568, 567, 1, + 0, 0, 0, 569, 136, 1, 0, 0, 0, 570, 571, 7, 11, 0, 0, 571, 138, 1, 0, 0, + 0, 37, 0, 1, 2, 146, 152, 162, 168, 178, 188, 191, 196, 198, 206, 208, + 228, 239, 245, 247, 263, 278, 295, 455, 461, 495, 497, 514, 523, 525, 527, + 529, 534, 536, 547, 549, 559, 561, 568, 8, 0, 3, 0, 1, 6, 0, 0, 2, 0, 7, + 74, 0, 5, 1, 0, 1, 54, 1, 4, 0, 0, 3, 0, 0, + } + deserializer := antlr.NewATNDeserializer(nil) + staticData.atn = deserializer.Deserialize(staticData.serializedATN) + atn := staticData.atn + staticData.decisionToDFA = make([]*antlr.DFA, len(atn.DecisionToState)) + decisionToDFA := staticData.decisionToDFA + for index, state := range atn.DecisionToState { + decisionToDFA[index] = antlr.NewDFA(state, index) + } +} + +// ANTLRv4LexerInit initializes any static state used to implement ANTLRv4Lexer. By default the +// static state used to implement the lexer is lazily initialized during the first call to +// NewANTLRv4Lexer(). You can call this function if you wish to initialize the static state ahead +// of time. +func ANTLRv4LexerInit() { + staticData := &ANTLRv4LexerLexerStaticData + staticData.once.Do(antlrv4lexerLexerInit) +} + +// NewANTLRv4Lexer produces a new lexer instance for the optional input antlr.CharStream. +func NewANTLRv4Lexer(input antlr.CharStream) *ANTLRv4Lexer { + ANTLRv4LexerInit() + l := new(ANTLRv4Lexer) + l.LexerAdaptor = *NewLexerAdaptor(input) + staticData := &ANTLRv4LexerLexerStaticData + l.Interpreter = antlr.NewLexerATNSimulator(l, staticData.atn, staticData.decisionToDFA, staticData.PredictionContextCache) + l.channelNames = staticData.ChannelNames + l.modeNames = staticData.ModeNames + l.RuleNames = staticData.RuleNames + l.LiteralNames = staticData.LiteralNames + l.SymbolicNames = staticData.SymbolicNames + l.GrammarFileName = "ANTLRv4Lexer.g4" + // TODO: l.EOF = antlr.TokenEOF + + return l +} + +// ANTLRv4Lexer tokens. +const ( + ANTLRv4LexerACTION = 1 + ANTLRv4LexerARG_ACTION = 2 + ANTLRv4LexerARG_OR_CHARSET = 3 + ANTLRv4LexerASSIGN = 4 + ANTLRv4LexerLEXER_CHAR_SET = 5 + ANTLRv4LexerRULE_REF = 6 + ANTLRv4LexerSEMPRED = 7 + ANTLRv4LexerSTRING_LITERAL = 8 + ANTLRv4LexerTOKEN_REF = 9 + ANTLRv4LexerUNICODE_ESC = 10 + ANTLRv4LexerUNICODE_EXTENDED_ESC = 11 + ANTLRv4LexerWS = 12 + ANTLRv4LexerALT = 13 + ANTLRv4LexerBLOCK = 14 + ANTLRv4LexerCLOSURE = 15 + ANTLRv4LexerELEMENT_OPTIONS = 16 + ANTLRv4LexerEPSILON = 17 + ANTLRv4LexerLEXER_ACTION_CALL = 18 + ANTLRv4LexerLEXER_ALT_ACTION = 19 + ANTLRv4LexerOPTIONAL = 20 + ANTLRv4LexerPOSITIVE_CLOSURE = 21 + ANTLRv4LexerRULE = 22 + ANTLRv4LexerRULEMODIFIERS = 23 + ANTLRv4LexerRULES = 24 + ANTLRv4LexerSET = 25 + ANTLRv4LexerWILDCARD = 26 + ANTLRv4LexerDOC_COMMENT = 27 + ANTLRv4LexerBLOCK_COMMENT = 28 + ANTLRv4LexerLINE_COMMENT = 29 + ANTLRv4LexerINT = 30 + ANTLRv4LexerUNTERMINATED_STRING_LITERAL = 31 + ANTLRv4LexerBEGIN_ARGUMENT = 32 + ANTLRv4LexerOPTIONS = 33 + ANTLRv4LexerTOKENS = 34 + ANTLRv4LexerCHANNELS = 35 + ANTLRv4LexerIMPORT = 36 + ANTLRv4LexerFRAGMENT = 37 + ANTLRv4LexerLEXER = 38 + ANTLRv4LexerPARSER = 39 + ANTLRv4LexerGRAMMAR = 40 + ANTLRv4LexerPROTECTED = 41 + ANTLRv4LexerPUBLIC = 42 + ANTLRv4LexerPRIVATE = 43 + ANTLRv4LexerRETURNS = 44 + ANTLRv4LexerLOCALS = 45 + ANTLRv4LexerTHROWS = 46 + ANTLRv4LexerCATCH = 47 + ANTLRv4LexerFINALLY = 48 + ANTLRv4LexerMODE = 49 + ANTLRv4LexerCOLON = 50 + ANTLRv4LexerCOLONCOLON = 51 + ANTLRv4LexerCOMMA = 52 + ANTLRv4LexerSEMI = 53 + ANTLRv4LexerLPAREN = 54 + ANTLRv4LexerRPAREN = 55 + ANTLRv4LexerRBRACE = 56 + ANTLRv4LexerRARROW = 57 + ANTLRv4LexerLT = 58 + ANTLRv4LexerGT = 59 + ANTLRv4LexerQUESTION = 60 + ANTLRv4LexerSTAR = 61 + ANTLRv4LexerPLUS_ASSIGN = 62 + ANTLRv4LexerPLUS = 63 + ANTLRv4LexerOR = 64 + ANTLRv4LexerDOLLAR = 65 + ANTLRv4LexerRANGE = 66 + ANTLRv4LexerDOT = 67 + ANTLRv4LexerAT = 68 + ANTLRv4LexerPOUND = 69 + ANTLRv4LexerNOT = 70 + ANTLRv4LexerID = 71 + ANTLRv4LexerEND_ARGUMENT = 72 + ANTLRv4LexerUNTERMINATED_ARGUMENT = 73 + ANTLRv4LexerARGUMENT_CONTENT = 74 + ANTLRv4LexerUNTERMINATED_CHAR_SET = 75 +) + +// ANTLRv4Lexer escapedChannels. +const ( + ANTLRv4LexerOFF_CHANNEL = 2 + ANTLRv4LexerCOMMENT = 3 +) + +// ANTLRv4Lexer modes. +const ( + ANTLRv4LexerArgument = iota + 1 + ANTLRv4LexerLexerCharSet +) + +func (l *ANTLRv4Lexer) Action(localctx antlr.RuleContext, ruleIndex, actionIndex int) { + switch ruleIndex { + case 6: + l.BEGIN_ARGUMENT_Action(localctx, actionIndex) + + case 54: + l.END_ARGUMENT_Action(localctx, actionIndex) + + default: + panic("No registered action for: " + fmt.Sprint(ruleIndex)) + } +} + +func (l *ANTLRv4Lexer) BEGIN_ARGUMENT_Action(localctx antlr.RuleContext, actionIndex int) { + switch actionIndex { + case 0: + l.HandleBeginArgument() + + default: + panic("No registered action for: " + fmt.Sprint(actionIndex)) + } +} +func (l *ANTLRv4Lexer) END_ARGUMENT_Action(localctx antlr.RuleContext, actionIndex int) { + switch actionIndex { + case 1: + l.HandleEndArgument() + + default: + panic("No registered action for: " + fmt.Sprint(actionIndex)) + } +} diff --git a/tools/grammar/antlrv4_parser.go b/tools/grammar/antlrv4_parser.go new file mode 100644 index 0000000..ca33564 --- /dev/null +++ b/tools/grammar/antlrv4_parser.go @@ -0,0 +1,12613 @@ +// Code generated from ANTLRv4Parser.g4 by ANTLR 4.13.2. DO NOT EDIT. + +package grammar // ANTLRv4Parser +import ( + "fmt" + "strconv" + "sync" + + "github.com/antlr4-go/antlr/v4" +) + +// Suppress unused import errors +var _ = fmt.Printf +var _ = strconv.Itoa +var _ = sync.Once{} + +type ANTLRv4Parser struct { + *antlr.BaseParser +} + +var ANTLRv4ParserParserStaticData struct { + once sync.Once + serializedATN []int32 + LiteralNames []string + SymbolicNames []string + RuleNames []string + PredictionContextCache *antlr.PredictionContextCache + atn *antlr.ATN + decisionToDFA []*antlr.DFA +} + +func antlrv4parserParserInit() { + staticData := &ANTLRv4ParserParserStaticData + staticData.LiteralNames = []string{ + "", "", "", "", "'='", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "'['", "", + "", "", "'import'", "'fragment'", "'lexer'", "'parser'", "'grammar'", + "'protected'", "'public'", "'private'", "'returns'", "'locals'", "'throws'", + "'catch'", "'finally'", "'mode'", "':'", "'::'", "','", "';'", "'('", + "')'", "'}'", "'->'", "'<'", "'>'", "'?'", "'*'", "'+='", "'+'", "'|'", + "'$'", "'..'", "'.'", "'@'", "'#'", "'~'", + } + staticData.SymbolicNames = []string{ + "", "ACTION", "ARG_ACTION", "ARG_OR_CHARSET", "ASSIGN", "LEXER_CHAR_SET", + "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", "UNTERMINATED_CHAR_SET", + } + staticData.RuleNames = []string{ + "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", + } + staticData.PredictionContextCache = antlr.NewPredictionContextCache() + staticData.serializedATN = []int32{ + 4, 1, 75, 649, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, + 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, + 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, + 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, + 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, + 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, + 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, + 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, + 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, + 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, + 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, + 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, + 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 1, 0, 1, 0, 5, 0, + 137, 8, 0, 10, 0, 12, 0, 140, 9, 0, 1, 0, 1, 0, 5, 0, 144, 8, 0, 10, 0, + 12, 0, 147, 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 3, 2, 160, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 167, 8, + 3, 1, 4, 1, 4, 1, 4, 1, 4, 5, 4, 173, 8, 4, 10, 4, 12, 4, 176, 9, 4, 1, + 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 5, 6, 187, 8, 6, 10, + 6, 12, 6, 190, 9, 6, 1, 6, 1, 6, 1, 6, 3, 6, 195, 8, 6, 1, 7, 1, 7, 1, + 7, 1, 7, 5, 7, 201, 8, 7, 10, 7, 12, 7, 204, 9, 7, 1, 7, 1, 7, 1, 8, 1, + 8, 1, 8, 1, 8, 1, 8, 3, 8, 213, 8, 8, 1, 9, 1, 9, 3, 9, 217, 8, 9, 1, 9, + 1, 9, 1, 10, 1, 10, 3, 10, 223, 8, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, + 5, 11, 230, 8, 11, 10, 11, 12, 11, 233, 9, 11, 1, 11, 3, 11, 236, 8, 11, + 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 242, 8, 12, 1, 12, 1, 12, 1, 12, 1, + 13, 1, 13, 1, 13, 3, 13, 250, 8, 13, 1, 14, 1, 14, 1, 15, 1, 15, 5, 15, + 256, 8, 15, 10, 15, 12, 15, 259, 9, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, + 16, 1, 16, 5, 16, 267, 8, 16, 10, 16, 12, 16, 270, 9, 16, 1, 17, 5, 17, + 273, 8, 17, 10, 17, 12, 17, 276, 9, 17, 1, 18, 1, 18, 3, 18, 280, 8, 18, + 1, 19, 3, 19, 283, 8, 19, 1, 19, 1, 19, 3, 19, 287, 8, 19, 1, 19, 3, 19, + 290, 8, 19, 1, 19, 3, 19, 293, 8, 19, 1, 19, 3, 19, 296, 8, 19, 1, 19, + 5, 19, 299, 8, 19, 10, 19, 12, 19, 302, 9, 19, 1, 19, 1, 19, 1, 19, 1, + 19, 1, 19, 1, 20, 5, 20, 310, 8, 20, 10, 20, 12, 20, 313, 9, 20, 1, 20, + 3, 20, 316, 8, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, + 23, 1, 23, 3, 23, 327, 8, 23, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, + 1, 25, 5, 25, 336, 8, 25, 10, 25, 12, 25, 339, 9, 25, 1, 26, 1, 26, 1, + 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 4, 28, 349, 8, 28, 11, 28, 12, 28, + 350, 1, 29, 1, 29, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 5, 31, 360, 8, 31, + 10, 31, 12, 31, 363, 9, 31, 1, 32, 1, 32, 1, 32, 3, 32, 368, 8, 32, 1, + 33, 3, 33, 371, 8, 33, 1, 33, 1, 33, 3, 33, 375, 8, 33, 1, 33, 1, 33, 1, + 33, 1, 33, 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 5, 35, 386, 8, 35, 10, 35, + 12, 35, 389, 9, 35, 1, 36, 1, 36, 3, 36, 393, 8, 36, 1, 36, 3, 36, 396, + 8, 36, 1, 37, 4, 37, 399, 8, 37, 11, 37, 12, 37, 400, 1, 37, 3, 37, 404, + 8, 37, 1, 38, 1, 38, 3, 38, 408, 8, 38, 1, 38, 1, 38, 3, 38, 412, 8, 38, + 1, 38, 1, 38, 3, 38, 416, 8, 38, 3, 38, 418, 8, 38, 1, 39, 1, 39, 1, 39, + 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 5, 40, 428, 8, 40, 10, 40, 12, 40, 431, + 9, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 3, 41, 439, 8, 41, 1, + 42, 1, 42, 3, 42, 443, 8, 42, 1, 43, 1, 43, 3, 43, 447, 8, 43, 1, 44, 1, + 44, 1, 44, 5, 44, 452, 8, 44, 10, 44, 12, 44, 455, 9, 44, 1, 45, 3, 45, + 458, 8, 45, 1, 45, 4, 45, 461, 8, 45, 11, 45, 12, 45, 462, 1, 45, 3, 45, + 466, 8, 45, 1, 46, 1, 46, 1, 46, 3, 46, 471, 8, 46, 1, 46, 1, 46, 1, 46, + 3, 46, 476, 8, 46, 1, 46, 1, 46, 1, 46, 3, 46, 481, 8, 46, 1, 46, 3, 46, + 484, 8, 46, 3, 46, 486, 8, 46, 1, 47, 1, 47, 1, 47, 1, 47, 5, 47, 492, + 8, 47, 10, 47, 12, 47, 495, 9, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 1, + 48, 1, 48, 1, 48, 3, 48, 505, 8, 48, 3, 48, 507, 8, 48, 1, 49, 1, 49, 1, + 49, 1, 49, 3, 49, 513, 8, 49, 1, 50, 1, 50, 3, 50, 517, 8, 50, 1, 51, 1, + 51, 1, 52, 1, 52, 3, 52, 523, 8, 52, 1, 52, 1, 52, 3, 52, 527, 8, 52, 1, + 52, 1, 52, 3, 52, 531, 8, 52, 3, 52, 533, 8, 52, 1, 53, 1, 53, 1, 53, 1, + 53, 1, 53, 3, 53, 540, 8, 53, 1, 54, 1, 54, 1, 54, 1, 54, 3, 54, 546, 8, + 54, 1, 55, 1, 55, 3, 55, 550, 8, 55, 1, 56, 1, 56, 1, 56, 1, 56, 3, 56, + 556, 8, 56, 1, 57, 1, 57, 1, 57, 1, 57, 5, 57, 562, 8, 57, 10, 57, 12, + 57, 565, 9, 57, 1, 57, 1, 57, 1, 58, 1, 58, 3, 58, 571, 8, 58, 1, 58, 1, + 58, 3, 58, 575, 8, 58, 1, 58, 1, 58, 3, 58, 579, 8, 58, 1, 59, 1, 59, 3, + 59, 583, 8, 59, 1, 59, 5, 59, 586, 8, 59, 10, 59, 12, 59, 589, 9, 59, 1, + 59, 3, 59, 592, 8, 59, 1, 59, 1, 59, 1, 59, 1, 60, 1, 60, 3, 60, 599, 8, + 60, 1, 60, 3, 60, 602, 8, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 62, 1, 62, + 3, 62, 610, 8, 62, 1, 62, 1, 62, 3, 62, 614, 8, 62, 3, 62, 616, 8, 62, + 1, 63, 1, 63, 1, 63, 1, 63, 5, 63, 622, 8, 63, 10, 63, 12, 63, 625, 9, + 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 3, 64, 635, + 8, 64, 3, 64, 637, 8, 64, 1, 65, 1, 65, 1, 66, 1, 66, 1, 66, 5, 66, 644, + 8, 66, 10, 66, 12, 66, 647, 9, 66, 1, 66, 1, 257, 0, 67, 0, 2, 4, 6, 8, + 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, + 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, + 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, + 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 0, 3, 2, 0, 37, 37, 41, + 43, 2, 0, 4, 4, 62, 62, 2, 0, 6, 6, 9, 9, 686, 0, 134, 1, 0, 0, 0, 2, 150, + 1, 0, 0, 0, 4, 159, 1, 0, 0, 0, 6, 166, 1, 0, 0, 0, 8, 168, 1, 0, 0, 0, + 10, 179, 1, 0, 0, 0, 12, 194, 1, 0, 0, 0, 14, 196, 1, 0, 0, 0, 16, 212, + 1, 0, 0, 0, 18, 214, 1, 0, 0, 0, 20, 220, 1, 0, 0, 0, 22, 226, 1, 0, 0, + 0, 24, 237, 1, 0, 0, 0, 26, 249, 1, 0, 0, 0, 28, 251, 1, 0, 0, 0, 30, 253, + 1, 0, 0, 0, 32, 262, 1, 0, 0, 0, 34, 274, 1, 0, 0, 0, 36, 279, 1, 0, 0, + 0, 38, 282, 1, 0, 0, 0, 40, 311, 1, 0, 0, 0, 42, 317, 1, 0, 0, 0, 44, 321, + 1, 0, 0, 0, 46, 326, 1, 0, 0, 0, 48, 328, 1, 0, 0, 0, 50, 331, 1, 0, 0, + 0, 52, 340, 1, 0, 0, 0, 54, 343, 1, 0, 0, 0, 56, 348, 1, 0, 0, 0, 58, 352, + 1, 0, 0, 0, 60, 354, 1, 0, 0, 0, 62, 356, 1, 0, 0, 0, 64, 364, 1, 0, 0, + 0, 66, 370, 1, 0, 0, 0, 68, 380, 1, 0, 0, 0, 70, 382, 1, 0, 0, 0, 72, 395, + 1, 0, 0, 0, 74, 403, 1, 0, 0, 0, 76, 417, 1, 0, 0, 0, 78, 419, 1, 0, 0, + 0, 80, 423, 1, 0, 0, 0, 82, 438, 1, 0, 0, 0, 84, 442, 1, 0, 0, 0, 86, 446, + 1, 0, 0, 0, 88, 448, 1, 0, 0, 0, 90, 465, 1, 0, 0, 0, 92, 485, 1, 0, 0, + 0, 94, 487, 1, 0, 0, 0, 96, 506, 1, 0, 0, 0, 98, 508, 1, 0, 0, 0, 100, + 514, 1, 0, 0, 0, 102, 518, 1, 0, 0, 0, 104, 532, 1, 0, 0, 0, 106, 539, + 1, 0, 0, 0, 108, 545, 1, 0, 0, 0, 110, 547, 1, 0, 0, 0, 112, 555, 1, 0, + 0, 0, 114, 557, 1, 0, 0, 0, 116, 578, 1, 0, 0, 0, 118, 580, 1, 0, 0, 0, + 120, 596, 1, 0, 0, 0, 122, 603, 1, 0, 0, 0, 124, 615, 1, 0, 0, 0, 126, + 617, 1, 0, 0, 0, 128, 636, 1, 0, 0, 0, 130, 638, 1, 0, 0, 0, 132, 640, + 1, 0, 0, 0, 134, 138, 3, 2, 1, 0, 135, 137, 3, 6, 3, 0, 136, 135, 1, 0, + 0, 0, 137, 140, 1, 0, 0, 0, 138, 136, 1, 0, 0, 0, 138, 139, 1, 0, 0, 0, + 139, 141, 1, 0, 0, 0, 140, 138, 1, 0, 0, 0, 141, 145, 3, 34, 17, 0, 142, + 144, 3, 32, 16, 0, 143, 142, 1, 0, 0, 0, 144, 147, 1, 0, 0, 0, 145, 143, + 1, 0, 0, 0, 145, 146, 1, 0, 0, 0, 146, 148, 1, 0, 0, 0, 147, 145, 1, 0, + 0, 0, 148, 149, 5, 0, 0, 1, 149, 1, 1, 0, 0, 0, 150, 151, 3, 4, 2, 0, 151, + 152, 3, 130, 65, 0, 152, 153, 5, 53, 0, 0, 153, 3, 1, 0, 0, 0, 154, 155, + 5, 38, 0, 0, 155, 160, 5, 40, 0, 0, 156, 157, 5, 39, 0, 0, 157, 160, 5, + 40, 0, 0, 158, 160, 5, 40, 0, 0, 159, 154, 1, 0, 0, 0, 159, 156, 1, 0, + 0, 0, 159, 158, 1, 0, 0, 0, 160, 5, 1, 0, 0, 0, 161, 167, 3, 8, 4, 0, 162, + 167, 3, 14, 7, 0, 163, 167, 3, 18, 9, 0, 164, 167, 3, 20, 10, 0, 165, 167, + 3, 24, 12, 0, 166, 161, 1, 0, 0, 0, 166, 162, 1, 0, 0, 0, 166, 163, 1, + 0, 0, 0, 166, 164, 1, 0, 0, 0, 166, 165, 1, 0, 0, 0, 167, 7, 1, 0, 0, 0, + 168, 174, 5, 33, 0, 0, 169, 170, 3, 10, 5, 0, 170, 171, 5, 53, 0, 0, 171, + 173, 1, 0, 0, 0, 172, 169, 1, 0, 0, 0, 173, 176, 1, 0, 0, 0, 174, 172, + 1, 0, 0, 0, 174, 175, 1, 0, 0, 0, 175, 177, 1, 0, 0, 0, 176, 174, 1, 0, + 0, 0, 177, 178, 5, 56, 0, 0, 178, 9, 1, 0, 0, 0, 179, 180, 3, 130, 65, + 0, 180, 181, 5, 4, 0, 0, 181, 182, 3, 12, 6, 0, 182, 11, 1, 0, 0, 0, 183, + 188, 3, 130, 65, 0, 184, 185, 5, 67, 0, 0, 185, 187, 3, 130, 65, 0, 186, + 184, 1, 0, 0, 0, 187, 190, 1, 0, 0, 0, 188, 186, 1, 0, 0, 0, 188, 189, + 1, 0, 0, 0, 189, 195, 1, 0, 0, 0, 190, 188, 1, 0, 0, 0, 191, 195, 5, 8, + 0, 0, 192, 195, 3, 28, 14, 0, 193, 195, 5, 30, 0, 0, 194, 183, 1, 0, 0, + 0, 194, 191, 1, 0, 0, 0, 194, 192, 1, 0, 0, 0, 194, 193, 1, 0, 0, 0, 195, + 13, 1, 0, 0, 0, 196, 197, 5, 36, 0, 0, 197, 202, 3, 16, 8, 0, 198, 199, + 5, 52, 0, 0, 199, 201, 3, 16, 8, 0, 200, 198, 1, 0, 0, 0, 201, 204, 1, + 0, 0, 0, 202, 200, 1, 0, 0, 0, 202, 203, 1, 0, 0, 0, 203, 205, 1, 0, 0, + 0, 204, 202, 1, 0, 0, 0, 205, 206, 5, 53, 0, 0, 206, 15, 1, 0, 0, 0, 207, + 208, 3, 130, 65, 0, 208, 209, 5, 4, 0, 0, 209, 210, 3, 130, 65, 0, 210, + 213, 1, 0, 0, 0, 211, 213, 3, 130, 65, 0, 212, 207, 1, 0, 0, 0, 212, 211, + 1, 0, 0, 0, 213, 17, 1, 0, 0, 0, 214, 216, 5, 34, 0, 0, 215, 217, 3, 22, + 11, 0, 216, 215, 1, 0, 0, 0, 216, 217, 1, 0, 0, 0, 217, 218, 1, 0, 0, 0, + 218, 219, 5, 56, 0, 0, 219, 19, 1, 0, 0, 0, 220, 222, 5, 35, 0, 0, 221, + 223, 3, 22, 11, 0, 222, 221, 1, 0, 0, 0, 222, 223, 1, 0, 0, 0, 223, 224, + 1, 0, 0, 0, 224, 225, 5, 56, 0, 0, 225, 21, 1, 0, 0, 0, 226, 231, 3, 130, + 65, 0, 227, 228, 5, 52, 0, 0, 228, 230, 3, 130, 65, 0, 229, 227, 1, 0, + 0, 0, 230, 233, 1, 0, 0, 0, 231, 229, 1, 0, 0, 0, 231, 232, 1, 0, 0, 0, + 232, 235, 1, 0, 0, 0, 233, 231, 1, 0, 0, 0, 234, 236, 5, 52, 0, 0, 235, + 234, 1, 0, 0, 0, 235, 236, 1, 0, 0, 0, 236, 23, 1, 0, 0, 0, 237, 241, 5, + 68, 0, 0, 238, 239, 3, 26, 13, 0, 239, 240, 5, 51, 0, 0, 240, 242, 1, 0, + 0, 0, 241, 238, 1, 0, 0, 0, 241, 242, 1, 0, 0, 0, 242, 243, 1, 0, 0, 0, + 243, 244, 3, 130, 65, 0, 244, 245, 3, 28, 14, 0, 245, 25, 1, 0, 0, 0, 246, + 250, 3, 130, 65, 0, 247, 250, 5, 38, 0, 0, 248, 250, 5, 39, 0, 0, 249, + 246, 1, 0, 0, 0, 249, 247, 1, 0, 0, 0, 249, 248, 1, 0, 0, 0, 250, 27, 1, + 0, 0, 0, 251, 252, 5, 1, 0, 0, 252, 29, 1, 0, 0, 0, 253, 257, 5, 32, 0, + 0, 254, 256, 5, 74, 0, 0, 255, 254, 1, 0, 0, 0, 256, 259, 1, 0, 0, 0, 257, + 258, 1, 0, 0, 0, 257, 255, 1, 0, 0, 0, 258, 260, 1, 0, 0, 0, 259, 257, + 1, 0, 0, 0, 260, 261, 5, 72, 0, 0, 261, 31, 1, 0, 0, 0, 262, 263, 5, 49, + 0, 0, 263, 264, 3, 130, 65, 0, 264, 268, 5, 53, 0, 0, 265, 267, 3, 66, + 33, 0, 266, 265, 1, 0, 0, 0, 267, 270, 1, 0, 0, 0, 268, 266, 1, 0, 0, 0, + 268, 269, 1, 0, 0, 0, 269, 33, 1, 0, 0, 0, 270, 268, 1, 0, 0, 0, 271, 273, + 3, 36, 18, 0, 272, 271, 1, 0, 0, 0, 273, 276, 1, 0, 0, 0, 274, 272, 1, + 0, 0, 0, 274, 275, 1, 0, 0, 0, 275, 35, 1, 0, 0, 0, 276, 274, 1, 0, 0, + 0, 277, 280, 3, 38, 19, 0, 278, 280, 3, 66, 33, 0, 279, 277, 1, 0, 0, 0, + 279, 278, 1, 0, 0, 0, 280, 37, 1, 0, 0, 0, 281, 283, 3, 56, 28, 0, 282, + 281, 1, 0, 0, 0, 282, 283, 1, 0, 0, 0, 283, 284, 1, 0, 0, 0, 284, 286, + 5, 6, 0, 0, 285, 287, 3, 30, 15, 0, 286, 285, 1, 0, 0, 0, 286, 287, 1, + 0, 0, 0, 287, 289, 1, 0, 0, 0, 288, 290, 3, 48, 24, 0, 289, 288, 1, 0, + 0, 0, 289, 290, 1, 0, 0, 0, 290, 292, 1, 0, 0, 0, 291, 293, 3, 50, 25, + 0, 292, 291, 1, 0, 0, 0, 292, 293, 1, 0, 0, 0, 293, 295, 1, 0, 0, 0, 294, + 296, 3, 52, 26, 0, 295, 294, 1, 0, 0, 0, 295, 296, 1, 0, 0, 0, 296, 300, + 1, 0, 0, 0, 297, 299, 3, 46, 23, 0, 298, 297, 1, 0, 0, 0, 299, 302, 1, + 0, 0, 0, 300, 298, 1, 0, 0, 0, 300, 301, 1, 0, 0, 0, 301, 303, 1, 0, 0, + 0, 302, 300, 1, 0, 0, 0, 303, 304, 5, 50, 0, 0, 304, 305, 3, 60, 30, 0, + 305, 306, 5, 53, 0, 0, 306, 307, 3, 40, 20, 0, 307, 39, 1, 0, 0, 0, 308, + 310, 3, 42, 21, 0, 309, 308, 1, 0, 0, 0, 310, 313, 1, 0, 0, 0, 311, 309, + 1, 0, 0, 0, 311, 312, 1, 0, 0, 0, 312, 315, 1, 0, 0, 0, 313, 311, 1, 0, + 0, 0, 314, 316, 3, 44, 22, 0, 315, 314, 1, 0, 0, 0, 315, 316, 1, 0, 0, + 0, 316, 41, 1, 0, 0, 0, 317, 318, 5, 47, 0, 0, 318, 319, 3, 30, 15, 0, + 319, 320, 3, 28, 14, 0, 320, 43, 1, 0, 0, 0, 321, 322, 5, 48, 0, 0, 322, + 323, 3, 28, 14, 0, 323, 45, 1, 0, 0, 0, 324, 327, 3, 8, 4, 0, 325, 327, + 3, 54, 27, 0, 326, 324, 1, 0, 0, 0, 326, 325, 1, 0, 0, 0, 327, 47, 1, 0, + 0, 0, 328, 329, 5, 44, 0, 0, 329, 330, 3, 30, 15, 0, 330, 49, 1, 0, 0, + 0, 331, 332, 5, 46, 0, 0, 332, 337, 3, 132, 66, 0, 333, 334, 5, 52, 0, + 0, 334, 336, 3, 132, 66, 0, 335, 333, 1, 0, 0, 0, 336, 339, 1, 0, 0, 0, + 337, 335, 1, 0, 0, 0, 337, 338, 1, 0, 0, 0, 338, 51, 1, 0, 0, 0, 339, 337, + 1, 0, 0, 0, 340, 341, 5, 45, 0, 0, 341, 342, 3, 30, 15, 0, 342, 53, 1, + 0, 0, 0, 343, 344, 5, 68, 0, 0, 344, 345, 3, 130, 65, 0, 345, 346, 3, 28, + 14, 0, 346, 55, 1, 0, 0, 0, 347, 349, 3, 58, 29, 0, 348, 347, 1, 0, 0, + 0, 349, 350, 1, 0, 0, 0, 350, 348, 1, 0, 0, 0, 350, 351, 1, 0, 0, 0, 351, + 57, 1, 0, 0, 0, 352, 353, 7, 0, 0, 0, 353, 59, 1, 0, 0, 0, 354, 355, 3, + 62, 31, 0, 355, 61, 1, 0, 0, 0, 356, 361, 3, 64, 32, 0, 357, 358, 5, 64, + 0, 0, 358, 360, 3, 64, 32, 0, 359, 357, 1, 0, 0, 0, 360, 363, 1, 0, 0, + 0, 361, 359, 1, 0, 0, 0, 361, 362, 1, 0, 0, 0, 362, 63, 1, 0, 0, 0, 363, + 361, 1, 0, 0, 0, 364, 367, 3, 90, 45, 0, 365, 366, 5, 69, 0, 0, 366, 368, + 3, 130, 65, 0, 367, 365, 1, 0, 0, 0, 367, 368, 1, 0, 0, 0, 368, 65, 1, + 0, 0, 0, 369, 371, 5, 37, 0, 0, 370, 369, 1, 0, 0, 0, 370, 371, 1, 0, 0, + 0, 371, 372, 1, 0, 0, 0, 372, 374, 5, 9, 0, 0, 373, 375, 3, 8, 4, 0, 374, + 373, 1, 0, 0, 0, 374, 375, 1, 0, 0, 0, 375, 376, 1, 0, 0, 0, 376, 377, + 5, 50, 0, 0, 377, 378, 3, 68, 34, 0, 378, 379, 5, 53, 0, 0, 379, 67, 1, + 0, 0, 0, 380, 381, 3, 70, 35, 0, 381, 69, 1, 0, 0, 0, 382, 387, 3, 72, + 36, 0, 383, 384, 5, 64, 0, 0, 384, 386, 3, 72, 36, 0, 385, 383, 1, 0, 0, + 0, 386, 389, 1, 0, 0, 0, 387, 385, 1, 0, 0, 0, 387, 388, 1, 0, 0, 0, 388, + 71, 1, 0, 0, 0, 389, 387, 1, 0, 0, 0, 390, 392, 3, 74, 37, 0, 391, 393, + 3, 80, 40, 0, 392, 391, 1, 0, 0, 0, 392, 393, 1, 0, 0, 0, 393, 396, 1, + 0, 0, 0, 394, 396, 1, 0, 0, 0, 395, 390, 1, 0, 0, 0, 395, 394, 1, 0, 0, + 0, 396, 73, 1, 0, 0, 0, 397, 399, 3, 76, 38, 0, 398, 397, 1, 0, 0, 0, 399, + 400, 1, 0, 0, 0, 400, 398, 1, 0, 0, 0, 400, 401, 1, 0, 0, 0, 401, 404, + 1, 0, 0, 0, 402, 404, 1, 0, 0, 0, 403, 398, 1, 0, 0, 0, 403, 402, 1, 0, + 0, 0, 404, 75, 1, 0, 0, 0, 405, 407, 3, 106, 53, 0, 406, 408, 3, 104, 52, + 0, 407, 406, 1, 0, 0, 0, 407, 408, 1, 0, 0, 0, 408, 418, 1, 0, 0, 0, 409, + 411, 3, 78, 39, 0, 410, 412, 3, 104, 52, 0, 411, 410, 1, 0, 0, 0, 411, + 412, 1, 0, 0, 0, 412, 418, 1, 0, 0, 0, 413, 415, 3, 28, 14, 0, 414, 416, + 5, 60, 0, 0, 415, 414, 1, 0, 0, 0, 415, 416, 1, 0, 0, 0, 416, 418, 1, 0, + 0, 0, 417, 405, 1, 0, 0, 0, 417, 409, 1, 0, 0, 0, 417, 413, 1, 0, 0, 0, + 418, 77, 1, 0, 0, 0, 419, 420, 5, 54, 0, 0, 420, 421, 3, 70, 35, 0, 421, + 422, 5, 55, 0, 0, 422, 79, 1, 0, 0, 0, 423, 424, 5, 57, 0, 0, 424, 429, + 3, 82, 41, 0, 425, 426, 5, 52, 0, 0, 426, 428, 3, 82, 41, 0, 427, 425, + 1, 0, 0, 0, 428, 431, 1, 0, 0, 0, 429, 427, 1, 0, 0, 0, 429, 430, 1, 0, + 0, 0, 430, 81, 1, 0, 0, 0, 431, 429, 1, 0, 0, 0, 432, 433, 3, 84, 42, 0, + 433, 434, 5, 54, 0, 0, 434, 435, 3, 86, 43, 0, 435, 436, 5, 55, 0, 0, 436, + 439, 1, 0, 0, 0, 437, 439, 3, 84, 42, 0, 438, 432, 1, 0, 0, 0, 438, 437, + 1, 0, 0, 0, 439, 83, 1, 0, 0, 0, 440, 443, 3, 130, 65, 0, 441, 443, 5, + 49, 0, 0, 442, 440, 1, 0, 0, 0, 442, 441, 1, 0, 0, 0, 443, 85, 1, 0, 0, + 0, 444, 447, 3, 130, 65, 0, 445, 447, 5, 30, 0, 0, 446, 444, 1, 0, 0, 0, + 446, 445, 1, 0, 0, 0, 447, 87, 1, 0, 0, 0, 448, 453, 3, 90, 45, 0, 449, + 450, 5, 64, 0, 0, 450, 452, 3, 90, 45, 0, 451, 449, 1, 0, 0, 0, 452, 455, + 1, 0, 0, 0, 453, 451, 1, 0, 0, 0, 453, 454, 1, 0, 0, 0, 454, 89, 1, 0, + 0, 0, 455, 453, 1, 0, 0, 0, 456, 458, 3, 126, 63, 0, 457, 456, 1, 0, 0, + 0, 457, 458, 1, 0, 0, 0, 458, 460, 1, 0, 0, 0, 459, 461, 3, 92, 46, 0, + 460, 459, 1, 0, 0, 0, 461, 462, 1, 0, 0, 0, 462, 460, 1, 0, 0, 0, 462, + 463, 1, 0, 0, 0, 463, 466, 1, 0, 0, 0, 464, 466, 1, 0, 0, 0, 465, 457, + 1, 0, 0, 0, 465, 464, 1, 0, 0, 0, 466, 91, 1, 0, 0, 0, 467, 470, 3, 98, + 49, 0, 468, 471, 3, 104, 52, 0, 469, 471, 1, 0, 0, 0, 470, 468, 1, 0, 0, + 0, 470, 469, 1, 0, 0, 0, 471, 486, 1, 0, 0, 0, 472, 475, 3, 108, 54, 0, + 473, 476, 3, 104, 52, 0, 474, 476, 1, 0, 0, 0, 475, 473, 1, 0, 0, 0, 475, + 474, 1, 0, 0, 0, 476, 486, 1, 0, 0, 0, 477, 486, 3, 100, 50, 0, 478, 480, + 3, 28, 14, 0, 479, 481, 5, 60, 0, 0, 480, 479, 1, 0, 0, 0, 480, 481, 1, + 0, 0, 0, 481, 483, 1, 0, 0, 0, 482, 484, 3, 94, 47, 0, 483, 482, 1, 0, + 0, 0, 483, 484, 1, 0, 0, 0, 484, 486, 1, 0, 0, 0, 485, 467, 1, 0, 0, 0, + 485, 472, 1, 0, 0, 0, 485, 477, 1, 0, 0, 0, 485, 478, 1, 0, 0, 0, 486, + 93, 1, 0, 0, 0, 487, 488, 5, 58, 0, 0, 488, 493, 3, 96, 48, 0, 489, 490, + 5, 52, 0, 0, 490, 492, 3, 96, 48, 0, 491, 489, 1, 0, 0, 0, 492, 495, 1, + 0, 0, 0, 493, 491, 1, 0, 0, 0, 493, 494, 1, 0, 0, 0, 494, 496, 1, 0, 0, + 0, 495, 493, 1, 0, 0, 0, 496, 497, 5, 59, 0, 0, 497, 95, 1, 0, 0, 0, 498, + 507, 3, 128, 64, 0, 499, 500, 3, 130, 65, 0, 500, 504, 5, 4, 0, 0, 501, + 505, 3, 28, 14, 0, 502, 505, 5, 30, 0, 0, 503, 505, 5, 8, 0, 0, 504, 501, + 1, 0, 0, 0, 504, 502, 1, 0, 0, 0, 504, 503, 1, 0, 0, 0, 505, 507, 1, 0, + 0, 0, 506, 498, 1, 0, 0, 0, 506, 499, 1, 0, 0, 0, 507, 97, 1, 0, 0, 0, + 508, 509, 3, 130, 65, 0, 509, 512, 7, 1, 0, 0, 510, 513, 3, 108, 54, 0, + 511, 513, 3, 118, 59, 0, 512, 510, 1, 0, 0, 0, 512, 511, 1, 0, 0, 0, 513, + 99, 1, 0, 0, 0, 514, 516, 3, 118, 59, 0, 515, 517, 3, 102, 51, 0, 516, + 515, 1, 0, 0, 0, 516, 517, 1, 0, 0, 0, 517, 101, 1, 0, 0, 0, 518, 519, + 3, 104, 52, 0, 519, 103, 1, 0, 0, 0, 520, 522, 5, 60, 0, 0, 521, 523, 5, + 60, 0, 0, 522, 521, 1, 0, 0, 0, 522, 523, 1, 0, 0, 0, 523, 533, 1, 0, 0, + 0, 524, 526, 5, 61, 0, 0, 525, 527, 5, 60, 0, 0, 526, 525, 1, 0, 0, 0, + 526, 527, 1, 0, 0, 0, 527, 533, 1, 0, 0, 0, 528, 530, 5, 63, 0, 0, 529, + 531, 5, 60, 0, 0, 530, 529, 1, 0, 0, 0, 530, 531, 1, 0, 0, 0, 531, 533, + 1, 0, 0, 0, 532, 520, 1, 0, 0, 0, 532, 524, 1, 0, 0, 0, 532, 528, 1, 0, + 0, 0, 533, 105, 1, 0, 0, 0, 534, 540, 3, 122, 61, 0, 535, 540, 3, 124, + 62, 0, 536, 540, 3, 112, 56, 0, 537, 540, 5, 5, 0, 0, 538, 540, 3, 110, + 55, 0, 539, 534, 1, 0, 0, 0, 539, 535, 1, 0, 0, 0, 539, 536, 1, 0, 0, 0, + 539, 537, 1, 0, 0, 0, 539, 538, 1, 0, 0, 0, 540, 107, 1, 0, 0, 0, 541, + 546, 3, 124, 62, 0, 542, 546, 3, 120, 60, 0, 543, 546, 3, 112, 56, 0, 544, + 546, 3, 110, 55, 0, 545, 541, 1, 0, 0, 0, 545, 542, 1, 0, 0, 0, 545, 543, + 1, 0, 0, 0, 545, 544, 1, 0, 0, 0, 546, 109, 1, 0, 0, 0, 547, 549, 5, 67, + 0, 0, 548, 550, 3, 126, 63, 0, 549, 548, 1, 0, 0, 0, 549, 550, 1, 0, 0, + 0, 550, 111, 1, 0, 0, 0, 551, 552, 5, 70, 0, 0, 552, 556, 3, 116, 58, 0, + 553, 554, 5, 70, 0, 0, 554, 556, 3, 114, 57, 0, 555, 551, 1, 0, 0, 0, 555, + 553, 1, 0, 0, 0, 556, 113, 1, 0, 0, 0, 557, 558, 5, 54, 0, 0, 558, 563, + 3, 116, 58, 0, 559, 560, 5, 64, 0, 0, 560, 562, 3, 116, 58, 0, 561, 559, + 1, 0, 0, 0, 562, 565, 1, 0, 0, 0, 563, 561, 1, 0, 0, 0, 563, 564, 1, 0, + 0, 0, 564, 566, 1, 0, 0, 0, 565, 563, 1, 0, 0, 0, 566, 567, 5, 55, 0, 0, + 567, 115, 1, 0, 0, 0, 568, 570, 5, 9, 0, 0, 569, 571, 3, 126, 63, 0, 570, + 569, 1, 0, 0, 0, 570, 571, 1, 0, 0, 0, 571, 579, 1, 0, 0, 0, 572, 574, + 5, 8, 0, 0, 573, 575, 3, 126, 63, 0, 574, 573, 1, 0, 0, 0, 574, 575, 1, + 0, 0, 0, 575, 579, 1, 0, 0, 0, 576, 579, 3, 122, 61, 0, 577, 579, 5, 5, + 0, 0, 578, 568, 1, 0, 0, 0, 578, 572, 1, 0, 0, 0, 578, 576, 1, 0, 0, 0, + 578, 577, 1, 0, 0, 0, 579, 117, 1, 0, 0, 0, 580, 591, 5, 54, 0, 0, 581, + 583, 3, 8, 4, 0, 582, 581, 1, 0, 0, 0, 582, 583, 1, 0, 0, 0, 583, 587, + 1, 0, 0, 0, 584, 586, 3, 54, 27, 0, 585, 584, 1, 0, 0, 0, 586, 589, 1, + 0, 0, 0, 587, 585, 1, 0, 0, 0, 587, 588, 1, 0, 0, 0, 588, 590, 1, 0, 0, + 0, 589, 587, 1, 0, 0, 0, 590, 592, 5, 50, 0, 0, 591, 582, 1, 0, 0, 0, 591, + 592, 1, 0, 0, 0, 592, 593, 1, 0, 0, 0, 593, 594, 3, 88, 44, 0, 594, 595, + 5, 55, 0, 0, 595, 119, 1, 0, 0, 0, 596, 598, 5, 6, 0, 0, 597, 599, 3, 30, + 15, 0, 598, 597, 1, 0, 0, 0, 598, 599, 1, 0, 0, 0, 599, 601, 1, 0, 0, 0, + 600, 602, 3, 126, 63, 0, 601, 600, 1, 0, 0, 0, 601, 602, 1, 0, 0, 0, 602, + 121, 1, 0, 0, 0, 603, 604, 5, 8, 0, 0, 604, 605, 5, 66, 0, 0, 605, 606, + 5, 8, 0, 0, 606, 123, 1, 0, 0, 0, 607, 609, 5, 9, 0, 0, 608, 610, 3, 126, + 63, 0, 609, 608, 1, 0, 0, 0, 609, 610, 1, 0, 0, 0, 610, 616, 1, 0, 0, 0, + 611, 613, 5, 8, 0, 0, 612, 614, 3, 126, 63, 0, 613, 612, 1, 0, 0, 0, 613, + 614, 1, 0, 0, 0, 614, 616, 1, 0, 0, 0, 615, 607, 1, 0, 0, 0, 615, 611, + 1, 0, 0, 0, 616, 125, 1, 0, 0, 0, 617, 618, 5, 58, 0, 0, 618, 623, 3, 128, + 64, 0, 619, 620, 5, 52, 0, 0, 620, 622, 3, 128, 64, 0, 621, 619, 1, 0, + 0, 0, 622, 625, 1, 0, 0, 0, 623, 621, 1, 0, 0, 0, 623, 624, 1, 0, 0, 0, + 624, 626, 1, 0, 0, 0, 625, 623, 1, 0, 0, 0, 626, 627, 5, 59, 0, 0, 627, + 127, 1, 0, 0, 0, 628, 637, 3, 132, 66, 0, 629, 630, 3, 130, 65, 0, 630, + 634, 5, 4, 0, 0, 631, 635, 3, 132, 66, 0, 632, 635, 5, 8, 0, 0, 633, 635, + 5, 30, 0, 0, 634, 631, 1, 0, 0, 0, 634, 632, 1, 0, 0, 0, 634, 633, 1, 0, + 0, 0, 635, 637, 1, 0, 0, 0, 636, 628, 1, 0, 0, 0, 636, 629, 1, 0, 0, 0, + 637, 129, 1, 0, 0, 0, 638, 639, 7, 2, 0, 0, 639, 131, 1, 0, 0, 0, 640, + 645, 3, 130, 65, 0, 641, 642, 5, 67, 0, 0, 642, 644, 3, 130, 65, 0, 643, + 641, 1, 0, 0, 0, 644, 647, 1, 0, 0, 0, 645, 643, 1, 0, 0, 0, 645, 646, + 1, 0, 0, 0, 646, 133, 1, 0, 0, 0, 647, 645, 1, 0, 0, 0, 85, 138, 145, 159, + 166, 174, 188, 194, 202, 212, 216, 222, 231, 235, 241, 249, 257, 268, 274, + 279, 282, 286, 289, 292, 295, 300, 311, 315, 326, 337, 350, 361, 367, 370, + 374, 387, 392, 395, 400, 403, 407, 411, 415, 417, 429, 438, 442, 446, 453, + 457, 462, 465, 470, 475, 480, 483, 485, 493, 504, 506, 512, 516, 522, 526, + 530, 532, 539, 545, 549, 555, 563, 570, 574, 578, 582, 587, 591, 598, 601, + 609, 613, 615, 623, 634, 636, 645, + } + deserializer := antlr.NewATNDeserializer(nil) + staticData.atn = deserializer.Deserialize(staticData.serializedATN) + atn := staticData.atn + staticData.decisionToDFA = make([]*antlr.DFA, len(atn.DecisionToState)) + decisionToDFA := staticData.decisionToDFA + for index, state := range atn.DecisionToState { + decisionToDFA[index] = antlr.NewDFA(state, index) + } +} + +// ANTLRv4ParserInit initializes any static state used to implement ANTLRv4Parser. By default the +// static state used to implement the parser is lazily initialized during the first call to +// NewANTLRv4Parser(). You can call this function if you wish to initialize the static state ahead +// of time. +func ANTLRv4ParserInit() { + staticData := &ANTLRv4ParserParserStaticData + staticData.once.Do(antlrv4parserParserInit) +} + +// NewANTLRv4Parser produces a new parser instance for the optional input antlr.TokenStream. +func NewANTLRv4Parser(input antlr.TokenStream) *ANTLRv4Parser { + ANTLRv4ParserInit() + this := new(ANTLRv4Parser) + this.BaseParser = antlr.NewBaseParser(input) + staticData := &ANTLRv4ParserParserStaticData + this.Interpreter = antlr.NewParserATNSimulator(this, staticData.atn, staticData.decisionToDFA, staticData.PredictionContextCache) + this.RuleNames = staticData.RuleNames + this.LiteralNames = staticData.LiteralNames + this.SymbolicNames = staticData.SymbolicNames + this.GrammarFileName = "ANTLRv4Parser.g4" + + return this +} + +// ANTLRv4Parser tokens. +const ( + ANTLRv4ParserEOF = antlr.TokenEOF + ANTLRv4ParserACTION = 1 + ANTLRv4ParserARG_ACTION = 2 + ANTLRv4ParserARG_OR_CHARSET = 3 + ANTLRv4ParserASSIGN = 4 + ANTLRv4ParserLEXER_CHAR_SET = 5 + ANTLRv4ParserRULE_REF = 6 + ANTLRv4ParserSEMPRED = 7 + ANTLRv4ParserSTRING_LITERAL = 8 + ANTLRv4ParserTOKEN_REF = 9 + ANTLRv4ParserUNICODE_ESC = 10 + ANTLRv4ParserUNICODE_EXTENDED_ESC = 11 + ANTLRv4ParserWS = 12 + ANTLRv4ParserALT = 13 + ANTLRv4ParserBLOCK = 14 + ANTLRv4ParserCLOSURE = 15 + ANTLRv4ParserELEMENT_OPTIONS = 16 + ANTLRv4ParserEPSILON = 17 + ANTLRv4ParserLEXER_ACTION_CALL = 18 + ANTLRv4ParserLEXER_ALT_ACTION = 19 + ANTLRv4ParserOPTIONAL = 20 + ANTLRv4ParserPOSITIVE_CLOSURE = 21 + ANTLRv4ParserRULE = 22 + ANTLRv4ParserRULEMODIFIERS = 23 + ANTLRv4ParserRULES = 24 + ANTLRv4ParserSET = 25 + ANTLRv4ParserWILDCARD = 26 + ANTLRv4ParserDOC_COMMENT = 27 + ANTLRv4ParserBLOCK_COMMENT = 28 + ANTLRv4ParserLINE_COMMENT = 29 + ANTLRv4ParserINT = 30 + ANTLRv4ParserUNTERMINATED_STRING_LITERAL = 31 + ANTLRv4ParserBEGIN_ARGUMENT = 32 + ANTLRv4ParserOPTIONS = 33 + ANTLRv4ParserTOKENS = 34 + ANTLRv4ParserCHANNELS = 35 + ANTLRv4ParserIMPORT = 36 + ANTLRv4ParserFRAGMENT = 37 + ANTLRv4ParserLEXER = 38 + ANTLRv4ParserPARSER = 39 + ANTLRv4ParserGRAMMAR = 40 + ANTLRv4ParserPROTECTED = 41 + ANTLRv4ParserPUBLIC = 42 + ANTLRv4ParserPRIVATE = 43 + ANTLRv4ParserRETURNS = 44 + ANTLRv4ParserLOCALS = 45 + ANTLRv4ParserTHROWS = 46 + ANTLRv4ParserCATCH = 47 + ANTLRv4ParserFINALLY = 48 + ANTLRv4ParserMODE = 49 + ANTLRv4ParserCOLON = 50 + ANTLRv4ParserCOLONCOLON = 51 + ANTLRv4ParserCOMMA = 52 + ANTLRv4ParserSEMI = 53 + ANTLRv4ParserLPAREN = 54 + ANTLRv4ParserRPAREN = 55 + ANTLRv4ParserRBRACE = 56 + ANTLRv4ParserRARROW = 57 + ANTLRv4ParserLT = 58 + ANTLRv4ParserGT = 59 + ANTLRv4ParserQUESTION = 60 + ANTLRv4ParserSTAR = 61 + ANTLRv4ParserPLUS_ASSIGN = 62 + ANTLRv4ParserPLUS = 63 + ANTLRv4ParserOR = 64 + ANTLRv4ParserDOLLAR = 65 + ANTLRv4ParserRANGE = 66 + ANTLRv4ParserDOT = 67 + ANTLRv4ParserAT = 68 + ANTLRv4ParserPOUND = 69 + ANTLRv4ParserNOT = 70 + ANTLRv4ParserID = 71 + ANTLRv4ParserEND_ARGUMENT = 72 + ANTLRv4ParserUNTERMINATED_ARGUMENT = 73 + ANTLRv4ParserARGUMENT_CONTENT = 74 + ANTLRv4ParserUNTERMINATED_CHAR_SET = 75 +) + +// ANTLRv4Parser rules. +const ( + ANTLRv4ParserRULE_grammarSpec = 0 + ANTLRv4ParserRULE_grammarDecl = 1 + ANTLRv4ParserRULE_grammarType = 2 + ANTLRv4ParserRULE_prequelConstruct = 3 + ANTLRv4ParserRULE_optionsSpec = 4 + ANTLRv4ParserRULE_option = 5 + ANTLRv4ParserRULE_optionValue = 6 + ANTLRv4ParserRULE_delegateGrammars = 7 + ANTLRv4ParserRULE_delegateGrammar = 8 + ANTLRv4ParserRULE_tokensSpec = 9 + ANTLRv4ParserRULE_channelsSpec = 10 + ANTLRv4ParserRULE_idList = 11 + ANTLRv4ParserRULE_action_ = 12 + ANTLRv4ParserRULE_actionScopeName = 13 + ANTLRv4ParserRULE_actionBlock = 14 + ANTLRv4ParserRULE_argActionBlock = 15 + ANTLRv4ParserRULE_modeSpec = 16 + ANTLRv4ParserRULE_rules = 17 + ANTLRv4ParserRULE_ruleSpec = 18 + ANTLRv4ParserRULE_parserRuleSpec = 19 + ANTLRv4ParserRULE_exceptionGroup = 20 + ANTLRv4ParserRULE_exceptionHandler = 21 + ANTLRv4ParserRULE_finallyClause = 22 + ANTLRv4ParserRULE_rulePrequel = 23 + ANTLRv4ParserRULE_ruleReturns = 24 + ANTLRv4ParserRULE_throwsSpec = 25 + ANTLRv4ParserRULE_localsSpec = 26 + ANTLRv4ParserRULE_ruleAction = 27 + ANTLRv4ParserRULE_ruleModifiers = 28 + ANTLRv4ParserRULE_ruleModifier = 29 + ANTLRv4ParserRULE_ruleBlock = 30 + ANTLRv4ParserRULE_ruleAltList = 31 + ANTLRv4ParserRULE_labeledAlt = 32 + ANTLRv4ParserRULE_lexerRuleSpec = 33 + ANTLRv4ParserRULE_lexerRuleBlock = 34 + ANTLRv4ParserRULE_lexerAltList = 35 + ANTLRv4ParserRULE_lexerAlt = 36 + ANTLRv4ParserRULE_lexerElements = 37 + ANTLRv4ParserRULE_lexerElement = 38 + ANTLRv4ParserRULE_lexerBlock = 39 + ANTLRv4ParserRULE_lexerCommands = 40 + ANTLRv4ParserRULE_lexerCommand = 41 + ANTLRv4ParserRULE_lexerCommandName = 42 + ANTLRv4ParserRULE_lexerCommandExpr = 43 + ANTLRv4ParserRULE_altList = 44 + ANTLRv4ParserRULE_alternative = 45 + ANTLRv4ParserRULE_element = 46 + ANTLRv4ParserRULE_predicateOptions = 47 + ANTLRv4ParserRULE_predicateOption = 48 + ANTLRv4ParserRULE_labeledElement = 49 + ANTLRv4ParserRULE_ebnf = 50 + ANTLRv4ParserRULE_blockSuffix = 51 + ANTLRv4ParserRULE_ebnfSuffix = 52 + ANTLRv4ParserRULE_lexerAtom = 53 + ANTLRv4ParserRULE_atom = 54 + ANTLRv4ParserRULE_wildcard = 55 + ANTLRv4ParserRULE_notSet = 56 + ANTLRv4ParserRULE_blockSet = 57 + ANTLRv4ParserRULE_setElement = 58 + ANTLRv4ParserRULE_block = 59 + ANTLRv4ParserRULE_ruleref = 60 + ANTLRv4ParserRULE_characterRange = 61 + ANTLRv4ParserRULE_terminalDef = 62 + ANTLRv4ParserRULE_elementOptions = 63 + ANTLRv4ParserRULE_elementOption = 64 + ANTLRv4ParserRULE_identifier = 65 + ANTLRv4ParserRULE_qualifiedIdentifier = 66 +) + +// IGrammarSpecContext is an interface to support dynamic dispatch. +type IGrammarSpecContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + GrammarDecl() IGrammarDeclContext + Rules() IRulesContext + EOF() antlr.TerminalNode + AllPrequelConstruct() []IPrequelConstructContext + PrequelConstruct(i int) IPrequelConstructContext + AllModeSpec() []IModeSpecContext + ModeSpec(i int) IModeSpecContext + + // IsGrammarSpecContext differentiates from other interfaces. + IsGrammarSpecContext() +} + +type GrammarSpecContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGrammarSpecContext() *GrammarSpecContext { + var p = new(GrammarSpecContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_grammarSpec + return p +} + +func InitEmptyGrammarSpecContext(p *GrammarSpecContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_grammarSpec +} + +func (*GrammarSpecContext) IsGrammarSpecContext() {} + +func NewGrammarSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *GrammarSpecContext { + var p = new(GrammarSpecContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_grammarSpec + + return p +} + +func (s *GrammarSpecContext) GetParser() antlr.Parser { return s.parser } + +func (s *GrammarSpecContext) GrammarDecl() IGrammarDeclContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGrammarDeclContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGrammarDeclContext) +} + +func (s *GrammarSpecContext) Rules() IRulesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRulesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRulesContext) +} + +func (s *GrammarSpecContext) EOF() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserEOF, 0) +} + +func (s *GrammarSpecContext) AllPrequelConstruct() []IPrequelConstructContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IPrequelConstructContext); ok { + len++ + } + } + + tst := make([]IPrequelConstructContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IPrequelConstructContext); ok { + tst[i] = t.(IPrequelConstructContext) + i++ + } + } + + return tst +} + +func (s *GrammarSpecContext) PrequelConstruct(i int) IPrequelConstructContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPrequelConstructContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IPrequelConstructContext) +} + +func (s *GrammarSpecContext) AllModeSpec() []IModeSpecContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IModeSpecContext); ok { + len++ + } + } + + tst := make([]IModeSpecContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IModeSpecContext); ok { + tst[i] = t.(IModeSpecContext) + i++ + } + } + + return tst +} + +func (s *GrammarSpecContext) ModeSpec(i int) IModeSpecContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IModeSpecContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IModeSpecContext) +} + +func (s *GrammarSpecContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *GrammarSpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *GrammarSpecContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterGrammarSpec(s) + } +} + +func (s *GrammarSpecContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitGrammarSpec(s) + } +} + +func (s *GrammarSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitGrammarSpec(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) GrammarSpec() (localctx IGrammarSpecContext) { + localctx = NewGrammarSpecContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 0, ANTLRv4ParserRULE_grammarSpec) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(134) + p.GrammarDecl() + } + p.SetState(138) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for (int64((_la-33)) & ^0x3f) == 0 && ((int64(1)<<(_la-33))&34359738383) != 0 { + { + p.SetState(135) + p.PrequelConstruct() + } + + p.SetState(140) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + { + p.SetState(141) + p.Rules() + } + p.SetState(145) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == ANTLRv4ParserMODE { + { + p.SetState(142) + p.ModeSpec() + } + + p.SetState(147) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + { + p.SetState(148) + p.Match(ANTLRv4ParserEOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGrammarDeclContext is an interface to support dynamic dispatch. +type IGrammarDeclContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + GrammarType() IGrammarTypeContext + Identifier() IIdentifierContext + SEMI() antlr.TerminalNode + + // IsGrammarDeclContext differentiates from other interfaces. + IsGrammarDeclContext() +} + +type GrammarDeclContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGrammarDeclContext() *GrammarDeclContext { + var p = new(GrammarDeclContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_grammarDecl + return p +} + +func InitEmptyGrammarDeclContext(p *GrammarDeclContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_grammarDecl +} + +func (*GrammarDeclContext) IsGrammarDeclContext() {} + +func NewGrammarDeclContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *GrammarDeclContext { + var p = new(GrammarDeclContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_grammarDecl + + return p +} + +func (s *GrammarDeclContext) GetParser() antlr.Parser { return s.parser } + +func (s *GrammarDeclContext) GrammarType() IGrammarTypeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGrammarTypeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGrammarTypeContext) +} + +func (s *GrammarDeclContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *GrammarDeclContext) SEMI() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserSEMI, 0) +} + +func (s *GrammarDeclContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *GrammarDeclContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *GrammarDeclContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterGrammarDecl(s) + } +} + +func (s *GrammarDeclContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitGrammarDecl(s) + } +} + +func (s *GrammarDeclContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitGrammarDecl(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) GrammarDecl() (localctx IGrammarDeclContext) { + localctx = NewGrammarDeclContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 2, ANTLRv4ParserRULE_grammarDecl) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(150) + p.GrammarType() + } + { + p.SetState(151) + p.Identifier() + } + { + p.SetState(152) + p.Match(ANTLRv4ParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGrammarTypeContext is an interface to support dynamic dispatch. +type IGrammarTypeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LEXER() antlr.TerminalNode + GRAMMAR() antlr.TerminalNode + PARSER() antlr.TerminalNode + + // IsGrammarTypeContext differentiates from other interfaces. + IsGrammarTypeContext() +} + +type GrammarTypeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGrammarTypeContext() *GrammarTypeContext { + var p = new(GrammarTypeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_grammarType + return p +} + +func InitEmptyGrammarTypeContext(p *GrammarTypeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_grammarType +} + +func (*GrammarTypeContext) IsGrammarTypeContext() {} + +func NewGrammarTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *GrammarTypeContext { + var p = new(GrammarTypeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_grammarType + + return p +} + +func (s *GrammarTypeContext) GetParser() antlr.Parser { return s.parser } + +func (s *GrammarTypeContext) LEXER() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserLEXER, 0) +} + +func (s *GrammarTypeContext) GRAMMAR() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserGRAMMAR, 0) +} + +func (s *GrammarTypeContext) PARSER() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserPARSER, 0) +} + +func (s *GrammarTypeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *GrammarTypeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *GrammarTypeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterGrammarType(s) + } +} + +func (s *GrammarTypeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitGrammarType(s) + } +} + +func (s *GrammarTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitGrammarType(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) GrammarType() (localctx IGrammarTypeContext) { + localctx = NewGrammarTypeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 4, ANTLRv4ParserRULE_grammarType) + p.SetState(159) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case ANTLRv4ParserLEXER: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(154) + p.Match(ANTLRv4ParserLEXER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(155) + p.Match(ANTLRv4ParserGRAMMAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case ANTLRv4ParserPARSER: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(156) + p.Match(ANTLRv4ParserPARSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(157) + p.Match(ANTLRv4ParserGRAMMAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case ANTLRv4ParserGRAMMAR: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(158) + p.Match(ANTLRv4ParserGRAMMAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPrequelConstructContext is an interface to support dynamic dispatch. +type IPrequelConstructContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OptionsSpec() IOptionsSpecContext + DelegateGrammars() IDelegateGrammarsContext + TokensSpec() ITokensSpecContext + ChannelsSpec() IChannelsSpecContext + Action_() IAction_Context + + // IsPrequelConstructContext differentiates from other interfaces. + IsPrequelConstructContext() +} + +type PrequelConstructContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPrequelConstructContext() *PrequelConstructContext { + var p = new(PrequelConstructContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_prequelConstruct + return p +} + +func InitEmptyPrequelConstructContext(p *PrequelConstructContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_prequelConstruct +} + +func (*PrequelConstructContext) IsPrequelConstructContext() {} + +func NewPrequelConstructContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PrequelConstructContext { + var p = new(PrequelConstructContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_prequelConstruct + + return p +} + +func (s *PrequelConstructContext) GetParser() antlr.Parser { return s.parser } + +func (s *PrequelConstructContext) OptionsSpec() IOptionsSpecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptionsSpecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptionsSpecContext) +} + +func (s *PrequelConstructContext) DelegateGrammars() IDelegateGrammarsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDelegateGrammarsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDelegateGrammarsContext) +} + +func (s *PrequelConstructContext) TokensSpec() ITokensSpecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITokensSpecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITokensSpecContext) +} + +func (s *PrequelConstructContext) ChannelsSpec() IChannelsSpecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IChannelsSpecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IChannelsSpecContext) +} + +func (s *PrequelConstructContext) Action_() IAction_Context { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAction_Context); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAction_Context) +} + +func (s *PrequelConstructContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *PrequelConstructContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *PrequelConstructContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterPrequelConstruct(s) + } +} + +func (s *PrequelConstructContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitPrequelConstruct(s) + } +} + +func (s *PrequelConstructContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitPrequelConstruct(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) PrequelConstruct() (localctx IPrequelConstructContext) { + localctx = NewPrequelConstructContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 6, ANTLRv4ParserRULE_prequelConstruct) + p.SetState(166) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case ANTLRv4ParserOPTIONS: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(161) + p.OptionsSpec() + } + + case ANTLRv4ParserIMPORT: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(162) + p.DelegateGrammars() + } + + case ANTLRv4ParserTOKENS: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(163) + p.TokensSpec() + } + + case ANTLRv4ParserCHANNELS: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(164) + p.ChannelsSpec() + } + + case ANTLRv4ParserAT: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(165) + p.Action_() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOptionsSpecContext is an interface to support dynamic dispatch. +type IOptionsSpecContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPTIONS() antlr.TerminalNode + RBRACE() antlr.TerminalNode + AllOption() []IOptionContext + Option(i int) IOptionContext + AllSEMI() []antlr.TerminalNode + SEMI(i int) antlr.TerminalNode + + // IsOptionsSpecContext differentiates from other interfaces. + IsOptionsSpecContext() +} + +type OptionsSpecContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOptionsSpecContext() *OptionsSpecContext { + var p = new(OptionsSpecContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_optionsSpec + return p +} + +func InitEmptyOptionsSpecContext(p *OptionsSpecContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_optionsSpec +} + +func (*OptionsSpecContext) IsOptionsSpecContext() {} + +func NewOptionsSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OptionsSpecContext { + var p = new(OptionsSpecContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_optionsSpec + + return p +} + +func (s *OptionsSpecContext) GetParser() antlr.Parser { return s.parser } + +func (s *OptionsSpecContext) OPTIONS() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserOPTIONS, 0) +} + +func (s *OptionsSpecContext) RBRACE() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserRBRACE, 0) +} + +func (s *OptionsSpecContext) AllOption() []IOptionContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IOptionContext); ok { + len++ + } + } + + tst := make([]IOptionContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IOptionContext); ok { + tst[i] = t.(IOptionContext) + i++ + } + } + + return tst +} + +func (s *OptionsSpecContext) Option(i int) IOptionContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptionContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IOptionContext) +} + +func (s *OptionsSpecContext) AllSEMI() []antlr.TerminalNode { + return s.GetTokens(ANTLRv4ParserSEMI) +} + +func (s *OptionsSpecContext) SEMI(i int) antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserSEMI, i) +} + +func (s *OptionsSpecContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OptionsSpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OptionsSpecContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterOptionsSpec(s) + } +} + +func (s *OptionsSpecContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitOptionsSpec(s) + } +} + +func (s *OptionsSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitOptionsSpec(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) OptionsSpec() (localctx IOptionsSpecContext) { + localctx = NewOptionsSpecContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 8, ANTLRv4ParserRULE_optionsSpec) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(168) + p.Match(ANTLRv4ParserOPTIONS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(174) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == ANTLRv4ParserRULE_REF || _la == ANTLRv4ParserTOKEN_REF { + { + p.SetState(169) + p.Option() + } + { + p.SetState(170) + p.Match(ANTLRv4ParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + p.SetState(176) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + { + p.SetState(177) + p.Match(ANTLRv4ParserRBRACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOptionContext is an interface to support dynamic dispatch. +type IOptionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Identifier() IIdentifierContext + ASSIGN() antlr.TerminalNode + OptionValue() IOptionValueContext + + // IsOptionContext differentiates from other interfaces. + IsOptionContext() +} + +type OptionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOptionContext() *OptionContext { + var p = new(OptionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_option + return p +} + +func InitEmptyOptionContext(p *OptionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_option +} + +func (*OptionContext) IsOptionContext() {} + +func NewOptionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OptionContext { + var p = new(OptionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_option + + return p +} + +func (s *OptionContext) GetParser() antlr.Parser { return s.parser } + +func (s *OptionContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *OptionContext) ASSIGN() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserASSIGN, 0) +} + +func (s *OptionContext) OptionValue() IOptionValueContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptionValueContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptionValueContext) +} + +func (s *OptionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OptionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OptionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterOption(s) + } +} + +func (s *OptionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitOption(s) + } +} + +func (s *OptionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitOption(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) Option() (localctx IOptionContext) { + localctx = NewOptionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 10, ANTLRv4ParserRULE_option) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(179) + p.Identifier() + } + { + p.SetState(180) + p.Match(ANTLRv4ParserASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(181) + p.OptionValue() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOptionValueContext is an interface to support dynamic dispatch. +type IOptionValueContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllIdentifier() []IIdentifierContext + Identifier(i int) IIdentifierContext + AllDOT() []antlr.TerminalNode + DOT(i int) antlr.TerminalNode + STRING_LITERAL() antlr.TerminalNode + ActionBlock() IActionBlockContext + INT() antlr.TerminalNode + + // IsOptionValueContext differentiates from other interfaces. + IsOptionValueContext() +} + +type OptionValueContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOptionValueContext() *OptionValueContext { + var p = new(OptionValueContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_optionValue + return p +} + +func InitEmptyOptionValueContext(p *OptionValueContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_optionValue +} + +func (*OptionValueContext) IsOptionValueContext() {} + +func NewOptionValueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OptionValueContext { + var p = new(OptionValueContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_optionValue + + return p +} + +func (s *OptionValueContext) GetParser() antlr.Parser { return s.parser } + +func (s *OptionValueContext) AllIdentifier() []IIdentifierContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IIdentifierContext); ok { + len++ + } + } + + tst := make([]IIdentifierContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IIdentifierContext); ok { + tst[i] = t.(IIdentifierContext) + i++ + } + } + + return tst +} + +func (s *OptionValueContext) Identifier(i int) IIdentifierContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *OptionValueContext) AllDOT() []antlr.TerminalNode { + return s.GetTokens(ANTLRv4ParserDOT) +} + +func (s *OptionValueContext) DOT(i int) antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserDOT, i) +} + +func (s *OptionValueContext) STRING_LITERAL() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserSTRING_LITERAL, 0) +} + +func (s *OptionValueContext) ActionBlock() IActionBlockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IActionBlockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IActionBlockContext) +} + +func (s *OptionValueContext) INT() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserINT, 0) +} + +func (s *OptionValueContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OptionValueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OptionValueContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterOptionValue(s) + } +} + +func (s *OptionValueContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitOptionValue(s) + } +} + +func (s *OptionValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitOptionValue(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) OptionValue() (localctx IOptionValueContext) { + localctx = NewOptionValueContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 12, ANTLRv4ParserRULE_optionValue) + var _la int + + p.SetState(194) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case ANTLRv4ParserRULE_REF, ANTLRv4ParserTOKEN_REF: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(183) + p.Identifier() + } + p.SetState(188) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == ANTLRv4ParserDOT { + { + p.SetState(184) + p.Match(ANTLRv4ParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(185) + p.Identifier() + } + + p.SetState(190) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + + case ANTLRv4ParserSTRING_LITERAL: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(191) + p.Match(ANTLRv4ParserSTRING_LITERAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case ANTLRv4ParserACTION: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(192) + p.ActionBlock() + } + + case ANTLRv4ParserINT: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(193) + p.Match(ANTLRv4ParserINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDelegateGrammarsContext is an interface to support dynamic dispatch. +type IDelegateGrammarsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + IMPORT() antlr.TerminalNode + AllDelegateGrammar() []IDelegateGrammarContext + DelegateGrammar(i int) IDelegateGrammarContext + SEMI() antlr.TerminalNode + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsDelegateGrammarsContext differentiates from other interfaces. + IsDelegateGrammarsContext() +} + +type DelegateGrammarsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDelegateGrammarsContext() *DelegateGrammarsContext { + var p = new(DelegateGrammarsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_delegateGrammars + return p +} + +func InitEmptyDelegateGrammarsContext(p *DelegateGrammarsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_delegateGrammars +} + +func (*DelegateGrammarsContext) IsDelegateGrammarsContext() {} + +func NewDelegateGrammarsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DelegateGrammarsContext { + var p = new(DelegateGrammarsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_delegateGrammars + + return p +} + +func (s *DelegateGrammarsContext) GetParser() antlr.Parser { return s.parser } + +func (s *DelegateGrammarsContext) IMPORT() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserIMPORT, 0) +} + +func (s *DelegateGrammarsContext) AllDelegateGrammar() []IDelegateGrammarContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IDelegateGrammarContext); ok { + len++ + } + } + + tst := make([]IDelegateGrammarContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IDelegateGrammarContext); ok { + tst[i] = t.(IDelegateGrammarContext) + i++ + } + } + + return tst +} + +func (s *DelegateGrammarsContext) DelegateGrammar(i int) IDelegateGrammarContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDelegateGrammarContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IDelegateGrammarContext) +} + +func (s *DelegateGrammarsContext) SEMI() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserSEMI, 0) +} + +func (s *DelegateGrammarsContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(ANTLRv4ParserCOMMA) +} + +func (s *DelegateGrammarsContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserCOMMA, i) +} + +func (s *DelegateGrammarsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DelegateGrammarsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DelegateGrammarsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterDelegateGrammars(s) + } +} + +func (s *DelegateGrammarsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitDelegateGrammars(s) + } +} + +func (s *DelegateGrammarsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitDelegateGrammars(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) DelegateGrammars() (localctx IDelegateGrammarsContext) { + localctx = NewDelegateGrammarsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 14, ANTLRv4ParserRULE_delegateGrammars) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(196) + p.Match(ANTLRv4ParserIMPORT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(197) + p.DelegateGrammar() + } + p.SetState(202) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == ANTLRv4ParserCOMMA { + { + p.SetState(198) + p.Match(ANTLRv4ParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(199) + p.DelegateGrammar() + } + + p.SetState(204) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + { + p.SetState(205) + p.Match(ANTLRv4ParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDelegateGrammarContext is an interface to support dynamic dispatch. +type IDelegateGrammarContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllIdentifier() []IIdentifierContext + Identifier(i int) IIdentifierContext + ASSIGN() antlr.TerminalNode + + // IsDelegateGrammarContext differentiates from other interfaces. + IsDelegateGrammarContext() +} + +type DelegateGrammarContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDelegateGrammarContext() *DelegateGrammarContext { + var p = new(DelegateGrammarContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_delegateGrammar + return p +} + +func InitEmptyDelegateGrammarContext(p *DelegateGrammarContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_delegateGrammar +} + +func (*DelegateGrammarContext) IsDelegateGrammarContext() {} + +func NewDelegateGrammarContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DelegateGrammarContext { + var p = new(DelegateGrammarContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_delegateGrammar + + return p +} + +func (s *DelegateGrammarContext) GetParser() antlr.Parser { return s.parser } + +func (s *DelegateGrammarContext) AllIdentifier() []IIdentifierContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IIdentifierContext); ok { + len++ + } + } + + tst := make([]IIdentifierContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IIdentifierContext); ok { + tst[i] = t.(IIdentifierContext) + i++ + } + } + + return tst +} + +func (s *DelegateGrammarContext) Identifier(i int) IIdentifierContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *DelegateGrammarContext) ASSIGN() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserASSIGN, 0) +} + +func (s *DelegateGrammarContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DelegateGrammarContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DelegateGrammarContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterDelegateGrammar(s) + } +} + +func (s *DelegateGrammarContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitDelegateGrammar(s) + } +} + +func (s *DelegateGrammarContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitDelegateGrammar(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) DelegateGrammar() (localctx IDelegateGrammarContext) { + localctx = NewDelegateGrammarContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 16, ANTLRv4ParserRULE_delegateGrammar) + p.SetState(212) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 8, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(207) + p.Identifier() + } + { + p.SetState(208) + p.Match(ANTLRv4ParserASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(209) + p.Identifier() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(211) + p.Identifier() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITokensSpecContext is an interface to support dynamic dispatch. +type ITokensSpecContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TOKENS() antlr.TerminalNode + RBRACE() antlr.TerminalNode + IdList() IIdListContext + + // IsTokensSpecContext differentiates from other interfaces. + IsTokensSpecContext() +} + +type TokensSpecContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTokensSpecContext() *TokensSpecContext { + var p = new(TokensSpecContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_tokensSpec + return p +} + +func InitEmptyTokensSpecContext(p *TokensSpecContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_tokensSpec +} + +func (*TokensSpecContext) IsTokensSpecContext() {} + +func NewTokensSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TokensSpecContext { + var p = new(TokensSpecContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_tokensSpec + + return p +} + +func (s *TokensSpecContext) GetParser() antlr.Parser { return s.parser } + +func (s *TokensSpecContext) TOKENS() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserTOKENS, 0) +} + +func (s *TokensSpecContext) RBRACE() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserRBRACE, 0) +} + +func (s *TokensSpecContext) IdList() IIdListContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdListContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdListContext) +} + +func (s *TokensSpecContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TokensSpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TokensSpecContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterTokensSpec(s) + } +} + +func (s *TokensSpecContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitTokensSpec(s) + } +} + +func (s *TokensSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitTokensSpec(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) TokensSpec() (localctx ITokensSpecContext) { + localctx = NewTokensSpecContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 18, ANTLRv4ParserRULE_tokensSpec) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(214) + p.Match(ANTLRv4ParserTOKENS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(216) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserRULE_REF || _la == ANTLRv4ParserTOKEN_REF { + { + p.SetState(215) + p.IdList() + } + + } + { + p.SetState(218) + p.Match(ANTLRv4ParserRBRACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IChannelsSpecContext is an interface to support dynamic dispatch. +type IChannelsSpecContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CHANNELS() antlr.TerminalNode + RBRACE() antlr.TerminalNode + IdList() IIdListContext + + // IsChannelsSpecContext differentiates from other interfaces. + IsChannelsSpecContext() +} + +type ChannelsSpecContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyChannelsSpecContext() *ChannelsSpecContext { + var p = new(ChannelsSpecContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_channelsSpec + return p +} + +func InitEmptyChannelsSpecContext(p *ChannelsSpecContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_channelsSpec +} + +func (*ChannelsSpecContext) IsChannelsSpecContext() {} + +func NewChannelsSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ChannelsSpecContext { + var p = new(ChannelsSpecContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_channelsSpec + + return p +} + +func (s *ChannelsSpecContext) GetParser() antlr.Parser { return s.parser } + +func (s *ChannelsSpecContext) CHANNELS() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserCHANNELS, 0) +} + +func (s *ChannelsSpecContext) RBRACE() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserRBRACE, 0) +} + +func (s *ChannelsSpecContext) IdList() IIdListContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdListContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdListContext) +} + +func (s *ChannelsSpecContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ChannelsSpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ChannelsSpecContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterChannelsSpec(s) + } +} + +func (s *ChannelsSpecContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitChannelsSpec(s) + } +} + +func (s *ChannelsSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitChannelsSpec(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) ChannelsSpec() (localctx IChannelsSpecContext) { + localctx = NewChannelsSpecContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 20, ANTLRv4ParserRULE_channelsSpec) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(220) + p.Match(ANTLRv4ParserCHANNELS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(222) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserRULE_REF || _la == ANTLRv4ParserTOKEN_REF { + { + p.SetState(221) + p.IdList() + } + + } + { + p.SetState(224) + p.Match(ANTLRv4ParserRBRACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IIdListContext is an interface to support dynamic dispatch. +type IIdListContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllIdentifier() []IIdentifierContext + Identifier(i int) IIdentifierContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsIdListContext differentiates from other interfaces. + IsIdListContext() +} + +type IdListContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyIdListContext() *IdListContext { + var p = new(IdListContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_idList + return p +} + +func InitEmptyIdListContext(p *IdListContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_idList +} + +func (*IdListContext) IsIdListContext() {} + +func NewIdListContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *IdListContext { + var p = new(IdListContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_idList + + return p +} + +func (s *IdListContext) GetParser() antlr.Parser { return s.parser } + +func (s *IdListContext) AllIdentifier() []IIdentifierContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IIdentifierContext); ok { + len++ + } + } + + tst := make([]IIdentifierContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IIdentifierContext); ok { + tst[i] = t.(IIdentifierContext) + i++ + } + } + + return tst +} + +func (s *IdListContext) Identifier(i int) IIdentifierContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *IdListContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(ANTLRv4ParserCOMMA) +} + +func (s *IdListContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserCOMMA, i) +} + +func (s *IdListContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *IdListContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *IdListContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterIdList(s) + } +} + +func (s *IdListContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitIdList(s) + } +} + +func (s *IdListContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitIdList(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) IdList() (localctx IIdListContext) { + localctx = NewIdListContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 22, ANTLRv4ParserRULE_idList) + var _la int + + var _alt int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(226) + p.Identifier() + } + p.SetState(231) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 11, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(227) + p.Match(ANTLRv4ParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(228) + p.Identifier() + } + + } + p.SetState(233) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 11, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + p.SetState(235) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserCOMMA { + { + p.SetState(234) + p.Match(ANTLRv4ParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAction_Context is an interface to support dynamic dispatch. +type IAction_Context interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AT() antlr.TerminalNode + Identifier() IIdentifierContext + ActionBlock() IActionBlockContext + ActionScopeName() IActionScopeNameContext + COLONCOLON() antlr.TerminalNode + + // IsAction_Context differentiates from other interfaces. + IsAction_Context() +} + +type Action_Context struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAction_Context() *Action_Context { + var p = new(Action_Context) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_action_ + return p +} + +func InitEmptyAction_Context(p *Action_Context) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_action_ +} + +func (*Action_Context) IsAction_Context() {} + +func NewAction_Context(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Action_Context { + var p = new(Action_Context) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_action_ + + return p +} + +func (s *Action_Context) GetParser() antlr.Parser { return s.parser } + +func (s *Action_Context) AT() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserAT, 0) +} + +func (s *Action_Context) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *Action_Context) ActionBlock() IActionBlockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IActionBlockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IActionBlockContext) +} + +func (s *Action_Context) ActionScopeName() IActionScopeNameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IActionScopeNameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IActionScopeNameContext) +} + +func (s *Action_Context) COLONCOLON() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserCOLONCOLON, 0) +} + +func (s *Action_Context) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Action_Context) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Action_Context) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterAction_(s) + } +} + +func (s *Action_Context) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitAction_(s) + } +} + +func (s *Action_Context) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitAction_(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) Action_() (localctx IAction_Context) { + localctx = NewAction_Context(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 24, ANTLRv4ParserRULE_action_) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(237) + p.Match(ANTLRv4ParserAT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(241) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 13, p.GetParserRuleContext()) == 1 { + { + p.SetState(238) + p.ActionScopeName() + } + { + p.SetState(239) + p.Match(ANTLRv4ParserCOLONCOLON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(243) + p.Identifier() + } + { + p.SetState(244) + p.ActionBlock() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IActionScopeNameContext is an interface to support dynamic dispatch. +type IActionScopeNameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Identifier() IIdentifierContext + LEXER() antlr.TerminalNode + PARSER() antlr.TerminalNode + + // IsActionScopeNameContext differentiates from other interfaces. + IsActionScopeNameContext() +} + +type ActionScopeNameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyActionScopeNameContext() *ActionScopeNameContext { + var p = new(ActionScopeNameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_actionScopeName + return p +} + +func InitEmptyActionScopeNameContext(p *ActionScopeNameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_actionScopeName +} + +func (*ActionScopeNameContext) IsActionScopeNameContext() {} + +func NewActionScopeNameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ActionScopeNameContext { + var p = new(ActionScopeNameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_actionScopeName + + return p +} + +func (s *ActionScopeNameContext) GetParser() antlr.Parser { return s.parser } + +func (s *ActionScopeNameContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *ActionScopeNameContext) LEXER() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserLEXER, 0) +} + +func (s *ActionScopeNameContext) PARSER() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserPARSER, 0) +} + +func (s *ActionScopeNameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ActionScopeNameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ActionScopeNameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterActionScopeName(s) + } +} + +func (s *ActionScopeNameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitActionScopeName(s) + } +} + +func (s *ActionScopeNameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitActionScopeName(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) ActionScopeName() (localctx IActionScopeNameContext) { + localctx = NewActionScopeNameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 26, ANTLRv4ParserRULE_actionScopeName) + p.SetState(249) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case ANTLRv4ParserRULE_REF, ANTLRv4ParserTOKEN_REF: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(246) + p.Identifier() + } + + case ANTLRv4ParserLEXER: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(247) + p.Match(ANTLRv4ParserLEXER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case ANTLRv4ParserPARSER: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(248) + p.Match(ANTLRv4ParserPARSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IActionBlockContext is an interface to support dynamic dispatch. +type IActionBlockContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ACTION() antlr.TerminalNode + + // IsActionBlockContext differentiates from other interfaces. + IsActionBlockContext() +} + +type ActionBlockContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyActionBlockContext() *ActionBlockContext { + var p = new(ActionBlockContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_actionBlock + return p +} + +func InitEmptyActionBlockContext(p *ActionBlockContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_actionBlock +} + +func (*ActionBlockContext) IsActionBlockContext() {} + +func NewActionBlockContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ActionBlockContext { + var p = new(ActionBlockContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_actionBlock + + return p +} + +func (s *ActionBlockContext) GetParser() antlr.Parser { return s.parser } + +func (s *ActionBlockContext) ACTION() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserACTION, 0) +} + +func (s *ActionBlockContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ActionBlockContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ActionBlockContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterActionBlock(s) + } +} + +func (s *ActionBlockContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitActionBlock(s) + } +} + +func (s *ActionBlockContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitActionBlock(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) ActionBlock() (localctx IActionBlockContext) { + localctx = NewActionBlockContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 28, ANTLRv4ParserRULE_actionBlock) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(251) + p.Match(ANTLRv4ParserACTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IArgActionBlockContext is an interface to support dynamic dispatch. +type IArgActionBlockContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + BEGIN_ARGUMENT() antlr.TerminalNode + END_ARGUMENT() antlr.TerminalNode + AllARGUMENT_CONTENT() []antlr.TerminalNode + ARGUMENT_CONTENT(i int) antlr.TerminalNode + + // IsArgActionBlockContext differentiates from other interfaces. + IsArgActionBlockContext() +} + +type ArgActionBlockContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyArgActionBlockContext() *ArgActionBlockContext { + var p = new(ArgActionBlockContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_argActionBlock + return p +} + +func InitEmptyArgActionBlockContext(p *ArgActionBlockContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_argActionBlock +} + +func (*ArgActionBlockContext) IsArgActionBlockContext() {} + +func NewArgActionBlockContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ArgActionBlockContext { + var p = new(ArgActionBlockContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_argActionBlock + + return p +} + +func (s *ArgActionBlockContext) GetParser() antlr.Parser { return s.parser } + +func (s *ArgActionBlockContext) BEGIN_ARGUMENT() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserBEGIN_ARGUMENT, 0) +} + +func (s *ArgActionBlockContext) END_ARGUMENT() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserEND_ARGUMENT, 0) +} + +func (s *ArgActionBlockContext) AllARGUMENT_CONTENT() []antlr.TerminalNode { + return s.GetTokens(ANTLRv4ParserARGUMENT_CONTENT) +} + +func (s *ArgActionBlockContext) ARGUMENT_CONTENT(i int) antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserARGUMENT_CONTENT, i) +} + +func (s *ArgActionBlockContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ArgActionBlockContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ArgActionBlockContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterArgActionBlock(s) + } +} + +func (s *ArgActionBlockContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitArgActionBlock(s) + } +} + +func (s *ArgActionBlockContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitArgActionBlock(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) ArgActionBlock() (localctx IArgActionBlockContext) { + localctx = NewArgActionBlockContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 30, ANTLRv4ParserRULE_argActionBlock) + var _alt int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(253) + p.Match(ANTLRv4ParserBEGIN_ARGUMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(257) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 15, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 1 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1+1 { + { + p.SetState(254) + p.Match(ANTLRv4ParserARGUMENT_CONTENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + p.SetState(259) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 15, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + { + p.SetState(260) + p.Match(ANTLRv4ParserEND_ARGUMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IModeSpecContext is an interface to support dynamic dispatch. +type IModeSpecContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + MODE() antlr.TerminalNode + Identifier() IIdentifierContext + SEMI() antlr.TerminalNode + AllLexerRuleSpec() []ILexerRuleSpecContext + LexerRuleSpec(i int) ILexerRuleSpecContext + + // IsModeSpecContext differentiates from other interfaces. + IsModeSpecContext() +} + +type ModeSpecContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyModeSpecContext() *ModeSpecContext { + var p = new(ModeSpecContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_modeSpec + return p +} + +func InitEmptyModeSpecContext(p *ModeSpecContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_modeSpec +} + +func (*ModeSpecContext) IsModeSpecContext() {} + +func NewModeSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ModeSpecContext { + var p = new(ModeSpecContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_modeSpec + + return p +} + +func (s *ModeSpecContext) GetParser() antlr.Parser { return s.parser } + +func (s *ModeSpecContext) MODE() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserMODE, 0) +} + +func (s *ModeSpecContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *ModeSpecContext) SEMI() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserSEMI, 0) +} + +func (s *ModeSpecContext) AllLexerRuleSpec() []ILexerRuleSpecContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ILexerRuleSpecContext); ok { + len++ + } + } + + tst := make([]ILexerRuleSpecContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ILexerRuleSpecContext); ok { + tst[i] = t.(ILexerRuleSpecContext) + i++ + } + } + + return tst +} + +func (s *ModeSpecContext) LexerRuleSpec(i int) ILexerRuleSpecContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILexerRuleSpecContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ILexerRuleSpecContext) +} + +func (s *ModeSpecContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ModeSpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ModeSpecContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterModeSpec(s) + } +} + +func (s *ModeSpecContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitModeSpec(s) + } +} + +func (s *ModeSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitModeSpec(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) ModeSpec() (localctx IModeSpecContext) { + localctx = NewModeSpecContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 32, ANTLRv4ParserRULE_modeSpec) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(262) + p.Match(ANTLRv4ParserMODE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(263) + p.Identifier() + } + { + p.SetState(264) + p.Match(ANTLRv4ParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(268) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == ANTLRv4ParserTOKEN_REF || _la == ANTLRv4ParserFRAGMENT { + { + p.SetState(265) + p.LexerRuleSpec() + } + + p.SetState(270) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRulesContext is an interface to support dynamic dispatch. +type IRulesContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllRuleSpec() []IRuleSpecContext + RuleSpec(i int) IRuleSpecContext + + // IsRulesContext differentiates from other interfaces. + IsRulesContext() +} + +type RulesContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRulesContext() *RulesContext { + var p = new(RulesContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_rules + return p +} + +func InitEmptyRulesContext(p *RulesContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_rules +} + +func (*RulesContext) IsRulesContext() {} + +func NewRulesContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RulesContext { + var p = new(RulesContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_rules + + return p +} + +func (s *RulesContext) GetParser() antlr.Parser { return s.parser } + +func (s *RulesContext) AllRuleSpec() []IRuleSpecContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IRuleSpecContext); ok { + len++ + } + } + + tst := make([]IRuleSpecContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IRuleSpecContext); ok { + tst[i] = t.(IRuleSpecContext) + i++ + } + } + + return tst +} + +func (s *RulesContext) RuleSpec(i int) IRuleSpecContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRuleSpecContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IRuleSpecContext) +} + +func (s *RulesContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RulesContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RulesContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterRules(s) + } +} + +func (s *RulesContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitRules(s) + } +} + +func (s *RulesContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitRules(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) Rules() (localctx IRulesContext) { + localctx = NewRulesContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 34, ANTLRv4ParserRULE_rules) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(274) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&15530601742912) != 0 { + { + p.SetState(271) + p.RuleSpec() + } + + p.SetState(276) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRuleSpecContext is an interface to support dynamic dispatch. +type IRuleSpecContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ParserRuleSpec() IParserRuleSpecContext + LexerRuleSpec() ILexerRuleSpecContext + + // IsRuleSpecContext differentiates from other interfaces. + IsRuleSpecContext() +} + +type RuleSpecContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRuleSpecContext() *RuleSpecContext { + var p = new(RuleSpecContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ruleSpec + return p +} + +func InitEmptyRuleSpecContext(p *RuleSpecContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ruleSpec +} + +func (*RuleSpecContext) IsRuleSpecContext() {} + +func NewRuleSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RuleSpecContext { + var p = new(RuleSpecContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_ruleSpec + + return p +} + +func (s *RuleSpecContext) GetParser() antlr.Parser { return s.parser } + +func (s *RuleSpecContext) ParserRuleSpec() IParserRuleSpecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IParserRuleSpecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IParserRuleSpecContext) +} + +func (s *RuleSpecContext) LexerRuleSpec() ILexerRuleSpecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILexerRuleSpecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILexerRuleSpecContext) +} + +func (s *RuleSpecContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RuleSpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RuleSpecContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterRuleSpec(s) + } +} + +func (s *RuleSpecContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitRuleSpec(s) + } +} + +func (s *RuleSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitRuleSpec(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) RuleSpec() (localctx IRuleSpecContext) { + localctx = NewRuleSpecContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 36, ANTLRv4ParserRULE_ruleSpec) + p.SetState(279) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 18, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(277) + p.ParserRuleSpec() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(278) + p.LexerRuleSpec() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IParserRuleSpecContext is an interface to support dynamic dispatch. +type IParserRuleSpecContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + RULE_REF() antlr.TerminalNode + COLON() antlr.TerminalNode + RuleBlock() IRuleBlockContext + SEMI() antlr.TerminalNode + ExceptionGroup() IExceptionGroupContext + RuleModifiers() IRuleModifiersContext + ArgActionBlock() IArgActionBlockContext + RuleReturns() IRuleReturnsContext + ThrowsSpec() IThrowsSpecContext + LocalsSpec() ILocalsSpecContext + AllRulePrequel() []IRulePrequelContext + RulePrequel(i int) IRulePrequelContext + + // IsParserRuleSpecContext differentiates from other interfaces. + IsParserRuleSpecContext() +} + +type ParserRuleSpecContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyParserRuleSpecContext() *ParserRuleSpecContext { + var p = new(ParserRuleSpecContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_parserRuleSpec + return p +} + +func InitEmptyParserRuleSpecContext(p *ParserRuleSpecContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_parserRuleSpec +} + +func (*ParserRuleSpecContext) IsParserRuleSpecContext() {} + +func NewParserRuleSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ParserRuleSpecContext { + var p = new(ParserRuleSpecContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_parserRuleSpec + + return p +} + +func (s *ParserRuleSpecContext) GetParser() antlr.Parser { return s.parser } + +func (s *ParserRuleSpecContext) RULE_REF() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserRULE_REF, 0) +} + +func (s *ParserRuleSpecContext) COLON() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserCOLON, 0) +} + +func (s *ParserRuleSpecContext) RuleBlock() IRuleBlockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRuleBlockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRuleBlockContext) +} + +func (s *ParserRuleSpecContext) SEMI() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserSEMI, 0) +} + +func (s *ParserRuleSpecContext) ExceptionGroup() IExceptionGroupContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExceptionGroupContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExceptionGroupContext) +} + +func (s *ParserRuleSpecContext) RuleModifiers() IRuleModifiersContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRuleModifiersContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRuleModifiersContext) +} + +func (s *ParserRuleSpecContext) ArgActionBlock() IArgActionBlockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IArgActionBlockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IArgActionBlockContext) +} + +func (s *ParserRuleSpecContext) RuleReturns() IRuleReturnsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRuleReturnsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRuleReturnsContext) +} + +func (s *ParserRuleSpecContext) ThrowsSpec() IThrowsSpecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IThrowsSpecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IThrowsSpecContext) +} + +func (s *ParserRuleSpecContext) LocalsSpec() ILocalsSpecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILocalsSpecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILocalsSpecContext) +} + +func (s *ParserRuleSpecContext) AllRulePrequel() []IRulePrequelContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IRulePrequelContext); ok { + len++ + } + } + + tst := make([]IRulePrequelContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IRulePrequelContext); ok { + tst[i] = t.(IRulePrequelContext) + i++ + } + } + + return tst +} + +func (s *ParserRuleSpecContext) RulePrequel(i int) IRulePrequelContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRulePrequelContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IRulePrequelContext) +} + +func (s *ParserRuleSpecContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ParserRuleSpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ParserRuleSpecContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterParserRuleSpec(s) + } +} + +func (s *ParserRuleSpecContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitParserRuleSpec(s) + } +} + +func (s *ParserRuleSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitParserRuleSpec(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) ParserRuleSpec() (localctx IParserRuleSpecContext) { + localctx = NewParserRuleSpecContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 38, ANTLRv4ParserRULE_parserRuleSpec) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(282) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&15530601742336) != 0 { + { + p.SetState(281) + p.RuleModifiers() + } + + } + { + p.SetState(284) + p.Match(ANTLRv4ParserRULE_REF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(286) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserBEGIN_ARGUMENT { + { + p.SetState(285) + p.ArgActionBlock() + } + + } + p.SetState(289) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserRETURNS { + { + p.SetState(288) + p.RuleReturns() + } + + } + p.SetState(292) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserTHROWS { + { + p.SetState(291) + p.ThrowsSpec() + } + + } + p.SetState(295) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserLOCALS { + { + p.SetState(294) + p.LocalsSpec() + } + + } + p.SetState(300) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == ANTLRv4ParserOPTIONS || _la == ANTLRv4ParserAT { + { + p.SetState(297) + p.RulePrequel() + } + + p.SetState(302) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + { + p.SetState(303) + p.Match(ANTLRv4ParserCOLON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(304) + p.RuleBlock() + } + { + p.SetState(305) + p.Match(ANTLRv4ParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(306) + p.ExceptionGroup() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExceptionGroupContext is an interface to support dynamic dispatch. +type IExceptionGroupContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllExceptionHandler() []IExceptionHandlerContext + ExceptionHandler(i int) IExceptionHandlerContext + FinallyClause() IFinallyClauseContext + + // IsExceptionGroupContext differentiates from other interfaces. + IsExceptionGroupContext() +} + +type ExceptionGroupContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExceptionGroupContext() *ExceptionGroupContext { + var p = new(ExceptionGroupContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_exceptionGroup + return p +} + +func InitEmptyExceptionGroupContext(p *ExceptionGroupContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_exceptionGroup +} + +func (*ExceptionGroupContext) IsExceptionGroupContext() {} + +func NewExceptionGroupContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExceptionGroupContext { + var p = new(ExceptionGroupContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_exceptionGroup + + return p +} + +func (s *ExceptionGroupContext) GetParser() antlr.Parser { return s.parser } + +func (s *ExceptionGroupContext) AllExceptionHandler() []IExceptionHandlerContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IExceptionHandlerContext); ok { + len++ + } + } + + tst := make([]IExceptionHandlerContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IExceptionHandlerContext); ok { + tst[i] = t.(IExceptionHandlerContext) + i++ + } + } + + return tst +} + +func (s *ExceptionGroupContext) ExceptionHandler(i int) IExceptionHandlerContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExceptionHandlerContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IExceptionHandlerContext) +} + +func (s *ExceptionGroupContext) FinallyClause() IFinallyClauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFinallyClauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFinallyClauseContext) +} + +func (s *ExceptionGroupContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ExceptionGroupContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ExceptionGroupContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterExceptionGroup(s) + } +} + +func (s *ExceptionGroupContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitExceptionGroup(s) + } +} + +func (s *ExceptionGroupContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitExceptionGroup(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) ExceptionGroup() (localctx IExceptionGroupContext) { + localctx = NewExceptionGroupContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 40, ANTLRv4ParserRULE_exceptionGroup) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(311) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == ANTLRv4ParserCATCH { + { + p.SetState(308) + p.ExceptionHandler() + } + + p.SetState(313) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + p.SetState(315) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserFINALLY { + { + p.SetState(314) + p.FinallyClause() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExceptionHandlerContext is an interface to support dynamic dispatch. +type IExceptionHandlerContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CATCH() antlr.TerminalNode + ArgActionBlock() IArgActionBlockContext + ActionBlock() IActionBlockContext + + // IsExceptionHandlerContext differentiates from other interfaces. + IsExceptionHandlerContext() +} + +type ExceptionHandlerContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExceptionHandlerContext() *ExceptionHandlerContext { + var p = new(ExceptionHandlerContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_exceptionHandler + return p +} + +func InitEmptyExceptionHandlerContext(p *ExceptionHandlerContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_exceptionHandler +} + +func (*ExceptionHandlerContext) IsExceptionHandlerContext() {} + +func NewExceptionHandlerContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExceptionHandlerContext { + var p = new(ExceptionHandlerContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_exceptionHandler + + return p +} + +func (s *ExceptionHandlerContext) GetParser() antlr.Parser { return s.parser } + +func (s *ExceptionHandlerContext) CATCH() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserCATCH, 0) +} + +func (s *ExceptionHandlerContext) ArgActionBlock() IArgActionBlockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IArgActionBlockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IArgActionBlockContext) +} + +func (s *ExceptionHandlerContext) ActionBlock() IActionBlockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IActionBlockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IActionBlockContext) +} + +func (s *ExceptionHandlerContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ExceptionHandlerContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ExceptionHandlerContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterExceptionHandler(s) + } +} + +func (s *ExceptionHandlerContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitExceptionHandler(s) + } +} + +func (s *ExceptionHandlerContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitExceptionHandler(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) ExceptionHandler() (localctx IExceptionHandlerContext) { + localctx = NewExceptionHandlerContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 42, ANTLRv4ParserRULE_exceptionHandler) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(317) + p.Match(ANTLRv4ParserCATCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(318) + p.ArgActionBlock() + } + { + p.SetState(319) + p.ActionBlock() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFinallyClauseContext is an interface to support dynamic dispatch. +type IFinallyClauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FINALLY() antlr.TerminalNode + ActionBlock() IActionBlockContext + + // IsFinallyClauseContext differentiates from other interfaces. + IsFinallyClauseContext() +} + +type FinallyClauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFinallyClauseContext() *FinallyClauseContext { + var p = new(FinallyClauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_finallyClause + return p +} + +func InitEmptyFinallyClauseContext(p *FinallyClauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_finallyClause +} + +func (*FinallyClauseContext) IsFinallyClauseContext() {} + +func NewFinallyClauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FinallyClauseContext { + var p = new(FinallyClauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_finallyClause + + return p +} + +func (s *FinallyClauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *FinallyClauseContext) FINALLY() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserFINALLY, 0) +} + +func (s *FinallyClauseContext) ActionBlock() IActionBlockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IActionBlockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IActionBlockContext) +} + +func (s *FinallyClauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *FinallyClauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *FinallyClauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterFinallyClause(s) + } +} + +func (s *FinallyClauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitFinallyClause(s) + } +} + +func (s *FinallyClauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitFinallyClause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) FinallyClause() (localctx IFinallyClauseContext) { + localctx = NewFinallyClauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 44, ANTLRv4ParserRULE_finallyClause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(321) + p.Match(ANTLRv4ParserFINALLY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(322) + p.ActionBlock() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRulePrequelContext is an interface to support dynamic dispatch. +type IRulePrequelContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OptionsSpec() IOptionsSpecContext + RuleAction() IRuleActionContext + + // IsRulePrequelContext differentiates from other interfaces. + IsRulePrequelContext() +} + +type RulePrequelContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRulePrequelContext() *RulePrequelContext { + var p = new(RulePrequelContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_rulePrequel + return p +} + +func InitEmptyRulePrequelContext(p *RulePrequelContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_rulePrequel +} + +func (*RulePrequelContext) IsRulePrequelContext() {} + +func NewRulePrequelContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RulePrequelContext { + var p = new(RulePrequelContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_rulePrequel + + return p +} + +func (s *RulePrequelContext) GetParser() antlr.Parser { return s.parser } + +func (s *RulePrequelContext) OptionsSpec() IOptionsSpecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptionsSpecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptionsSpecContext) +} + +func (s *RulePrequelContext) RuleAction() IRuleActionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRuleActionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRuleActionContext) +} + +func (s *RulePrequelContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RulePrequelContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RulePrequelContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterRulePrequel(s) + } +} + +func (s *RulePrequelContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitRulePrequel(s) + } +} + +func (s *RulePrequelContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitRulePrequel(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) RulePrequel() (localctx IRulePrequelContext) { + localctx = NewRulePrequelContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 46, ANTLRv4ParserRULE_rulePrequel) + p.SetState(326) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case ANTLRv4ParserOPTIONS: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(324) + p.OptionsSpec() + } + + case ANTLRv4ParserAT: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(325) + p.RuleAction() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRuleReturnsContext is an interface to support dynamic dispatch. +type IRuleReturnsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + RETURNS() antlr.TerminalNode + ArgActionBlock() IArgActionBlockContext + + // IsRuleReturnsContext differentiates from other interfaces. + IsRuleReturnsContext() +} + +type RuleReturnsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRuleReturnsContext() *RuleReturnsContext { + var p = new(RuleReturnsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ruleReturns + return p +} + +func InitEmptyRuleReturnsContext(p *RuleReturnsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ruleReturns +} + +func (*RuleReturnsContext) IsRuleReturnsContext() {} + +func NewRuleReturnsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RuleReturnsContext { + var p = new(RuleReturnsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_ruleReturns + + return p +} + +func (s *RuleReturnsContext) GetParser() antlr.Parser { return s.parser } + +func (s *RuleReturnsContext) RETURNS() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserRETURNS, 0) +} + +func (s *RuleReturnsContext) ArgActionBlock() IArgActionBlockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IArgActionBlockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IArgActionBlockContext) +} + +func (s *RuleReturnsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RuleReturnsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RuleReturnsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterRuleReturns(s) + } +} + +func (s *RuleReturnsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitRuleReturns(s) + } +} + +func (s *RuleReturnsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitRuleReturns(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) RuleReturns() (localctx IRuleReturnsContext) { + localctx = NewRuleReturnsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 48, ANTLRv4ParserRULE_ruleReturns) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(328) + p.Match(ANTLRv4ParserRETURNS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(329) + p.ArgActionBlock() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IThrowsSpecContext is an interface to support dynamic dispatch. +type IThrowsSpecContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + THROWS() antlr.TerminalNode + AllQualifiedIdentifier() []IQualifiedIdentifierContext + QualifiedIdentifier(i int) IQualifiedIdentifierContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsThrowsSpecContext differentiates from other interfaces. + IsThrowsSpecContext() +} + +type ThrowsSpecContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyThrowsSpecContext() *ThrowsSpecContext { + var p = new(ThrowsSpecContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_throwsSpec + return p +} + +func InitEmptyThrowsSpecContext(p *ThrowsSpecContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_throwsSpec +} + +func (*ThrowsSpecContext) IsThrowsSpecContext() {} + +func NewThrowsSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ThrowsSpecContext { + var p = new(ThrowsSpecContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_throwsSpec + + return p +} + +func (s *ThrowsSpecContext) GetParser() antlr.Parser { return s.parser } + +func (s *ThrowsSpecContext) THROWS() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserTHROWS, 0) +} + +func (s *ThrowsSpecContext) AllQualifiedIdentifier() []IQualifiedIdentifierContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IQualifiedIdentifierContext); ok { + len++ + } + } + + tst := make([]IQualifiedIdentifierContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IQualifiedIdentifierContext); ok { + tst[i] = t.(IQualifiedIdentifierContext) + i++ + } + } + + return tst +} + +func (s *ThrowsSpecContext) QualifiedIdentifier(i int) IQualifiedIdentifierContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualifiedIdentifierContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IQualifiedIdentifierContext) +} + +func (s *ThrowsSpecContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(ANTLRv4ParserCOMMA) +} + +func (s *ThrowsSpecContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserCOMMA, i) +} + +func (s *ThrowsSpecContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ThrowsSpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ThrowsSpecContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterThrowsSpec(s) + } +} + +func (s *ThrowsSpecContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitThrowsSpec(s) + } +} + +func (s *ThrowsSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitThrowsSpec(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) ThrowsSpec() (localctx IThrowsSpecContext) { + localctx = NewThrowsSpecContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 50, ANTLRv4ParserRULE_throwsSpec) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(331) + p.Match(ANTLRv4ParserTHROWS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(332) + p.QualifiedIdentifier() + } + p.SetState(337) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == ANTLRv4ParserCOMMA { + { + p.SetState(333) + p.Match(ANTLRv4ParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(334) + p.QualifiedIdentifier() + } + + p.SetState(339) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILocalsSpecContext is an interface to support dynamic dispatch. +type ILocalsSpecContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LOCALS() antlr.TerminalNode + ArgActionBlock() IArgActionBlockContext + + // IsLocalsSpecContext differentiates from other interfaces. + IsLocalsSpecContext() +} + +type LocalsSpecContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLocalsSpecContext() *LocalsSpecContext { + var p = new(LocalsSpecContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_localsSpec + return p +} + +func InitEmptyLocalsSpecContext(p *LocalsSpecContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_localsSpec +} + +func (*LocalsSpecContext) IsLocalsSpecContext() {} + +func NewLocalsSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LocalsSpecContext { + var p = new(LocalsSpecContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_localsSpec + + return p +} + +func (s *LocalsSpecContext) GetParser() antlr.Parser { return s.parser } + +func (s *LocalsSpecContext) LOCALS() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserLOCALS, 0) +} + +func (s *LocalsSpecContext) ArgActionBlock() IArgActionBlockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IArgActionBlockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IArgActionBlockContext) +} + +func (s *LocalsSpecContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *LocalsSpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *LocalsSpecContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterLocalsSpec(s) + } +} + +func (s *LocalsSpecContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitLocalsSpec(s) + } +} + +func (s *LocalsSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitLocalsSpec(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) LocalsSpec() (localctx ILocalsSpecContext) { + localctx = NewLocalsSpecContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 52, ANTLRv4ParserRULE_localsSpec) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(340) + p.Match(ANTLRv4ParserLOCALS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(341) + p.ArgActionBlock() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRuleActionContext is an interface to support dynamic dispatch. +type IRuleActionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AT() antlr.TerminalNode + Identifier() IIdentifierContext + ActionBlock() IActionBlockContext + + // IsRuleActionContext differentiates from other interfaces. + IsRuleActionContext() +} + +type RuleActionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRuleActionContext() *RuleActionContext { + var p = new(RuleActionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ruleAction + return p +} + +func InitEmptyRuleActionContext(p *RuleActionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ruleAction +} + +func (*RuleActionContext) IsRuleActionContext() {} + +func NewRuleActionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RuleActionContext { + var p = new(RuleActionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_ruleAction + + return p +} + +func (s *RuleActionContext) GetParser() antlr.Parser { return s.parser } + +func (s *RuleActionContext) AT() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserAT, 0) +} + +func (s *RuleActionContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *RuleActionContext) ActionBlock() IActionBlockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IActionBlockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IActionBlockContext) +} + +func (s *RuleActionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RuleActionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RuleActionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterRuleAction(s) + } +} + +func (s *RuleActionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitRuleAction(s) + } +} + +func (s *RuleActionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitRuleAction(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) RuleAction() (localctx IRuleActionContext) { + localctx = NewRuleActionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 54, ANTLRv4ParserRULE_ruleAction) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(343) + p.Match(ANTLRv4ParserAT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(344) + p.Identifier() + } + { + p.SetState(345) + p.ActionBlock() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRuleModifiersContext is an interface to support dynamic dispatch. +type IRuleModifiersContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllRuleModifier() []IRuleModifierContext + RuleModifier(i int) IRuleModifierContext + + // IsRuleModifiersContext differentiates from other interfaces. + IsRuleModifiersContext() +} + +type RuleModifiersContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRuleModifiersContext() *RuleModifiersContext { + var p = new(RuleModifiersContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ruleModifiers + return p +} + +func InitEmptyRuleModifiersContext(p *RuleModifiersContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ruleModifiers +} + +func (*RuleModifiersContext) IsRuleModifiersContext() {} + +func NewRuleModifiersContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RuleModifiersContext { + var p = new(RuleModifiersContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_ruleModifiers + + return p +} + +func (s *RuleModifiersContext) GetParser() antlr.Parser { return s.parser } + +func (s *RuleModifiersContext) AllRuleModifier() []IRuleModifierContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IRuleModifierContext); ok { + len++ + } + } + + tst := make([]IRuleModifierContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IRuleModifierContext); ok { + tst[i] = t.(IRuleModifierContext) + i++ + } + } + + return tst +} + +func (s *RuleModifiersContext) RuleModifier(i int) IRuleModifierContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRuleModifierContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IRuleModifierContext) +} + +func (s *RuleModifiersContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RuleModifiersContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RuleModifiersContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterRuleModifiers(s) + } +} + +func (s *RuleModifiersContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitRuleModifiers(s) + } +} + +func (s *RuleModifiersContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitRuleModifiers(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) RuleModifiers() (localctx IRuleModifiersContext) { + localctx = NewRuleModifiersContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 56, ANTLRv4ParserRULE_ruleModifiers) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(348) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for ok := true; ok; ok = ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&15530601742336) != 0) { + { + p.SetState(347) + p.RuleModifier() + } + + p.SetState(350) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRuleModifierContext is an interface to support dynamic dispatch. +type IRuleModifierContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + PUBLIC() antlr.TerminalNode + PRIVATE() antlr.TerminalNode + PROTECTED() antlr.TerminalNode + FRAGMENT() antlr.TerminalNode + + // IsRuleModifierContext differentiates from other interfaces. + IsRuleModifierContext() +} + +type RuleModifierContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRuleModifierContext() *RuleModifierContext { + var p = new(RuleModifierContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ruleModifier + return p +} + +func InitEmptyRuleModifierContext(p *RuleModifierContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ruleModifier +} + +func (*RuleModifierContext) IsRuleModifierContext() {} + +func NewRuleModifierContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RuleModifierContext { + var p = new(RuleModifierContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_ruleModifier + + return p +} + +func (s *RuleModifierContext) GetParser() antlr.Parser { return s.parser } + +func (s *RuleModifierContext) PUBLIC() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserPUBLIC, 0) +} + +func (s *RuleModifierContext) PRIVATE() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserPRIVATE, 0) +} + +func (s *RuleModifierContext) PROTECTED() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserPROTECTED, 0) +} + +func (s *RuleModifierContext) FRAGMENT() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserFRAGMENT, 0) +} + +func (s *RuleModifierContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RuleModifierContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RuleModifierContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterRuleModifier(s) + } +} + +func (s *RuleModifierContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitRuleModifier(s) + } +} + +func (s *RuleModifierContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitRuleModifier(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) RuleModifier() (localctx IRuleModifierContext) { + localctx = NewRuleModifierContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 58, ANTLRv4ParserRULE_ruleModifier) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(352) + _la = p.GetTokenStream().LA(1) + + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&15530601742336) != 0) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRuleBlockContext is an interface to support dynamic dispatch. +type IRuleBlockContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + RuleAltList() IRuleAltListContext + + // IsRuleBlockContext differentiates from other interfaces. + IsRuleBlockContext() +} + +type RuleBlockContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRuleBlockContext() *RuleBlockContext { + var p = new(RuleBlockContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ruleBlock + return p +} + +func InitEmptyRuleBlockContext(p *RuleBlockContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ruleBlock +} + +func (*RuleBlockContext) IsRuleBlockContext() {} + +func NewRuleBlockContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RuleBlockContext { + var p = new(RuleBlockContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_ruleBlock + + return p +} + +func (s *RuleBlockContext) GetParser() antlr.Parser { return s.parser } + +func (s *RuleBlockContext) RuleAltList() IRuleAltListContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRuleAltListContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRuleAltListContext) +} + +func (s *RuleBlockContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RuleBlockContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RuleBlockContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterRuleBlock(s) + } +} + +func (s *RuleBlockContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitRuleBlock(s) + } +} + +func (s *RuleBlockContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitRuleBlock(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) RuleBlock() (localctx IRuleBlockContext) { + localctx = NewRuleBlockContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 60, ANTLRv4ParserRULE_ruleBlock) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(354) + p.RuleAltList() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRuleAltListContext is an interface to support dynamic dispatch. +type IRuleAltListContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllLabeledAlt() []ILabeledAltContext + LabeledAlt(i int) ILabeledAltContext + AllOR() []antlr.TerminalNode + OR(i int) antlr.TerminalNode + + // IsRuleAltListContext differentiates from other interfaces. + IsRuleAltListContext() +} + +type RuleAltListContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRuleAltListContext() *RuleAltListContext { + var p = new(RuleAltListContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ruleAltList + return p +} + +func InitEmptyRuleAltListContext(p *RuleAltListContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ruleAltList +} + +func (*RuleAltListContext) IsRuleAltListContext() {} + +func NewRuleAltListContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RuleAltListContext { + var p = new(RuleAltListContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_ruleAltList + + return p +} + +func (s *RuleAltListContext) GetParser() antlr.Parser { return s.parser } + +func (s *RuleAltListContext) AllLabeledAlt() []ILabeledAltContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ILabeledAltContext); ok { + len++ + } + } + + tst := make([]ILabeledAltContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ILabeledAltContext); ok { + tst[i] = t.(ILabeledAltContext) + i++ + } + } + + return tst +} + +func (s *RuleAltListContext) LabeledAlt(i int) ILabeledAltContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILabeledAltContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ILabeledAltContext) +} + +func (s *RuleAltListContext) AllOR() []antlr.TerminalNode { + return s.GetTokens(ANTLRv4ParserOR) +} + +func (s *RuleAltListContext) OR(i int) antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserOR, i) +} + +func (s *RuleAltListContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RuleAltListContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RuleAltListContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterRuleAltList(s) + } +} + +func (s *RuleAltListContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitRuleAltList(s) + } +} + +func (s *RuleAltListContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitRuleAltList(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) RuleAltList() (localctx IRuleAltListContext) { + localctx = NewRuleAltListContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 62, ANTLRv4ParserRULE_ruleAltList) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(356) + p.LabeledAlt() + } + p.SetState(361) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == ANTLRv4ParserOR { + { + p.SetState(357) + p.Match(ANTLRv4ParserOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(358) + p.LabeledAlt() + } + + p.SetState(363) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILabeledAltContext is an interface to support dynamic dispatch. +type ILabeledAltContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Alternative() IAlternativeContext + POUND() antlr.TerminalNode + Identifier() IIdentifierContext + + // IsLabeledAltContext differentiates from other interfaces. + IsLabeledAltContext() +} + +type LabeledAltContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLabeledAltContext() *LabeledAltContext { + var p = new(LabeledAltContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_labeledAlt + return p +} + +func InitEmptyLabeledAltContext(p *LabeledAltContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_labeledAlt +} + +func (*LabeledAltContext) IsLabeledAltContext() {} + +func NewLabeledAltContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LabeledAltContext { + var p = new(LabeledAltContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_labeledAlt + + return p +} + +func (s *LabeledAltContext) GetParser() antlr.Parser { return s.parser } + +func (s *LabeledAltContext) Alternative() IAlternativeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlternativeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlternativeContext) +} + +func (s *LabeledAltContext) POUND() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserPOUND, 0) +} + +func (s *LabeledAltContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *LabeledAltContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *LabeledAltContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *LabeledAltContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterLabeledAlt(s) + } +} + +func (s *LabeledAltContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitLabeledAlt(s) + } +} + +func (s *LabeledAltContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitLabeledAlt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) LabeledAlt() (localctx ILabeledAltContext) { + localctx = NewLabeledAltContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 64, ANTLRv4ParserRULE_labeledAlt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(364) + p.Alternative() + } + p.SetState(367) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserPOUND { + { + p.SetState(365) + p.Match(ANTLRv4ParserPOUND) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(366) + p.Identifier() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILexerRuleSpecContext is an interface to support dynamic dispatch. +type ILexerRuleSpecContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TOKEN_REF() antlr.TerminalNode + COLON() antlr.TerminalNode + LexerRuleBlock() ILexerRuleBlockContext + SEMI() antlr.TerminalNode + FRAGMENT() antlr.TerminalNode + OptionsSpec() IOptionsSpecContext + + // IsLexerRuleSpecContext differentiates from other interfaces. + IsLexerRuleSpecContext() +} + +type LexerRuleSpecContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLexerRuleSpecContext() *LexerRuleSpecContext { + var p = new(LexerRuleSpecContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerRuleSpec + return p +} + +func InitEmptyLexerRuleSpecContext(p *LexerRuleSpecContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerRuleSpec +} + +func (*LexerRuleSpecContext) IsLexerRuleSpecContext() {} + +func NewLexerRuleSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LexerRuleSpecContext { + var p = new(LexerRuleSpecContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_lexerRuleSpec + + return p +} + +func (s *LexerRuleSpecContext) GetParser() antlr.Parser { return s.parser } + +func (s *LexerRuleSpecContext) TOKEN_REF() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserTOKEN_REF, 0) +} + +func (s *LexerRuleSpecContext) COLON() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserCOLON, 0) +} + +func (s *LexerRuleSpecContext) LexerRuleBlock() ILexerRuleBlockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILexerRuleBlockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILexerRuleBlockContext) +} + +func (s *LexerRuleSpecContext) SEMI() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserSEMI, 0) +} + +func (s *LexerRuleSpecContext) FRAGMENT() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserFRAGMENT, 0) +} + +func (s *LexerRuleSpecContext) OptionsSpec() IOptionsSpecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptionsSpecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptionsSpecContext) +} + +func (s *LexerRuleSpecContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *LexerRuleSpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *LexerRuleSpecContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterLexerRuleSpec(s) + } +} + +func (s *LexerRuleSpecContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitLexerRuleSpec(s) + } +} + +func (s *LexerRuleSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitLexerRuleSpec(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) LexerRuleSpec() (localctx ILexerRuleSpecContext) { + localctx = NewLexerRuleSpecContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 66, ANTLRv4ParserRULE_lexerRuleSpec) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(370) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserFRAGMENT { + { + p.SetState(369) + p.Match(ANTLRv4ParserFRAGMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(372) + p.Match(ANTLRv4ParserTOKEN_REF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(374) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserOPTIONS { + { + p.SetState(373) + p.OptionsSpec() + } + + } + { + p.SetState(376) + p.Match(ANTLRv4ParserCOLON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(377) + p.LexerRuleBlock() + } + { + p.SetState(378) + p.Match(ANTLRv4ParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILexerRuleBlockContext is an interface to support dynamic dispatch. +type ILexerRuleBlockContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LexerAltList() ILexerAltListContext + + // IsLexerRuleBlockContext differentiates from other interfaces. + IsLexerRuleBlockContext() +} + +type LexerRuleBlockContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLexerRuleBlockContext() *LexerRuleBlockContext { + var p = new(LexerRuleBlockContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerRuleBlock + return p +} + +func InitEmptyLexerRuleBlockContext(p *LexerRuleBlockContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerRuleBlock +} + +func (*LexerRuleBlockContext) IsLexerRuleBlockContext() {} + +func NewLexerRuleBlockContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LexerRuleBlockContext { + var p = new(LexerRuleBlockContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_lexerRuleBlock + + return p +} + +func (s *LexerRuleBlockContext) GetParser() antlr.Parser { return s.parser } + +func (s *LexerRuleBlockContext) LexerAltList() ILexerAltListContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILexerAltListContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILexerAltListContext) +} + +func (s *LexerRuleBlockContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *LexerRuleBlockContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *LexerRuleBlockContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterLexerRuleBlock(s) + } +} + +func (s *LexerRuleBlockContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitLexerRuleBlock(s) + } +} + +func (s *LexerRuleBlockContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitLexerRuleBlock(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) LexerRuleBlock() (localctx ILexerRuleBlockContext) { + localctx = NewLexerRuleBlockContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 68, ANTLRv4ParserRULE_lexerRuleBlock) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(380) + p.LexerAltList() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILexerAltListContext is an interface to support dynamic dispatch. +type ILexerAltListContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllLexerAlt() []ILexerAltContext + LexerAlt(i int) ILexerAltContext + AllOR() []antlr.TerminalNode + OR(i int) antlr.TerminalNode + + // IsLexerAltListContext differentiates from other interfaces. + IsLexerAltListContext() +} + +type LexerAltListContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLexerAltListContext() *LexerAltListContext { + var p = new(LexerAltListContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerAltList + return p +} + +func InitEmptyLexerAltListContext(p *LexerAltListContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerAltList +} + +func (*LexerAltListContext) IsLexerAltListContext() {} + +func NewLexerAltListContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LexerAltListContext { + var p = new(LexerAltListContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_lexerAltList + + return p +} + +func (s *LexerAltListContext) GetParser() antlr.Parser { return s.parser } + +func (s *LexerAltListContext) AllLexerAlt() []ILexerAltContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ILexerAltContext); ok { + len++ + } + } + + tst := make([]ILexerAltContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ILexerAltContext); ok { + tst[i] = t.(ILexerAltContext) + i++ + } + } + + return tst +} + +func (s *LexerAltListContext) LexerAlt(i int) ILexerAltContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILexerAltContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ILexerAltContext) +} + +func (s *LexerAltListContext) AllOR() []antlr.TerminalNode { + return s.GetTokens(ANTLRv4ParserOR) +} + +func (s *LexerAltListContext) OR(i int) antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserOR, i) +} + +func (s *LexerAltListContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *LexerAltListContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *LexerAltListContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterLexerAltList(s) + } +} + +func (s *LexerAltListContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitLexerAltList(s) + } +} + +func (s *LexerAltListContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitLexerAltList(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) LexerAltList() (localctx ILexerAltListContext) { + localctx = NewLexerAltListContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 70, ANTLRv4ParserRULE_lexerAltList) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(382) + p.LexerAlt() + } + p.SetState(387) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == ANTLRv4ParserOR { + { + p.SetState(383) + p.Match(ANTLRv4ParserOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(384) + p.LexerAlt() + } + + p.SetState(389) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILexerAltContext is an interface to support dynamic dispatch. +type ILexerAltContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LexerElements() ILexerElementsContext + LexerCommands() ILexerCommandsContext + + // IsLexerAltContext differentiates from other interfaces. + IsLexerAltContext() +} + +type LexerAltContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLexerAltContext() *LexerAltContext { + var p = new(LexerAltContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerAlt + return p +} + +func InitEmptyLexerAltContext(p *LexerAltContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerAlt +} + +func (*LexerAltContext) IsLexerAltContext() {} + +func NewLexerAltContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LexerAltContext { + var p = new(LexerAltContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_lexerAlt + + return p +} + +func (s *LexerAltContext) GetParser() antlr.Parser { return s.parser } + +func (s *LexerAltContext) LexerElements() ILexerElementsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILexerElementsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILexerElementsContext) +} + +func (s *LexerAltContext) LexerCommands() ILexerCommandsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILexerCommandsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILexerCommandsContext) +} + +func (s *LexerAltContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *LexerAltContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *LexerAltContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterLexerAlt(s) + } +} + +func (s *LexerAltContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitLexerAlt(s) + } +} + +func (s *LexerAltContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitLexerAlt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) LexerAlt() (localctx ILexerAltContext) { + localctx = NewLexerAltContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 72, ANTLRv4ParserRULE_lexerAlt) + var _la int + + p.SetState(395) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 36, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(390) + p.LexerElements() + } + p.SetState(392) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserRARROW { + { + p.SetState(391) + p.LexerCommands() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILexerElementsContext is an interface to support dynamic dispatch. +type ILexerElementsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllLexerElement() []ILexerElementContext + LexerElement(i int) ILexerElementContext + + // IsLexerElementsContext differentiates from other interfaces. + IsLexerElementsContext() +} + +type LexerElementsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLexerElementsContext() *LexerElementsContext { + var p = new(LexerElementsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerElements + return p +} + +func InitEmptyLexerElementsContext(p *LexerElementsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerElements +} + +func (*LexerElementsContext) IsLexerElementsContext() {} + +func NewLexerElementsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LexerElementsContext { + var p = new(LexerElementsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_lexerElements + + return p +} + +func (s *LexerElementsContext) GetParser() antlr.Parser { return s.parser } + +func (s *LexerElementsContext) AllLexerElement() []ILexerElementContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ILexerElementContext); ok { + len++ + } + } + + tst := make([]ILexerElementContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ILexerElementContext); ok { + tst[i] = t.(ILexerElementContext) + i++ + } + } + + return tst +} + +func (s *LexerElementsContext) LexerElement(i int) ILexerElementContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILexerElementContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ILexerElementContext) +} + +func (s *LexerElementsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *LexerElementsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *LexerElementsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterLexerElements(s) + } +} + +func (s *LexerElementsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitLexerElements(s) + } +} + +func (s *LexerElementsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitLexerElements(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) LexerElements() (localctx ILexerElementsContext) { + localctx = NewLexerElementsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 74, ANTLRv4ParserRULE_lexerElements) + var _la int + + p.SetState(403) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case ANTLRv4ParserACTION, ANTLRv4ParserLEXER_CHAR_SET, ANTLRv4ParserSTRING_LITERAL, ANTLRv4ParserTOKEN_REF, ANTLRv4ParserLPAREN, ANTLRv4ParserDOT, ANTLRv4ParserNOT: + p.EnterOuterAlt(localctx, 1) + p.SetState(398) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for ok := true; ok; ok = ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&18014398509482786) != 0) || _la == ANTLRv4ParserDOT || _la == ANTLRv4ParserNOT { + { + p.SetState(397) + p.LexerElement() + } + + p.SetState(400) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + + case ANTLRv4ParserSEMI, ANTLRv4ParserRPAREN, ANTLRv4ParserRARROW, ANTLRv4ParserOR: + p.EnterOuterAlt(localctx, 2) + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILexerElementContext is an interface to support dynamic dispatch. +type ILexerElementContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LexerAtom() ILexerAtomContext + EbnfSuffix() IEbnfSuffixContext + LexerBlock() ILexerBlockContext + ActionBlock() IActionBlockContext + QUESTION() antlr.TerminalNode + + // IsLexerElementContext differentiates from other interfaces. + IsLexerElementContext() +} + +type LexerElementContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLexerElementContext() *LexerElementContext { + var p = new(LexerElementContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerElement + return p +} + +func InitEmptyLexerElementContext(p *LexerElementContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerElement +} + +func (*LexerElementContext) IsLexerElementContext() {} + +func NewLexerElementContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LexerElementContext { + var p = new(LexerElementContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_lexerElement + + return p +} + +func (s *LexerElementContext) GetParser() antlr.Parser { return s.parser } + +func (s *LexerElementContext) LexerAtom() ILexerAtomContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILexerAtomContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILexerAtomContext) +} + +func (s *LexerElementContext) EbnfSuffix() IEbnfSuffixContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IEbnfSuffixContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IEbnfSuffixContext) +} + +func (s *LexerElementContext) LexerBlock() ILexerBlockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILexerBlockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILexerBlockContext) +} + +func (s *LexerElementContext) ActionBlock() IActionBlockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IActionBlockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IActionBlockContext) +} + +func (s *LexerElementContext) QUESTION() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserQUESTION, 0) +} + +func (s *LexerElementContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *LexerElementContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *LexerElementContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterLexerElement(s) + } +} + +func (s *LexerElementContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitLexerElement(s) + } +} + +func (s *LexerElementContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitLexerElement(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) LexerElement() (localctx ILexerElementContext) { + localctx = NewLexerElementContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 76, ANTLRv4ParserRULE_lexerElement) + var _la int + + p.SetState(417) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case ANTLRv4ParserLEXER_CHAR_SET, ANTLRv4ParserSTRING_LITERAL, ANTLRv4ParserTOKEN_REF, ANTLRv4ParserDOT, ANTLRv4ParserNOT: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(405) + p.LexerAtom() + } + p.SetState(407) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&-5764607523034234880) != 0 { + { + p.SetState(406) + p.EbnfSuffix() + } + + } + + case ANTLRv4ParserLPAREN: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(409) + p.LexerBlock() + } + p.SetState(411) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&-5764607523034234880) != 0 { + { + p.SetState(410) + p.EbnfSuffix() + } + + } + + case ANTLRv4ParserACTION: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(413) + p.ActionBlock() + } + p.SetState(415) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserQUESTION { + { + p.SetState(414) + p.Match(ANTLRv4ParserQUESTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILexerBlockContext is an interface to support dynamic dispatch. +type ILexerBlockContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LPAREN() antlr.TerminalNode + LexerAltList() ILexerAltListContext + RPAREN() antlr.TerminalNode + + // IsLexerBlockContext differentiates from other interfaces. + IsLexerBlockContext() +} + +type LexerBlockContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLexerBlockContext() *LexerBlockContext { + var p = new(LexerBlockContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerBlock + return p +} + +func InitEmptyLexerBlockContext(p *LexerBlockContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerBlock +} + +func (*LexerBlockContext) IsLexerBlockContext() {} + +func NewLexerBlockContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LexerBlockContext { + var p = new(LexerBlockContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_lexerBlock + + return p +} + +func (s *LexerBlockContext) GetParser() antlr.Parser { return s.parser } + +func (s *LexerBlockContext) LPAREN() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserLPAREN, 0) +} + +func (s *LexerBlockContext) LexerAltList() ILexerAltListContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILexerAltListContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILexerAltListContext) +} + +func (s *LexerBlockContext) RPAREN() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserRPAREN, 0) +} + +func (s *LexerBlockContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *LexerBlockContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *LexerBlockContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterLexerBlock(s) + } +} + +func (s *LexerBlockContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitLexerBlock(s) + } +} + +func (s *LexerBlockContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitLexerBlock(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) LexerBlock() (localctx ILexerBlockContext) { + localctx = NewLexerBlockContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 78, ANTLRv4ParserRULE_lexerBlock) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(419) + p.Match(ANTLRv4ParserLPAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(420) + p.LexerAltList() + } + { + p.SetState(421) + p.Match(ANTLRv4ParserRPAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILexerCommandsContext is an interface to support dynamic dispatch. +type ILexerCommandsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + RARROW() antlr.TerminalNode + AllLexerCommand() []ILexerCommandContext + LexerCommand(i int) ILexerCommandContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsLexerCommandsContext differentiates from other interfaces. + IsLexerCommandsContext() +} + +type LexerCommandsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLexerCommandsContext() *LexerCommandsContext { + var p = new(LexerCommandsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerCommands + return p +} + +func InitEmptyLexerCommandsContext(p *LexerCommandsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerCommands +} + +func (*LexerCommandsContext) IsLexerCommandsContext() {} + +func NewLexerCommandsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LexerCommandsContext { + var p = new(LexerCommandsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_lexerCommands + + return p +} + +func (s *LexerCommandsContext) GetParser() antlr.Parser { return s.parser } + +func (s *LexerCommandsContext) RARROW() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserRARROW, 0) +} + +func (s *LexerCommandsContext) AllLexerCommand() []ILexerCommandContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ILexerCommandContext); ok { + len++ + } + } + + tst := make([]ILexerCommandContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ILexerCommandContext); ok { + tst[i] = t.(ILexerCommandContext) + i++ + } + } + + return tst +} + +func (s *LexerCommandsContext) LexerCommand(i int) ILexerCommandContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILexerCommandContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ILexerCommandContext) +} + +func (s *LexerCommandsContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(ANTLRv4ParserCOMMA) +} + +func (s *LexerCommandsContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserCOMMA, i) +} + +func (s *LexerCommandsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *LexerCommandsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *LexerCommandsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterLexerCommands(s) + } +} + +func (s *LexerCommandsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitLexerCommands(s) + } +} + +func (s *LexerCommandsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitLexerCommands(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) LexerCommands() (localctx ILexerCommandsContext) { + localctx = NewLexerCommandsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 80, ANTLRv4ParserRULE_lexerCommands) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(423) + p.Match(ANTLRv4ParserRARROW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(424) + p.LexerCommand() + } + p.SetState(429) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == ANTLRv4ParserCOMMA { + { + p.SetState(425) + p.Match(ANTLRv4ParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(426) + p.LexerCommand() + } + + p.SetState(431) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILexerCommandContext is an interface to support dynamic dispatch. +type ILexerCommandContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LexerCommandName() ILexerCommandNameContext + LPAREN() antlr.TerminalNode + LexerCommandExpr() ILexerCommandExprContext + RPAREN() antlr.TerminalNode + + // IsLexerCommandContext differentiates from other interfaces. + IsLexerCommandContext() +} + +type LexerCommandContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLexerCommandContext() *LexerCommandContext { + var p = new(LexerCommandContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerCommand + return p +} + +func InitEmptyLexerCommandContext(p *LexerCommandContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerCommand +} + +func (*LexerCommandContext) IsLexerCommandContext() {} + +func NewLexerCommandContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LexerCommandContext { + var p = new(LexerCommandContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_lexerCommand + + return p +} + +func (s *LexerCommandContext) GetParser() antlr.Parser { return s.parser } + +func (s *LexerCommandContext) LexerCommandName() ILexerCommandNameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILexerCommandNameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILexerCommandNameContext) +} + +func (s *LexerCommandContext) LPAREN() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserLPAREN, 0) +} + +func (s *LexerCommandContext) LexerCommandExpr() ILexerCommandExprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILexerCommandExprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILexerCommandExprContext) +} + +func (s *LexerCommandContext) RPAREN() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserRPAREN, 0) +} + +func (s *LexerCommandContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *LexerCommandContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *LexerCommandContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterLexerCommand(s) + } +} + +func (s *LexerCommandContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitLexerCommand(s) + } +} + +func (s *LexerCommandContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitLexerCommand(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) LexerCommand() (localctx ILexerCommandContext) { + localctx = NewLexerCommandContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 82, ANTLRv4ParserRULE_lexerCommand) + p.SetState(438) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 44, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(432) + p.LexerCommandName() + } + { + p.SetState(433) + p.Match(ANTLRv4ParserLPAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(434) + p.LexerCommandExpr() + } + { + p.SetState(435) + p.Match(ANTLRv4ParserRPAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(437) + p.LexerCommandName() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILexerCommandNameContext is an interface to support dynamic dispatch. +type ILexerCommandNameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Identifier() IIdentifierContext + MODE() antlr.TerminalNode + + // IsLexerCommandNameContext differentiates from other interfaces. + IsLexerCommandNameContext() +} + +type LexerCommandNameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLexerCommandNameContext() *LexerCommandNameContext { + var p = new(LexerCommandNameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerCommandName + return p +} + +func InitEmptyLexerCommandNameContext(p *LexerCommandNameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerCommandName +} + +func (*LexerCommandNameContext) IsLexerCommandNameContext() {} + +func NewLexerCommandNameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LexerCommandNameContext { + var p = new(LexerCommandNameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_lexerCommandName + + return p +} + +func (s *LexerCommandNameContext) GetParser() antlr.Parser { return s.parser } + +func (s *LexerCommandNameContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *LexerCommandNameContext) MODE() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserMODE, 0) +} + +func (s *LexerCommandNameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *LexerCommandNameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *LexerCommandNameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterLexerCommandName(s) + } +} + +func (s *LexerCommandNameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitLexerCommandName(s) + } +} + +func (s *LexerCommandNameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitLexerCommandName(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) LexerCommandName() (localctx ILexerCommandNameContext) { + localctx = NewLexerCommandNameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 84, ANTLRv4ParserRULE_lexerCommandName) + p.SetState(442) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case ANTLRv4ParserRULE_REF, ANTLRv4ParserTOKEN_REF: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(440) + p.Identifier() + } + + case ANTLRv4ParserMODE: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(441) + p.Match(ANTLRv4ParserMODE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILexerCommandExprContext is an interface to support dynamic dispatch. +type ILexerCommandExprContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Identifier() IIdentifierContext + INT() antlr.TerminalNode + + // IsLexerCommandExprContext differentiates from other interfaces. + IsLexerCommandExprContext() +} + +type LexerCommandExprContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLexerCommandExprContext() *LexerCommandExprContext { + var p = new(LexerCommandExprContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerCommandExpr + return p +} + +func InitEmptyLexerCommandExprContext(p *LexerCommandExprContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerCommandExpr +} + +func (*LexerCommandExprContext) IsLexerCommandExprContext() {} + +func NewLexerCommandExprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LexerCommandExprContext { + var p = new(LexerCommandExprContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_lexerCommandExpr + + return p +} + +func (s *LexerCommandExprContext) GetParser() antlr.Parser { return s.parser } + +func (s *LexerCommandExprContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *LexerCommandExprContext) INT() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserINT, 0) +} + +func (s *LexerCommandExprContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *LexerCommandExprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *LexerCommandExprContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterLexerCommandExpr(s) + } +} + +func (s *LexerCommandExprContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitLexerCommandExpr(s) + } +} + +func (s *LexerCommandExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitLexerCommandExpr(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) LexerCommandExpr() (localctx ILexerCommandExprContext) { + localctx = NewLexerCommandExprContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 86, ANTLRv4ParserRULE_lexerCommandExpr) + p.SetState(446) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case ANTLRv4ParserRULE_REF, ANTLRv4ParserTOKEN_REF: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(444) + p.Identifier() + } + + case ANTLRv4ParserINT: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(445) + p.Match(ANTLRv4ParserINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAltListContext is an interface to support dynamic dispatch. +type IAltListContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllAlternative() []IAlternativeContext + Alternative(i int) IAlternativeContext + AllOR() []antlr.TerminalNode + OR(i int) antlr.TerminalNode + + // IsAltListContext differentiates from other interfaces. + IsAltListContext() +} + +type AltListContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAltListContext() *AltListContext { + var p = new(AltListContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_altList + return p +} + +func InitEmptyAltListContext(p *AltListContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_altList +} + +func (*AltListContext) IsAltListContext() {} + +func NewAltListContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AltListContext { + var p = new(AltListContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_altList + + return p +} + +func (s *AltListContext) GetParser() antlr.Parser { return s.parser } + +func (s *AltListContext) AllAlternative() []IAlternativeContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IAlternativeContext); ok { + len++ + } + } + + tst := make([]IAlternativeContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IAlternativeContext); ok { + tst[i] = t.(IAlternativeContext) + i++ + } + } + + return tst +} + +func (s *AltListContext) Alternative(i int) IAlternativeContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlternativeContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IAlternativeContext) +} + +func (s *AltListContext) AllOR() []antlr.TerminalNode { + return s.GetTokens(ANTLRv4ParserOR) +} + +func (s *AltListContext) OR(i int) antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserOR, i) +} + +func (s *AltListContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AltListContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AltListContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterAltList(s) + } +} + +func (s *AltListContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitAltList(s) + } +} + +func (s *AltListContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitAltList(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) AltList() (localctx IAltListContext) { + localctx = NewAltListContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 88, ANTLRv4ParserRULE_altList) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(448) + p.Alternative() + } + p.SetState(453) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == ANTLRv4ParserOR { + { + p.SetState(449) + p.Match(ANTLRv4ParserOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(450) + p.Alternative() + } + + p.SetState(455) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlternativeContext is an interface to support dynamic dispatch. +type IAlternativeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ElementOptions() IElementOptionsContext + AllElement() []IElementContext + Element(i int) IElementContext + + // IsAlternativeContext differentiates from other interfaces. + IsAlternativeContext() +} + +type AlternativeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlternativeContext() *AlternativeContext { + var p = new(AlternativeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_alternative + return p +} + +func InitEmptyAlternativeContext(p *AlternativeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_alternative +} + +func (*AlternativeContext) IsAlternativeContext() {} + +func NewAlternativeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlternativeContext { + var p = new(AlternativeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_alternative + + return p +} + +func (s *AlternativeContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlternativeContext) ElementOptions() IElementOptionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IElementOptionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IElementOptionsContext) +} + +func (s *AlternativeContext) AllElement() []IElementContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IElementContext); ok { + len++ + } + } + + tst := make([]IElementContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IElementContext); ok { + tst[i] = t.(IElementContext) + i++ + } + } + + return tst +} + +func (s *AlternativeContext) Element(i int) IElementContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IElementContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IElementContext) +} + +func (s *AlternativeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlternativeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlternativeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterAlternative(s) + } +} + +func (s *AlternativeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitAlternative(s) + } +} + +func (s *AlternativeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitAlternative(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) Alternative() (localctx IAlternativeContext) { + localctx = NewAlternativeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 90, ANTLRv4ParserRULE_alternative) + var _la int + + p.SetState(465) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case ANTLRv4ParserACTION, ANTLRv4ParserRULE_REF, ANTLRv4ParserSTRING_LITERAL, ANTLRv4ParserTOKEN_REF, ANTLRv4ParserLPAREN, ANTLRv4ParserLT, ANTLRv4ParserDOT, ANTLRv4ParserNOT: + p.EnterOuterAlt(localctx, 1) + p.SetState(457) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserLT { + { + p.SetState(456) + p.ElementOptions() + } + + } + p.SetState(460) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for ok := true; ok; ok = ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&18014398509482818) != 0) || _la == ANTLRv4ParserDOT || _la == ANTLRv4ParserNOT { + { + p.SetState(459) + p.Element() + } + + p.SetState(462) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + + case ANTLRv4ParserSEMI, ANTLRv4ParserRPAREN, ANTLRv4ParserOR, ANTLRv4ParserPOUND: + p.EnterOuterAlt(localctx, 2) + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IElementContext is an interface to support dynamic dispatch. +type IElementContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LabeledElement() ILabeledElementContext + EbnfSuffix() IEbnfSuffixContext + Atom() IAtomContext + Ebnf() IEbnfContext + ActionBlock() IActionBlockContext + QUESTION() antlr.TerminalNode + PredicateOptions() IPredicateOptionsContext + + // IsElementContext differentiates from other interfaces. + IsElementContext() +} + +type ElementContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyElementContext() *ElementContext { + var p = new(ElementContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_element + return p +} + +func InitEmptyElementContext(p *ElementContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_element +} + +func (*ElementContext) IsElementContext() {} + +func NewElementContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ElementContext { + var p = new(ElementContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_element + + return p +} + +func (s *ElementContext) GetParser() antlr.Parser { return s.parser } + +func (s *ElementContext) LabeledElement() ILabeledElementContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILabeledElementContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILabeledElementContext) +} + +func (s *ElementContext) EbnfSuffix() IEbnfSuffixContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IEbnfSuffixContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IEbnfSuffixContext) +} + +func (s *ElementContext) Atom() IAtomContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAtomContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAtomContext) +} + +func (s *ElementContext) Ebnf() IEbnfContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IEbnfContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IEbnfContext) +} + +func (s *ElementContext) ActionBlock() IActionBlockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IActionBlockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IActionBlockContext) +} + +func (s *ElementContext) QUESTION() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserQUESTION, 0) +} + +func (s *ElementContext) PredicateOptions() IPredicateOptionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPredicateOptionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPredicateOptionsContext) +} + +func (s *ElementContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ElementContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ElementContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterElement(s) + } +} + +func (s *ElementContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitElement(s) + } +} + +func (s *ElementContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitElement(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) Element() (localctx IElementContext) { + localctx = NewElementContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 92, ANTLRv4ParserRULE_element) + var _la int + + p.SetState(485) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 55, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(467) + p.LabeledElement() + } + p.SetState(470) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case ANTLRv4ParserQUESTION, ANTLRv4ParserSTAR, ANTLRv4ParserPLUS: + { + p.SetState(468) + p.EbnfSuffix() + } + + case ANTLRv4ParserACTION, ANTLRv4ParserRULE_REF, ANTLRv4ParserSTRING_LITERAL, ANTLRv4ParserTOKEN_REF, ANTLRv4ParserSEMI, ANTLRv4ParserLPAREN, ANTLRv4ParserRPAREN, ANTLRv4ParserOR, ANTLRv4ParserDOT, ANTLRv4ParserPOUND, ANTLRv4ParserNOT: + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(472) + p.Atom() + } + p.SetState(475) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case ANTLRv4ParserQUESTION, ANTLRv4ParserSTAR, ANTLRv4ParserPLUS: + { + p.SetState(473) + p.EbnfSuffix() + } + + case ANTLRv4ParserACTION, ANTLRv4ParserRULE_REF, ANTLRv4ParserSTRING_LITERAL, ANTLRv4ParserTOKEN_REF, ANTLRv4ParserSEMI, ANTLRv4ParserLPAREN, ANTLRv4ParserRPAREN, ANTLRv4ParserOR, ANTLRv4ParserDOT, ANTLRv4ParserPOUND, ANTLRv4ParserNOT: + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(477) + p.Ebnf() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(478) + p.ActionBlock() + } + p.SetState(480) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserQUESTION { + { + p.SetState(479) + p.Match(ANTLRv4ParserQUESTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + p.SetState(483) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserLT { + { + p.SetState(482) + p.PredicateOptions() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPredicateOptionsContext is an interface to support dynamic dispatch. +type IPredicateOptionsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LT() antlr.TerminalNode + AllPredicateOption() []IPredicateOptionContext + PredicateOption(i int) IPredicateOptionContext + GT() antlr.TerminalNode + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsPredicateOptionsContext differentiates from other interfaces. + IsPredicateOptionsContext() +} + +type PredicateOptionsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPredicateOptionsContext() *PredicateOptionsContext { + var p = new(PredicateOptionsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_predicateOptions + return p +} + +func InitEmptyPredicateOptionsContext(p *PredicateOptionsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_predicateOptions +} + +func (*PredicateOptionsContext) IsPredicateOptionsContext() {} + +func NewPredicateOptionsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PredicateOptionsContext { + var p = new(PredicateOptionsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_predicateOptions + + return p +} + +func (s *PredicateOptionsContext) GetParser() antlr.Parser { return s.parser } + +func (s *PredicateOptionsContext) LT() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserLT, 0) +} + +func (s *PredicateOptionsContext) AllPredicateOption() []IPredicateOptionContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IPredicateOptionContext); ok { + len++ + } + } + + tst := make([]IPredicateOptionContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IPredicateOptionContext); ok { + tst[i] = t.(IPredicateOptionContext) + i++ + } + } + + return tst +} + +func (s *PredicateOptionsContext) PredicateOption(i int) IPredicateOptionContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPredicateOptionContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IPredicateOptionContext) +} + +func (s *PredicateOptionsContext) GT() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserGT, 0) +} + +func (s *PredicateOptionsContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(ANTLRv4ParserCOMMA) +} + +func (s *PredicateOptionsContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserCOMMA, i) +} + +func (s *PredicateOptionsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *PredicateOptionsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *PredicateOptionsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterPredicateOptions(s) + } +} + +func (s *PredicateOptionsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitPredicateOptions(s) + } +} + +func (s *PredicateOptionsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitPredicateOptions(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) PredicateOptions() (localctx IPredicateOptionsContext) { + localctx = NewPredicateOptionsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 94, ANTLRv4ParserRULE_predicateOptions) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(487) + p.Match(ANTLRv4ParserLT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(488) + p.PredicateOption() + } + p.SetState(493) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == ANTLRv4ParserCOMMA { + { + p.SetState(489) + p.Match(ANTLRv4ParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(490) + p.PredicateOption() + } + + p.SetState(495) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + { + p.SetState(496) + p.Match(ANTLRv4ParserGT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPredicateOptionContext is an interface to support dynamic dispatch. +type IPredicateOptionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ElementOption() IElementOptionContext + Identifier() IIdentifierContext + ASSIGN() antlr.TerminalNode + ActionBlock() IActionBlockContext + INT() antlr.TerminalNode + STRING_LITERAL() antlr.TerminalNode + + // IsPredicateOptionContext differentiates from other interfaces. + IsPredicateOptionContext() +} + +type PredicateOptionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPredicateOptionContext() *PredicateOptionContext { + var p = new(PredicateOptionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_predicateOption + return p +} + +func InitEmptyPredicateOptionContext(p *PredicateOptionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_predicateOption +} + +func (*PredicateOptionContext) IsPredicateOptionContext() {} + +func NewPredicateOptionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PredicateOptionContext { + var p = new(PredicateOptionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_predicateOption + + return p +} + +func (s *PredicateOptionContext) GetParser() antlr.Parser { return s.parser } + +func (s *PredicateOptionContext) ElementOption() IElementOptionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IElementOptionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IElementOptionContext) +} + +func (s *PredicateOptionContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *PredicateOptionContext) ASSIGN() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserASSIGN, 0) +} + +func (s *PredicateOptionContext) ActionBlock() IActionBlockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IActionBlockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IActionBlockContext) +} + +func (s *PredicateOptionContext) INT() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserINT, 0) +} + +func (s *PredicateOptionContext) STRING_LITERAL() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserSTRING_LITERAL, 0) +} + +func (s *PredicateOptionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *PredicateOptionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *PredicateOptionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterPredicateOption(s) + } +} + +func (s *PredicateOptionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitPredicateOption(s) + } +} + +func (s *PredicateOptionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitPredicateOption(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) PredicateOption() (localctx IPredicateOptionContext) { + localctx = NewPredicateOptionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 96, ANTLRv4ParserRULE_predicateOption) + p.SetState(506) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 58, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(498) + p.ElementOption() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(499) + p.Identifier() + } + { + p.SetState(500) + p.Match(ANTLRv4ParserASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(504) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case ANTLRv4ParserACTION: + { + p.SetState(501) + p.ActionBlock() + } + + case ANTLRv4ParserINT: + { + p.SetState(502) + p.Match(ANTLRv4ParserINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case ANTLRv4ParserSTRING_LITERAL: + { + p.SetState(503) + p.Match(ANTLRv4ParserSTRING_LITERAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILabeledElementContext is an interface to support dynamic dispatch. +type ILabeledElementContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Identifier() IIdentifierContext + ASSIGN() antlr.TerminalNode + PLUS_ASSIGN() antlr.TerminalNode + Atom() IAtomContext + Block() IBlockContext + + // IsLabeledElementContext differentiates from other interfaces. + IsLabeledElementContext() +} + +type LabeledElementContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLabeledElementContext() *LabeledElementContext { + var p = new(LabeledElementContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_labeledElement + return p +} + +func InitEmptyLabeledElementContext(p *LabeledElementContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_labeledElement +} + +func (*LabeledElementContext) IsLabeledElementContext() {} + +func NewLabeledElementContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LabeledElementContext { + var p = new(LabeledElementContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_labeledElement + + return p +} + +func (s *LabeledElementContext) GetParser() antlr.Parser { return s.parser } + +func (s *LabeledElementContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *LabeledElementContext) ASSIGN() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserASSIGN, 0) +} + +func (s *LabeledElementContext) PLUS_ASSIGN() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserPLUS_ASSIGN, 0) +} + +func (s *LabeledElementContext) Atom() IAtomContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAtomContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAtomContext) +} + +func (s *LabeledElementContext) Block() IBlockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IBlockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IBlockContext) +} + +func (s *LabeledElementContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *LabeledElementContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *LabeledElementContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterLabeledElement(s) + } +} + +func (s *LabeledElementContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitLabeledElement(s) + } +} + +func (s *LabeledElementContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitLabeledElement(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) LabeledElement() (localctx ILabeledElementContext) { + localctx = NewLabeledElementContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 98, ANTLRv4ParserRULE_labeledElement) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(508) + p.Identifier() + } + { + p.SetState(509) + _la = p.GetTokenStream().LA(1) + + if !(_la == ANTLRv4ParserASSIGN || _la == ANTLRv4ParserPLUS_ASSIGN) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + p.SetState(512) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case ANTLRv4ParserRULE_REF, ANTLRv4ParserSTRING_LITERAL, ANTLRv4ParserTOKEN_REF, ANTLRv4ParserDOT, ANTLRv4ParserNOT: + { + p.SetState(510) + p.Atom() + } + + case ANTLRv4ParserLPAREN: + { + p.SetState(511) + p.Block() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IEbnfContext is an interface to support dynamic dispatch. +type IEbnfContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Block() IBlockContext + BlockSuffix() IBlockSuffixContext + + // IsEbnfContext differentiates from other interfaces. + IsEbnfContext() +} + +type EbnfContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyEbnfContext() *EbnfContext { + var p = new(EbnfContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ebnf + return p +} + +func InitEmptyEbnfContext(p *EbnfContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ebnf +} + +func (*EbnfContext) IsEbnfContext() {} + +func NewEbnfContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *EbnfContext { + var p = new(EbnfContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_ebnf + + return p +} + +func (s *EbnfContext) GetParser() antlr.Parser { return s.parser } + +func (s *EbnfContext) Block() IBlockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IBlockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IBlockContext) +} + +func (s *EbnfContext) BlockSuffix() IBlockSuffixContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IBlockSuffixContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IBlockSuffixContext) +} + +func (s *EbnfContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *EbnfContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *EbnfContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterEbnf(s) + } +} + +func (s *EbnfContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitEbnf(s) + } +} + +func (s *EbnfContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitEbnf(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) Ebnf() (localctx IEbnfContext) { + localctx = NewEbnfContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 100, ANTLRv4ParserRULE_ebnf) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(514) + p.Block() + } + p.SetState(516) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&-5764607523034234880) != 0 { + { + p.SetState(515) + p.BlockSuffix() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IBlockSuffixContext is an interface to support dynamic dispatch. +type IBlockSuffixContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + EbnfSuffix() IEbnfSuffixContext + + // IsBlockSuffixContext differentiates from other interfaces. + IsBlockSuffixContext() +} + +type BlockSuffixContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyBlockSuffixContext() *BlockSuffixContext { + var p = new(BlockSuffixContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_blockSuffix + return p +} + +func InitEmptyBlockSuffixContext(p *BlockSuffixContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_blockSuffix +} + +func (*BlockSuffixContext) IsBlockSuffixContext() {} + +func NewBlockSuffixContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *BlockSuffixContext { + var p = new(BlockSuffixContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_blockSuffix + + return p +} + +func (s *BlockSuffixContext) GetParser() antlr.Parser { return s.parser } + +func (s *BlockSuffixContext) EbnfSuffix() IEbnfSuffixContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IEbnfSuffixContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IEbnfSuffixContext) +} + +func (s *BlockSuffixContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *BlockSuffixContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *BlockSuffixContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterBlockSuffix(s) + } +} + +func (s *BlockSuffixContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitBlockSuffix(s) + } +} + +func (s *BlockSuffixContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitBlockSuffix(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) BlockSuffix() (localctx IBlockSuffixContext) { + localctx = NewBlockSuffixContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 102, ANTLRv4ParserRULE_blockSuffix) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(518) + p.EbnfSuffix() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IEbnfSuffixContext is an interface to support dynamic dispatch. +type IEbnfSuffixContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllQUESTION() []antlr.TerminalNode + QUESTION(i int) antlr.TerminalNode + STAR() antlr.TerminalNode + PLUS() antlr.TerminalNode + + // IsEbnfSuffixContext differentiates from other interfaces. + IsEbnfSuffixContext() +} + +type EbnfSuffixContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyEbnfSuffixContext() *EbnfSuffixContext { + var p = new(EbnfSuffixContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ebnfSuffix + return p +} + +func InitEmptyEbnfSuffixContext(p *EbnfSuffixContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ebnfSuffix +} + +func (*EbnfSuffixContext) IsEbnfSuffixContext() {} + +func NewEbnfSuffixContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *EbnfSuffixContext { + var p = new(EbnfSuffixContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_ebnfSuffix + + return p +} + +func (s *EbnfSuffixContext) GetParser() antlr.Parser { return s.parser } + +func (s *EbnfSuffixContext) AllQUESTION() []antlr.TerminalNode { + return s.GetTokens(ANTLRv4ParserQUESTION) +} + +func (s *EbnfSuffixContext) QUESTION(i int) antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserQUESTION, i) +} + +func (s *EbnfSuffixContext) STAR() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserSTAR, 0) +} + +func (s *EbnfSuffixContext) PLUS() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserPLUS, 0) +} + +func (s *EbnfSuffixContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *EbnfSuffixContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *EbnfSuffixContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterEbnfSuffix(s) + } +} + +func (s *EbnfSuffixContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitEbnfSuffix(s) + } +} + +func (s *EbnfSuffixContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitEbnfSuffix(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) EbnfSuffix() (localctx IEbnfSuffixContext) { + localctx = NewEbnfSuffixContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 104, ANTLRv4ParserRULE_ebnfSuffix) + var _la int + + p.SetState(532) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case ANTLRv4ParserQUESTION: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(520) + p.Match(ANTLRv4ParserQUESTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(522) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserQUESTION { + { + p.SetState(521) + p.Match(ANTLRv4ParserQUESTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + + case ANTLRv4ParserSTAR: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(524) + p.Match(ANTLRv4ParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(526) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserQUESTION { + { + p.SetState(525) + p.Match(ANTLRv4ParserQUESTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + + case ANTLRv4ParserPLUS: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(528) + p.Match(ANTLRv4ParserPLUS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(530) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserQUESTION { + { + p.SetState(529) + p.Match(ANTLRv4ParserQUESTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILexerAtomContext is an interface to support dynamic dispatch. +type ILexerAtomContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CharacterRange() ICharacterRangeContext + TerminalDef() ITerminalDefContext + NotSet() INotSetContext + LEXER_CHAR_SET() antlr.TerminalNode + Wildcard() IWildcardContext + + // IsLexerAtomContext differentiates from other interfaces. + IsLexerAtomContext() +} + +type LexerAtomContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLexerAtomContext() *LexerAtomContext { + var p = new(LexerAtomContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerAtom + return p +} + +func InitEmptyLexerAtomContext(p *LexerAtomContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_lexerAtom +} + +func (*LexerAtomContext) IsLexerAtomContext() {} + +func NewLexerAtomContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LexerAtomContext { + var p = new(LexerAtomContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_lexerAtom + + return p +} + +func (s *LexerAtomContext) GetParser() antlr.Parser { return s.parser } + +func (s *LexerAtomContext) CharacterRange() ICharacterRangeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICharacterRangeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICharacterRangeContext) +} + +func (s *LexerAtomContext) TerminalDef() ITerminalDefContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITerminalDefContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITerminalDefContext) +} + +func (s *LexerAtomContext) NotSet() INotSetContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INotSetContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INotSetContext) +} + +func (s *LexerAtomContext) LEXER_CHAR_SET() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserLEXER_CHAR_SET, 0) +} + +func (s *LexerAtomContext) Wildcard() IWildcardContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWildcardContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWildcardContext) +} + +func (s *LexerAtomContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *LexerAtomContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *LexerAtomContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterLexerAtom(s) + } +} + +func (s *LexerAtomContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitLexerAtom(s) + } +} + +func (s *LexerAtomContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitLexerAtom(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) LexerAtom() (localctx ILexerAtomContext) { + localctx = NewLexerAtomContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 106, ANTLRv4ParserRULE_lexerAtom) + p.SetState(539) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 65, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(534) + p.CharacterRange() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(535) + p.TerminalDef() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(536) + p.NotSet() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(537) + p.Match(ANTLRv4ParserLEXER_CHAR_SET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(538) + p.Wildcard() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAtomContext is an interface to support dynamic dispatch. +type IAtomContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TerminalDef() ITerminalDefContext + Ruleref() IRulerefContext + NotSet() INotSetContext + Wildcard() IWildcardContext + + // IsAtomContext differentiates from other interfaces. + IsAtomContext() +} + +type AtomContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAtomContext() *AtomContext { + var p = new(AtomContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_atom + return p +} + +func InitEmptyAtomContext(p *AtomContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_atom +} + +func (*AtomContext) IsAtomContext() {} + +func NewAtomContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AtomContext { + var p = new(AtomContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_atom + + return p +} + +func (s *AtomContext) GetParser() antlr.Parser { return s.parser } + +func (s *AtomContext) TerminalDef() ITerminalDefContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITerminalDefContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITerminalDefContext) +} + +func (s *AtomContext) Ruleref() IRulerefContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRulerefContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRulerefContext) +} + +func (s *AtomContext) NotSet() INotSetContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INotSetContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INotSetContext) +} + +func (s *AtomContext) Wildcard() IWildcardContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWildcardContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWildcardContext) +} + +func (s *AtomContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AtomContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AtomContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterAtom(s) + } +} + +func (s *AtomContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitAtom(s) + } +} + +func (s *AtomContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitAtom(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) Atom() (localctx IAtomContext) { + localctx = NewAtomContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 108, ANTLRv4ParserRULE_atom) + p.SetState(545) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case ANTLRv4ParserSTRING_LITERAL, ANTLRv4ParserTOKEN_REF: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(541) + p.TerminalDef() + } + + case ANTLRv4ParserRULE_REF: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(542) + p.Ruleref() + } + + case ANTLRv4ParserNOT: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(543) + p.NotSet() + } + + case ANTLRv4ParserDOT: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(544) + p.Wildcard() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IWildcardContext is an interface to support dynamic dispatch. +type IWildcardContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DOT() antlr.TerminalNode + ElementOptions() IElementOptionsContext + + // IsWildcardContext differentiates from other interfaces. + IsWildcardContext() +} + +type WildcardContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyWildcardContext() *WildcardContext { + var p = new(WildcardContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_wildcard + return p +} + +func InitEmptyWildcardContext(p *WildcardContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_wildcard +} + +func (*WildcardContext) IsWildcardContext() {} + +func NewWildcardContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *WildcardContext { + var p = new(WildcardContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_wildcard + + return p +} + +func (s *WildcardContext) GetParser() antlr.Parser { return s.parser } + +func (s *WildcardContext) DOT() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserDOT, 0) +} + +func (s *WildcardContext) ElementOptions() IElementOptionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IElementOptionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IElementOptionsContext) +} + +func (s *WildcardContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *WildcardContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *WildcardContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterWildcard(s) + } +} + +func (s *WildcardContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitWildcard(s) + } +} + +func (s *WildcardContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitWildcard(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) Wildcard() (localctx IWildcardContext) { + localctx = NewWildcardContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 110, ANTLRv4ParserRULE_wildcard) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(547) + p.Match(ANTLRv4ParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(549) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserLT { + { + p.SetState(548) + p.ElementOptions() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// INotSetContext is an interface to support dynamic dispatch. +type INotSetContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NOT() antlr.TerminalNode + SetElement() ISetElementContext + BlockSet() IBlockSetContext + + // IsNotSetContext differentiates from other interfaces. + IsNotSetContext() +} + +type NotSetContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyNotSetContext() *NotSetContext { + var p = new(NotSetContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_notSet + return p +} + +func InitEmptyNotSetContext(p *NotSetContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_notSet +} + +func (*NotSetContext) IsNotSetContext() {} + +func NewNotSetContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *NotSetContext { + var p = new(NotSetContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_notSet + + return p +} + +func (s *NotSetContext) GetParser() antlr.Parser { return s.parser } + +func (s *NotSetContext) NOT() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserNOT, 0) +} + +func (s *NotSetContext) SetElement() ISetElementContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISetElementContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISetElementContext) +} + +func (s *NotSetContext) BlockSet() IBlockSetContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IBlockSetContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IBlockSetContext) +} + +func (s *NotSetContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *NotSetContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *NotSetContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterNotSet(s) + } +} + +func (s *NotSetContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitNotSet(s) + } +} + +func (s *NotSetContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitNotSet(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) NotSet() (localctx INotSetContext) { + localctx = NewNotSetContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 112, ANTLRv4ParserRULE_notSet) + p.SetState(555) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 68, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(551) + p.Match(ANTLRv4ParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(552) + p.SetElement() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(553) + p.Match(ANTLRv4ParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(554) + p.BlockSet() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IBlockSetContext is an interface to support dynamic dispatch. +type IBlockSetContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LPAREN() antlr.TerminalNode + AllSetElement() []ISetElementContext + SetElement(i int) ISetElementContext + RPAREN() antlr.TerminalNode + AllOR() []antlr.TerminalNode + OR(i int) antlr.TerminalNode + + // IsBlockSetContext differentiates from other interfaces. + IsBlockSetContext() +} + +type BlockSetContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyBlockSetContext() *BlockSetContext { + var p = new(BlockSetContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_blockSet + return p +} + +func InitEmptyBlockSetContext(p *BlockSetContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_blockSet +} + +func (*BlockSetContext) IsBlockSetContext() {} + +func NewBlockSetContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *BlockSetContext { + var p = new(BlockSetContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_blockSet + + return p +} + +func (s *BlockSetContext) GetParser() antlr.Parser { return s.parser } + +func (s *BlockSetContext) LPAREN() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserLPAREN, 0) +} + +func (s *BlockSetContext) AllSetElement() []ISetElementContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ISetElementContext); ok { + len++ + } + } + + tst := make([]ISetElementContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ISetElementContext); ok { + tst[i] = t.(ISetElementContext) + i++ + } + } + + return tst +} + +func (s *BlockSetContext) SetElement(i int) ISetElementContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISetElementContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ISetElementContext) +} + +func (s *BlockSetContext) RPAREN() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserRPAREN, 0) +} + +func (s *BlockSetContext) AllOR() []antlr.TerminalNode { + return s.GetTokens(ANTLRv4ParserOR) +} + +func (s *BlockSetContext) OR(i int) antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserOR, i) +} + +func (s *BlockSetContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *BlockSetContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *BlockSetContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterBlockSet(s) + } +} + +func (s *BlockSetContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitBlockSet(s) + } +} + +func (s *BlockSetContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitBlockSet(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) BlockSet() (localctx IBlockSetContext) { + localctx = NewBlockSetContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 114, ANTLRv4ParserRULE_blockSet) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(557) + p.Match(ANTLRv4ParserLPAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(558) + p.SetElement() + } + p.SetState(563) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == ANTLRv4ParserOR { + { + p.SetState(559) + p.Match(ANTLRv4ParserOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(560) + p.SetElement() + } + + p.SetState(565) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + { + p.SetState(566) + p.Match(ANTLRv4ParserRPAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISetElementContext is an interface to support dynamic dispatch. +type ISetElementContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TOKEN_REF() antlr.TerminalNode + ElementOptions() IElementOptionsContext + STRING_LITERAL() antlr.TerminalNode + CharacterRange() ICharacterRangeContext + LEXER_CHAR_SET() antlr.TerminalNode + + // IsSetElementContext differentiates from other interfaces. + IsSetElementContext() +} + +type SetElementContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySetElementContext() *SetElementContext { + var p = new(SetElementContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_setElement + return p +} + +func InitEmptySetElementContext(p *SetElementContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_setElement +} + +func (*SetElementContext) IsSetElementContext() {} + +func NewSetElementContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SetElementContext { + var p = new(SetElementContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_setElement + + return p +} + +func (s *SetElementContext) GetParser() antlr.Parser { return s.parser } + +func (s *SetElementContext) TOKEN_REF() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserTOKEN_REF, 0) +} + +func (s *SetElementContext) ElementOptions() IElementOptionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IElementOptionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IElementOptionsContext) +} + +func (s *SetElementContext) STRING_LITERAL() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserSTRING_LITERAL, 0) +} + +func (s *SetElementContext) CharacterRange() ICharacterRangeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICharacterRangeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICharacterRangeContext) +} + +func (s *SetElementContext) LEXER_CHAR_SET() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserLEXER_CHAR_SET, 0) +} + +func (s *SetElementContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *SetElementContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *SetElementContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterSetElement(s) + } +} + +func (s *SetElementContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitSetElement(s) + } +} + +func (s *SetElementContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitSetElement(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) SetElement() (localctx ISetElementContext) { + localctx = NewSetElementContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 116, ANTLRv4ParserRULE_setElement) + var _la int + + p.SetState(578) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 72, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(568) + p.Match(ANTLRv4ParserTOKEN_REF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(570) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserLT { + { + p.SetState(569) + p.ElementOptions() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(572) + p.Match(ANTLRv4ParserSTRING_LITERAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(574) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserLT { + { + p.SetState(573) + p.ElementOptions() + } + + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(576) + p.CharacterRange() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(577) + p.Match(ANTLRv4ParserLEXER_CHAR_SET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IBlockContext is an interface to support dynamic dispatch. +type IBlockContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LPAREN() antlr.TerminalNode + AltList() IAltListContext + RPAREN() antlr.TerminalNode + COLON() antlr.TerminalNode + OptionsSpec() IOptionsSpecContext + AllRuleAction() []IRuleActionContext + RuleAction(i int) IRuleActionContext + + // IsBlockContext differentiates from other interfaces. + IsBlockContext() +} + +type BlockContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyBlockContext() *BlockContext { + var p = new(BlockContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_block + return p +} + +func InitEmptyBlockContext(p *BlockContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_block +} + +func (*BlockContext) IsBlockContext() {} + +func NewBlockContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *BlockContext { + var p = new(BlockContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_block + + return p +} + +func (s *BlockContext) GetParser() antlr.Parser { return s.parser } + +func (s *BlockContext) LPAREN() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserLPAREN, 0) +} + +func (s *BlockContext) AltList() IAltListContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAltListContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAltListContext) +} + +func (s *BlockContext) RPAREN() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserRPAREN, 0) +} + +func (s *BlockContext) COLON() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserCOLON, 0) +} + +func (s *BlockContext) OptionsSpec() IOptionsSpecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptionsSpecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptionsSpecContext) +} + +func (s *BlockContext) AllRuleAction() []IRuleActionContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IRuleActionContext); ok { + len++ + } + } + + tst := make([]IRuleActionContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IRuleActionContext); ok { + tst[i] = t.(IRuleActionContext) + i++ + } + } + + return tst +} + +func (s *BlockContext) RuleAction(i int) IRuleActionContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRuleActionContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IRuleActionContext) +} + +func (s *BlockContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *BlockContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *BlockContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterBlock(s) + } +} + +func (s *BlockContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitBlock(s) + } +} + +func (s *BlockContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitBlock(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) Block() (localctx IBlockContext) { + localctx = NewBlockContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 118, ANTLRv4ParserRULE_block) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(580) + p.Match(ANTLRv4ParserLPAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(591) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if (int64((_la-33)) & ^0x3f) == 0 && ((int64(1)<<(_la-33))&34359869441) != 0 { + p.SetState(582) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserOPTIONS { + { + p.SetState(581) + p.OptionsSpec() + } + + } + p.SetState(587) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == ANTLRv4ParserAT { + { + p.SetState(584) + p.RuleAction() + } + + p.SetState(589) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + { + p.SetState(590) + p.Match(ANTLRv4ParserCOLON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(593) + p.AltList() + } + { + p.SetState(594) + p.Match(ANTLRv4ParserRPAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRulerefContext is an interface to support dynamic dispatch. +type IRulerefContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + RULE_REF() antlr.TerminalNode + ArgActionBlock() IArgActionBlockContext + ElementOptions() IElementOptionsContext + + // IsRulerefContext differentiates from other interfaces. + IsRulerefContext() +} + +type RulerefContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRulerefContext() *RulerefContext { + var p = new(RulerefContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ruleref + return p +} + +func InitEmptyRulerefContext(p *RulerefContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_ruleref +} + +func (*RulerefContext) IsRulerefContext() {} + +func NewRulerefContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RulerefContext { + var p = new(RulerefContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_ruleref + + return p +} + +func (s *RulerefContext) GetParser() antlr.Parser { return s.parser } + +func (s *RulerefContext) RULE_REF() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserRULE_REF, 0) +} + +func (s *RulerefContext) ArgActionBlock() IArgActionBlockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IArgActionBlockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IArgActionBlockContext) +} + +func (s *RulerefContext) ElementOptions() IElementOptionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IElementOptionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IElementOptionsContext) +} + +func (s *RulerefContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RulerefContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RulerefContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterRuleref(s) + } +} + +func (s *RulerefContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitRuleref(s) + } +} + +func (s *RulerefContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitRuleref(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) Ruleref() (localctx IRulerefContext) { + localctx = NewRulerefContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 120, ANTLRv4ParserRULE_ruleref) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(596) + p.Match(ANTLRv4ParserRULE_REF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(598) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserBEGIN_ARGUMENT { + { + p.SetState(597) + p.ArgActionBlock() + } + + } + p.SetState(601) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserLT { + { + p.SetState(600) + p.ElementOptions() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICharacterRangeContext is an interface to support dynamic dispatch. +type ICharacterRangeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllSTRING_LITERAL() []antlr.TerminalNode + STRING_LITERAL(i int) antlr.TerminalNode + RANGE() antlr.TerminalNode + + // IsCharacterRangeContext differentiates from other interfaces. + IsCharacterRangeContext() +} + +type CharacterRangeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCharacterRangeContext() *CharacterRangeContext { + var p = new(CharacterRangeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_characterRange + return p +} + +func InitEmptyCharacterRangeContext(p *CharacterRangeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_characterRange +} + +func (*CharacterRangeContext) IsCharacterRangeContext() {} + +func NewCharacterRangeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CharacterRangeContext { + var p = new(CharacterRangeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_characterRange + + return p +} + +func (s *CharacterRangeContext) GetParser() antlr.Parser { return s.parser } + +func (s *CharacterRangeContext) AllSTRING_LITERAL() []antlr.TerminalNode { + return s.GetTokens(ANTLRv4ParserSTRING_LITERAL) +} + +func (s *CharacterRangeContext) STRING_LITERAL(i int) antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserSTRING_LITERAL, i) +} + +func (s *CharacterRangeContext) RANGE() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserRANGE, 0) +} + +func (s *CharacterRangeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CharacterRangeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CharacterRangeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterCharacterRange(s) + } +} + +func (s *CharacterRangeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitCharacterRange(s) + } +} + +func (s *CharacterRangeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitCharacterRange(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) CharacterRange() (localctx ICharacterRangeContext) { + localctx = NewCharacterRangeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 122, ANTLRv4ParserRULE_characterRange) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(603) + p.Match(ANTLRv4ParserSTRING_LITERAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(604) + p.Match(ANTLRv4ParserRANGE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(605) + p.Match(ANTLRv4ParserSTRING_LITERAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITerminalDefContext is an interface to support dynamic dispatch. +type ITerminalDefContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TOKEN_REF() antlr.TerminalNode + ElementOptions() IElementOptionsContext + STRING_LITERAL() antlr.TerminalNode + + // IsTerminalDefContext differentiates from other interfaces. + IsTerminalDefContext() +} + +type TerminalDefContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTerminalDefContext() *TerminalDefContext { + var p = new(TerminalDefContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_terminalDef + return p +} + +func InitEmptyTerminalDefContext(p *TerminalDefContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_terminalDef +} + +func (*TerminalDefContext) IsTerminalDefContext() {} + +func NewTerminalDefContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TerminalDefContext { + var p = new(TerminalDefContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_terminalDef + + return p +} + +func (s *TerminalDefContext) GetParser() antlr.Parser { return s.parser } + +func (s *TerminalDefContext) TOKEN_REF() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserTOKEN_REF, 0) +} + +func (s *TerminalDefContext) ElementOptions() IElementOptionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IElementOptionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IElementOptionsContext) +} + +func (s *TerminalDefContext) STRING_LITERAL() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserSTRING_LITERAL, 0) +} + +func (s *TerminalDefContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TerminalDefContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TerminalDefContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterTerminalDef(s) + } +} + +func (s *TerminalDefContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitTerminalDef(s) + } +} + +func (s *TerminalDefContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitTerminalDef(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) TerminalDef() (localctx ITerminalDefContext) { + localctx = NewTerminalDefContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 124, ANTLRv4ParserRULE_terminalDef) + var _la int + + p.SetState(615) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case ANTLRv4ParserTOKEN_REF: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(607) + p.Match(ANTLRv4ParserTOKEN_REF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(609) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserLT { + { + p.SetState(608) + p.ElementOptions() + } + + } + + case ANTLRv4ParserSTRING_LITERAL: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(611) + p.Match(ANTLRv4ParserSTRING_LITERAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(613) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == ANTLRv4ParserLT { + { + p.SetState(612) + p.ElementOptions() + } + + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IElementOptionsContext is an interface to support dynamic dispatch. +type IElementOptionsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LT() antlr.TerminalNode + AllElementOption() []IElementOptionContext + ElementOption(i int) IElementOptionContext + GT() antlr.TerminalNode + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsElementOptionsContext differentiates from other interfaces. + IsElementOptionsContext() +} + +type ElementOptionsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyElementOptionsContext() *ElementOptionsContext { + var p = new(ElementOptionsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_elementOptions + return p +} + +func InitEmptyElementOptionsContext(p *ElementOptionsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_elementOptions +} + +func (*ElementOptionsContext) IsElementOptionsContext() {} + +func NewElementOptionsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ElementOptionsContext { + var p = new(ElementOptionsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_elementOptions + + return p +} + +func (s *ElementOptionsContext) GetParser() antlr.Parser { return s.parser } + +func (s *ElementOptionsContext) LT() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserLT, 0) +} + +func (s *ElementOptionsContext) AllElementOption() []IElementOptionContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IElementOptionContext); ok { + len++ + } + } + + tst := make([]IElementOptionContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IElementOptionContext); ok { + tst[i] = t.(IElementOptionContext) + i++ + } + } + + return tst +} + +func (s *ElementOptionsContext) ElementOption(i int) IElementOptionContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IElementOptionContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IElementOptionContext) +} + +func (s *ElementOptionsContext) GT() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserGT, 0) +} + +func (s *ElementOptionsContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(ANTLRv4ParserCOMMA) +} + +func (s *ElementOptionsContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserCOMMA, i) +} + +func (s *ElementOptionsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ElementOptionsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ElementOptionsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterElementOptions(s) + } +} + +func (s *ElementOptionsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitElementOptions(s) + } +} + +func (s *ElementOptionsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitElementOptions(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) ElementOptions() (localctx IElementOptionsContext) { + localctx = NewElementOptionsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 126, ANTLRv4ParserRULE_elementOptions) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(617) + p.Match(ANTLRv4ParserLT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(618) + p.ElementOption() + } + p.SetState(623) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == ANTLRv4ParserCOMMA { + { + p.SetState(619) + p.Match(ANTLRv4ParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(620) + p.ElementOption() + } + + p.SetState(625) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + { + p.SetState(626) + p.Match(ANTLRv4ParserGT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IElementOptionContext is an interface to support dynamic dispatch. +type IElementOptionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + QualifiedIdentifier() IQualifiedIdentifierContext + Identifier() IIdentifierContext + ASSIGN() antlr.TerminalNode + STRING_LITERAL() antlr.TerminalNode + INT() antlr.TerminalNode + + // IsElementOptionContext differentiates from other interfaces. + IsElementOptionContext() +} + +type ElementOptionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyElementOptionContext() *ElementOptionContext { + var p = new(ElementOptionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_elementOption + return p +} + +func InitEmptyElementOptionContext(p *ElementOptionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_elementOption +} + +func (*ElementOptionContext) IsElementOptionContext() {} + +func NewElementOptionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ElementOptionContext { + var p = new(ElementOptionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_elementOption + + return p +} + +func (s *ElementOptionContext) GetParser() antlr.Parser { return s.parser } + +func (s *ElementOptionContext) QualifiedIdentifier() IQualifiedIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualifiedIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualifiedIdentifierContext) +} + +func (s *ElementOptionContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *ElementOptionContext) ASSIGN() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserASSIGN, 0) +} + +func (s *ElementOptionContext) STRING_LITERAL() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserSTRING_LITERAL, 0) +} + +func (s *ElementOptionContext) INT() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserINT, 0) +} + +func (s *ElementOptionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ElementOptionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ElementOptionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterElementOption(s) + } +} + +func (s *ElementOptionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitElementOption(s) + } +} + +func (s *ElementOptionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitElementOption(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) ElementOption() (localctx IElementOptionContext) { + localctx = NewElementOptionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 128, ANTLRv4ParserRULE_elementOption) + p.SetState(636) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 83, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(628) + p.QualifiedIdentifier() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(629) + p.Identifier() + } + { + p.SetState(630) + p.Match(ANTLRv4ParserASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(634) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case ANTLRv4ParserRULE_REF, ANTLRv4ParserTOKEN_REF: + { + p.SetState(631) + p.QualifiedIdentifier() + } + + case ANTLRv4ParserSTRING_LITERAL: + { + p.SetState(632) + p.Match(ANTLRv4ParserSTRING_LITERAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case ANTLRv4ParserINT: + { + p.SetState(633) + p.Match(ANTLRv4ParserINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IIdentifierContext is an interface to support dynamic dispatch. +type IIdentifierContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + RULE_REF() antlr.TerminalNode + TOKEN_REF() antlr.TerminalNode + + // IsIdentifierContext differentiates from other interfaces. + IsIdentifierContext() +} + +type IdentifierContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyIdentifierContext() *IdentifierContext { + var p = new(IdentifierContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_identifier + return p +} + +func InitEmptyIdentifierContext(p *IdentifierContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_identifier +} + +func (*IdentifierContext) IsIdentifierContext() {} + +func NewIdentifierContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *IdentifierContext { + var p = new(IdentifierContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_identifier + + return p +} + +func (s *IdentifierContext) GetParser() antlr.Parser { return s.parser } + +func (s *IdentifierContext) RULE_REF() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserRULE_REF, 0) +} + +func (s *IdentifierContext) TOKEN_REF() antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserTOKEN_REF, 0) +} + +func (s *IdentifierContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *IdentifierContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *IdentifierContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterIdentifier(s) + } +} + +func (s *IdentifierContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitIdentifier(s) + } +} + +func (s *IdentifierContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitIdentifier(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) Identifier() (localctx IIdentifierContext) { + localctx = NewIdentifierContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 130, ANTLRv4ParserRULE_identifier) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(638) + _la = p.GetTokenStream().LA(1) + + if !(_la == ANTLRv4ParserRULE_REF || _la == ANTLRv4ParserTOKEN_REF) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IQualifiedIdentifierContext is an interface to support dynamic dispatch. +type IQualifiedIdentifierContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllIdentifier() []IIdentifierContext + Identifier(i int) IIdentifierContext + AllDOT() []antlr.TerminalNode + DOT(i int) antlr.TerminalNode + + // IsQualifiedIdentifierContext differentiates from other interfaces. + IsQualifiedIdentifierContext() +} + +type QualifiedIdentifierContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyQualifiedIdentifierContext() *QualifiedIdentifierContext { + var p = new(QualifiedIdentifierContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_qualifiedIdentifier + return p +} + +func InitEmptyQualifiedIdentifierContext(p *QualifiedIdentifierContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = ANTLRv4ParserRULE_qualifiedIdentifier +} + +func (*QualifiedIdentifierContext) IsQualifiedIdentifierContext() {} + +func NewQualifiedIdentifierContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *QualifiedIdentifierContext { + var p = new(QualifiedIdentifierContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = ANTLRv4ParserRULE_qualifiedIdentifier + + return p +} + +func (s *QualifiedIdentifierContext) GetParser() antlr.Parser { return s.parser } + +func (s *QualifiedIdentifierContext) AllIdentifier() []IIdentifierContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IIdentifierContext); ok { + len++ + } + } + + tst := make([]IIdentifierContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IIdentifierContext); ok { + tst[i] = t.(IIdentifierContext) + i++ + } + } + + return tst +} + +func (s *QualifiedIdentifierContext) Identifier(i int) IIdentifierContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *QualifiedIdentifierContext) AllDOT() []antlr.TerminalNode { + return s.GetTokens(ANTLRv4ParserDOT) +} + +func (s *QualifiedIdentifierContext) DOT(i int) antlr.TerminalNode { + return s.GetToken(ANTLRv4ParserDOT, i) +} + +func (s *QualifiedIdentifierContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *QualifiedIdentifierContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *QualifiedIdentifierContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.EnterQualifiedIdentifier(s) + } +} + +func (s *QualifiedIdentifierContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(ANTLRv4ParserListener); ok { + listenerT.ExitQualifiedIdentifier(s) + } +} + +func (s *QualifiedIdentifierContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case ANTLRv4ParserVisitor: + return t.VisitQualifiedIdentifier(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *ANTLRv4Parser) QualifiedIdentifier() (localctx IQualifiedIdentifierContext) { + localctx = NewQualifiedIdentifierContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 132, ANTLRv4ParserRULE_qualifiedIdentifier) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(640) + p.Identifier() + } + p.SetState(645) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == ANTLRv4ParserDOT { + { + p.SetState(641) + p.Match(ANTLRv4ParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(642) + p.Identifier() + } + + p.SetState(647) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} diff --git a/tools/grammar/antlrv4parser_base_listener.go b/tools/grammar/antlrv4parser_base_listener.go new file mode 100644 index 0000000..57c6672 --- /dev/null +++ b/tools/grammar/antlrv4parser_base_listener.go @@ -0,0 +1,423 @@ +// Code generated from ANTLRv4Parser.g4 by ANTLR 4.13.2. DO NOT EDIT. + +package grammar // ANTLRv4Parser +import "github.com/antlr4-go/antlr/v4" + +// BaseANTLRv4ParserListener is a complete listener for a parse tree produced by ANTLRv4Parser. +type BaseANTLRv4ParserListener struct{} + +var _ ANTLRv4ParserListener = &BaseANTLRv4ParserListener{} + +// VisitTerminal is called when a terminal node is visited. +func (s *BaseANTLRv4ParserListener) VisitTerminal(node antlr.TerminalNode) {} + +// VisitErrorNode is called when an error node is visited. +func (s *BaseANTLRv4ParserListener) VisitErrorNode(node antlr.ErrorNode) {} + +// EnterEveryRule is called when any rule is entered. +func (s *BaseANTLRv4ParserListener) EnterEveryRule(ctx antlr.ParserRuleContext) {} + +// ExitEveryRule is called when any rule is exited. +func (s *BaseANTLRv4ParserListener) ExitEveryRule(ctx antlr.ParserRuleContext) {} + +// EnterGrammarSpec is called when production grammarSpec is entered. +func (s *BaseANTLRv4ParserListener) EnterGrammarSpec(ctx *GrammarSpecContext) {} + +// ExitGrammarSpec is called when production grammarSpec is exited. +func (s *BaseANTLRv4ParserListener) ExitGrammarSpec(ctx *GrammarSpecContext) {} + +// EnterGrammarDecl is called when production grammarDecl is entered. +func (s *BaseANTLRv4ParserListener) EnterGrammarDecl(ctx *GrammarDeclContext) {} + +// ExitGrammarDecl is called when production grammarDecl is exited. +func (s *BaseANTLRv4ParserListener) ExitGrammarDecl(ctx *GrammarDeclContext) {} + +// EnterGrammarType is called when production grammarType is entered. +func (s *BaseANTLRv4ParserListener) EnterGrammarType(ctx *GrammarTypeContext) {} + +// ExitGrammarType is called when production grammarType is exited. +func (s *BaseANTLRv4ParserListener) ExitGrammarType(ctx *GrammarTypeContext) {} + +// EnterPrequelConstruct is called when production prequelConstruct is entered. +func (s *BaseANTLRv4ParserListener) EnterPrequelConstruct(ctx *PrequelConstructContext) {} + +// ExitPrequelConstruct is called when production prequelConstruct is exited. +func (s *BaseANTLRv4ParserListener) ExitPrequelConstruct(ctx *PrequelConstructContext) {} + +// EnterOptionsSpec is called when production optionsSpec is entered. +func (s *BaseANTLRv4ParserListener) EnterOptionsSpec(ctx *OptionsSpecContext) {} + +// ExitOptionsSpec is called when production optionsSpec is exited. +func (s *BaseANTLRv4ParserListener) ExitOptionsSpec(ctx *OptionsSpecContext) {} + +// EnterOption is called when production option is entered. +func (s *BaseANTLRv4ParserListener) EnterOption(ctx *OptionContext) {} + +// ExitOption is called when production option is exited. +func (s *BaseANTLRv4ParserListener) ExitOption(ctx *OptionContext) {} + +// EnterOptionValue is called when production optionValue is entered. +func (s *BaseANTLRv4ParserListener) EnterOptionValue(ctx *OptionValueContext) {} + +// ExitOptionValue is called when production optionValue is exited. +func (s *BaseANTLRv4ParserListener) ExitOptionValue(ctx *OptionValueContext) {} + +// EnterDelegateGrammars is called when production delegateGrammars is entered. +func (s *BaseANTLRv4ParserListener) EnterDelegateGrammars(ctx *DelegateGrammarsContext) {} + +// ExitDelegateGrammars is called when production delegateGrammars is exited. +func (s *BaseANTLRv4ParserListener) ExitDelegateGrammars(ctx *DelegateGrammarsContext) {} + +// EnterDelegateGrammar is called when production delegateGrammar is entered. +func (s *BaseANTLRv4ParserListener) EnterDelegateGrammar(ctx *DelegateGrammarContext) {} + +// ExitDelegateGrammar is called when production delegateGrammar is exited. +func (s *BaseANTLRv4ParserListener) ExitDelegateGrammar(ctx *DelegateGrammarContext) {} + +// EnterTokensSpec is called when production tokensSpec is entered. +func (s *BaseANTLRv4ParserListener) EnterTokensSpec(ctx *TokensSpecContext) {} + +// ExitTokensSpec is called when production tokensSpec is exited. +func (s *BaseANTLRv4ParserListener) ExitTokensSpec(ctx *TokensSpecContext) {} + +// EnterChannelsSpec is called when production channelsSpec is entered. +func (s *BaseANTLRv4ParserListener) EnterChannelsSpec(ctx *ChannelsSpecContext) {} + +// ExitChannelsSpec is called when production channelsSpec is exited. +func (s *BaseANTLRv4ParserListener) ExitChannelsSpec(ctx *ChannelsSpecContext) {} + +// EnterIdList is called when production idList is entered. +func (s *BaseANTLRv4ParserListener) EnterIdList(ctx *IdListContext) {} + +// ExitIdList is called when production idList is exited. +func (s *BaseANTLRv4ParserListener) ExitIdList(ctx *IdListContext) {} + +// EnterAction_ is called when production action_ is entered. +func (s *BaseANTLRv4ParserListener) EnterAction_(ctx *Action_Context) {} + +// ExitAction_ is called when production action_ is exited. +func (s *BaseANTLRv4ParserListener) ExitAction_(ctx *Action_Context) {} + +// EnterActionScopeName is called when production actionScopeName is entered. +func (s *BaseANTLRv4ParserListener) EnterActionScopeName(ctx *ActionScopeNameContext) {} + +// ExitActionScopeName is called when production actionScopeName is exited. +func (s *BaseANTLRv4ParserListener) ExitActionScopeName(ctx *ActionScopeNameContext) {} + +// EnterActionBlock is called when production actionBlock is entered. +func (s *BaseANTLRv4ParserListener) EnterActionBlock(ctx *ActionBlockContext) {} + +// ExitActionBlock is called when production actionBlock is exited. +func (s *BaseANTLRv4ParserListener) ExitActionBlock(ctx *ActionBlockContext) {} + +// EnterArgActionBlock is called when production argActionBlock is entered. +func (s *BaseANTLRv4ParserListener) EnterArgActionBlock(ctx *ArgActionBlockContext) {} + +// ExitArgActionBlock is called when production argActionBlock is exited. +func (s *BaseANTLRv4ParserListener) ExitArgActionBlock(ctx *ArgActionBlockContext) {} + +// EnterModeSpec is called when production modeSpec is entered. +func (s *BaseANTLRv4ParserListener) EnterModeSpec(ctx *ModeSpecContext) {} + +// ExitModeSpec is called when production modeSpec is exited. +func (s *BaseANTLRv4ParserListener) ExitModeSpec(ctx *ModeSpecContext) {} + +// EnterRules is called when production rules is entered. +func (s *BaseANTLRv4ParserListener) EnterRules(ctx *RulesContext) {} + +// ExitRules is called when production rules is exited. +func (s *BaseANTLRv4ParserListener) ExitRules(ctx *RulesContext) {} + +// EnterRuleSpec is called when production ruleSpec is entered. +func (s *BaseANTLRv4ParserListener) EnterRuleSpec(ctx *RuleSpecContext) {} + +// ExitRuleSpec is called when production ruleSpec is exited. +func (s *BaseANTLRv4ParserListener) ExitRuleSpec(ctx *RuleSpecContext) {} + +// EnterParserRuleSpec is called when production parserRuleSpec is entered. +func (s *BaseANTLRv4ParserListener) EnterParserRuleSpec(ctx *ParserRuleSpecContext) {} + +// ExitParserRuleSpec is called when production parserRuleSpec is exited. +func (s *BaseANTLRv4ParserListener) ExitParserRuleSpec(ctx *ParserRuleSpecContext) {} + +// EnterExceptionGroup is called when production exceptionGroup is entered. +func (s *BaseANTLRv4ParserListener) EnterExceptionGroup(ctx *ExceptionGroupContext) {} + +// ExitExceptionGroup is called when production exceptionGroup is exited. +func (s *BaseANTLRv4ParserListener) ExitExceptionGroup(ctx *ExceptionGroupContext) {} + +// EnterExceptionHandler is called when production exceptionHandler is entered. +func (s *BaseANTLRv4ParserListener) EnterExceptionHandler(ctx *ExceptionHandlerContext) {} + +// ExitExceptionHandler is called when production exceptionHandler is exited. +func (s *BaseANTLRv4ParserListener) ExitExceptionHandler(ctx *ExceptionHandlerContext) {} + +// EnterFinallyClause is called when production finallyClause is entered. +func (s *BaseANTLRv4ParserListener) EnterFinallyClause(ctx *FinallyClauseContext) {} + +// ExitFinallyClause is called when production finallyClause is exited. +func (s *BaseANTLRv4ParserListener) ExitFinallyClause(ctx *FinallyClauseContext) {} + +// EnterRulePrequel is called when production rulePrequel is entered. +func (s *BaseANTLRv4ParserListener) EnterRulePrequel(ctx *RulePrequelContext) {} + +// ExitRulePrequel is called when production rulePrequel is exited. +func (s *BaseANTLRv4ParserListener) ExitRulePrequel(ctx *RulePrequelContext) {} + +// EnterRuleReturns is called when production ruleReturns is entered. +func (s *BaseANTLRv4ParserListener) EnterRuleReturns(ctx *RuleReturnsContext) {} + +// ExitRuleReturns is called when production ruleReturns is exited. +func (s *BaseANTLRv4ParserListener) ExitRuleReturns(ctx *RuleReturnsContext) {} + +// EnterThrowsSpec is called when production throwsSpec is entered. +func (s *BaseANTLRv4ParserListener) EnterThrowsSpec(ctx *ThrowsSpecContext) {} + +// ExitThrowsSpec is called when production throwsSpec is exited. +func (s *BaseANTLRv4ParserListener) ExitThrowsSpec(ctx *ThrowsSpecContext) {} + +// EnterLocalsSpec is called when production localsSpec is entered. +func (s *BaseANTLRv4ParserListener) EnterLocalsSpec(ctx *LocalsSpecContext) {} + +// ExitLocalsSpec is called when production localsSpec is exited. +func (s *BaseANTLRv4ParserListener) ExitLocalsSpec(ctx *LocalsSpecContext) {} + +// EnterRuleAction is called when production ruleAction is entered. +func (s *BaseANTLRv4ParserListener) EnterRuleAction(ctx *RuleActionContext) {} + +// ExitRuleAction is called when production ruleAction is exited. +func (s *BaseANTLRv4ParserListener) ExitRuleAction(ctx *RuleActionContext) {} + +// EnterRuleModifiers is called when production ruleModifiers is entered. +func (s *BaseANTLRv4ParserListener) EnterRuleModifiers(ctx *RuleModifiersContext) {} + +// ExitRuleModifiers is called when production ruleModifiers is exited. +func (s *BaseANTLRv4ParserListener) ExitRuleModifiers(ctx *RuleModifiersContext) {} + +// EnterRuleModifier is called when production ruleModifier is entered. +func (s *BaseANTLRv4ParserListener) EnterRuleModifier(ctx *RuleModifierContext) {} + +// ExitRuleModifier is called when production ruleModifier is exited. +func (s *BaseANTLRv4ParserListener) ExitRuleModifier(ctx *RuleModifierContext) {} + +// EnterRuleBlock is called when production ruleBlock is entered. +func (s *BaseANTLRv4ParserListener) EnterRuleBlock(ctx *RuleBlockContext) {} + +// ExitRuleBlock is called when production ruleBlock is exited. +func (s *BaseANTLRv4ParserListener) ExitRuleBlock(ctx *RuleBlockContext) {} + +// EnterRuleAltList is called when production ruleAltList is entered. +func (s *BaseANTLRv4ParserListener) EnterRuleAltList(ctx *RuleAltListContext) {} + +// ExitRuleAltList is called when production ruleAltList is exited. +func (s *BaseANTLRv4ParserListener) ExitRuleAltList(ctx *RuleAltListContext) {} + +// EnterLabeledAlt is called when production labeledAlt is entered. +func (s *BaseANTLRv4ParserListener) EnterLabeledAlt(ctx *LabeledAltContext) {} + +// ExitLabeledAlt is called when production labeledAlt is exited. +func (s *BaseANTLRv4ParserListener) ExitLabeledAlt(ctx *LabeledAltContext) {} + +// EnterLexerRuleSpec is called when production lexerRuleSpec is entered. +func (s *BaseANTLRv4ParserListener) EnterLexerRuleSpec(ctx *LexerRuleSpecContext) {} + +// ExitLexerRuleSpec is called when production lexerRuleSpec is exited. +func (s *BaseANTLRv4ParserListener) ExitLexerRuleSpec(ctx *LexerRuleSpecContext) {} + +// EnterLexerRuleBlock is called when production lexerRuleBlock is entered. +func (s *BaseANTLRv4ParserListener) EnterLexerRuleBlock(ctx *LexerRuleBlockContext) {} + +// ExitLexerRuleBlock is called when production lexerRuleBlock is exited. +func (s *BaseANTLRv4ParserListener) ExitLexerRuleBlock(ctx *LexerRuleBlockContext) {} + +// EnterLexerAltList is called when production lexerAltList is entered. +func (s *BaseANTLRv4ParserListener) EnterLexerAltList(ctx *LexerAltListContext) {} + +// ExitLexerAltList is called when production lexerAltList is exited. +func (s *BaseANTLRv4ParserListener) ExitLexerAltList(ctx *LexerAltListContext) {} + +// EnterLexerAlt is called when production lexerAlt is entered. +func (s *BaseANTLRv4ParserListener) EnterLexerAlt(ctx *LexerAltContext) {} + +// ExitLexerAlt is called when production lexerAlt is exited. +func (s *BaseANTLRv4ParserListener) ExitLexerAlt(ctx *LexerAltContext) {} + +// EnterLexerElements is called when production lexerElements is entered. +func (s *BaseANTLRv4ParserListener) EnterLexerElements(ctx *LexerElementsContext) {} + +// ExitLexerElements is called when production lexerElements is exited. +func (s *BaseANTLRv4ParserListener) ExitLexerElements(ctx *LexerElementsContext) {} + +// EnterLexerElement is called when production lexerElement is entered. +func (s *BaseANTLRv4ParserListener) EnterLexerElement(ctx *LexerElementContext) {} + +// ExitLexerElement is called when production lexerElement is exited. +func (s *BaseANTLRv4ParserListener) ExitLexerElement(ctx *LexerElementContext) {} + +// EnterLexerBlock is called when production lexerBlock is entered. +func (s *BaseANTLRv4ParserListener) EnterLexerBlock(ctx *LexerBlockContext) {} + +// ExitLexerBlock is called when production lexerBlock is exited. +func (s *BaseANTLRv4ParserListener) ExitLexerBlock(ctx *LexerBlockContext) {} + +// EnterLexerCommands is called when production lexerCommands is entered. +func (s *BaseANTLRv4ParserListener) EnterLexerCommands(ctx *LexerCommandsContext) {} + +// ExitLexerCommands is called when production lexerCommands is exited. +func (s *BaseANTLRv4ParserListener) ExitLexerCommands(ctx *LexerCommandsContext) {} + +// EnterLexerCommand is called when production lexerCommand is entered. +func (s *BaseANTLRv4ParserListener) EnterLexerCommand(ctx *LexerCommandContext) {} + +// ExitLexerCommand is called when production lexerCommand is exited. +func (s *BaseANTLRv4ParserListener) ExitLexerCommand(ctx *LexerCommandContext) {} + +// EnterLexerCommandName is called when production lexerCommandName is entered. +func (s *BaseANTLRv4ParserListener) EnterLexerCommandName(ctx *LexerCommandNameContext) {} + +// ExitLexerCommandName is called when production lexerCommandName is exited. +func (s *BaseANTLRv4ParserListener) ExitLexerCommandName(ctx *LexerCommandNameContext) {} + +// EnterLexerCommandExpr is called when production lexerCommandExpr is entered. +func (s *BaseANTLRv4ParserListener) EnterLexerCommandExpr(ctx *LexerCommandExprContext) {} + +// ExitLexerCommandExpr is called when production lexerCommandExpr is exited. +func (s *BaseANTLRv4ParserListener) ExitLexerCommandExpr(ctx *LexerCommandExprContext) {} + +// EnterAltList is called when production altList is entered. +func (s *BaseANTLRv4ParserListener) EnterAltList(ctx *AltListContext) {} + +// ExitAltList is called when production altList is exited. +func (s *BaseANTLRv4ParserListener) ExitAltList(ctx *AltListContext) {} + +// EnterAlternative is called when production alternative is entered. +func (s *BaseANTLRv4ParserListener) EnterAlternative(ctx *AlternativeContext) {} + +// ExitAlternative is called when production alternative is exited. +func (s *BaseANTLRv4ParserListener) ExitAlternative(ctx *AlternativeContext) {} + +// EnterElement is called when production element is entered. +func (s *BaseANTLRv4ParserListener) EnterElement(ctx *ElementContext) {} + +// ExitElement is called when production element is exited. +func (s *BaseANTLRv4ParserListener) ExitElement(ctx *ElementContext) {} + +// EnterPredicateOptions is called when production predicateOptions is entered. +func (s *BaseANTLRv4ParserListener) EnterPredicateOptions(ctx *PredicateOptionsContext) {} + +// ExitPredicateOptions is called when production predicateOptions is exited. +func (s *BaseANTLRv4ParserListener) ExitPredicateOptions(ctx *PredicateOptionsContext) {} + +// EnterPredicateOption is called when production predicateOption is entered. +func (s *BaseANTLRv4ParserListener) EnterPredicateOption(ctx *PredicateOptionContext) {} + +// ExitPredicateOption is called when production predicateOption is exited. +func (s *BaseANTLRv4ParserListener) ExitPredicateOption(ctx *PredicateOptionContext) {} + +// EnterLabeledElement is called when production labeledElement is entered. +func (s *BaseANTLRv4ParserListener) EnterLabeledElement(ctx *LabeledElementContext) {} + +// ExitLabeledElement is called when production labeledElement is exited. +func (s *BaseANTLRv4ParserListener) ExitLabeledElement(ctx *LabeledElementContext) {} + +// EnterEbnf is called when production ebnf is entered. +func (s *BaseANTLRv4ParserListener) EnterEbnf(ctx *EbnfContext) {} + +// ExitEbnf is called when production ebnf is exited. +func (s *BaseANTLRv4ParserListener) ExitEbnf(ctx *EbnfContext) {} + +// EnterBlockSuffix is called when production blockSuffix is entered. +func (s *BaseANTLRv4ParserListener) EnterBlockSuffix(ctx *BlockSuffixContext) {} + +// ExitBlockSuffix is called when production blockSuffix is exited. +func (s *BaseANTLRv4ParserListener) ExitBlockSuffix(ctx *BlockSuffixContext) {} + +// EnterEbnfSuffix is called when production ebnfSuffix is entered. +func (s *BaseANTLRv4ParserListener) EnterEbnfSuffix(ctx *EbnfSuffixContext) {} + +// ExitEbnfSuffix is called when production ebnfSuffix is exited. +func (s *BaseANTLRv4ParserListener) ExitEbnfSuffix(ctx *EbnfSuffixContext) {} + +// EnterLexerAtom is called when production lexerAtom is entered. +func (s *BaseANTLRv4ParserListener) EnterLexerAtom(ctx *LexerAtomContext) {} + +// ExitLexerAtom is called when production lexerAtom is exited. +func (s *BaseANTLRv4ParserListener) ExitLexerAtom(ctx *LexerAtomContext) {} + +// EnterAtom is called when production atom is entered. +func (s *BaseANTLRv4ParserListener) EnterAtom(ctx *AtomContext) {} + +// ExitAtom is called when production atom is exited. +func (s *BaseANTLRv4ParserListener) ExitAtom(ctx *AtomContext) {} + +// EnterWildcard is called when production wildcard is entered. +func (s *BaseANTLRv4ParserListener) EnterWildcard(ctx *WildcardContext) {} + +// ExitWildcard is called when production wildcard is exited. +func (s *BaseANTLRv4ParserListener) ExitWildcard(ctx *WildcardContext) {} + +// EnterNotSet is called when production notSet is entered. +func (s *BaseANTLRv4ParserListener) EnterNotSet(ctx *NotSetContext) {} + +// ExitNotSet is called when production notSet is exited. +func (s *BaseANTLRv4ParserListener) ExitNotSet(ctx *NotSetContext) {} + +// EnterBlockSet is called when production blockSet is entered. +func (s *BaseANTLRv4ParserListener) EnterBlockSet(ctx *BlockSetContext) {} + +// ExitBlockSet is called when production blockSet is exited. +func (s *BaseANTLRv4ParserListener) ExitBlockSet(ctx *BlockSetContext) {} + +// EnterSetElement is called when production setElement is entered. +func (s *BaseANTLRv4ParserListener) EnterSetElement(ctx *SetElementContext) {} + +// ExitSetElement is called when production setElement is exited. +func (s *BaseANTLRv4ParserListener) ExitSetElement(ctx *SetElementContext) {} + +// EnterBlock is called when production block is entered. +func (s *BaseANTLRv4ParserListener) EnterBlock(ctx *BlockContext) {} + +// ExitBlock is called when production block is exited. +func (s *BaseANTLRv4ParserListener) ExitBlock(ctx *BlockContext) {} + +// EnterRuleref is called when production ruleref is entered. +func (s *BaseANTLRv4ParserListener) EnterRuleref(ctx *RulerefContext) {} + +// ExitRuleref is called when production ruleref is exited. +func (s *BaseANTLRv4ParserListener) ExitRuleref(ctx *RulerefContext) {} + +// EnterCharacterRange is called when production characterRange is entered. +func (s *BaseANTLRv4ParserListener) EnterCharacterRange(ctx *CharacterRangeContext) {} + +// ExitCharacterRange is called when production characterRange is exited. +func (s *BaseANTLRv4ParserListener) ExitCharacterRange(ctx *CharacterRangeContext) {} + +// EnterTerminalDef is called when production terminalDef is entered. +func (s *BaseANTLRv4ParserListener) EnterTerminalDef(ctx *TerminalDefContext) {} + +// ExitTerminalDef is called when production terminalDef is exited. +func (s *BaseANTLRv4ParserListener) ExitTerminalDef(ctx *TerminalDefContext) {} + +// EnterElementOptions is called when production elementOptions is entered. +func (s *BaseANTLRv4ParserListener) EnterElementOptions(ctx *ElementOptionsContext) {} + +// ExitElementOptions is called when production elementOptions is exited. +func (s *BaseANTLRv4ParserListener) ExitElementOptions(ctx *ElementOptionsContext) {} + +// EnterElementOption is called when production elementOption is entered. +func (s *BaseANTLRv4ParserListener) EnterElementOption(ctx *ElementOptionContext) {} + +// ExitElementOption is called when production elementOption is exited. +func (s *BaseANTLRv4ParserListener) ExitElementOption(ctx *ElementOptionContext) {} + +// EnterIdentifier is called when production identifier is entered. +func (s *BaseANTLRv4ParserListener) EnterIdentifier(ctx *IdentifierContext) {} + +// ExitIdentifier is called when production identifier is exited. +func (s *BaseANTLRv4ParserListener) ExitIdentifier(ctx *IdentifierContext) {} + +// EnterQualifiedIdentifier is called when production qualifiedIdentifier is entered. +func (s *BaseANTLRv4ParserListener) EnterQualifiedIdentifier(ctx *QualifiedIdentifierContext) {} + +// ExitQualifiedIdentifier is called when production qualifiedIdentifier is exited. +func (s *BaseANTLRv4ParserListener) ExitQualifiedIdentifier(ctx *QualifiedIdentifierContext) {} diff --git a/tools/grammar/antlrv4parser_base_visitor.go b/tools/grammar/antlrv4parser_base_visitor.go new file mode 100644 index 0000000..c543334 --- /dev/null +++ b/tools/grammar/antlrv4parser_base_visitor.go @@ -0,0 +1,276 @@ +// Code generated from ANTLRv4Parser.g4 by ANTLR 4.13.2. DO NOT EDIT. + +package grammar // ANTLRv4Parser +import "github.com/antlr4-go/antlr/v4" + +type BaseANTLRv4ParserVisitor struct { + *antlr.BaseParseTreeVisitor +} + +func (v *BaseANTLRv4ParserVisitor) VisitGrammarSpec(ctx *GrammarSpecContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitGrammarDecl(ctx *GrammarDeclContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitGrammarType(ctx *GrammarTypeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitPrequelConstruct(ctx *PrequelConstructContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitOptionsSpec(ctx *OptionsSpecContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitOption(ctx *OptionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitOptionValue(ctx *OptionValueContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitDelegateGrammars(ctx *DelegateGrammarsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitDelegateGrammar(ctx *DelegateGrammarContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitTokensSpec(ctx *TokensSpecContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitChannelsSpec(ctx *ChannelsSpecContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitIdList(ctx *IdListContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitAction_(ctx *Action_Context) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitActionScopeName(ctx *ActionScopeNameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitActionBlock(ctx *ActionBlockContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitArgActionBlock(ctx *ArgActionBlockContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitModeSpec(ctx *ModeSpecContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitRules(ctx *RulesContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitRuleSpec(ctx *RuleSpecContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitParserRuleSpec(ctx *ParserRuleSpecContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitExceptionGroup(ctx *ExceptionGroupContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitExceptionHandler(ctx *ExceptionHandlerContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitFinallyClause(ctx *FinallyClauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitRulePrequel(ctx *RulePrequelContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitRuleReturns(ctx *RuleReturnsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitThrowsSpec(ctx *ThrowsSpecContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitLocalsSpec(ctx *LocalsSpecContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitRuleAction(ctx *RuleActionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitRuleModifiers(ctx *RuleModifiersContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitRuleModifier(ctx *RuleModifierContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitRuleBlock(ctx *RuleBlockContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitRuleAltList(ctx *RuleAltListContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitLabeledAlt(ctx *LabeledAltContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitLexerRuleSpec(ctx *LexerRuleSpecContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitLexerRuleBlock(ctx *LexerRuleBlockContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitLexerAltList(ctx *LexerAltListContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitLexerAlt(ctx *LexerAltContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitLexerElements(ctx *LexerElementsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitLexerElement(ctx *LexerElementContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitLexerBlock(ctx *LexerBlockContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitLexerCommands(ctx *LexerCommandsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitLexerCommand(ctx *LexerCommandContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitLexerCommandName(ctx *LexerCommandNameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitLexerCommandExpr(ctx *LexerCommandExprContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitAltList(ctx *AltListContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitAlternative(ctx *AlternativeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitElement(ctx *ElementContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitPredicateOptions(ctx *PredicateOptionsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitPredicateOption(ctx *PredicateOptionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitLabeledElement(ctx *LabeledElementContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitEbnf(ctx *EbnfContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitBlockSuffix(ctx *BlockSuffixContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitEbnfSuffix(ctx *EbnfSuffixContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitLexerAtom(ctx *LexerAtomContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitAtom(ctx *AtomContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitWildcard(ctx *WildcardContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitNotSet(ctx *NotSetContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitBlockSet(ctx *BlockSetContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitSetElement(ctx *SetElementContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitBlock(ctx *BlockContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitRuleref(ctx *RulerefContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitCharacterRange(ctx *CharacterRangeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitTerminalDef(ctx *TerminalDefContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitElementOptions(ctx *ElementOptionsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitElementOption(ctx *ElementOptionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitIdentifier(ctx *IdentifierContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseANTLRv4ParserVisitor) VisitQualifiedIdentifier(ctx *QualifiedIdentifierContext) interface{} { + return v.VisitChildren(ctx) +} diff --git a/tools/grammar/antlrv4parser_listener.go b/tools/grammar/antlrv4parser_listener.go new file mode 100644 index 0000000..cb5ac96 --- /dev/null +++ b/tools/grammar/antlrv4parser_listener.go @@ -0,0 +1,411 @@ +// Code generated from ANTLRv4Parser.g4 by ANTLR 4.13.2. DO NOT EDIT. + +package grammar // ANTLRv4Parser +import "github.com/antlr4-go/antlr/v4" + +// ANTLRv4ParserListener is a complete listener for a parse tree produced by ANTLRv4Parser. +type ANTLRv4ParserListener interface { + antlr.ParseTreeListener + + // EnterGrammarSpec is called when entering the grammarSpec production. + EnterGrammarSpec(c *GrammarSpecContext) + + // EnterGrammarDecl is called when entering the grammarDecl production. + EnterGrammarDecl(c *GrammarDeclContext) + + // EnterGrammarType is called when entering the grammarType production. + EnterGrammarType(c *GrammarTypeContext) + + // EnterPrequelConstruct is called when entering the prequelConstruct production. + EnterPrequelConstruct(c *PrequelConstructContext) + + // EnterOptionsSpec is called when entering the optionsSpec production. + EnterOptionsSpec(c *OptionsSpecContext) + + // EnterOption is called when entering the option production. + EnterOption(c *OptionContext) + + // EnterOptionValue is called when entering the optionValue production. + EnterOptionValue(c *OptionValueContext) + + // EnterDelegateGrammars is called when entering the delegateGrammars production. + EnterDelegateGrammars(c *DelegateGrammarsContext) + + // EnterDelegateGrammar is called when entering the delegateGrammar production. + EnterDelegateGrammar(c *DelegateGrammarContext) + + // EnterTokensSpec is called when entering the tokensSpec production. + EnterTokensSpec(c *TokensSpecContext) + + // EnterChannelsSpec is called when entering the channelsSpec production. + EnterChannelsSpec(c *ChannelsSpecContext) + + // EnterIdList is called when entering the idList production. + EnterIdList(c *IdListContext) + + // EnterAction_ is called when entering the action_ production. + EnterAction_(c *Action_Context) + + // EnterActionScopeName is called when entering the actionScopeName production. + EnterActionScopeName(c *ActionScopeNameContext) + + // EnterActionBlock is called when entering the actionBlock production. + EnterActionBlock(c *ActionBlockContext) + + // EnterArgActionBlock is called when entering the argActionBlock production. + EnterArgActionBlock(c *ArgActionBlockContext) + + // EnterModeSpec is called when entering the modeSpec production. + EnterModeSpec(c *ModeSpecContext) + + // EnterRules is called when entering the rules production. + EnterRules(c *RulesContext) + + // EnterRuleSpec is called when entering the ruleSpec production. + EnterRuleSpec(c *RuleSpecContext) + + // EnterParserRuleSpec is called when entering the parserRuleSpec production. + EnterParserRuleSpec(c *ParserRuleSpecContext) + + // EnterExceptionGroup is called when entering the exceptionGroup production. + EnterExceptionGroup(c *ExceptionGroupContext) + + // EnterExceptionHandler is called when entering the exceptionHandler production. + EnterExceptionHandler(c *ExceptionHandlerContext) + + // EnterFinallyClause is called when entering the finallyClause production. + EnterFinallyClause(c *FinallyClauseContext) + + // EnterRulePrequel is called when entering the rulePrequel production. + EnterRulePrequel(c *RulePrequelContext) + + // EnterRuleReturns is called when entering the ruleReturns production. + EnterRuleReturns(c *RuleReturnsContext) + + // EnterThrowsSpec is called when entering the throwsSpec production. + EnterThrowsSpec(c *ThrowsSpecContext) + + // EnterLocalsSpec is called when entering the localsSpec production. + EnterLocalsSpec(c *LocalsSpecContext) + + // EnterRuleAction is called when entering the ruleAction production. + EnterRuleAction(c *RuleActionContext) + + // EnterRuleModifiers is called when entering the ruleModifiers production. + EnterRuleModifiers(c *RuleModifiersContext) + + // EnterRuleModifier is called when entering the ruleModifier production. + EnterRuleModifier(c *RuleModifierContext) + + // EnterRuleBlock is called when entering the ruleBlock production. + EnterRuleBlock(c *RuleBlockContext) + + // EnterRuleAltList is called when entering the ruleAltList production. + EnterRuleAltList(c *RuleAltListContext) + + // EnterLabeledAlt is called when entering the labeledAlt production. + EnterLabeledAlt(c *LabeledAltContext) + + // EnterLexerRuleSpec is called when entering the lexerRuleSpec production. + EnterLexerRuleSpec(c *LexerRuleSpecContext) + + // EnterLexerRuleBlock is called when entering the lexerRuleBlock production. + EnterLexerRuleBlock(c *LexerRuleBlockContext) + + // EnterLexerAltList is called when entering the lexerAltList production. + EnterLexerAltList(c *LexerAltListContext) + + // EnterLexerAlt is called when entering the lexerAlt production. + EnterLexerAlt(c *LexerAltContext) + + // EnterLexerElements is called when entering the lexerElements production. + EnterLexerElements(c *LexerElementsContext) + + // EnterLexerElement is called when entering the lexerElement production. + EnterLexerElement(c *LexerElementContext) + + // EnterLexerBlock is called when entering the lexerBlock production. + EnterLexerBlock(c *LexerBlockContext) + + // EnterLexerCommands is called when entering the lexerCommands production. + EnterLexerCommands(c *LexerCommandsContext) + + // EnterLexerCommand is called when entering the lexerCommand production. + EnterLexerCommand(c *LexerCommandContext) + + // EnterLexerCommandName is called when entering the lexerCommandName production. + EnterLexerCommandName(c *LexerCommandNameContext) + + // EnterLexerCommandExpr is called when entering the lexerCommandExpr production. + EnterLexerCommandExpr(c *LexerCommandExprContext) + + // EnterAltList is called when entering the altList production. + EnterAltList(c *AltListContext) + + // EnterAlternative is called when entering the alternative production. + EnterAlternative(c *AlternativeContext) + + // EnterElement is called when entering the element production. + EnterElement(c *ElementContext) + + // EnterPredicateOptions is called when entering the predicateOptions production. + EnterPredicateOptions(c *PredicateOptionsContext) + + // EnterPredicateOption is called when entering the predicateOption production. + EnterPredicateOption(c *PredicateOptionContext) + + // EnterLabeledElement is called when entering the labeledElement production. + EnterLabeledElement(c *LabeledElementContext) + + // EnterEbnf is called when entering the ebnf production. + EnterEbnf(c *EbnfContext) + + // EnterBlockSuffix is called when entering the blockSuffix production. + EnterBlockSuffix(c *BlockSuffixContext) + + // EnterEbnfSuffix is called when entering the ebnfSuffix production. + EnterEbnfSuffix(c *EbnfSuffixContext) + + // EnterLexerAtom is called when entering the lexerAtom production. + EnterLexerAtom(c *LexerAtomContext) + + // EnterAtom is called when entering the atom production. + EnterAtom(c *AtomContext) + + // EnterWildcard is called when entering the wildcard production. + EnterWildcard(c *WildcardContext) + + // EnterNotSet is called when entering the notSet production. + EnterNotSet(c *NotSetContext) + + // EnterBlockSet is called when entering the blockSet production. + EnterBlockSet(c *BlockSetContext) + + // EnterSetElement is called when entering the setElement production. + EnterSetElement(c *SetElementContext) + + // EnterBlock is called when entering the block production. + EnterBlock(c *BlockContext) + + // EnterRuleref is called when entering the ruleref production. + EnterRuleref(c *RulerefContext) + + // EnterCharacterRange is called when entering the characterRange production. + EnterCharacterRange(c *CharacterRangeContext) + + // EnterTerminalDef is called when entering the terminalDef production. + EnterTerminalDef(c *TerminalDefContext) + + // EnterElementOptions is called when entering the elementOptions production. + EnterElementOptions(c *ElementOptionsContext) + + // EnterElementOption is called when entering the elementOption production. + EnterElementOption(c *ElementOptionContext) + + // EnterIdentifier is called when entering the identifier production. + EnterIdentifier(c *IdentifierContext) + + // EnterQualifiedIdentifier is called when entering the qualifiedIdentifier production. + EnterQualifiedIdentifier(c *QualifiedIdentifierContext) + + // ExitGrammarSpec is called when exiting the grammarSpec production. + ExitGrammarSpec(c *GrammarSpecContext) + + // ExitGrammarDecl is called when exiting the grammarDecl production. + ExitGrammarDecl(c *GrammarDeclContext) + + // ExitGrammarType is called when exiting the grammarType production. + ExitGrammarType(c *GrammarTypeContext) + + // ExitPrequelConstruct is called when exiting the prequelConstruct production. + ExitPrequelConstruct(c *PrequelConstructContext) + + // ExitOptionsSpec is called when exiting the optionsSpec production. + ExitOptionsSpec(c *OptionsSpecContext) + + // ExitOption is called when exiting the option production. + ExitOption(c *OptionContext) + + // ExitOptionValue is called when exiting the optionValue production. + ExitOptionValue(c *OptionValueContext) + + // ExitDelegateGrammars is called when exiting the delegateGrammars production. + ExitDelegateGrammars(c *DelegateGrammarsContext) + + // ExitDelegateGrammar is called when exiting the delegateGrammar production. + ExitDelegateGrammar(c *DelegateGrammarContext) + + // ExitTokensSpec is called when exiting the tokensSpec production. + ExitTokensSpec(c *TokensSpecContext) + + // ExitChannelsSpec is called when exiting the channelsSpec production. + ExitChannelsSpec(c *ChannelsSpecContext) + + // ExitIdList is called when exiting the idList production. + ExitIdList(c *IdListContext) + + // ExitAction_ is called when exiting the action_ production. + ExitAction_(c *Action_Context) + + // ExitActionScopeName is called when exiting the actionScopeName production. + ExitActionScopeName(c *ActionScopeNameContext) + + // ExitActionBlock is called when exiting the actionBlock production. + ExitActionBlock(c *ActionBlockContext) + + // ExitArgActionBlock is called when exiting the argActionBlock production. + ExitArgActionBlock(c *ArgActionBlockContext) + + // ExitModeSpec is called when exiting the modeSpec production. + ExitModeSpec(c *ModeSpecContext) + + // ExitRules is called when exiting the rules production. + ExitRules(c *RulesContext) + + // ExitRuleSpec is called when exiting the ruleSpec production. + ExitRuleSpec(c *RuleSpecContext) + + // ExitParserRuleSpec is called when exiting the parserRuleSpec production. + ExitParserRuleSpec(c *ParserRuleSpecContext) + + // ExitExceptionGroup is called when exiting the exceptionGroup production. + ExitExceptionGroup(c *ExceptionGroupContext) + + // ExitExceptionHandler is called when exiting the exceptionHandler production. + ExitExceptionHandler(c *ExceptionHandlerContext) + + // ExitFinallyClause is called when exiting the finallyClause production. + ExitFinallyClause(c *FinallyClauseContext) + + // ExitRulePrequel is called when exiting the rulePrequel production. + ExitRulePrequel(c *RulePrequelContext) + + // ExitRuleReturns is called when exiting the ruleReturns production. + ExitRuleReturns(c *RuleReturnsContext) + + // ExitThrowsSpec is called when exiting the throwsSpec production. + ExitThrowsSpec(c *ThrowsSpecContext) + + // ExitLocalsSpec is called when exiting the localsSpec production. + ExitLocalsSpec(c *LocalsSpecContext) + + // ExitRuleAction is called when exiting the ruleAction production. + ExitRuleAction(c *RuleActionContext) + + // ExitRuleModifiers is called when exiting the ruleModifiers production. + ExitRuleModifiers(c *RuleModifiersContext) + + // ExitRuleModifier is called when exiting the ruleModifier production. + ExitRuleModifier(c *RuleModifierContext) + + // ExitRuleBlock is called when exiting the ruleBlock production. + ExitRuleBlock(c *RuleBlockContext) + + // ExitRuleAltList is called when exiting the ruleAltList production. + ExitRuleAltList(c *RuleAltListContext) + + // ExitLabeledAlt is called when exiting the labeledAlt production. + ExitLabeledAlt(c *LabeledAltContext) + + // ExitLexerRuleSpec is called when exiting the lexerRuleSpec production. + ExitLexerRuleSpec(c *LexerRuleSpecContext) + + // ExitLexerRuleBlock is called when exiting the lexerRuleBlock production. + ExitLexerRuleBlock(c *LexerRuleBlockContext) + + // ExitLexerAltList is called when exiting the lexerAltList production. + ExitLexerAltList(c *LexerAltListContext) + + // ExitLexerAlt is called when exiting the lexerAlt production. + ExitLexerAlt(c *LexerAltContext) + + // ExitLexerElements is called when exiting the lexerElements production. + ExitLexerElements(c *LexerElementsContext) + + // ExitLexerElement is called when exiting the lexerElement production. + ExitLexerElement(c *LexerElementContext) + + // ExitLexerBlock is called when exiting the lexerBlock production. + ExitLexerBlock(c *LexerBlockContext) + + // ExitLexerCommands is called when exiting the lexerCommands production. + ExitLexerCommands(c *LexerCommandsContext) + + // ExitLexerCommand is called when exiting the lexerCommand production. + ExitLexerCommand(c *LexerCommandContext) + + // ExitLexerCommandName is called when exiting the lexerCommandName production. + ExitLexerCommandName(c *LexerCommandNameContext) + + // ExitLexerCommandExpr is called when exiting the lexerCommandExpr production. + ExitLexerCommandExpr(c *LexerCommandExprContext) + + // ExitAltList is called when exiting the altList production. + ExitAltList(c *AltListContext) + + // ExitAlternative is called when exiting the alternative production. + ExitAlternative(c *AlternativeContext) + + // ExitElement is called when exiting the element production. + ExitElement(c *ElementContext) + + // ExitPredicateOptions is called when exiting the predicateOptions production. + ExitPredicateOptions(c *PredicateOptionsContext) + + // ExitPredicateOption is called when exiting the predicateOption production. + ExitPredicateOption(c *PredicateOptionContext) + + // ExitLabeledElement is called when exiting the labeledElement production. + ExitLabeledElement(c *LabeledElementContext) + + // ExitEbnf is called when exiting the ebnf production. + ExitEbnf(c *EbnfContext) + + // ExitBlockSuffix is called when exiting the blockSuffix production. + ExitBlockSuffix(c *BlockSuffixContext) + + // ExitEbnfSuffix is called when exiting the ebnfSuffix production. + ExitEbnfSuffix(c *EbnfSuffixContext) + + // ExitLexerAtom is called when exiting the lexerAtom production. + ExitLexerAtom(c *LexerAtomContext) + + // ExitAtom is called when exiting the atom production. + ExitAtom(c *AtomContext) + + // ExitWildcard is called when exiting the wildcard production. + ExitWildcard(c *WildcardContext) + + // ExitNotSet is called when exiting the notSet production. + ExitNotSet(c *NotSetContext) + + // ExitBlockSet is called when exiting the blockSet production. + ExitBlockSet(c *BlockSetContext) + + // ExitSetElement is called when exiting the setElement production. + ExitSetElement(c *SetElementContext) + + // ExitBlock is called when exiting the block production. + ExitBlock(c *BlockContext) + + // ExitRuleref is called when exiting the ruleref production. + ExitRuleref(c *RulerefContext) + + // ExitCharacterRange is called when exiting the characterRange production. + ExitCharacterRange(c *CharacterRangeContext) + + // ExitTerminalDef is called when exiting the terminalDef production. + ExitTerminalDef(c *TerminalDefContext) + + // ExitElementOptions is called when exiting the elementOptions production. + ExitElementOptions(c *ElementOptionsContext) + + // ExitElementOption is called when exiting the elementOption production. + ExitElementOption(c *ElementOptionContext) + + // ExitIdentifier is called when exiting the identifier production. + ExitIdentifier(c *IdentifierContext) + + // ExitQualifiedIdentifier is called when exiting the qualifiedIdentifier production. + ExitQualifiedIdentifier(c *QualifiedIdentifierContext) +} diff --git a/tools/grammar/antlrv4parser_visitor.go b/tools/grammar/antlrv4parser_visitor.go new file mode 100644 index 0000000..d707fa3 --- /dev/null +++ b/tools/grammar/antlrv4parser_visitor.go @@ -0,0 +1,210 @@ +// Code generated from ANTLRv4Parser.g4 by ANTLR 4.13.2. DO NOT EDIT. + +package grammar // ANTLRv4Parser +import "github.com/antlr4-go/antlr/v4" + +// A complete Visitor for a parse tree produced by ANTLRv4Parser. +type ANTLRv4ParserVisitor interface { + antlr.ParseTreeVisitor + + // Visit a parse tree produced by ANTLRv4Parser#grammarSpec. + VisitGrammarSpec(ctx *GrammarSpecContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#grammarDecl. + VisitGrammarDecl(ctx *GrammarDeclContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#grammarType. + VisitGrammarType(ctx *GrammarTypeContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#prequelConstruct. + VisitPrequelConstruct(ctx *PrequelConstructContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#optionsSpec. + VisitOptionsSpec(ctx *OptionsSpecContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#option. + VisitOption(ctx *OptionContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#optionValue. + VisitOptionValue(ctx *OptionValueContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#delegateGrammars. + VisitDelegateGrammars(ctx *DelegateGrammarsContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#delegateGrammar. + VisitDelegateGrammar(ctx *DelegateGrammarContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#tokensSpec. + VisitTokensSpec(ctx *TokensSpecContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#channelsSpec. + VisitChannelsSpec(ctx *ChannelsSpecContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#idList. + VisitIdList(ctx *IdListContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#action_. + VisitAction_(ctx *Action_Context) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#actionScopeName. + VisitActionScopeName(ctx *ActionScopeNameContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#actionBlock. + VisitActionBlock(ctx *ActionBlockContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#argActionBlock. + VisitArgActionBlock(ctx *ArgActionBlockContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#modeSpec. + VisitModeSpec(ctx *ModeSpecContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#rules. + VisitRules(ctx *RulesContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#ruleSpec. + VisitRuleSpec(ctx *RuleSpecContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#parserRuleSpec. + VisitParserRuleSpec(ctx *ParserRuleSpecContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#exceptionGroup. + VisitExceptionGroup(ctx *ExceptionGroupContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#exceptionHandler. + VisitExceptionHandler(ctx *ExceptionHandlerContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#finallyClause. + VisitFinallyClause(ctx *FinallyClauseContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#rulePrequel. + VisitRulePrequel(ctx *RulePrequelContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#ruleReturns. + VisitRuleReturns(ctx *RuleReturnsContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#throwsSpec. + VisitThrowsSpec(ctx *ThrowsSpecContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#localsSpec. + VisitLocalsSpec(ctx *LocalsSpecContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#ruleAction. + VisitRuleAction(ctx *RuleActionContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#ruleModifiers. + VisitRuleModifiers(ctx *RuleModifiersContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#ruleModifier. + VisitRuleModifier(ctx *RuleModifierContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#ruleBlock. + VisitRuleBlock(ctx *RuleBlockContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#ruleAltList. + VisitRuleAltList(ctx *RuleAltListContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#labeledAlt. + VisitLabeledAlt(ctx *LabeledAltContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#lexerRuleSpec. + VisitLexerRuleSpec(ctx *LexerRuleSpecContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#lexerRuleBlock. + VisitLexerRuleBlock(ctx *LexerRuleBlockContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#lexerAltList. + VisitLexerAltList(ctx *LexerAltListContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#lexerAlt. + VisitLexerAlt(ctx *LexerAltContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#lexerElements. + VisitLexerElements(ctx *LexerElementsContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#lexerElement. + VisitLexerElement(ctx *LexerElementContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#lexerBlock. + VisitLexerBlock(ctx *LexerBlockContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#lexerCommands. + VisitLexerCommands(ctx *LexerCommandsContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#lexerCommand. + VisitLexerCommand(ctx *LexerCommandContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#lexerCommandName. + VisitLexerCommandName(ctx *LexerCommandNameContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#lexerCommandExpr. + VisitLexerCommandExpr(ctx *LexerCommandExprContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#altList. + VisitAltList(ctx *AltListContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#alternative. + VisitAlternative(ctx *AlternativeContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#element. + VisitElement(ctx *ElementContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#predicateOptions. + VisitPredicateOptions(ctx *PredicateOptionsContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#predicateOption. + VisitPredicateOption(ctx *PredicateOptionContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#labeledElement. + VisitLabeledElement(ctx *LabeledElementContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#ebnf. + VisitEbnf(ctx *EbnfContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#blockSuffix. + VisitBlockSuffix(ctx *BlockSuffixContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#ebnfSuffix. + VisitEbnfSuffix(ctx *EbnfSuffixContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#lexerAtom. + VisitLexerAtom(ctx *LexerAtomContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#atom. + VisitAtom(ctx *AtomContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#wildcard. + VisitWildcard(ctx *WildcardContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#notSet. + VisitNotSet(ctx *NotSetContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#blockSet. + VisitBlockSet(ctx *BlockSetContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#setElement. + VisitSetElement(ctx *SetElementContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#block. + VisitBlock(ctx *BlockContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#ruleref. + VisitRuleref(ctx *RulerefContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#characterRange. + VisitCharacterRange(ctx *CharacterRangeContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#terminalDef. + VisitTerminalDef(ctx *TerminalDefContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#elementOptions. + VisitElementOptions(ctx *ElementOptionsContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#elementOption. + VisitElementOption(ctx *ElementOptionContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#identifier. + VisitIdentifier(ctx *IdentifierContext) interface{} + + // Visit a parse tree produced by ANTLRv4Parser#qualifiedIdentifier. + VisitQualifiedIdentifier(ctx *QualifiedIdentifierContext) interface{} +} diff --git a/tools/grammar/lexer_adaptor.go b/tools/grammar/lexer_adaptor.go new file mode 100644 index 0000000..14e6b64 --- /dev/null +++ b/tools/grammar/lexer_adaptor.go @@ -0,0 +1,210 @@ +/* + * This file is translated from https://github.com/antlr/grammars-v4/blob/master/antlr/antlr4/TypeScript/LexerAdaptor.ts. + */ +package grammar + +import ( + "github.com/antlr4-go/antlr/v4" +) + +// LexerAdaptor extends the ANTLR lexer to handle context-sensitive parsing +// of ANTLR v4 grammar files. This is needed because ANTLR grammar syntax +// has ambiguous constructs like [abc] (charset) vs [action] that require +// context to distinguish. +type LexerAdaptor struct { + *antlr.BaseLexer + + // Constants for special construct types + PREQUEL_CONSTRUCT int + OPTIONS_CONSTRUCT int + + /** + * Track whether we are inside of a rule and whether it is lexical parser. _currentRuleType==Token.INVALID_TYPE + * means that we are outside of a rule. At the first sign of a rule name reference and _currentRuleType + * ==invalid, we can assume that we are starting a parser rule. Similarly, seeing a token reference when not + * already in rule means starting a token rule. The terminating ';' of a rule, flips this back to invalid type. + * + * This is not perfect logic but works. For example, "grammar T;" means that we start and stop a lexical rule + * for the "T;". Dangerous but works. + * + * The whole point of this state information is to distinguish between [..arg actions..] and [char sets]. + * Char sets can only occur in lexical rules and arg actions cannot occur. + */ + currentRuleType int +} + +// NewLexerAdaptor creates a new lexer adaptor +func NewLexerAdaptor(input antlr.CharStream) *LexerAdaptor { + lexer := &LexerAdaptor{ + BaseLexer: antlr.NewBaseLexer(input), + PREQUEL_CONSTRUCT: -10, + OPTIONS_CONSTRUCT: -11, + currentRuleType: antlr.TokenInvalidType, + } + return lexer +} + +// Reset resets the lexer state +func (l *LexerAdaptor) Reset() { + l.currentRuleType = antlr.TokenInvalidType + l.BaseLexer.Reset() +} + +func (l *LexerAdaptor) Emit() antlr.Token { + if (l.GetType() == ANTLRv4LexerOPTIONS || + l.GetType() == ANTLRv4LexerTOKENS || + l.GetType() == ANTLRv4LexerCHANNELS) && l.currentRuleType == antlr.TokenInvalidType { + // Enter prequel construct ending with a RBRACE. + l.currentRuleType = l.PREQUEL_CONSTRUCT + } else if l.GetType() == ANTLRv4LexerOPTIONS && l.currentRuleType == ANTLRv4LexerTOKEN_REF { + l.currentRuleType = l.OPTIONS_CONSTRUCT + } else if l.GetType() == ANTLRv4LexerRBRACE && l.currentRuleType == l.PREQUEL_CONSTRUCT { + // Exit prequel construct. + l.currentRuleType = antlr.TokenInvalidType + } else if l.GetType() == ANTLRv4LexerRBRACE && l.currentRuleType == l.OPTIONS_CONSTRUCT { + // Exit options. + l.currentRuleType = ANTLRv4LexerTOKEN_REF + } else if l.GetType() == ANTLRv4LexerAT && l.currentRuleType == antlr.TokenInvalidType { + // Enter action. + l.currentRuleType = ANTLRv4LexerAT + } else if l.GetType() == ANTLRv4LexerSEMI && l.currentRuleType == l.OPTIONS_CONSTRUCT { + // ';' in options { .... }. Don't change anything. + } else if l.GetType() == ANTLRv4LexerACTION && l.currentRuleType == ANTLRv4LexerAT { + // Exit action + l.currentRuleType = antlr.TokenInvalidType + } else if l.GetType() == ANTLRv4LexerID { + firstChar := l.GetInputStream().GetText(l.TokenStartCharIndex, l.TokenStartCharIndex) + c := len(firstChar) > 0 && firstChar[0] >= 'A' && firstChar[0] <= 'Z' + if c { + l.SetType(ANTLRv4LexerTOKEN_REF) + } else { + l.SetType(ANTLRv4LexerRULE_REF) + } + + // If outside of the rule def. + if l.currentRuleType == antlr.TokenInvalidType { + // Set to inside lexer or parser rule. + l.currentRuleType = l.GetType() + } + } else if l.GetType() == ANTLRv4LexerSEMI { + // Exit rule def. + l.currentRuleType = antlr.TokenInvalidType + } + + return l.BaseLexer.Emit() +} + +// HandleBeginArgument handles the beginning of argument constructs like [...] +// This distinguishes between character sets [abc] and semantic actions [action_code] +func (l *LexerAdaptor) HandleBeginArgument() { + // ANTLRv4LexerTOKEN_REF context means we're in a lexer rule, so [abc] is a character set + if l.currentRuleType == ANTLRv4LexerTOKEN_REF { + l.PushMode(ANTLRv4LexerLexerCharSet) + l.More() + } else { + // Parser rule context, so [action] is a semantic action + l.PushMode(ANTLRv4LexerArgument) + } +} + +// HandleEndArgument handles the end of argument constructs +func (l *LexerAdaptor) HandleEndArgument() { + l.PopMode() + + // Set token type if we're still in a mode stack + if l.BaseLexer.ModeStackLength() > 0 { + l.SetType(ANTLRv4LexerARGUMENT_CONTENT) + } +} + +// NextToken override to call our custom Emit logic +func (l *LexerAdaptor) NextToken() antlr.Token { + // Get the next token using the base implementation + token := l.BaseLexer.NextToken() + + // Now apply our custom emit logic to modify the token type if needed + if token.GetTokenType() != antlr.TokenEOF { + token = l.applyEmitLogic(token) + } + + return token +} + +// applyEmitLogic applies the same logic as the Java emit() method +func (l *LexerAdaptor) applyEmitLogic(token antlr.Token) antlr.Token { + tokenType := token.GetTokenType() + + if (tokenType == ANTLRv4LexerOPTIONS || + tokenType == ANTLRv4LexerTOKENS || + tokenType == ANTLRv4LexerCHANNELS) && l.currentRuleType == antlr.TokenInvalidType { + // Enter prequel construct ending with a RBRACE. + l.currentRuleType = l.PREQUEL_CONSTRUCT + } else if tokenType == ANTLRv4LexerOPTIONS && l.currentRuleType == ANTLRv4LexerTOKEN_REF { + l.currentRuleType = l.OPTIONS_CONSTRUCT + } else if tokenType == ANTLRv4LexerRBRACE && l.currentRuleType == l.PREQUEL_CONSTRUCT { + // Exit prequel construct. + l.currentRuleType = antlr.TokenInvalidType + } else if tokenType == ANTLRv4LexerRBRACE && l.currentRuleType == l.OPTIONS_CONSTRUCT { + // Exit options. + l.currentRuleType = ANTLRv4LexerTOKEN_REF + } else if tokenType == ANTLRv4LexerAT && l.currentRuleType == antlr.TokenInvalidType { + // Enter action. + l.currentRuleType = ANTLRv4LexerAT + } else if tokenType == ANTLRv4LexerSEMI && l.currentRuleType == l.OPTIONS_CONSTRUCT { + // ';' in options { .... }. Don't change anything. + } else if tokenType == ANTLRv4LexerACTION && l.currentRuleType == ANTLRv4LexerAT { + // Exit action + l.currentRuleType = antlr.TokenInvalidType + } else if tokenType == ANTLRv4LexerID { + // This is the key part - convert ID to TOKEN_REF or RULE_REF + text := token.GetText() + if len(text) > 0 { + firstChar := rune(text[0]) + if firstChar >= 'A' && firstChar <= 'Z' { + // Uppercase = token reference + token = l.setTokenType(token, ANTLRv4LexerTOKEN_REF) + } else { + // Lowercase = rule reference + token = l.setTokenType(token, ANTLRv4LexerRULE_REF) + } + } + + // If outside of the rule def. + if l.currentRuleType == antlr.TokenInvalidType { + // Set to inside lexer or parser rule. + l.currentRuleType = token.GetTokenType() // Use the new token type + } + } else if tokenType == ANTLRv4LexerSEMI { + // Exit rule def. + l.currentRuleType = antlr.TokenInvalidType + } + + return token +} + +// TokenTypeWrapper wraps a token and overrides its type +type TokenTypeWrapper struct { + antlr.Token + overriddenType int +} + +func (w *TokenTypeWrapper) GetTokenType() int { + return w.overriddenType +} + +// setTokenType creates a wrapper token with the new type +func (l *LexerAdaptor) setTokenType(token antlr.Token, newType int) antlr.Token { + return &TokenTypeWrapper{ + Token: token, + overriddenType: newType, + } +} + +// Helper methods for mode management +func (l *LexerAdaptor) PushMode(mode int) { + l.BaseLexer.PushMode(mode) +} + +func (l *LexerAdaptor) PopMode() int { + return l.BaseLexer.PopMode() +} diff --git a/tools/grammar/parser_test.go b/tools/grammar/parser_test.go new file mode 100644 index 0000000..718b4ce --- /dev/null +++ b/tools/grammar/parser_test.go @@ -0,0 +1,135 @@ +package grammar + +import ( + "fmt" + "os" + "path/filepath" + "testing" + + "github.com/antlr4-go/antlr/v4" +) + +// CustomErrorListener captures parsing errors like redshift parser_test.go +type CustomErrorListener struct { + errors int +} + +func (l *CustomErrorListener) SyntaxError(recognizer antlr.Recognizer, offendingSymbol interface{}, line, column int, msg string, e antlr.RecognitionException) { + l.errors += 1 + antlr.ConsoleErrorListenerINSTANCE.SyntaxError(recognizer, offendingSymbol, line, column, msg, e) +} + +func (l *CustomErrorListener) ReportAmbiguity(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex int, exact bool, ambigAlts *antlr.BitSet, configs *antlr.ATNConfigSet) { + antlr.ConsoleErrorListenerINSTANCE.ReportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) +} + +func (l *CustomErrorListener) ReportAttemptingFullContext(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex int, conflictingAlts *antlr.BitSet, configs *antlr.ATNConfigSet) { + antlr.ConsoleErrorListenerINSTANCE.ReportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) +} + +func (l *CustomErrorListener) ReportContextSensitivity(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex, prediction int, configs *antlr.ATNConfigSet) { + antlr.ConsoleErrorListenerINSTANCE.ReportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs) +} + +// TestAllGrammarFiles tests parsing of all .g4 files in the repository +func TestAllGrammarFiles(t *testing.T) { + // 1. Calculate all the g4 files, record their paths + repoRoot := filepath.Join("..", "..") + grammarFiles, err := findGrammarFiles(repoRoot) + if err != nil { + t.Fatalf("Failed to find grammar files: %v", err) + } + + if len(grammarFiles) == 0 { + t.Fatalf("No .g4 grammar files found in repository") + } + + t.Logf("Found %d grammar files to test", len(grammarFiles)) + + // 2. Parse them one by one using t.Run() + for _, grammarFile := range grammarFiles { + relPath, _ := filepath.Rel(repoRoot, grammarFile) + + t.Run(relPath, func(t *testing.T) { + // Parse the grammar file + err := parseAndValidateGrammarFile(grammarFile) + if err != nil { + t.Errorf("Failed to parse grammar file: %v", err) + } + }) + } +} + +// findGrammarFiles recursively finds all .g4 files +func findGrammarFiles(root string) ([]string, error) { + var files []string + + err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + + if filepath.Ext(path) == ".g4" { + files = append(files, path) + } + + return nil + }) + + return files, err +} + +// parseAndValidateGrammarFile parses a single grammar file and returns error if it fails +func parseAndValidateGrammarFile(filePath string) error { + // Read file content + content, err := os.ReadFile(filePath) + if err != nil { + return fmt.Errorf("failed to read file: %w", err) + } + + if len(content) == 0 { + return fmt.Errorf("grammar file is empty") + } + + // Create input stream + input := antlr.NewInputStream(string(content)) + + // Create lexer + lexer := NewANTLRv4Lexer(input) + + // Add custom error listener to lexer + lexerErrorListener := &CustomErrorListener{} + lexer.RemoveErrorListeners() + lexer.AddErrorListener(lexerErrorListener) + + // Create token stream + stream := antlr.NewCommonTokenStream(lexer, 0) + + // Create parser + parser := NewANTLRv4Parser(stream) + + // Add custom error listener to parser (using same pattern as redshift) + parserErrorListener := &CustomErrorListener{} + parser.RemoveErrorListeners() + parser.AddErrorListener(parserErrorListener) + + // Parse the grammar + tree := parser.GrammarSpec() + + // Check for lexer errors + if lexerErrorListener.errors > 0 { + return fmt.Errorf("lexer found %d errors", lexerErrorListener.errors) + } + + // Check for parser errors + if parserErrorListener.errors > 0 { + return fmt.Errorf("parser found %d errors", parserErrorListener.errors) + } + + // Check tree is not nil + if tree == nil { + return fmt.Errorf("parser returned nil tree") + } + + return nil +} \ No newline at end of file