did_parser 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +12 -0
- data/Rakefile +28 -0
- data/did_parser.gemspec +31 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorListener.cpp +10 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorListener.h +167 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorStrategy.cpp +10 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorStrategy.h +121 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.cpp +23 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.h +30 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +180 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.h +79 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/BailErrorStrategy.cpp +61 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/BailErrorStrategy.h +59 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/BaseErrorListener.cpp +25 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/BaseErrorListener.h +36 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/BufferedTokenStream.cpp +414 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/BufferedTokenStream.h +200 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/CharStream.cpp +11 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/CharStream.h +37 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.cpp +193 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.h +158 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.cpp +39 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.h +74 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenStream.cpp +78 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenStream.h +79 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ConsoleErrorListener.cpp +15 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ConsoleErrorListener.h +35 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp +336 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.h +466 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/DiagnosticErrorListener.cpp +84 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/DiagnosticErrorListener.h +80 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.cpp +64 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.h +99 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.cpp +52 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.h +32 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/InputMismatchException.cpp +18 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/InputMismatchException.h +24 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.cpp +12 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.h +218 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/InterpreterRuleContext.cpp +19 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/InterpreterRuleContext.h +45 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.cpp +294 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.h +196 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.cpp +60 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.h +46 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerNoViableAltException.cpp +36 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerNoViableAltException.h +31 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.cpp +92 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.h +88 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/NoViableAltException.cpp +46 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/NoViableAltException.h +42 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.cpp +668 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.h +461 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.cpp +294 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.h +173 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.cpp +138 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.h +147 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.cpp +53 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.h +38 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.cpp +65 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.h +98 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.cpp +156 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.h +159 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.cpp +144 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.h +141 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContextWithAltNum.cpp +27 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContextWithAltNum.h +32 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.cpp +54 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.h +155 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.cpp +9 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.h +92 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenFactory.h +30 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.cpp +9 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.h +85 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStream.cpp +11 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStream.h +137 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp +425 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.h +295 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp +208 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.h +117 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedTokenStream.cpp +270 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedTokenStream.h +115 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Version.h +42 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.cpp +64 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.h +177 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/WritableToken.cpp +9 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/WritableToken.h +23 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-common.h +98 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-runtime.h +169 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.cpp +158 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.h +132 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.cpp +106 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.h +157 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp +232 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.h +156 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.cpp +54 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.h +48 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp +629 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.h +32 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.cpp +33 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.h +71 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.cpp +56 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.h +139 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.cpp +33 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.h +36 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNType.h +20 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.cpp +29 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.h +35 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AmbiguityInfo.cpp +16 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AmbiguityInfo.h +68 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.cpp +109 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.h +51 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.cpp +27 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.h +33 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.h +24 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.h +23 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.h +26 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.h +30 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.cpp +14 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.h +47 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionEventInfo.cpp +14 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionEventInfo.h +70 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.cpp +25 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.h +227 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.cpp +12 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.h +34 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.cpp +31 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.h +42 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ErrorInfo.cpp +15 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ErrorInfo.h +43 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp +189 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.h +76 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.cpp +67 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.h +44 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp +615 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.h +199 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.cpp +15 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.h +100 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.cpp +111 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.h +128 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionType.h +57 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.cpp +43 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.h +59 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.cpp +45 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.h +75 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.cpp +57 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.h +76 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp +43 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.h +57 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.cpp +36 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.h +53 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.cpp +36 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.h +53 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.cpp +43 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.h +57 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.cpp +36 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.h +51 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.cpp +43 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.h +51 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.cpp +16 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.h +42 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.h +26 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.cpp +22 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.h +27 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.cpp +16 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.h +25 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParseInfo.cpp +102 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParseInfo.h +102 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp +1383 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.h +911 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulatorOptions.h +50 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.h +29 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.h +25 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.cpp +23 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.h +35 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.cpp +17 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.h +62 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.cpp +24 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.h +50 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.cpp +579 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.h +225 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.cpp +56 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.h +64 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.cpp +167 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.h +101 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCacheOptions.h +71 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextType.h +21 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.cpp +202 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.h +436 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.cpp +179 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.h +60 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.cpp +26 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.h +31 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.h +26 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.h +27 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.cpp +33 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.h +42 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.cpp +418 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.h +233 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContextType.h +23 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SerializedATNView.h +101 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.cpp +28 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.h +38 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp +86 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.h +43 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.h +24 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.h +37 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.cpp +19 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.h +25 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.h +24 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.cpp +36 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.h +65 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.cpp +27 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.h +33 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.cpp +21 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.h +27 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.cpp +115 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.h +96 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.cpp +60 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.h +32 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.cpp +59 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.h +153 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.cpp +17 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.h +22 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.cpp +124 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.h +33 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.cpp +61 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.h +84 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.cpp +508 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.h +190 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.cpp +120 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.h +102 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Predicate.cpp +4 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Predicate.h +21 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.cpp +8 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.h +16 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.cpp +43 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.h +149 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/BitSet.h +76 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.cpp +207 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.h +65 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Casts.h +34 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Declarations.h +161 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.cpp +38 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.h +16 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Unicode.h +28 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.cpp +242 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.h +54 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h +129 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.h +24 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.cpp +54 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.h +43 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.cpp +66 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.h +53 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.cpp +12 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.h +111 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeListener.cpp +9 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeListener.h +39 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeProperty.h +50 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeType.h +22 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.cpp +9 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.h +57 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.cpp +48 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.h +55 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.h +40 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp +54 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.h +32 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.cpp +241 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.h +78 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/Chunk.cpp +9 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/Chunk.h +44 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.cpp +69 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.h +132 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp +64 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.h +105 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp +370 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.h +185 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.cpp +77 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.h +117 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TagChunk.cpp +39 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TagChunk.h +86 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TextChunk.cpp +28 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TextChunk.h +51 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.cpp +36 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.h +80 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp +154 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.h +86 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathElement.cpp +31 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathElement.h +40 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.cpp +182 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.h +47 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.cpp +13 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.h +22 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.cpp +20 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.h +27 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp +30 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.h +26 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.cpp +20 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.h +25 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp +33 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.h +26 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.cpp +23 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.h +23 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.cpp +24 -0
- data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.h +23 -0
- data/ext/did_parser/antlrgen/DIDLexer.cpp +225 -0
- data/ext/did_parser/antlrgen/DIDLexer.h +52 -0
- data/ext/did_parser/antlrgen/DIDLexer.interp +93 -0
- data/ext/did_parser/antlrgen/DIDLexer.tokens +42 -0
- data/ext/did_parser/antlrgen/DIDParser.cpp +2042 -0
- data/ext/did_parser/antlrgen/DIDParser.h +537 -0
- data/ext/did_parser/antlrgen/DIDParser.interp +74 -0
- data/ext/did_parser/antlrgen/DIDParser.tokens +42 -0
- data/ext/did_parser/antlrgen/DIDParserBaseListener.cpp +7 -0
- data/ext/did_parser/antlrgen/DIDParserBaseListener.h +104 -0
- data/ext/did_parser/antlrgen/DIDParserBaseVisitor.cpp +7 -0
- data/ext/did_parser/antlrgen/DIDParserBaseVisitor.h +124 -0
- data/ext/did_parser/antlrgen/DIDParserListener.cpp +7 -0
- data/ext/did_parser/antlrgen/DIDParserListener.h +97 -0
- data/ext/did_parser/antlrgen/DIDParserVisitor.cpp +7 -0
- data/ext/did_parser/antlrgen/DIDParserVisitor.h +76 -0
- data/ext/did_parser/did_parser.cpp +2996 -0
- data/ext/did_parser/extconf.rb +38 -0
- data/lib/did_parser/version.rb +3 -0
- data/lib/did_parser.rb +2 -0
- metadata +382 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
|
2
|
+
* Use of this file is governed by the BSD 3-clause license that
|
|
3
|
+
* can be found in the LICENSE.txt file in the project root.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include "Token.h"
|
|
9
|
+
|
|
10
|
+
namespace antlr4 {
|
|
11
|
+
|
|
12
|
+
class ANTLR4CPP_PUBLIC WritableToken : public Token {
|
|
13
|
+
public:
|
|
14
|
+
virtual ~WritableToken();
|
|
15
|
+
virtual void setText(const std::string &text) = 0;
|
|
16
|
+
virtual void setType(size_t ttype) = 0;
|
|
17
|
+
virtual void setLine(size_t line) = 0;
|
|
18
|
+
virtual void setCharPositionInLine(size_t pos) = 0;
|
|
19
|
+
virtual void setChannel(size_t channel) = 0;
|
|
20
|
+
virtual void setTokenIndex(size_t index) = 0;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
} // namespace antlr4
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
|
2
|
+
* Use of this file is governed by the BSD 3-clause license that
|
|
3
|
+
* can be found in the LICENSE.txt file in the project root.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include <algorithm>
|
|
9
|
+
#include <any>
|
|
10
|
+
#include <atomic>
|
|
11
|
+
#include <bitset>
|
|
12
|
+
#include <cassert>
|
|
13
|
+
#include <climits>
|
|
14
|
+
#include <cstddef>
|
|
15
|
+
#include <cstdint>
|
|
16
|
+
#include <cstdlib>
|
|
17
|
+
#include <exception>
|
|
18
|
+
#include <fstream>
|
|
19
|
+
#include <iostream>
|
|
20
|
+
#include <iterator>
|
|
21
|
+
#include <limits>
|
|
22
|
+
#include <map>
|
|
23
|
+
#include <memory>
|
|
24
|
+
#include <mutex>
|
|
25
|
+
#include <set>
|
|
26
|
+
#include <shared_mutex>
|
|
27
|
+
#include <sstream>
|
|
28
|
+
#include <stack>
|
|
29
|
+
#include <string>
|
|
30
|
+
#include <string_view>
|
|
31
|
+
#include <typeinfo>
|
|
32
|
+
#include <type_traits>
|
|
33
|
+
#include <unordered_map>
|
|
34
|
+
#include <unordered_set>
|
|
35
|
+
#include <utility>
|
|
36
|
+
#include <vector>
|
|
37
|
+
|
|
38
|
+
// Defines for the Guid class and other platform dependent stuff.
|
|
39
|
+
#ifdef _WIN32
|
|
40
|
+
#ifdef _MSC_VER
|
|
41
|
+
#pragma warning (disable: 4250) // Class inherits by dominance.
|
|
42
|
+
#pragma warning (disable: 4512) // assignment operator could not be generated
|
|
43
|
+
|
|
44
|
+
#if _MSC_VER < 1900
|
|
45
|
+
// Before VS 2015 code like "while (true)" will create a (useless) warning in level 4.
|
|
46
|
+
#pragma warning (disable: 4127) // conditional expression is constant
|
|
47
|
+
#endif
|
|
48
|
+
#endif
|
|
49
|
+
|
|
50
|
+
#ifdef _WIN64
|
|
51
|
+
typedef __int64 ssize_t;
|
|
52
|
+
#else
|
|
53
|
+
typedef __int32 ssize_t;
|
|
54
|
+
#endif
|
|
55
|
+
|
|
56
|
+
#ifdef ANTLR4CPP_EXPORTS
|
|
57
|
+
#define ANTLR4CPP_PUBLIC __declspec(dllexport)
|
|
58
|
+
#else
|
|
59
|
+
#ifdef ANTLR4CPP_STATIC
|
|
60
|
+
#define ANTLR4CPP_PUBLIC
|
|
61
|
+
#else
|
|
62
|
+
#define ANTLR4CPP_PUBLIC __declspec(dllimport)
|
|
63
|
+
#endif
|
|
64
|
+
#endif
|
|
65
|
+
|
|
66
|
+
#elif defined(__APPLE__)
|
|
67
|
+
#if __GNUC__ >= 4
|
|
68
|
+
#define ANTLR4CPP_PUBLIC __attribute__ ((visibility ("default")))
|
|
69
|
+
#else
|
|
70
|
+
#define ANTLR4CPP_PUBLIC
|
|
71
|
+
#endif
|
|
72
|
+
#else
|
|
73
|
+
#if __GNUC__ >= 6
|
|
74
|
+
#define ANTLR4CPP_PUBLIC __attribute__ ((visibility ("default")))
|
|
75
|
+
#else
|
|
76
|
+
#define ANTLR4CPP_PUBLIC
|
|
77
|
+
#endif
|
|
78
|
+
#endif
|
|
79
|
+
|
|
80
|
+
#ifdef __has_builtin
|
|
81
|
+
#define ANTLR4CPP_HAVE_BUILTIN(x) __has_builtin(x)
|
|
82
|
+
#else
|
|
83
|
+
#define ANTLR4CPP_HAVE_BUILTIN(x) 0
|
|
84
|
+
#endif
|
|
85
|
+
|
|
86
|
+
#define ANTLR4CPP_INTERNAL_STRINGIFY(x) #x
|
|
87
|
+
#define ANTLR4CPP_STRINGIFY(x) ANTLR4CPP_INTERNAL_STRINGIFY(x)
|
|
88
|
+
|
|
89
|
+
#include "support/Declarations.h"
|
|
90
|
+
|
|
91
|
+
// We have to undefine this symbol as ANTLR will use this name for own members and even
|
|
92
|
+
// generated functions. Because EOF is a global macro we cannot use e.g. a namespace scope to disambiguate.
|
|
93
|
+
#ifdef EOF
|
|
94
|
+
#undef EOF
|
|
95
|
+
#endif
|
|
96
|
+
|
|
97
|
+
#define INVALID_INDEX std::numeric_limits<size_t>::max()
|
|
98
|
+
template<class T> using Ref = std::shared_ptr<T>;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
|
2
|
+
* Use of this file is governed by the BSD 3-clause license that
|
|
3
|
+
* can be found in the LICENSE.txt file in the project root.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
// This is the umbrella header for all ANTLR4 C++ runtime headers.
|
|
9
|
+
|
|
10
|
+
#include "antlr4-common.h"
|
|
11
|
+
|
|
12
|
+
#include "ANTLRErrorListener.h"
|
|
13
|
+
#include "ANTLRErrorStrategy.h"
|
|
14
|
+
#include "ANTLRFileStream.h"
|
|
15
|
+
#include "ANTLRInputStream.h"
|
|
16
|
+
#include "BailErrorStrategy.h"
|
|
17
|
+
#include "BaseErrorListener.h"
|
|
18
|
+
#include "BufferedTokenStream.h"
|
|
19
|
+
#include "CharStream.h"
|
|
20
|
+
#include "CommonToken.h"
|
|
21
|
+
#include "CommonTokenFactory.h"
|
|
22
|
+
#include "CommonTokenStream.h"
|
|
23
|
+
#include "ConsoleErrorListener.h"
|
|
24
|
+
#include "DefaultErrorStrategy.h"
|
|
25
|
+
#include "DiagnosticErrorListener.h"
|
|
26
|
+
#include "Exceptions.h"
|
|
27
|
+
#include "FailedPredicateException.h"
|
|
28
|
+
#include "InputMismatchException.h"
|
|
29
|
+
#include "IntStream.h"
|
|
30
|
+
#include "InterpreterRuleContext.h"
|
|
31
|
+
#include "Lexer.h"
|
|
32
|
+
#include "LexerInterpreter.h"
|
|
33
|
+
#include "LexerNoViableAltException.h"
|
|
34
|
+
#include "ListTokenSource.h"
|
|
35
|
+
#include "NoViableAltException.h"
|
|
36
|
+
#include "Parser.h"
|
|
37
|
+
#include "ParserInterpreter.h"
|
|
38
|
+
#include "ParserRuleContext.h"
|
|
39
|
+
#include "ProxyErrorListener.h"
|
|
40
|
+
#include "RecognitionException.h"
|
|
41
|
+
#include "Recognizer.h"
|
|
42
|
+
#include "RuleContext.h"
|
|
43
|
+
#include "RuleContextWithAltNum.h"
|
|
44
|
+
#include "RuntimeMetaData.h"
|
|
45
|
+
#include "Token.h"
|
|
46
|
+
#include "TokenFactory.h"
|
|
47
|
+
#include "TokenSource.h"
|
|
48
|
+
#include "TokenStream.h"
|
|
49
|
+
#include "TokenStreamRewriter.h"
|
|
50
|
+
#include "UnbufferedCharStream.h"
|
|
51
|
+
#include "UnbufferedTokenStream.h"
|
|
52
|
+
#include "Version.h"
|
|
53
|
+
#include "Vocabulary.h"
|
|
54
|
+
#include "Vocabulary.h"
|
|
55
|
+
#include "WritableToken.h"
|
|
56
|
+
#include "atn/ATN.h"
|
|
57
|
+
#include "atn/ATNConfig.h"
|
|
58
|
+
#include "atn/ATNConfigSet.h"
|
|
59
|
+
#include "atn/ATNDeserializationOptions.h"
|
|
60
|
+
#include "atn/ATNDeserializer.h"
|
|
61
|
+
#include "atn/ATNSimulator.h"
|
|
62
|
+
#include "atn/ATNState.h"
|
|
63
|
+
#include "atn/ATNType.h"
|
|
64
|
+
#include "atn/ActionTransition.h"
|
|
65
|
+
#include "atn/AmbiguityInfo.h"
|
|
66
|
+
#include "atn/ArrayPredictionContext.h"
|
|
67
|
+
#include "atn/AtomTransition.h"
|
|
68
|
+
#include "atn/BasicBlockStartState.h"
|
|
69
|
+
#include "atn/BasicState.h"
|
|
70
|
+
#include "atn/BlockEndState.h"
|
|
71
|
+
#include "atn/BlockStartState.h"
|
|
72
|
+
#include "atn/ContextSensitivityInfo.h"
|
|
73
|
+
#include "atn/DecisionEventInfo.h"
|
|
74
|
+
#include "atn/DecisionInfo.h"
|
|
75
|
+
#include "atn/DecisionState.h"
|
|
76
|
+
#include "atn/EpsilonTransition.h"
|
|
77
|
+
#include "atn/ErrorInfo.h"
|
|
78
|
+
#include "atn/LL1Analyzer.h"
|
|
79
|
+
#include "atn/LexerATNConfig.h"
|
|
80
|
+
#include "atn/LexerATNSimulator.h"
|
|
81
|
+
#include "atn/LexerAction.h"
|
|
82
|
+
#include "atn/LexerActionExecutor.h"
|
|
83
|
+
#include "atn/LexerActionType.h"
|
|
84
|
+
#include "atn/LexerChannelAction.h"
|
|
85
|
+
#include "atn/LexerCustomAction.h"
|
|
86
|
+
#include "atn/LexerIndexedCustomAction.h"
|
|
87
|
+
#include "atn/LexerModeAction.h"
|
|
88
|
+
#include "atn/LexerMoreAction.h"
|
|
89
|
+
#include "atn/LexerPopModeAction.h"
|
|
90
|
+
#include "atn/LexerPushModeAction.h"
|
|
91
|
+
#include "atn/LexerSkipAction.h"
|
|
92
|
+
#include "atn/LexerTypeAction.h"
|
|
93
|
+
#include "atn/LookaheadEventInfo.h"
|
|
94
|
+
#include "atn/LoopEndState.h"
|
|
95
|
+
#include "atn/NotSetTransition.h"
|
|
96
|
+
#include "atn/OrderedATNConfigSet.h"
|
|
97
|
+
#include "atn/ParseInfo.h"
|
|
98
|
+
#include "atn/ParserATNSimulator.h"
|
|
99
|
+
#include "atn/ParserATNSimulatorOptions.h"
|
|
100
|
+
#include "atn/PlusBlockStartState.h"
|
|
101
|
+
#include "atn/PlusLoopbackState.h"
|
|
102
|
+
#include "atn/PrecedencePredicateTransition.h"
|
|
103
|
+
#include "atn/PredicateEvalInfo.h"
|
|
104
|
+
#include "atn/PredicateTransition.h"
|
|
105
|
+
#include "atn/PredictionContext.h"
|
|
106
|
+
#include "atn/PredictionContextCache.h"
|
|
107
|
+
#include "atn/PredictionContextMergeCache.h"
|
|
108
|
+
#include "atn/PredictionContextMergeCacheOptions.h"
|
|
109
|
+
#include "atn/PredictionMode.h"
|
|
110
|
+
#include "atn/ProfilingATNSimulator.h"
|
|
111
|
+
#include "atn/RangeTransition.h"
|
|
112
|
+
#include "atn/RuleStartState.h"
|
|
113
|
+
#include "atn/RuleStopState.h"
|
|
114
|
+
#include "atn/RuleTransition.h"
|
|
115
|
+
#include "atn/SemanticContext.h"
|
|
116
|
+
#include "atn/SerializedATNView.h"
|
|
117
|
+
#include "atn/SetTransition.h"
|
|
118
|
+
#include "atn/SingletonPredictionContext.h"
|
|
119
|
+
#include "atn/StarBlockStartState.h"
|
|
120
|
+
#include "atn/StarLoopEntryState.h"
|
|
121
|
+
#include "atn/StarLoopbackState.h"
|
|
122
|
+
#include "atn/TokensStartState.h"
|
|
123
|
+
#include "atn/Transition.h"
|
|
124
|
+
#include "atn/WildcardTransition.h"
|
|
125
|
+
#include "dfa/DFA.h"
|
|
126
|
+
#include "dfa/DFASerializer.h"
|
|
127
|
+
#include "dfa/DFAState.h"
|
|
128
|
+
#include "dfa/LexerDFASerializer.h"
|
|
129
|
+
#include "misc/InterpreterDataReader.h"
|
|
130
|
+
#include "misc/Interval.h"
|
|
131
|
+
#include "misc/IntervalSet.h"
|
|
132
|
+
#include "misc/MurmurHash.h"
|
|
133
|
+
#include "misc/Predicate.h"
|
|
134
|
+
#include "support/Any.h"
|
|
135
|
+
#include "support/Arrays.h"
|
|
136
|
+
#include "support/BitSet.h"
|
|
137
|
+
#include "support/Casts.h"
|
|
138
|
+
#include "support/CPPUtils.h"
|
|
139
|
+
#include "tree/AbstractParseTreeVisitor.h"
|
|
140
|
+
#include "tree/ErrorNode.h"
|
|
141
|
+
#include "tree/ErrorNodeImpl.h"
|
|
142
|
+
#include "tree/ParseTree.h"
|
|
143
|
+
#include "tree/ParseTreeListener.h"
|
|
144
|
+
#include "tree/ParseTreeProperty.h"
|
|
145
|
+
#include "tree/ParseTreeVisitor.h"
|
|
146
|
+
#include "tree/ParseTreeWalker.h"
|
|
147
|
+
#include "tree/TerminalNode.h"
|
|
148
|
+
#include "tree/TerminalNodeImpl.h"
|
|
149
|
+
#include "tree/Trees.h"
|
|
150
|
+
#include "tree/pattern/Chunk.h"
|
|
151
|
+
#include "tree/pattern/ParseTreeMatch.h"
|
|
152
|
+
#include "tree/pattern/ParseTreePattern.h"
|
|
153
|
+
#include "tree/pattern/ParseTreePatternMatcher.h"
|
|
154
|
+
#include "tree/pattern/RuleTagToken.h"
|
|
155
|
+
#include "tree/pattern/TagChunk.h"
|
|
156
|
+
#include "tree/pattern/TextChunk.h"
|
|
157
|
+
#include "tree/pattern/TokenTagToken.h"
|
|
158
|
+
#include "tree/xpath/XPath.h"
|
|
159
|
+
#include "tree/xpath/XPathElement.h"
|
|
160
|
+
#include "tree/xpath/XPathLexer.h"
|
|
161
|
+
#include "tree/xpath/XPathLexerErrorListener.h"
|
|
162
|
+
#include "tree/xpath/XPathRuleAnywhereElement.h"
|
|
163
|
+
#include "tree/xpath/XPathRuleElement.h"
|
|
164
|
+
#include "tree/xpath/XPathTokenAnywhereElement.h"
|
|
165
|
+
#include "tree/xpath/XPathTokenElement.h"
|
|
166
|
+
#include "tree/xpath/XPathWildcardAnywhereElement.h"
|
|
167
|
+
#include "tree/xpath/XPathWildcardElement.h"
|
|
168
|
+
|
|
169
|
+
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
|
2
|
+
* Use of this file is governed by the BSD 3-clause license that
|
|
3
|
+
* can be found in the LICENSE.txt file in the project root.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
#include "atn/LL1Analyzer.h"
|
|
7
|
+
#include "Token.h"
|
|
8
|
+
#include "atn/RuleTransition.h"
|
|
9
|
+
#include "misc/IntervalSet.h"
|
|
10
|
+
#include "RuleContext.h"
|
|
11
|
+
#include "atn/DecisionState.h"
|
|
12
|
+
#include "Recognizer.h"
|
|
13
|
+
#include "atn/ATNType.h"
|
|
14
|
+
#include "Exceptions.h"
|
|
15
|
+
#include "support/CPPUtils.h"
|
|
16
|
+
|
|
17
|
+
#include "atn/ATN.h"
|
|
18
|
+
|
|
19
|
+
using namespace antlr4;
|
|
20
|
+
using namespace antlr4::atn;
|
|
21
|
+
using namespace antlrcpp;
|
|
22
|
+
|
|
23
|
+
ATN::ATN() : ATN(ATNType::LEXER, 0) {}
|
|
24
|
+
|
|
25
|
+
ATN::ATN(ATNType grammarType_, size_t maxTokenType_) : grammarType(grammarType_), maxTokenType(maxTokenType_) {}
|
|
26
|
+
|
|
27
|
+
ATN::~ATN() {
|
|
28
|
+
for (ATNState *state : states) {
|
|
29
|
+
delete state;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
misc::IntervalSet ATN::nextTokens(ATNState *s, RuleContext *ctx) const {
|
|
34
|
+
LL1Analyzer analyzer(*this);
|
|
35
|
+
return analyzer.LOOK(s, ctx);
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
misc::IntervalSet const& ATN::nextTokens(ATNState *s) const {
|
|
40
|
+
if (!s->_nextTokenUpdated) {
|
|
41
|
+
std::unique_lock<std::mutex> lock(_mutex);
|
|
42
|
+
if (!s->_nextTokenUpdated) {
|
|
43
|
+
s->_nextTokenWithinRule = nextTokens(s, nullptr);
|
|
44
|
+
s->_nextTokenUpdated = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return s->_nextTokenWithinRule;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
void ATN::addState(ATNState *state) {
|
|
51
|
+
if (state != nullptr) {
|
|
52
|
+
//state->atn = this;
|
|
53
|
+
state->stateNumber = static_cast<int>(states.size());
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
states.push_back(state);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
void ATN::removeState(ATNState *state) {
|
|
60
|
+
delete states.at(state->stateNumber);// just free mem, don't shift states in list
|
|
61
|
+
states.at(state->stateNumber) = nullptr;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
int ATN::defineDecisionState(DecisionState *s) {
|
|
65
|
+
decisionToState.push_back(s);
|
|
66
|
+
s->decision = static_cast<int>(decisionToState.size() - 1);
|
|
67
|
+
return s->decision;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
DecisionState *ATN::getDecisionState(size_t decision) const {
|
|
71
|
+
if (!decisionToState.empty()) {
|
|
72
|
+
return decisionToState[decision];
|
|
73
|
+
}
|
|
74
|
+
return nullptr;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
size_t ATN::getNumberOfDecisions() const {
|
|
78
|
+
return decisionToState.size();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
misc::IntervalSet ATN::getExpectedTokens(size_t stateNumber, RuleContext *context) const {
|
|
82
|
+
if (stateNumber == ATNState::INVALID_STATE_NUMBER || stateNumber >= states.size()) {
|
|
83
|
+
throw IllegalArgumentException("Invalid state number.");
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
RuleContext *ctx = context;
|
|
87
|
+
ATNState *s = states.at(stateNumber);
|
|
88
|
+
misc::IntervalSet following = nextTokens(s);
|
|
89
|
+
if (!following.contains(Token::EPSILON)) {
|
|
90
|
+
return following;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
misc::IntervalSet expected;
|
|
94
|
+
expected.addAll(following);
|
|
95
|
+
expected.remove(Token::EPSILON);
|
|
96
|
+
while (ctx && ctx->invokingState != ATNState::INVALID_STATE_NUMBER && following.contains(Token::EPSILON)) {
|
|
97
|
+
ATNState *invokingState = states.at(ctx->invokingState);
|
|
98
|
+
const RuleTransition *rt = static_cast<const RuleTransition*>(invokingState->transitions[0].get());
|
|
99
|
+
following = nextTokens(rt->followState);
|
|
100
|
+
expected.addAll(following);
|
|
101
|
+
expected.remove(Token::EPSILON);
|
|
102
|
+
|
|
103
|
+
if (ctx->parent == nullptr) {
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
ctx = static_cast<RuleContext *>(ctx->parent);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (following.contains(Token::EPSILON)) {
|
|
110
|
+
expected.add(Token::EOF);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return expected;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
std::string ATN::toString() const {
|
|
117
|
+
std::stringstream ss;
|
|
118
|
+
std::string type;
|
|
119
|
+
switch (grammarType) {
|
|
120
|
+
case ATNType::LEXER:
|
|
121
|
+
type = "LEXER ";
|
|
122
|
+
break;
|
|
123
|
+
|
|
124
|
+
case ATNType::PARSER:
|
|
125
|
+
type = "PARSER ";
|
|
126
|
+
break;
|
|
127
|
+
|
|
128
|
+
default:
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
ss << "(" << type << "ATN " << std::hex << this << std::dec << ") maxTokenType: " << maxTokenType << std::endl;
|
|
132
|
+
ss << "states (" << states.size() << ") {" << std::endl;
|
|
133
|
+
|
|
134
|
+
size_t index = 0;
|
|
135
|
+
for (auto *state : states) {
|
|
136
|
+
if (state == nullptr) {
|
|
137
|
+
ss << " " << index++ << ": nul" << std::endl;
|
|
138
|
+
} else {
|
|
139
|
+
std::string text = state->toString();
|
|
140
|
+
ss << " " << index++ << ": " << indent(text, " ", false) << std::endl;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
index = 0;
|
|
145
|
+
for (auto *state : decisionToState) {
|
|
146
|
+
if (state == nullptr) {
|
|
147
|
+
ss << " " << index++ << ": nul" << std::endl;
|
|
148
|
+
} else {
|
|
149
|
+
std::string text = state->toString();
|
|
150
|
+
ss << " " << index++ << ": " << indent(text, " ", false) << std::endl;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
ss << "}";
|
|
155
|
+
|
|
156
|
+
return ss.str();
|
|
157
|
+
}
|
|
158
|
+
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
|
2
|
+
* Use of this file is governed by the BSD 3-clause license that
|
|
3
|
+
* can be found in the LICENSE.txt file in the project root.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include "RuleContext.h"
|
|
9
|
+
|
|
10
|
+
// GCC generates a warning when forward-declaring ATN if ATN has already been
|
|
11
|
+
// declared due to the attributes added by ANTLR4CPP_PUBLIC.
|
|
12
|
+
// See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39159
|
|
13
|
+
// Add constant that can be checked so forward-declarations can be omitted.
|
|
14
|
+
#define ANTLR4CPP_ATN_DECLARED
|
|
15
|
+
|
|
16
|
+
namespace antlr4 {
|
|
17
|
+
namespace atn {
|
|
18
|
+
|
|
19
|
+
class LexerATNSimulator;
|
|
20
|
+
class ParserATNSimulator;
|
|
21
|
+
|
|
22
|
+
class ANTLR4CPP_PUBLIC ATN {
|
|
23
|
+
public:
|
|
24
|
+
static constexpr size_t INVALID_ALT_NUMBER = 0;
|
|
25
|
+
|
|
26
|
+
/// Used for runtime deserialization of ATNs from strings.
|
|
27
|
+
ATN();
|
|
28
|
+
|
|
29
|
+
ATN(ATNType grammarType, size_t maxTokenType);
|
|
30
|
+
|
|
31
|
+
ATN(const ATN&) = delete;
|
|
32
|
+
|
|
33
|
+
ATN(ATN&&) = delete;
|
|
34
|
+
|
|
35
|
+
~ATN();
|
|
36
|
+
|
|
37
|
+
ATN& operator=(const ATN&) = delete;
|
|
38
|
+
|
|
39
|
+
ATN& operator=(ATN&&) = delete;
|
|
40
|
+
|
|
41
|
+
std::vector<ATNState *> states;
|
|
42
|
+
|
|
43
|
+
/// Each subrule/rule is a decision point and we must track them so we
|
|
44
|
+
/// can go back later and build DFA predictors for them. This includes
|
|
45
|
+
/// all the rules, subrules, optional blocks, ()+, ()* etc...
|
|
46
|
+
std::vector<DecisionState *> decisionToState;
|
|
47
|
+
|
|
48
|
+
/// Maps from rule index to starting state number.
|
|
49
|
+
std::vector<RuleStartState *> ruleToStartState;
|
|
50
|
+
|
|
51
|
+
/// Maps from rule index to stop state number.
|
|
52
|
+
std::vector<RuleStopState *> ruleToStopState;
|
|
53
|
+
|
|
54
|
+
/// The type of the ATN.
|
|
55
|
+
ATNType grammarType;
|
|
56
|
+
|
|
57
|
+
/// The maximum value for any symbol recognized by a transition in the ATN.
|
|
58
|
+
size_t maxTokenType;
|
|
59
|
+
|
|
60
|
+
/// <summary>
|
|
61
|
+
/// For lexer ATNs, this maps the rule index to the resulting token type.
|
|
62
|
+
/// For parser ATNs, this maps the rule index to the generated bypass token
|
|
63
|
+
/// type if the
|
|
64
|
+
/// <seealso cref="ATNDeserializationOptions#isGenerateRuleBypassTransitions"/>
|
|
65
|
+
/// deserialization option was specified; otherwise, this is {@code null}.
|
|
66
|
+
/// </summary>
|
|
67
|
+
std::vector<size_t> ruleToTokenType;
|
|
68
|
+
|
|
69
|
+
/// For lexer ATNs, this is an array of {@link LexerAction} objects which may
|
|
70
|
+
/// be referenced by action transitions in the ATN.
|
|
71
|
+
std::vector<Ref<const LexerAction>> lexerActions;
|
|
72
|
+
|
|
73
|
+
std::vector<TokensStartState *> modeToStartState;
|
|
74
|
+
|
|
75
|
+
/// <summary>
|
|
76
|
+
/// Compute the set of valid tokens that can occur starting in state {@code s}.
|
|
77
|
+
/// If {@code ctx} is null, the set of tokens will not include what can follow
|
|
78
|
+
/// the rule surrounding {@code s}. In other words, the set will be
|
|
79
|
+
/// restricted to tokens reachable staying within {@code s}'s rule.
|
|
80
|
+
/// </summary>
|
|
81
|
+
misc::IntervalSet nextTokens(ATNState *s, RuleContext *ctx) const;
|
|
82
|
+
|
|
83
|
+
/// <summary>
|
|
84
|
+
/// Compute the set of valid tokens that can occur starting in {@code s} and
|
|
85
|
+
/// staying in same rule. <seealso cref="Token#EPSILON"/> is in set if we reach end of
|
|
86
|
+
/// rule.
|
|
87
|
+
/// </summary>
|
|
88
|
+
misc::IntervalSet const& nextTokens(ATNState *s) const;
|
|
89
|
+
|
|
90
|
+
void addState(ATNState *state);
|
|
91
|
+
|
|
92
|
+
void removeState(ATNState *state);
|
|
93
|
+
|
|
94
|
+
int defineDecisionState(DecisionState *s);
|
|
95
|
+
|
|
96
|
+
DecisionState *getDecisionState(size_t decision) const;
|
|
97
|
+
|
|
98
|
+
size_t getNumberOfDecisions() const;
|
|
99
|
+
|
|
100
|
+
/// <summary>
|
|
101
|
+
/// Computes the set of input symbols which could follow ATN state number
|
|
102
|
+
/// {@code stateNumber} in the specified full {@code context}. This method
|
|
103
|
+
/// considers the complete parser context, but does not evaluate semantic
|
|
104
|
+
/// predicates (i.e. all predicates encountered during the calculation are
|
|
105
|
+
/// assumed true). If a path in the ATN exists from the starting state to the
|
|
106
|
+
/// <seealso cref="RuleStopState"/> of the outermost context without matching any
|
|
107
|
+
/// symbols, <seealso cref="Token#EOF"/> is added to the returned set.
|
|
108
|
+
/// <p/>
|
|
109
|
+
/// If {@code context} is {@code null}, it is treated as
|
|
110
|
+
/// <seealso cref="ParserRuleContext#EMPTY"/>.
|
|
111
|
+
/// </summary>
|
|
112
|
+
/// <param name="stateNumber"> the ATN state number </param>
|
|
113
|
+
/// <param name="context"> the full parse context </param>
|
|
114
|
+
/// <returns> The set of potentially valid input symbols which could follow the
|
|
115
|
+
/// specified state in the specified context. </returns>
|
|
116
|
+
/// <exception cref="IllegalArgumentException"> if the ATN does not contain a state with
|
|
117
|
+
/// number {@code stateNumber} </exception>
|
|
118
|
+
misc::IntervalSet getExpectedTokens(size_t stateNumber, RuleContext *context) const;
|
|
119
|
+
|
|
120
|
+
std::string toString() const;
|
|
121
|
+
|
|
122
|
+
private:
|
|
123
|
+
friend class LexerATNSimulator;
|
|
124
|
+
friend class ParserATNSimulator;
|
|
125
|
+
|
|
126
|
+
mutable std::mutex _mutex;
|
|
127
|
+
mutable std::shared_mutex _stateMutex;
|
|
128
|
+
mutable std::shared_mutex _edgeMutex;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
} // namespace atn
|
|
132
|
+
} // namespace antlr4
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
|
2
|
+
* Use of this file is governed by the BSD 3-clause license that
|
|
3
|
+
* can be found in the LICENSE.txt file in the project root.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
#include "misc/MurmurHash.h"
|
|
7
|
+
#include "atn/PredictionContext.h"
|
|
8
|
+
#include "SemanticContext.h"
|
|
9
|
+
|
|
10
|
+
#include "atn/ATNConfig.h"
|
|
11
|
+
|
|
12
|
+
using namespace antlr4::atn;
|
|
13
|
+
|
|
14
|
+
namespace {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* This field stores the bit mask for implementing the
|
|
18
|
+
* {@link #isPrecedenceFilterSuppressed} property as a bit within the
|
|
19
|
+
* existing {@link #reachesIntoOuterContext} field.
|
|
20
|
+
*/
|
|
21
|
+
inline constexpr size_t SUPPRESS_PRECEDENCE_FILTER = 0x40000000;
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ATNConfig::ATNConfig(ATNState *state, size_t alt, Ref<const PredictionContext> context)
|
|
26
|
+
: ATNConfig(state, alt, std::move(context), 0, SemanticContext::NONE) {}
|
|
27
|
+
|
|
28
|
+
ATNConfig::ATNConfig(ATNState *state, size_t alt, Ref<const PredictionContext> context, Ref<const SemanticContext> semanticContext)
|
|
29
|
+
: ATNConfig(state, alt, std::move(context), 0, std::move(semanticContext)) {}
|
|
30
|
+
|
|
31
|
+
ATNConfig::ATNConfig(ATNConfig const& other, Ref<const SemanticContext> semanticContext)
|
|
32
|
+
: ATNConfig(other.state, other.alt, other.context, other.reachesIntoOuterContext, std::move(semanticContext)) {}
|
|
33
|
+
|
|
34
|
+
ATNConfig::ATNConfig(ATNConfig const& other, ATNState *state)
|
|
35
|
+
: ATNConfig(state, other.alt, other.context, other.reachesIntoOuterContext, other.semanticContext) {}
|
|
36
|
+
|
|
37
|
+
ATNConfig::ATNConfig(ATNConfig const& other, ATNState *state, Ref<const SemanticContext> semanticContext)
|
|
38
|
+
: ATNConfig(state, other.alt, other.context, other.reachesIntoOuterContext, std::move(semanticContext)) {}
|
|
39
|
+
|
|
40
|
+
ATNConfig::ATNConfig(ATNConfig const& other, ATNState *state, Ref<const PredictionContext> context)
|
|
41
|
+
: ATNConfig(state, other.alt, std::move(context), other.reachesIntoOuterContext, other.semanticContext) {}
|
|
42
|
+
|
|
43
|
+
ATNConfig::ATNConfig(ATNConfig const& other, ATNState *state, Ref<const PredictionContext> context, Ref<const SemanticContext> semanticContext)
|
|
44
|
+
: ATNConfig(state, other.alt, std::move(context), other.reachesIntoOuterContext, std::move(semanticContext)) {}
|
|
45
|
+
|
|
46
|
+
ATNConfig::ATNConfig(ATNState *state, size_t alt, Ref<const PredictionContext> context, size_t reachesIntoOuterContext, Ref<const SemanticContext> semanticContext)
|
|
47
|
+
: state(state), alt(alt), context(std::move(context)), reachesIntoOuterContext(reachesIntoOuterContext), semanticContext(std::move(semanticContext)) {}
|
|
48
|
+
|
|
49
|
+
size_t ATNConfig::hashCode() const {
|
|
50
|
+
size_t hashCode = misc::MurmurHash::initialize(7);
|
|
51
|
+
hashCode = misc::MurmurHash::update(hashCode, state->stateNumber);
|
|
52
|
+
hashCode = misc::MurmurHash::update(hashCode, alt);
|
|
53
|
+
hashCode = misc::MurmurHash::update(hashCode, context);
|
|
54
|
+
hashCode = misc::MurmurHash::update(hashCode, semanticContext);
|
|
55
|
+
hashCode = misc::MurmurHash::finish(hashCode, 4);
|
|
56
|
+
return hashCode;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
size_t ATNConfig::getOuterContextDepth() const {
|
|
60
|
+
return reachesIntoOuterContext & ~SUPPRESS_PRECEDENCE_FILTER;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
bool ATNConfig::isPrecedenceFilterSuppressed() const {
|
|
64
|
+
return (reachesIntoOuterContext & SUPPRESS_PRECEDENCE_FILTER) != 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
void ATNConfig::setPrecedenceFilterSuppressed(bool value) {
|
|
68
|
+
if (value) {
|
|
69
|
+
reachesIntoOuterContext |= SUPPRESS_PRECEDENCE_FILTER;
|
|
70
|
+
} else {
|
|
71
|
+
reachesIntoOuterContext &= ~SUPPRESS_PRECEDENCE_FILTER;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
bool ATNConfig::operator==(const ATNConfig &other) const {
|
|
76
|
+
return state->stateNumber == other.state->stateNumber && alt == other.alt &&
|
|
77
|
+
((context == other.context) || (*context == *other.context)) &&
|
|
78
|
+
*semanticContext == *other.semanticContext &&
|
|
79
|
+
isPrecedenceFilterSuppressed() == other.isPrecedenceFilterSuppressed();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
std::string ATNConfig::toString() const {
|
|
83
|
+
return toString(true);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
std::string ATNConfig::toString(bool showAlt) const {
|
|
87
|
+
std::stringstream ss;
|
|
88
|
+
ss << "(";
|
|
89
|
+
|
|
90
|
+
ss << state->toString();
|
|
91
|
+
if (showAlt) {
|
|
92
|
+
ss << "," << alt;
|
|
93
|
+
}
|
|
94
|
+
if (context) {
|
|
95
|
+
ss << ",[" << context->toString() << "]";
|
|
96
|
+
}
|
|
97
|
+
if (semanticContext != nullptr && semanticContext != SemanticContext::NONE) {
|
|
98
|
+
ss << ",[" << semanticContext->toString() << "]";
|
|
99
|
+
}
|
|
100
|
+
if (getOuterContextDepth() > 0) {
|
|
101
|
+
ss << ",up=" << getOuterContextDepth();
|
|
102
|
+
}
|
|
103
|
+
ss << ")";
|
|
104
|
+
|
|
105
|
+
return ss.str();
|
|
106
|
+
}
|