From c6ad2948bb98d42f8e0883ef82cd14cd2d5eda60 Mon Sep 17 00:00:00 2001 From: Patrick Schönberger Date: Sat, 14 Aug 2021 14:56:12 +0200 Subject: add antlr source code and ReadMe --- .../runtime/src/ANTLRErrorListener.cpp | 10 + .../runtime/src/ANTLRErrorListener.h | 167 +++ .../runtime/src/ANTLRErrorStrategy.cpp | 10 + .../runtime/src/ANTLRErrorStrategy.h | 121 ++ .../runtime/src/ANTLRFileStream.cpp | 29 + .../runtime/src/ANTLRFileStream.h | 30 + .../runtime/src/ANTLRInputStream.cpp | 169 +++ .../runtime/src/ANTLRInputStream.h | 76 ++ .../runtime/src/BailErrorStrategy.cpp | 61 + .../runtime/src/BailErrorStrategy.h | 59 + .../runtime/src/BaseErrorListener.cpp | 25 + .../runtime/src/BaseErrorListener.h | 36 + .../runtime/src/BufferedTokenStream.cpp | 414 ++++++ .../runtime/src/BufferedTokenStream.h | 200 +++ .../runtime/src/CharStream.cpp | 11 + .../runtime/src/CharStream.h | 37 + .../runtime/src/CommonToken.cpp | 195 +++ .../runtime/src/CommonToken.h | 158 +++ .../runtime/src/CommonTokenFactory.cpp | 39 + .../runtime/src/CommonTokenFactory.h | 74 ++ .../runtime/src/CommonTokenStream.cpp | 78 ++ .../runtime/src/CommonTokenStream.h | 79 ++ .../runtime/src/ConsoleErrorListener.cpp | 15 + .../runtime/src/ConsoleErrorListener.h | 35 + .../runtime/src/DefaultErrorStrategy.cpp | 333 +++++ .../runtime/src/DefaultErrorStrategy.h | 466 +++++++ .../runtime/src/DiagnosticErrorListener.cpp | 84 ++ .../runtime/src/DiagnosticErrorListener.h | 80 ++ .../runtime/src/Exceptions.cpp | 64 + .../runtime/src/Exceptions.h | 99 ++ .../runtime/src/FailedPredicateException.cpp | 51 + .../runtime/src/FailedPredicateException.h | 32 + .../runtime/src/InputMismatchException.cpp | 18 + .../runtime/src/InputMismatchException.h | 24 + .../runtime/src/IntStream.cpp | 12 + .../runtime/src/IntStream.h | 224 ++++ .../runtime/src/InterpreterRuleContext.cpp | 19 + .../runtime/src/InterpreterRuleContext.h | 45 + .../runtime/src/Lexer.cpp | 295 +++++ .../runtime/src/Lexer.h | 209 +++ .../runtime/src/LexerInterpreter.cpp | 75 ++ .../runtime/src/LexerInterpreter.h | 52 + .../runtime/src/LexerNoViableAltException.cpp | 36 + .../runtime/src/LexerNoViableAltException.h | 31 + .../runtime/src/ListTokenSource.cpp | 92 ++ .../runtime/src/ListTokenSource.h | 88 ++ .../runtime/src/NoViableAltException.cpp | 46 + .../runtime/src/NoViableAltException.h | 42 + .../runtime/src/Parser.cpp | 648 +++++++++ .../runtime/src/Parser.h | 467 +++++++ .../runtime/src/ParserInterpreter.cpp | 306 +++++ .../runtime/src/ParserInterpreter.h | 179 +++ .../runtime/src/ParserRuleContext.cpp | 141 ++ .../runtime/src/ParserRuleContext.h | 147 +++ .../runtime/src/ProxyErrorListener.cpp | 53 + .../runtime/src/ProxyErrorListener.h | 38 + .../runtime/src/RecognitionException.cpp | 66 + .../runtime/src/RecognitionException.h | 98 ++ .../runtime/src/Recognizer.cpp | 167 +++ .../runtime/src/Recognizer.h | 170 +++ .../runtime/src/RuleContext.cpp | 143 ++ .../runtime/src/RuleContext.h | 137 ++ .../runtime/src/RuleContextWithAltNum.cpp | 27 + .../runtime/src/RuleContextWithAltNum.h | 32 + .../runtime/src/RuntimeMetaData.cpp | 53 + .../runtime/src/RuntimeMetaData.h | 155 +++ .../runtime/src/Token.cpp | 9 + .../runtime/src/Token.h | 124 ++ .../runtime/src/TokenFactory.h | 30 + .../runtime/src/TokenSource.cpp | 9 + .../runtime/src/TokenSource.h | 85 ++ .../runtime/src/TokenStream.cpp | 11 + .../runtime/src/TokenStream.h | 137 ++ .../runtime/src/TokenStreamRewriter.cpp | 425 ++++++ .../runtime/src/TokenStreamRewriter.h | 300 +++++ .../runtime/src/UnbufferedCharStream.cpp | 211 +++ .../runtime/src/UnbufferedCharStream.h | 123 ++ .../runtime/src/UnbufferedTokenStream.cpp | 270 ++++ .../runtime/src/UnbufferedTokenStream.h | 115 ++ .../runtime/src/Vocabulary.cpp | 96 ++ .../runtime/src/Vocabulary.h | 192 +++ .../runtime/src/WritableToken.cpp | 9 + .../runtime/src/WritableToken.h | 23 + .../runtime/src/antlr4-common.h | 140 ++ .../runtime/src/antlr4-runtime.h | 167 +++ .../runtime/src/atn/ATN.cpp | 209 +++ .../runtime/src/atn/ATN.h | 118 ++ .../runtime/src/atn/ATNConfig.cpp | 111 ++ .../runtime/src/atn/ATNConfig.h | 154 +++ .../runtime/src/atn/ATNConfigSet.cpp | 228 ++++ .../runtime/src/atn/ATNConfigSet.h | 110 ++ .../runtime/src/atn/ATNDeserializationOptions.cpp | 64 + .../runtime/src/atn/ATNDeserializationOptions.h | 50 + .../runtime/src/atn/ATNDeserializer.cpp | 756 +++++++++++ .../runtime/src/atn/ATNDeserializer.h | 91 ++ .../runtime/src/atn/ATNSerializer.cpp | 621 +++++++++ .../runtime/src/atn/ATNSerializer.h | 61 + .../runtime/src/atn/ATNSimulator.cpp | 63 + .../runtime/src/atn/ATNSimulator.h | 87 ++ .../runtime/src/atn/ATNState.cpp | 72 + .../runtime/src/atn/ATNState.h | 140 ++ .../runtime/src/atn/ATNType.h | 20 + .../src/atn/AbstractPredicateTransition.cpp | 14 + .../runtime/src/atn/AbstractPredicateTransition.h | 24 + .../runtime/src/atn/ActionTransition.cpp | 33 + .../runtime/src/atn/ActionTransition.h | 33 + .../runtime/src/atn/AmbiguityInfo.cpp | 16 + .../runtime/src/atn/AmbiguityInfo.h | 68 + .../runtime/src/atn/ArrayPredictionContext.cpp | 82 ++ .../runtime/src/atn/ArrayPredictionContext.h | 43 + .../runtime/src/atn/AtomTransition.cpp | 31 + .../runtime/src/atn/AtomTransition.h | 30 + .../runtime/src/atn/BasicBlockStartState.cpp | 12 + .../runtime/src/atn/BasicBlockStartState.h | 22 + .../runtime/src/atn/BasicState.cpp | 12 + .../runtime/src/atn/BasicState.h | 21 + .../runtime/src/atn/BlockEndState.cpp | 15 + .../runtime/src/atn/BlockEndState.h | 24 + .../runtime/src/atn/BlockStartState.cpp | 9 + .../runtime/src/atn/BlockStartState.h | 21 + .../runtime/src/atn/ContextSensitivityInfo.cpp | 14 + .../runtime/src/atn/ContextSensitivityInfo.h | 47 + .../runtime/src/atn/DecisionEventInfo.cpp | 14 + .../runtime/src/atn/DecisionEventInfo.h | 70 + .../runtime/src/atn/DecisionInfo.cpp | 25 + .../runtime/src/atn/DecisionInfo.h | 227 ++++ .../runtime/src/atn/DecisionState.cpp | 17 + .../runtime/src/atn/DecisionState.h | 30 + .../runtime/src/atn/EmptyPredictionContext.cpp | 35 + .../runtime/src/atn/EmptyPredictionContext.h | 27 + .../runtime/src/atn/EpsilonTransition.cpp | 35 + .../runtime/src/atn/EpsilonTransition.h | 39 + .../runtime/src/atn/ErrorInfo.cpp | 15 + .../runtime/src/atn/ErrorInfo.h | 43 + .../runtime/src/atn/LL1Analyzer.cpp | 156 +++ .../runtime/src/atn/LL1Analyzer.h | 115 ++ .../runtime/src/atn/LexerATNConfig.cpp | 84 ++ .../runtime/src/atn/LexerATNConfig.h | 44 + .../runtime/src/atn/LexerATNSimulator.cpp | 628 +++++++++ .../runtime/src/atn/LexerATNSimulator.h | 217 ++++ .../runtime/src/atn/LexerAction.cpp | 9 + .../runtime/src/atn/LexerAction.h | 66 + .../runtime/src/atn/LexerActionExecutor.cpp | 107 ++ .../runtime/src/atn/LexerActionExecutor.h | 115 ++ .../runtime/src/atn/LexerActionType.h | 55 + .../runtime/src/atn/LexerChannelAction.cpp | 55 + .../runtime/src/atn/LexerChannelAction.h | 63 + .../runtime/src/atn/LexerCustomAction.cpp | 62 + .../runtime/src/atn/LexerCustomAction.h | 87 ++ .../runtime/src/atn/LexerIndexedCustomAction.cpp | 63 + .../runtime/src/atn/LexerIndexedCustomAction.h | 82 ++ .../runtime/src/atn/LexerModeAction.cpp | 56 + .../runtime/src/atn/LexerModeAction.h | 61 + .../runtime/src/atn/LexerMoreAction.cpp | 47 + .../runtime/src/atn/LexerMoreAction.h | 57 + .../runtime/src/atn/LexerPopModeAction.cpp | 47 + .../runtime/src/atn/LexerPopModeAction.h | 57 + .../runtime/src/atn/LexerPushModeAction.cpp | 56 + .../runtime/src/atn/LexerPushModeAction.h | 61 + .../runtime/src/atn/LexerSkipAction.cpp | 47 + .../runtime/src/atn/LexerSkipAction.h | 55 + .../runtime/src/atn/LexerTypeAction.cpp | 56 + .../runtime/src/atn/LexerTypeAction.h | 55 + .../runtime/src/atn/LookaheadEventInfo.cpp | 16 + .../runtime/src/atn/LookaheadEventInfo.h | 42 + .../runtime/src/atn/LoopEndState.cpp | 12 + .../runtime/src/atn/LoopEndState.h | 22 + .../runtime/src/atn/Makefile | 67 + .../runtime/src/atn/NotSetTransition.cpp | 27 + .../runtime/src/atn/NotSetTransition.h | 25 + .../runtime/src/atn/OrderedATNConfigSet.cpp | 12 + .../runtime/src/atn/OrderedATNConfigSet.h | 20 + .../runtime/src/atn/ParseInfo.cpp | 102 ++ .../runtime/src/atn/ParseInfo.h | 102 ++ .../runtime/src/atn/ParserATNSimulator.cpp | 1370 ++++++++++++++++++++ .../runtime/src/atn/ParserATNSimulator.h | 904 +++++++++++++ .../runtime/src/atn/PlusBlockStartState.cpp | 12 + .../runtime/src/atn/PlusBlockStartState.h | 25 + .../runtime/src/atn/PlusLoopbackState.cpp | 12 + .../runtime/src/atn/PlusLoopbackState.h | 22 + .../src/atn/PrecedencePredicateTransition.cpp | 32 + .../src/atn/PrecedencePredicateTransition.h | 29 + .../runtime/src/atn/PredicateEvalInfo.cpp | 17 + .../runtime/src/atn/PredicateEvalInfo.h | 62 + .../runtime/src/atn/PredicateTransition.cpp | 34 + .../runtime/src/atn/PredicateTransition.h | 39 + .../runtime/src/atn/PredictionContext.cpp | 662 ++++++++++ .../runtime/src/atn/PredictionContext.h | 266 ++++ .../runtime/src/atn/PredictionMode.cpp | 201 +++ .../runtime/src/atn/PredictionMode.h | 436 +++++++ .../runtime/src/atn/ProfilingATNSimulator.cpp | 179 +++ .../runtime/src/atn/ProfilingATNSimulator.h | 60 + .../runtime/src/atn/RangeTransition.cpp | 30 + .../runtime/src/atn/RangeTransition.h | 29 + .../runtime/src/atn/RuleStartState.cpp | 16 + .../runtime/src/atn/RuleStartState.h | 25 + .../runtime/src/atn/RuleStopState.cpp | 12 + .../runtime/src/atn/RuleStopState.h | 25 + .../runtime/src/atn/RuleTransition.cpp | 37 + .../runtime/src/atn/RuleTransition.h | 40 + .../runtime/src/atn/SemanticContext.cpp | 377 ++++++ .../runtime/src/atn/SemanticContext.h | 222 ++++ .../runtime/src/atn/SetTransition.cpp | 32 + .../runtime/src/atn/SetTransition.h | 30 + .../runtime/src/atn/SingletonPredictionContext.cpp | 81 ++ .../runtime/src/atn/SingletonPredictionContext.h | 36 + .../runtime/src/atn/StarBlockStartState.cpp | 12 + .../runtime/src/atn/StarBlockStartState.h | 21 + .../runtime/src/atn/StarLoopEntryState.cpp | 15 + .../runtime/src/atn/StarLoopEntryState.h | 35 + .../runtime/src/atn/StarLoopbackState.cpp | 19 + .../runtime/src/atn/StarLoopbackState.h | 21 + .../runtime/src/atn/TokensStartState.cpp | 12 + .../runtime/src/atn/TokensStartState.h | 21 + .../runtime/src/atn/Transition.cpp | 44 + .../runtime/src/atn/Transition.h | 76 ++ .../runtime/src/atn/WildcardTransition.cpp | 25 + .../runtime/src/atn/WildcardTransition.h | 25 + .../runtime/src/dfa/DFA.cpp | 127 ++ .../runtime/src/dfa/DFA.h | 91 ++ .../runtime/src/dfa/DFASerializer.cpp | 67 + .../runtime/src/dfa/DFASerializer.h | 32 + .../runtime/src/dfa/DFAState.cpp | 100 ++ .../runtime/src/dfa/DFAState.h | 144 ++ .../runtime/src/dfa/LexerDFASerializer.cpp | 20 + .../runtime/src/dfa/LexerDFASerializer.h | 23 + .../runtime/src/misc/InterpreterDataReader.cpp | 124 ++ .../runtime/src/misc/InterpreterDataReader.h | 31 + .../runtime/src/misc/Interval.cpp | 89 ++ .../runtime/src/misc/Interval.h | 84 ++ .../runtime/src/misc/IntervalSet.cpp | 521 ++++++++ .../runtime/src/misc/IntervalSet.h | 198 +++ .../runtime/src/misc/MurmurHash.cpp | 134 ++ .../runtime/src/misc/MurmurHash.h | 82 ++ .../runtime/src/misc/Predicate.cpp | 4 + .../runtime/src/misc/Predicate.h | 21 + .../runtime/src/support/Any.cpp | 13 + .../runtime/src/support/Any.h | 170 +++ .../runtime/src/support/Arrays.cpp | 43 + .../runtime/src/support/Arrays.h | 110 ++ .../runtime/src/support/BitSet.h | 76 ++ .../runtime/src/support/CPPUtils.cpp | 248 ++++ .../runtime/src/support/CPPUtils.h | 78 ++ .../runtime/src/support/Declarations.h | 163 +++ .../runtime/src/support/StringUtils.cpp | 46 + .../runtime/src/support/StringUtils.h | 76 ++ .../runtime/src/support/guid.cpp | 303 +++++ .../runtime/src/support/guid.h | 112 ++ .../runtime/src/tree/AbstractParseTreeVisitor.h | 128 ++ .../runtime/src/tree/ErrorNode.cpp | 9 + .../runtime/src/tree/ErrorNode.h | 19 + .../runtime/src/tree/ErrorNodeImpl.cpp | 23 + .../runtime/src/tree/ErrorNodeImpl.h | 33 + .../runtime/src/tree/IterativeParseTreeWalker.cpp | 71 + .../runtime/src/tree/IterativeParseTreeWalker.h | 53 + .../runtime/src/tree/ParseTree.cpp | 15 + .../runtime/src/tree/ParseTree.h | 102 ++ .../runtime/src/tree/ParseTreeListener.cpp | 9 + .../runtime/src/tree/ParseTreeListener.h | 39 + .../runtime/src/tree/ParseTreeProperty.h | 50 + .../runtime/src/tree/ParseTreeVisitor.cpp | 9 + .../runtime/src/tree/ParseTreeVisitor.h | 57 + .../runtime/src/tree/ParseTreeWalker.cpp | 49 + .../runtime/src/tree/ParseTreeWalker.h | 55 + .../runtime/src/tree/TerminalNode.cpp | 9 + .../runtime/src/tree/TerminalNode.h | 32 + .../runtime/src/tree/TerminalNodeImpl.cpp | 57 + .../runtime/src/tree/TerminalNodeImpl.h | 33 + .../runtime/src/tree/Trees.cpp | 241 ++++ .../runtime/src/tree/Trees.h | 78 ++ .../runtime/src/tree/pattern/Chunk.cpp | 9 + .../runtime/src/tree/pattern/Chunk.h | 44 + .../runtime/src/tree/pattern/ParseTreeMatch.cpp | 69 + .../runtime/src/tree/pattern/ParseTreeMatch.h | 132 ++ .../runtime/src/tree/pattern/ParseTreePattern.cpp | 64 + .../runtime/src/tree/pattern/ParseTreePattern.h | 105 ++ .../src/tree/pattern/ParseTreePatternMatcher.cpp | 371 ++++++ .../src/tree/pattern/ParseTreePatternMatcher.h | 185 +++ .../runtime/src/tree/pattern/RuleTagToken.cpp | 77 ++ .../runtime/src/tree/pattern/RuleTagToken.h | 117 ++ .../runtime/src/tree/pattern/TagChunk.cpp | 39 + .../runtime/src/tree/pattern/TagChunk.h | 86 ++ .../runtime/src/tree/pattern/TextChunk.cpp | 28 + .../runtime/src/tree/pattern/TextChunk.h | 51 + .../runtime/src/tree/pattern/TokenTagToken.cpp | 36 + .../runtime/src/tree/pattern/TokenTagToken.h | 80 ++ .../runtime/src/tree/xpath/XPath.cpp | 154 +++ .../runtime/src/tree/xpath/XPath.h | 86 ++ .../runtime/src/tree/xpath/XPathElement.cpp | 31 + .../runtime/src/tree/xpath/XPathElement.h | 40 + .../runtime/src/tree/xpath/XPathLexer.cpp | 173 +++ .../runtime/src/tree/xpath/XPathLexer.g4 | 64 + .../runtime/src/tree/xpath/XPathLexer.h | 56 + .../runtime/src/tree/xpath/XPathLexer.tokens | 12 + .../src/tree/xpath/XPathLexerErrorListener.cpp | 13 + .../src/tree/xpath/XPathLexerErrorListener.h | 22 + .../src/tree/xpath/XPathRuleAnywhereElement.cpp | 20 + .../src/tree/xpath/XPathRuleAnywhereElement.h | 27 + .../runtime/src/tree/xpath/XPathRuleElement.cpp | 30 + .../runtime/src/tree/xpath/XPathRuleElement.h | 26 + .../src/tree/xpath/XPathTokenAnywhereElement.cpp | 20 + .../src/tree/xpath/XPathTokenAnywhereElement.h | 25 + .../runtime/src/tree/xpath/XPathTokenElement.cpp | 33 + .../runtime/src/tree/xpath/XPathTokenElement.h | 26 + .../tree/xpath/XPathWildcardAnywhereElement.cpp | 23 + .../src/tree/xpath/XPathWildcardAnywhereElement.h | 23 + .../src/tree/xpath/XPathWildcardElement.cpp | 24 + .../runtime/src/tree/xpath/XPathWildcardElement.h | 23 + 308 files changed, 29986 insertions(+) create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRErrorListener.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRErrorListener.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRErrorStrategy.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRErrorStrategy.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRFileStream.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRFileStream.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRInputStream.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRInputStream.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/BailErrorStrategy.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/BailErrorStrategy.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/BaseErrorListener.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/BaseErrorListener.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/BufferedTokenStream.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/BufferedTokenStream.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/CharStream.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/CharStream.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/CommonToken.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/CommonToken.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/CommonTokenFactory.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/CommonTokenFactory.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/CommonTokenStream.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/CommonTokenStream.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/ConsoleErrorListener.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/ConsoleErrorListener.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/DefaultErrorStrategy.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/DefaultErrorStrategy.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/DiagnosticErrorListener.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/DiagnosticErrorListener.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/Exceptions.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/Exceptions.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/FailedPredicateException.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/FailedPredicateException.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/InputMismatchException.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/InputMismatchException.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/IntStream.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/IntStream.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/InterpreterRuleContext.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/InterpreterRuleContext.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/Lexer.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/Lexer.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/LexerInterpreter.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/LexerInterpreter.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/LexerNoViableAltException.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/LexerNoViableAltException.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/ListTokenSource.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/ListTokenSource.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/NoViableAltException.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/NoViableAltException.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/Parser.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/Parser.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/ParserInterpreter.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/ParserInterpreter.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/ParserRuleContext.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/ParserRuleContext.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/ProxyErrorListener.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/ProxyErrorListener.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/RecognitionException.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/RecognitionException.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/Recognizer.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/Recognizer.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/RuleContext.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/RuleContext.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/RuleContextWithAltNum.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/RuleContextWithAltNum.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/RuntimeMetaData.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/RuntimeMetaData.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/Token.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/Token.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/TokenFactory.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/TokenSource.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/TokenSource.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/TokenStream.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/TokenStream.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/TokenStreamRewriter.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/TokenStreamRewriter.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/UnbufferedCharStream.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/UnbufferedCharStream.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/UnbufferedTokenStream.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/UnbufferedTokenStream.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/Vocabulary.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/Vocabulary.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/WritableToken.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/WritableToken.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/antlr4-common.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/antlr4-runtime.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ATN.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ATN.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ATNConfig.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ATNConfig.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ATNConfigSet.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ATNConfigSet.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ATNDeserializationOptions.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ATNDeserializationOptions.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ATNDeserializer.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ATNDeserializer.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ATNSerializer.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ATNSerializer.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ATNSimulator.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ATNSimulator.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ATNState.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ATNState.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ATNType.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/AbstractPredicateTransition.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/AbstractPredicateTransition.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ActionTransition.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ActionTransition.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/AmbiguityInfo.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/AmbiguityInfo.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ArrayPredictionContext.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ArrayPredictionContext.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/AtomTransition.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/AtomTransition.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/BasicBlockStartState.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/BasicBlockStartState.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/BasicState.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/BasicState.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/BlockEndState.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/BlockEndState.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/BlockStartState.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/BlockStartState.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ContextSensitivityInfo.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ContextSensitivityInfo.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/DecisionEventInfo.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/DecisionEventInfo.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/DecisionInfo.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/DecisionInfo.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/DecisionState.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/DecisionState.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/EmptyPredictionContext.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/EmptyPredictionContext.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/EpsilonTransition.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/EpsilonTransition.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ErrorInfo.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ErrorInfo.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LL1Analyzer.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LL1Analyzer.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerATNConfig.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerATNConfig.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerATNSimulator.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerATNSimulator.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerAction.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerAction.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerActionExecutor.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerActionExecutor.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerActionType.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerChannelAction.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerChannelAction.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerCustomAction.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerCustomAction.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerIndexedCustomAction.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerIndexedCustomAction.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerModeAction.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerModeAction.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerMoreAction.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerMoreAction.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerPopModeAction.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerPopModeAction.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerPushModeAction.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerPushModeAction.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerSkipAction.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerSkipAction.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerTypeAction.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LexerTypeAction.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LookaheadEventInfo.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LookaheadEventInfo.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LoopEndState.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/LoopEndState.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/Makefile create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/NotSetTransition.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/NotSetTransition.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/OrderedATNConfigSet.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/OrderedATNConfigSet.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ParseInfo.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ParseInfo.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ParserATNSimulator.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ParserATNSimulator.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/PlusBlockStartState.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/PlusBlockStartState.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/PlusLoopbackState.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/PlusLoopbackState.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/PrecedencePredicateTransition.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/PrecedencePredicateTransition.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/PredicateEvalInfo.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/PredicateEvalInfo.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/PredicateTransition.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/PredicateTransition.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/PredictionContext.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/PredictionContext.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/PredictionMode.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/PredictionMode.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ProfilingATNSimulator.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/ProfilingATNSimulator.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/RangeTransition.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/RangeTransition.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/RuleStartState.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/RuleStartState.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/RuleStopState.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/RuleStopState.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/RuleTransition.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/RuleTransition.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/SemanticContext.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/SemanticContext.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/SetTransition.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/SetTransition.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/SingletonPredictionContext.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/SingletonPredictionContext.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/StarBlockStartState.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/StarBlockStartState.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/StarLoopEntryState.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/StarLoopEntryState.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/StarLoopbackState.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/StarLoopbackState.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/TokensStartState.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/TokensStartState.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/Transition.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/Transition.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/WildcardTransition.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/atn/WildcardTransition.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/dfa/DFA.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/dfa/DFA.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/dfa/DFASerializer.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/dfa/DFASerializer.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/dfa/DFAState.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/dfa/DFAState.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/dfa/LexerDFASerializer.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/dfa/LexerDFASerializer.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/misc/InterpreterDataReader.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/misc/InterpreterDataReader.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/misc/Interval.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/misc/Interval.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/misc/IntervalSet.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/misc/IntervalSet.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/misc/MurmurHash.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/misc/MurmurHash.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/misc/Predicate.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/misc/Predicate.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/support/Any.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/support/Any.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/support/Arrays.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/support/Arrays.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/support/BitSet.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/support/CPPUtils.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/support/CPPUtils.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/support/Declarations.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/support/StringUtils.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/support/StringUtils.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/support/guid.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/support/guid.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/AbstractParseTreeVisitor.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/ErrorNode.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/ErrorNode.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/ErrorNodeImpl.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/ErrorNodeImpl.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/IterativeParseTreeWalker.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/IterativeParseTreeWalker.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/ParseTree.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/ParseTree.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/ParseTreeListener.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/ParseTreeListener.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/ParseTreeProperty.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/ParseTreeVisitor.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/ParseTreeVisitor.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/ParseTreeWalker.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/ParseTreeWalker.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/TerminalNode.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/TerminalNode.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/TerminalNodeImpl.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/TerminalNodeImpl.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/Trees.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/Trees.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/pattern/Chunk.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/pattern/Chunk.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/pattern/ParseTreeMatch.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/pattern/ParseTreeMatch.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/pattern/ParseTreePattern.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/pattern/ParseTreePattern.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/pattern/ParseTreePatternMatcher.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/pattern/RuleTagToken.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/pattern/RuleTagToken.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/pattern/TagChunk.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/pattern/TagChunk.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/pattern/TextChunk.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/pattern/TextChunk.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/pattern/TokenTagToken.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/pattern/TokenTagToken.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPath.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPath.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathElement.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathElement.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathLexer.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathLexer.g4 create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathLexer.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathLexer.tokens create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathLexerErrorListener.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathLexerErrorListener.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathRuleAnywhereElement.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathRuleAnywhereElement.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathRuleElement.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathRuleElement.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathTokenAnywhereElement.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathTokenAnywhereElement.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathTokenElement.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathTokenElement.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathWildcardAnywhereElement.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathWildcardAnywhereElement.h create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathWildcardElement.cpp create mode 100644 antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathWildcardElement.h (limited to 'antlr4-cpp-runtime-4.9.2-source/runtime/src') diff --git a/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRErrorListener.cpp b/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRErrorListener.cpp new file mode 100644 index 0000000..6ceadb8 --- /dev/null +++ b/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRErrorListener.cpp @@ -0,0 +1,10 @@ +/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. + * Use of this file is governed by the BSD 3-clause license that + * can be found in the LICENSE.txt file in the project root. + */ + +#include "ANTLRErrorListener.h" + +antlr4::ANTLRErrorListener::~ANTLRErrorListener() +{ +} diff --git a/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRErrorListener.h b/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRErrorListener.h new file mode 100644 index 0000000..d6efad1 --- /dev/null +++ b/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRErrorListener.h @@ -0,0 +1,167 @@ +/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. + * Use of this file is governed by the BSD 3-clause license that + * can be found in the LICENSE.txt file in the project root. + */ + +#pragma once + +#include "RecognitionException.h" + +namespace antlrcpp { + class BitSet; +} + +namespace antlr4 { + + /// How to emit recognition errors (an interface in Java). + class ANTLR4CPP_PUBLIC ANTLRErrorListener { + public: + virtual ~ANTLRErrorListener(); + + /// + /// Upon syntax error, notify any interested parties. This is not how to + /// recover from errors or compute error messages. + /// specifies how to recover from syntax errors and how to compute error + /// messages. This listener's job is simply to emit a computed message, + /// though it has enough information to create its own message in many cases. + ///

+ /// The is non-null for all syntax errors except + /// when we discover mismatched token errors that we can recover from + /// in-line, without returning from the surrounding rule (via the single + /// token insertion and deletion mechanism). + ///

+ /// + /// What parser got the error. From this + /// object, you can access the context as well + /// as the input stream. + /// + /// The offending token in the input token + /// stream, unless recognizer is a lexer (then it's null). If + /// no viable alternative error, {@code e} has token at which we + /// started production for the decision. + /// + /// The line number in the input where the error occurred. + /// + /// The character position within that line where the error occurred. + /// + /// The message to emit. + /// + /// The exception generated by the parser that led to + /// the reporting of an error. It is null in the case where + /// the parser was able to recover in line without exiting the + /// surrounding rule. + virtual void syntaxError(Recognizer *recognizer, Token *offendingSymbol, size_t line, + size_t charPositionInLine, const std::string &msg, std::exception_ptr e) = 0; + + /** + * This method is called by the parser when a full-context prediction + * results in an ambiguity. + * + *

Each full-context prediction which does not result in a syntax error + * will call either {@link #reportContextSensitivity} or + * {@link #reportAmbiguity}.

+ * + *

When {@code ambigAlts} is not null, it contains the set of potentially + * viable alternatives identified by the prediction algorithm. When + * {@code ambigAlts} is null, use {@link ATNConfigSet#getAlts} to obtain the + * represented alternatives from the {@code configs} argument.

+ * + *

When {@code exact} is {@code true}, all of the potentially + * viable alternatives are truly viable, i.e. this is reporting an exact + * ambiguity. When {@code exact} is {@code false}, at least two of + * the potentially viable alternatives are viable for the current input, but + * the prediction algorithm terminated as soon as it determined that at + * least the minimum potentially viable alternative is truly + * viable.

+ * + *

When the {@link PredictionMode#LL_EXACT_AMBIG_DETECTION} prediction + * mode is used, the parser is required to identify exact ambiguities so + * {@code exact} will always be {@code true}.

+ * + *

This method is not used by lexers.

+ * + * @param recognizer the parser instance + * @param dfa the DFA for the current decision + * @param startIndex the input index where the decision started + * @param stopIndex the input input where the ambiguity was identified + * @param exact {@code true} if the ambiguity is exactly known, otherwise + * {@code false}. This is always {@code true} when + * {@link PredictionMode#LL_EXACT_AMBIG_DETECTION} is used. + * @param ambigAlts the potentially ambiguous alternatives, or {@code null} + * to indicate that the potentially ambiguous alternatives are the complete + * set of represented alternatives in {@code configs} + * @param configs the ATN configuration set where the ambiguity was + * identified + */ + virtual void reportAmbiguity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex, bool exact, + const antlrcpp::BitSet &ambigAlts, atn::ATNConfigSet *configs) = 0; + + /** + * This method is called when an SLL conflict occurs and the parser is about + * to use the full context information to make an LL decision. + * + *

If one or more configurations in {@code configs} contains a semantic + * predicate, the predicates are evaluated before this method is called. The + * subset of alternatives which are still viable after predicates are + * evaluated is reported in {@code conflictingAlts}.

+ * + *

This method is not used by lexers.

+ * + * @param recognizer the parser instance + * @param dfa the DFA for the current decision + * @param startIndex the input index where the decision started + * @param stopIndex the input index where the SLL conflict occurred + * @param conflictingAlts The specific conflicting alternatives. If this is + * {@code null}, the conflicting alternatives are all alternatives + * represented in {@code configs}. At the moment, conflictingAlts is non-null + * (for the reference implementation, but Sam's optimized version can see this + * as null). + * @param configs the ATN configuration set where the SLL conflict was + * detected + */ + virtual void reportAttemptingFullContext(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex, + const antlrcpp::BitSet &conflictingAlts, atn::ATNConfigSet *configs) = 0; + + /** + * This method is called by the parser when a full-context prediction has a + * unique result. + * + *

Each full-context prediction which does not result in a syntax error + * will call either {@link #reportContextSensitivity} or + * {@link #reportAmbiguity}.

+ * + *

For prediction implementations that only evaluate full-context + * predictions when an SLL conflict is found (including the default + * {@link ParserATNSimulator} implementation), this method reports cases + * where SLL conflicts were resolved to unique full-context predictions, + * i.e. the decision was context-sensitive. This report does not necessarily + * indicate a problem, and it may appear even in completely unambiguous + * grammars.

+ * + *

{@code configs} may have more than one represented alternative if the + * full-context prediction algorithm does not evaluate predicates before + * beginning the full-context prediction. In all cases, the final prediction + * is passed as the {@code prediction} argument.

+ * + *

Note that the definition of "context sensitivity" in this method + * differs from the concept in {@link DecisionInfo#contextSensitivities}. + * This method reports all instances where an SLL conflict occurred but LL + * parsing produced a unique result, whether or not that unique result + * matches the minimum alternative in the SLL conflicting set.

+ * + *

This method is not used by lexers.

+ * + * @param recognizer the parser instance + * @param dfa the DFA for the current decision + * @param startIndex the input index where the decision started + * @param stopIndex the input index where the context sensitivity was + * finally determined + * @param prediction the unambiguous result of the full-context prediction + * @param configs the ATN configuration set where the unambiguous prediction + * was determined + */ + virtual void reportContextSensitivity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex, + size_t prediction, atn::ATNConfigSet *configs) = 0; + }; + +} // namespace antlr4 diff --git a/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRErrorStrategy.cpp b/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRErrorStrategy.cpp new file mode 100644 index 0000000..1655a57 --- /dev/null +++ b/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRErrorStrategy.cpp @@ -0,0 +1,10 @@ +/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. + * Use of this file is governed by the BSD 3-clause license that + * can be found in the LICENSE.txt file in the project root. + */ + +#include "ANTLRErrorStrategy.h" + +antlr4::ANTLRErrorStrategy::~ANTLRErrorStrategy() +{ +} diff --git a/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRErrorStrategy.h b/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRErrorStrategy.h new file mode 100644 index 0000000..a3eecd1 --- /dev/null +++ b/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRErrorStrategy.h @@ -0,0 +1,121 @@ +/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. + * Use of this file is governed by the BSD 3-clause license that + * can be found in the LICENSE.txt file in the project root. + */ + +#pragma once + +#include "Token.h" + +namespace antlr4 { + + /// + /// The interface for defining strategies to deal with syntax errors encountered + /// during a parse by ANTLR-generated parsers. We distinguish between three + /// different kinds of errors: + /// + /// + /// + /// Implementations of this interface report syntax errors by calling + /// . + ///

+ /// TODO: what to do about lexers + ///

+ class ANTLR4CPP_PUBLIC ANTLRErrorStrategy { + public: + + /// + /// Reset the error handler state for the specified {@code recognizer}. + /// the parser instance + virtual ~ANTLRErrorStrategy(); + + virtual void reset(Parser *recognizer) = 0; + + /** + * This method is called when an unexpected symbol is encountered during an + * inline match operation, such as {@link Parser#match}. If the error + * strategy successfully recovers from the match failure, this method + * returns the {@link Token} instance which should be treated as the + * successful result of the match. + * + *

This method handles the consumption of any tokens - the caller should + * not call {@link Parser#consume} after a successful recovery.

+ * + *

Note that the calling code will not report an error if this method + * returns successfully. The error strategy implementation is responsible + * for calling {@link Parser#notifyErrorListeners} as appropriate.

+ * + * @param recognizer the parser instance + * @throws RecognitionException if the error strategy was not able to + * recover from the unexpected input symbol + */ + virtual Token* recoverInline(Parser *recognizer) = 0; + + /// + /// This method is called to recover from exception {@code e}. This method is + /// called after by the default exception handler + /// generated for a rule method. + /// + /// + /// the parser instance + /// the recognition exception to recover from + /// if the error strategy could not recover from + /// the recognition exception + virtual void recover(Parser *recognizer, std::exception_ptr e) = 0; + + /// + /// This method provides the error handler with an opportunity to handle + /// syntactic or semantic errors in the input stream before they result in a + /// . + ///

+ /// The generated code currently contains calls to after + /// entering the decision state of a closure block ({@code (...)*} or + /// {@code (...)+}). + ///

+ /// For an implementation based on Jim Idle's "magic sync" mechanism, see + /// . + ///

+ /// + /// the parser instance + /// if an error is detected by the error + /// strategy but cannot be automatically recovered at the current state in + /// the parsing process + virtual void sync(Parser *recognizer) = 0; + + /// + /// Tests whether or not {@code recognizer} is in the process of recovering + /// from an error. In error recovery mode, adds + /// symbols to the parse tree by calling + /// {@link Parser#createErrorNode(ParserRuleContext, Token)} then + /// {@link ParserRuleContext#addErrorNode(ErrorNode)} instead of + /// {@link Parser#createTerminalNode(ParserRuleContext, Token)}. + /// + /// the parser instance + /// {@code true} if the parser is currently recovering from a parse + /// error, otherwise {@code false} + virtual bool inErrorRecoveryMode(Parser *recognizer) = 0; + + /// + /// This method is called by when the parser successfully matches an input + /// symbol. + /// + /// the parser instance + virtual void reportMatch(Parser *recognizer) = 0; + + /// + /// Report any kind of . This method is called by + /// the default exception handler generated for a rule method. + /// + /// the parser instance + /// the recognition exception to report + virtual void reportError(Parser *recognizer, const RecognitionException &e) = 0; + }; + +} // namespace antlr4 diff --git a/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRFileStream.cpp b/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRFileStream.cpp new file mode 100644 index 0000000..62061bb --- /dev/null +++ b/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRFileStream.cpp @@ -0,0 +1,29 @@ +/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. + * Use of this file is governed by the BSD 3-clause license that + * can be found in the LICENSE.txt file in the project root. + */ + +#include "support/StringUtils.h" + +#include "ANTLRFileStream.h" + +using namespace antlr4; + +void ANTLRFileStream::loadFromFile(const std::string &fileName) { + _fileName = fileName; + if (_fileName.empty()) { + return; + } + +#ifdef _MSC_VER + std::ifstream stream(antlrcpp::s2ws(fileName), std::ios::binary); +#else + std::ifstream stream(fileName, std::ios::binary); +#endif + + ANTLRInputStream::load(stream); +} + +std::string ANTLRFileStream::getSourceName() const { + return _fileName; +} diff --git a/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRFileStream.h b/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRFileStream.h new file mode 100644 index 0000000..6c7d619 --- /dev/null +++ b/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRFileStream.h @@ -0,0 +1,30 @@ +/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. + * Use of this file is governed by the BSD 3-clause license that + * can be found in the LICENSE.txt file in the project root. + */ + +#pragma once + +#include "ANTLRInputStream.h" + +namespace antlr4 { + + /// This is an ANTLRInputStream that is loaded from a file all at once + /// when you construct the object (or call load()). + // TODO: this class needs testing. + class ANTLR4CPP_PUBLIC ANTLRFileStream : public ANTLRInputStream { + public: + ANTLRFileStream() = default; + ANTLRFileStream(const std::string &) = delete; + ANTLRFileStream(const char *data, size_t length) = delete; + ANTLRFileStream(std::istream &stream) = delete; + + // Assumes a file name encoded in UTF-8 and file content in the same encoding (with or w/o BOM). + virtual void loadFromFile(const std::string &fileName); + virtual std::string getSourceName() const override; + + private: + std::string _fileName; // UTF-8 encoded file name. + }; + +} // namespace antlr4 diff --git a/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRInputStream.cpp b/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRInputStream.cpp new file mode 100644 index 0000000..2dded40 --- /dev/null +++ b/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRInputStream.cpp @@ -0,0 +1,169 @@ +/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. + * Use of this file is governed by the BSD 3-clause license that + * can be found in the LICENSE.txt file in the project root. + */ + +#include + +#include "Exceptions.h" +#include "misc/Interval.h" +#include "IntStream.h" + +#include "support/StringUtils.h" +#include "support/CPPUtils.h" + +#include "ANTLRInputStream.h" + +using namespace antlr4; +using namespace antlrcpp; + +using misc::Interval; + +ANTLRInputStream::ANTLRInputStream() { + InitializeInstanceFields(); +} + +#if __cplusplus >= 201703L +ANTLRInputStream::ANTLRInputStream(const std::string_view &input): ANTLRInputStream() { + load(input.data(), input.length()); +} +#endif + +ANTLRInputStream::ANTLRInputStream(const std::string &input): ANTLRInputStream() { + load(input.data(), input.size()); +} + +ANTLRInputStream::ANTLRInputStream(const char *data, size_t length) { + load(data, length); +} + +ANTLRInputStream::ANTLRInputStream(std::istream &stream): ANTLRInputStream() { + load(stream); +} + +void ANTLRInputStream::load(const std::string &input) { + load(input.data(), input.size()); +} + +void ANTLRInputStream::load(const char *data, size_t length) { + // Remove the UTF-8 BOM if present. + const char *bom = "\xef\xbb\xbf"; + if (length >= 3 && strncmp(data, bom, 3) == 0) + _data = antlrcpp::utf8_to_utf32(data + 3, data + length); + else + _data = antlrcpp::utf8_to_utf32(data, data + length); + p = 0; +} + +void ANTLRInputStream::load(std::istream &stream) { + if (!stream.good() || stream.eof()) // No fail, bad or EOF. + return; + + _data.clear(); + + std::string s((std::istreambuf_iterator(stream)), std::istreambuf_iterator()); + load(s.data(), s.length()); +} + +void ANTLRInputStream::reset() { + p = 0; +} + +void ANTLRInputStream::consume() { + if (p >= _data.size()) { + assert(LA(1) == IntStream::EOF); + throw IllegalStateException("cannot consume EOF"); + } + + if (p < _data.size()) { + p++; + } +} + +size_t ANTLRInputStream::LA(ssize_t i) { + if (i == 0) { + return 0; // undefined + } + + ssize_t position = static_cast(p); + if (i < 0) { + i++; // e.g., translate LA(-1) to use offset i=0; then _data[p+0-1] + if ((position + i - 1) < 0) { + return IntStream::EOF; // invalid; no char before first char + } + } + + if ((position + i - 1) >= static_cast(_data.size())) { + return IntStream::EOF; + } + + return _data[static_cast((position + i - 1))]; +} + +size_t ANTLRInputStream::LT(ssize_t i) { + return LA(i); +} + +size_t ANTLRInputStream::index() { + return p; +} + +size_t ANTLRInputStream::size() { + return _data.size(); +} + +// Mark/release do nothing. We have entire buffer. +ssize_t ANTLRInputStream::mark() { + return -1; +} + +void ANTLRInputStream::release(ssize_t /* marker */) { +} + +void ANTLRInputStream::seek(size_t index) { + if (index <= p) { + p = index; // just jump; don't update stream state (line, ...) + return; + } + // seek forward, consume until p hits index or n (whichever comes first) + index = std::min(index, _data.size()); + while (p < index) { + consume(); + } +} + +std::string ANTLRInputStream::getText(const Interval &interval) { + if (interval.a < 0 || interval.b < 0) { + return ""; + } + + size_t start = static_cast(interval.a); + size_t stop = static_cast(interval.b); + + + if (stop >= _data.size()) { + stop = _data.size() - 1; + } + + size_t count = stop - start + 1; + if (start >= _data.size()) { + return ""; + } + + return antlrcpp::utf32_to_utf8(_data.substr(start, count)); +} + +std::string ANTLRInputStream::getSourceName() const { + if (name.empty()) { + return IntStream::UNKNOWN_SOURCE_NAME; + } + return name; +} + +std::string ANTLRInputStream::toString() const { + return antlrcpp::utf32_to_utf8(_data); +} + +void ANTLRInputStream::InitializeInstanceFields() { + p = 0; +} diff --git a/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRInputStream.h b/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRInputStream.h new file mode 100644 index 0000000..fdf857e --- /dev/null +++ b/antlr4-cpp-runtime-4.9.2-source/runtime/src/ANTLRInputStream.h @@ -0,0 +1,76 @@ +/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. + * Use of this file is governed by the BSD 3-clause license that + * can be found in the LICENSE.txt file in the project root. + */ + +#pragma once + +#include "CharStream.h" + +namespace antlr4 { + + // Vacuum all input from a stream and then treat it + // like a string. Can also pass in a string or char[] to use. + // Input is expected to be encoded in UTF-8 and converted to UTF-32 internally. + class ANTLR4CPP_PUBLIC ANTLRInputStream : public CharStream { + protected: + /// The data being scanned. + // UTF-32 + UTF32String _data; + + /// 0..n-1 index into string of next char + size_t p; + + public: + /// What is name or source of this char stream? + std::string name; + + ANTLRInputStream(); + +#if __cplusplus >= 201703L + ANTLRInputStream(const std::string_view &input); +#endif + + ANTLRInputStream(const std::string &input); + ANTLRInputStream(const char *data, size_t length); + ANTLRInputStream(std::istream &stream); + + virtual void load(const std::string &input); + virtual void load(const char *data, size_t length); + virtual void load(std::istream &stream); + + /// Reset the stream so that it's in the same state it was + /// when the object was created *except* the data array is not + /// touched. + virtual void reset(); + virtual void consume() override; + virtual size_t LA(ssize_t i) override; + virtual size_t LT(ssize_t i); + + /// + /// Return the current input symbol index 0..n where n indicates the + /// last symbol has been read. The index is the index of char to + /// be returned from LA(1). + /// + virtual size_t index() override; + virtual size_t size() override; + + /// + /// mark/release do nothing; we have entire buffer + virtual ssize_t mark() override; + virtual void release(ssize_t marker) override; + + /// + /// consume() ahead until p==index; can't just set p=index as we must + /// update line and charPositionInLine. If we seek backwards, just set p + /// + virtual void seek(size_t index) override; + virtual std::string getText(const misc::Interval &interval) override; + virtual std::string getSourceName() const override; + virtual std::string toString() const override; + + private: + void InitializeInstanceFields(); + }; + +} // namespace antlr4 diff --git a/antlr4-cpp-runtime-4.9.2-source/runtime/src/BailErrorStrategy.cpp b/antlr4-cpp-runtime-4.9.2-source/runtime/src/BailErrorStrategy.cpp new file mode 100644 index 0000000..5fbc011 --- /dev/null +++ b/antlr4-cpp-runtime-4.9.2-source/runtime/src/BailErrorStrategy.cpp @@ -0,0 +1,61 @@ +/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. + * Use of this file is governed by the BSD 3-clause license that + * can be found in the LICENSE.txt file in the project root. + */ + +#include "Exceptions.h" +#include "ParserRuleContext.h" +#include "InputMismatchException.h" +#include "Parser.h" + +#include "BailErrorStrategy.h" + +using namespace antlr4; + +void BailErrorStrategy::recover(Parser *recognizer, std::exception_ptr e) { + ParserRuleContext *context = recognizer->getContext(); + do { + context->exception = e; + if (context->parent == nullptr) + break; + context = static_cast(context->parent); + } while (true); + + try { + std::rethrow_exception(e); // Throw the exception to be able to catch and rethrow nested. +#if defined(_MSC_FULL_VER) && _MSC_FULL_VER < 190023026 + } catch (RecognitionException &inner) { + throw ParseCancellationException(inner.what()); +#else + } catch (RecognitionException & /*inner*/) { + std::throw_with_nested(ParseCancellationException()); +#endif + } +} + +Token* BailErrorStrategy::recoverInline(Parser *recognizer) { + InputMismatchException e(recognizer); + std::exception_ptr exception = std::make_exception_ptr(e); + + ParserRuleContext *context = recognizer->getContext(); + do { + context->exception = exception; + if (context->parent == nullptr) + break; + context = static_cast(context->parent); + } while (true); + + try { + throw e; +#if defined(_MSC_FULL_VER) && _MSC_FULL_VER < 190023026 + } catch (InputMismatchException &inner) { + throw ParseCancellationException(inner.what()); +#else + } catch (InputMismatchException & /*inner*/) { + std::throw_with_nested(ParseCancellationException()); +#endif + } +} + +void BailErrorStrategy::sync(Parser * /*recognizer*/) { +} diff --git a/antlr4-cpp-runtime-4.9.2-source/runtime/src/BailErrorStrategy.h b/antlr4-cpp-runtime-4.9.2-source/runtime/src/BailErrorStrategy.h new file mode 100644 index 0000000..2a8c36f --- /dev/null +++ b/antlr4-cpp-runtime-4.9.2-source/runtime/src/BailErrorStrategy.h @@ -0,0 +1,59 @@ +/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. + * Use of this file is governed by the BSD 3-clause license that + * can be found in the LICENSE.txt file in the project root. + */ + +#pragma once + +#include "DefaultErrorStrategy.h" + +namespace antlr4 { + + /** + * This implementation of {@link ANTLRErrorStrategy} responds to syntax errors + * by immediately canceling the parse operation with a + * {@link ParseCancellationException}. The implementation ensures that the + * {@link ParserRuleContext#exception} field is set for all parse tree nodes + * that were not completed prior to encountering the error. + * + *

+ * This error strategy is useful in the following scenarios.

+ * + *
    + *
  • Two-stage parsing: This error strategy allows the first + * stage of two-stage parsing to immediately terminate if an error is + * encountered, and immediately fall back to the second stage. In addition to + * avoiding wasted work by attempting to recover from errors here, the empty + * implementation of {@link BailErrorStrategy#sync} improves the performance of + * the first stage.
  • + *
  • Silent validation: When syntax errors are not being + * reported or logged, and the parse result is simply ignored if errors occur, + * the {@link BailErrorStrategy} avoids wasting work on recovering from errors + * when the result will be ignored either way.
  • + *
+ * + *

+ * {@code myparser.setErrorHandler(new BailErrorStrategy());}

+ * + * @see Parser#setErrorHandler(ANTLRErrorStrategy) + */ + class ANTLR4CPP_PUBLIC BailErrorStrategy : public DefaultErrorStrategy { + /// + /// Instead of recovering from exception {@code e}, re-throw it wrapped + /// in a so it is not caught by the + /// rule function catches. Use to get the + /// original . + /// + public: + virtual void recover(Parser *recognizer, std::exception_ptr e) override; + + /// Make sure we don't attempt to recover inline; if the parser + /// successfully recovers, it won't throw an exception. + virtual Token* recoverInline(Parser *recognizer) override; + + /// + /// Make sure we don't attempt to recover from problems in subrules. + virtual void sync(Parser *recognizer) override; + }; + +} // namespace antlr4 diff --git a/antlr4-cpp-runtime-4.9.2-source/runtime/src/BaseErrorListener.cpp b/antlr4-cpp-runtime-4.9.2-source/runtime/src/BaseErrorListener.cpp new file mode 100644 index 0000000..c035f09 --- /dev/null +++ b/antlr4-cpp-runtime-4.9.2-source/runtime/src/BaseErrorListener.cpp @@ -0,0 +1,25 @@ +/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. + * Use of this file is governed by the BSD 3-clause license that + * can be found in the LICENSE.txt file in the project root. + */ + +#include "BaseErrorListener.h" +#include "RecognitionException.h" + +using namespace antlr4; + +void BaseErrorListener::syntaxError(Recognizer * /*recognizer*/, Token * /*offendingSymbol*/, size_t /*line*/, + size_t /*charPositionInLine*/, const std::string &/*msg*/, std::exception_ptr /*e*/) { +} + +void BaseErrorListener::reportAmbiguity(Parser * /*recognizer*/, const dfa::DFA &/*dfa*/, size_t /*startIndex*/, + size_t /*stopIndex*/, bool /*exact*/, const antlrcpp::BitSet &/*ambigAlts*/, atn::ATNConfigSet * /*configs*/) { +} + +void BaseErrorListener::reportAttemptingFullContext(Parser * /*recognizer*/, const dfa::DFA &/*dfa*/, size_t /*startIndex*/, + size_t /*stopIndex*/, const antlrcpp::BitSet &/*conflictingAlts*/, atn::ATNConfigSet * /*configs*/) { +} + +void BaseErrorListener::reportContextSensitivity(Parser * /*recognizer*/, const dfa::DFA &/*dfa*/, size_t /*startIndex*/, + size_t /*stopIndex*/, size_t /*prediction*/, atn::ATNConfigSet * /*configs*/) { +} diff --git a/antlr4-cpp-runtime-4.9.2-source/runtime/src/BaseErrorListener.h b/antlr4-cpp-runtime-4.9.2-source/runtime/src/BaseErrorListener.h new file mode 100644 index 0000000..aad2e5d --- /dev/null +++ b/antlr4-cpp-runtime-4.9.2-source/runtime/src/BaseErrorListener.h @@ -0,0 +1,36 @@ +/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. + * Use of this file is governed by the BSD 3-clause license that + * can be found in the LICENSE.txt file in the project root. + */ + +#pragma once + +#include "ANTLRErrorListener.h" + +namespace antlrcpp { + class BitSet; +} + +namespace antlr4 { + + /** + * Provides an empty default implementation of {@link ANTLRErrorListener}. The + * default implementation of each method does nothing, but can be overridden as + * necessary. + */ + class ANTLR4CPP_PUBLIC BaseErrorListener : public ANTLRErrorListener { + + virtual void syntaxError(Recognizer *recognizer, Token * offendingSymbol, size_t line, size_t charPositionInLine, + const std::string &msg, std::exception_ptr e) override; + + virtual void reportAmbiguity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex, bool exact, + const antlrcpp::BitSet &ambigAlts, atn::ATNConfigSet *configs) override; + + virtual void reportAttemptingFullContext(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex, + const antlrcpp::BitSet &conflictingAlts, atn::ATNConfigSet *configs) override; + + virtual void reportContextSensitivity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex, + size_t prediction, atn::ATNConfigSet *configs) override; + }; + +} // namespace antlr4 diff --git a/antlr4-cpp-runtime-4.9.2-source/runtime/src/BufferedTokenStream.cpp b/antlr4-cpp-runtime-4.9.2-source/runtime/src/BufferedTokenStream.cpp new file mode 100644 index 0000000..241dfe5 --- /dev/null +++ b/antlr4-cpp-runtime-4.9.2-source/runtime/src/BufferedTokenStream.cpp @@ -0,0 +1,414 @@ +/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. + * Use of this file is governed by the BSD 3-clause license that + * can be found in the LICENSE.txt file in the project root. + */ + +#include "WritableToken.h" +#include "Lexer.h" +#include "RuleContext.h" +#include "misc/Interval.h" +#include "Exceptions.h" +#include "support/CPPUtils.h" + +#include "BufferedTokenStream.h" + +using namespace antlr4; +using namespace antlrcpp; + +BufferedTokenStream::BufferedTokenStream(TokenSource *tokenSource) : _tokenSource(tokenSource){ + InitializeInstanceFields(); +} + +TokenSource* BufferedTokenStream::getTokenSource() const { + return _tokenSource; +} + +size_t BufferedTokenStream::index() { + return _p; +} + +ssize_t BufferedTokenStream::mark() { + return 0; +} + +void BufferedTokenStream::release(ssize_t /*marker*/) { + // no resources to release +} + +void BufferedTokenStream::reset() { + seek(0); +} + +void BufferedTokenStream::seek(size_t index) { + lazyInit(); + _p = adjustSeekIndex(index); +} + +size_t BufferedTokenStream::size() { + return _tokens.size(); +} + +void BufferedTokenStream::consume() { + bool skipEofCheck = false; + if (!_needSetup) { + if (_fetchedEOF) { + // the last token in tokens is EOF. skip check if p indexes any + // fetched token except the last. + skipEofCheck = _p < _tokens.size() - 1; + } else { + // no EOF token in tokens. skip check if p indexes a fetched token. + skipEofCheck = _p < _tokens.size(); + } + } else { + // not yet initialized + skipEofCheck = false; + } + + if (!skipEofCheck && LA(1) == Token::EOF) { + throw IllegalStateException("cannot consume EOF"); + } + + if (sync(_p + 1)) { + _p = adjustSeekIndex(_p + 1); + } +} + +bool BufferedTokenStream::sync(size_t i) { + if (i + 1 < _tokens.size()) + return true; + size_t n = i - _tokens.size() + 1; // how many more elements we need? + + if (n > 0) { + size_t fetched = fetch(n); + return fetched >= n; + } + + return true; +} + +size_t BufferedTokenStream::fetch(size_t n) { + if (_fetchedEOF) { + return 0; + } + + size_t i = 0; + while (i < n) { + std::unique_ptr t(_tokenSource->nextToken()); + + if (is(t.get())) { + (static_cast(t.get()))->setTokenIndex(_tokens.size()); + } + + _tokens.push_back(std::move(t)); + ++i; + + if (_tokens.back()->getType() == Token::EOF) { + _fetchedEOF = true; + break; + } + } + + return i; +} + +Token* BufferedTokenStream::get(size_t i) const { + if (i >= _tokens.size()) { + throw IndexOutOfBoundsException(std::string("token index ") + + std::to_string(i) + + std::string(" out of range 0..") + + std::to_string(_tokens.size() - 1)); + } + return _tokens[i].get(); +} + +std::vector BufferedTokenStream::get(size_t start, size_t stop) { + std::vector subset; + + lazyInit(); + + if (_tokens.empty()) { + return subset; + } + + if (stop >= _tokens.size()) { + stop = _tokens.size() - 1; + } + for (size_t i = start; i <= stop; i++) { + Token *t = _tokens[i].get(); + if (t->getType() == Token::EOF) { + break; + } + subset.push_back(t); + } + return subset; +} + +size_t BufferedTokenStream::LA(ssize_t i) { + return LT(i)->getType(); +} + +Token* BufferedTokenStream::LB(size_t k) { + if (k > _p) { + return nullptr; + } + return _tokens[_p - k].get(); +} + +Token* BufferedTokenStream::LT(ssize_t k) { + lazyInit(); + if (k == 0) { + return nullptr; + } + if (k < 0) { + return LB(-k); + } + + size_t i = _p + k - 1; + sync(i); + if (i >= _tokens.size()) { // return EOF token + // EOF must be last token + return _tokens.back().get(); + } + + return _tokens[i].get(); +} + +ssize_t BufferedTokenStream::adjustSeekIndex(size_t i) { + return i; +} + +void BufferedTokenStream::lazyInit() { + if (_needSetup) { + setup(); + } +} + +void BufferedTokenStream::setup() { + _needSetup = false; + sync(0); + _p = adjustSeekIndex(0); +} + +void BufferedTokenStream::setTokenSource(TokenSource *tokenSource) { + _tokenSource = tokenSource; + _tokens.clear(); + _fetchedEOF = false; + _needSetup = true; +} + +std::vector BufferedTokenStream::getTokens() { + std::vector result; + for (auto &t : _tokens) + result.push_back(t.get()); + return result; +} + +std::vector BufferedTokenStream::getTokens(size_t start, size_t stop) { + return getTokens(start, stop, std::vector()); +} + +std::vector BufferedTokenStream::getTokens(size_t start, size_t stop, const std::vector &types) { + lazyInit(); + if (stop >= _tokens.size() || start >= _tokens.size()) { + throw IndexOutOfBoundsException(std::string("start ") + + std::to_string(start) + + std::string(" or stop ") + + std::to_string(stop) + + std::string(" not in 0..") + + std::to_string(_tokens.size() - 1)); + } + + std::vector filteredTokens; + + if (start > stop) { + return filteredTokens; + } + + for (size_t i = start; i <= stop; i++) { + Token *tok = _tokens[i].get(); + + if (types.empty() || std::find(types.begin(), types.end(), tok->getType()) != types.end()) { + filteredTokens.push_back(tok); + } + } + return filteredTokens; +} + +std::vector BufferedTokenStream::getTokens(size_t start, size_t stop, size_t ttype) { + std::vector s; + s.push_back(ttype); + return getTokens(start, stop, s); +} + +ssize_t BufferedTokenStream::nextTokenOnChannel(size_t i, size_t channel) { + sync(i); + if (i >= size()) { + return size() - 1; + } + + Token *token = _tokens[i].get(); + while (token->getChannel() != channel) { + if (token->getType() == Token::EOF) { + return i; + } + i++; + sync(i); + token = _tokens[i].get(); + } + return i; +} + +ssize_t BufferedTokenStream::previousTokenOnChannel(size_t i, size_t channel) { + sync(i); + if (i >= size()) { + // the EOF token is on every channel + return size() - 1; + } + + while (true) { + Token *token = _tokens[i].get(); + if (token->getType() == Token::EOF || token->getChannel() == channel) { + return i; + } + + if (i == 0) + return -1; + i--; + } + return i; +} + +std::vector BufferedTokenStream::getHiddenTokensToRight(size_t tokenIndex, ssize_t channel) { + lazyInit(); + if (tokenIndex >= _tokens.size()) { + throw IndexOutOfBoundsException(std::to_string(tokenIndex) + " not in 0.." + std::to_string(_tokens.size() - 1)); + } + + ssize_t nextOnChannel = nextTokenOnChannel(tokenIndex + 1, Lexer::DEFAULT_TOKEN_CHANNEL); + size_t to; + size_t from = tokenIndex + 1; + // if none onchannel to right, nextOnChannel=-1 so set to = last token + if (nextOnChannel == -1) { + to = static_cast(size() - 1); + } else { + to = nextOnChannel; + } + + return filterForChannel(from, to, channel); +} + +std::vector BufferedTokenStream::getHiddenTokensToRight(size_t tokenIndex) { + return getHiddenTokensToRight(tokenIndex, -1); +} + +std::vector BufferedTokenStream::getHiddenTokensToLeft(size_t tokenIndex, ssize_t channel) { + lazyInit(); + if (tokenIndex >= _tokens.size()) { + throw IndexOutOfBoundsException(std::to_string(tokenIndex) + " not in 0.." + std::to_string(_tokens.size() - 1)); + } + + if (tokenIndex == 0) { + // Obviously no tokens can appear before the first token. + return { }; + } + + ssize_t prevOnChannel = previousTokenOnChannel(tokenIndex - 1, Lexer::DEFAULT_TOKEN_CHANNEL); + if (prevOnChannel == static_cast(tokenIndex - 1)) { + return { }; + } + // if none onchannel to left, prevOnChannel=-1 then from=0 + size_t from = static_cast(prevOnChannel + 1); + size_t to = tokenIndex - 1; + + return filterForChannel(from, to, channel); +} + +std::vector BufferedTokenStream::getHiddenTokensToLeft(size_t tokenIndex) { + return getHiddenTokensToLeft(tokenIndex, -1); +} + +std::vector BufferedTokenStream::filterForChannel(size_t from, size_t to, ssize_t channel) { + std::vector hidden; + for (size_t i = from; i <= to; i++) { + Token *t = _tokens[i].get(); + if (channel == -1) { + if (t->getChannel() != Lexer::DEFAULT_TOKEN_CHANNEL) { + hidden.push_back(t); + } + } else { + if (t->getChannel() == static_cast(channel)) { + hidden.push_back(t); + } + } + } + + return hidden; +} + +bool BufferedTokenStream::isInitialized() const { + return !_needSetup; +} + +/** + * Get the text of all tokens in this buffer. + */ +std::string BufferedTokenStream::getSourceName() const +{ + return _tokenSource->getSourceName(); +} + +std::string BufferedTokenStream::getText() { + fill(); + return getText(misc::Interval(0U, size() - 1)); +} + +std::string BufferedTokenStream::getText(const misc::Interval &interval) { + lazyInit(); + size_t start = interval.a; + size_t stop = interval.b; + if (start == INVALID_INDEX || stop == INVALID_INDEX) { + return ""; + } + sync(stop); + if (stop >= _tokens.size()) { + stop = _tokens.size() - 1; + } + + std::stringstream ss; + for (size_t i = start; i <= stop; i++) { + Token *t = _tokens[i].get(); + if (t->getType() == Token::EOF) { + break; + } + ss << t->getText(); + } + return ss.str(); +} + +std::string BufferedTokenStream::getText(RuleContext *ctx) { + return getText(ctx->getSourceInterval()); +} + +std::string BufferedTokenStream::getText(Token *start, Token *stop) { + if (start != nullptr && stop != nullptr) { + return getText(misc::Interval(start->getTokenIndex(), stop->getTokenIndex())); + } + + return ""; +} + +void BufferedTokenStream::fill() { + lazyInit(); + const size_t blockSize = 1000; + while (true) { + size_t fetched = fetch(blockSize); + if (fetched < blockSize) { + return; + } + } +} + +void BufferedTokenStream::InitializeInstanceFields() { + _needSetup = true; + _fetchedEOF = false; +} diff --git a/antlr4-cpp-runtime-4.9.2-source/runtime/src/BufferedTokenStream.h b/antlr4-cpp-runtime-4.9.2-source/runtime/src/BufferedTokenStream.h new file mode 100644 index 0000000..fab74d2 --- /dev/null +++ b/antlr4-cpp-runtime-4.9.2-source/runtime/src/BufferedTokenStream.h @@ -0,0 +1,200 @@ +/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. + * Use of this file is governed by the BSD 3-clause license that + * can be found in the LICENSE.txt file in the project root. + */ + +#pragma once + +#include "TokenStream.h" + +namespace antlr4 { + + /** + * This implementation of {@link TokenStream} loads tokens from a + * {@link TokenSource} on-demand, and places the tokens in a buffer to provide + * access to any previous token by index. + * + *

+ * This token stream ignores the value of {@link Token#getChannel}. If your + * parser requires the token stream filter tokens to only those on a particular + * channel, such as {@link Token#DEFAULT_CHANNEL} or + * {@link Token#HIDDEN_CHANNEL}, use a filtering token stream such a + * {@link CommonTokenStream}.

+ */ + class ANTLR4CPP_PUBLIC BufferedTokenStream : public TokenStream { + public: + BufferedTokenStream(TokenSource *tokenSource); + BufferedTokenStream(const BufferedTokenStream& other) = delete; + + BufferedTokenStream& operator = (const BufferedTokenStream& other) = delete; + + virtual TokenSource* getTokenSource() const override; + virtual size_t index() override; + virtual ssize_t mark() override; + + virtual void release(ssize_t marker) override; + virtual void reset(); + virtual void seek(size_t index) override; + + virtual size_t size() override; + virtual void consume() override; + + virtual Token* get(size_t i) const override; + + /// Get all tokens from start..stop inclusively. + virtual std::vector get(size_t start, size_t stop); + + virtual size_t LA(ssize_t i) override; + virtual Token* LT(ssize_t k) override; + + /// Reset this token stream by setting its token source. + virtual void setTokenSource(TokenSource *tokenSource); + virtual std::vector getTokens(); + virtual std::vector getTokens(size_t start, size_t stop); + + /// + /// Given a start and stop index, return a List of all tokens in + /// the token type BitSet. Return null if no tokens were found. This + /// method looks at both on and off channel tokens. + /// + virtual std::vector getTokens(size_t start, size_t stop, const std::vector &types); + virtual std::vector getTokens(size_t start, size_t stop, size_t ttype); + + /// Collect all tokens on specified channel to the right of + /// the current token up until we see a token on DEFAULT_TOKEN_CHANNEL or + /// EOF. If channel is -1, find any non default channel token. + virtual std::vector getHiddenTokensToRight(size_t tokenIndex, ssize_t channel); + + /// + /// Collect all hidden tokens (any off-default channel) to the right of + /// the current token up until we see a token on DEFAULT_TOKEN_CHANNEL + /// or EOF. + /// + virtual std::vector getHiddenTokensToRight(size_t tokenIndex); + + /// + /// Collect all tokens on specified channel to the left of + /// the current token up until we see a token on DEFAULT_TOKEN_CHANNEL. + /// If channel is -1, find any non default channel token. + /// + virtual std::vector getHiddenTokensToLeft(size_t tokenIndex, ssize_t channel); + + /// + /// Collect all hidden tokens (any off-default channel) to the left of + /// the current token up until we see a token on DEFAULT_TOKEN_CHANNEL. + /// + virtual std::vector getHiddenTokensToLeft(size_t tokenIndex); + + virtual std::string getSourceName() const override; + virtual std::string getText() override; + virtual std::string getText(const misc::Interval &interval) override; + virtual std::string getText(RuleContext *ctx) override; + virtual std::string getText(Token *start, Token *stop) override; + + /// Get all tokens from lexer until EOF. + virtual void fill(); + + protected: + /** + * The {@link TokenSource} from which tokens for this stream are fetched. + */ + TokenSource *_tokenSource; + + /** + * A collection of all tokens fetched from the token source. The list is + * considered a complete view of the input once {@link #fetchedEOF} is set + * to {@code true}. + */ + std::vector> _tokens; + + /** + * The index into {@link #tokens} of the current token (next token to + * {@link #consume}). {@link #tokens}{@code [}{@link #p}{@code ]} should be + * {@link #LT LT(1)}. + * + *

This field is set to -1 when the stream is first constructed or when + * {@link #setTokenSource} is called, indicating that the first token has + * not yet been fetched from the token source. For additional information, + * see the documentation of {@link IntStream} for a description of + * Initializing Methods.

+ */ + // ml: since -1 requires to make this member signed for just this single aspect we use a member _needSetup instead. + // Use bool isInitialized() to find out if this stream has started reading. + size_t _p; + + /** + * Indicates whether the {@link Token#EOF} token has been fetched from + * {@link #tokenSource} and added to {@link #tokens}. This field improves + * performance for the following cases: + * + *