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,157 @@
|
|
|
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 <cassert>
|
|
9
|
+
|
|
10
|
+
#include "antlr4-common.h"
|
|
11
|
+
#include "atn/SemanticContext.h"
|
|
12
|
+
|
|
13
|
+
namespace antlr4 {
|
|
14
|
+
namespace atn {
|
|
15
|
+
|
|
16
|
+
/// <summary>
|
|
17
|
+
/// A tuple: (ATN state, predicted alt, syntactic, semantic context).
|
|
18
|
+
/// The syntactic context is a graph-structured stack node whose
|
|
19
|
+
/// path(s) to the root is the rule invocation(s)
|
|
20
|
+
/// chain used to arrive at the state. The semantic context is
|
|
21
|
+
/// the tree of semantic predicates encountered before reaching
|
|
22
|
+
/// an ATN state.
|
|
23
|
+
/// </summary>
|
|
24
|
+
class ANTLR4CPP_PUBLIC ATNConfig {
|
|
25
|
+
public:
|
|
26
|
+
struct Hasher
|
|
27
|
+
{
|
|
28
|
+
size_t operator()(Ref<ATNConfig> const& k) const {
|
|
29
|
+
return k->hashCode();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
size_t operator()(ATNConfig const& k) const {
|
|
33
|
+
return k.hashCode();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
struct Comparer {
|
|
38
|
+
bool operator()(Ref<ATNConfig> const& lhs, Ref<ATNConfig> const& rhs) const {
|
|
39
|
+
return (lhs == rhs) || (*lhs == *rhs);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
bool operator()(ATNConfig const& lhs, ATNConfig const& rhs) const {
|
|
43
|
+
return (&lhs == &rhs) || (lhs == rhs);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
using Set = std::unordered_set<Ref<ATNConfig>, Hasher, Comparer>;
|
|
48
|
+
|
|
49
|
+
/// The ATN state associated with this configuration.
|
|
50
|
+
ATNState *state = nullptr;
|
|
51
|
+
|
|
52
|
+
/// What alt (or lexer rule) is predicted by this configuration.
|
|
53
|
+
const size_t alt = 0;
|
|
54
|
+
|
|
55
|
+
/// The stack of invoking states leading to the rule/states associated
|
|
56
|
+
/// with this config. We track only those contexts pushed during
|
|
57
|
+
/// execution of the ATN simulator.
|
|
58
|
+
///
|
|
59
|
+
/// Can be shared between multiple ANTConfig instances.
|
|
60
|
+
Ref<const PredictionContext> context;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* We cannot execute predicates dependent upon local context unless
|
|
64
|
+
* we know for sure we are in the correct context. Because there is
|
|
65
|
+
* no way to do this efficiently, we simply cannot evaluate
|
|
66
|
+
* dependent predicates unless we are in the rule that initially
|
|
67
|
+
* invokes the ATN simulator.
|
|
68
|
+
*
|
|
69
|
+
* <p>
|
|
70
|
+
* closure() tracks the depth of how far we dip into the outer context:
|
|
71
|
+
* depth > 0. Note that it may not be totally accurate depth since I
|
|
72
|
+
* don't ever decrement. TODO: make it a boolean then</p>
|
|
73
|
+
*
|
|
74
|
+
* <p>
|
|
75
|
+
* For memory efficiency, the {@link #isPrecedenceFilterSuppressed} method
|
|
76
|
+
* is also backed by this field. Since the field is publicly accessible, the
|
|
77
|
+
* highest bit which would not cause the value to become negative is used to
|
|
78
|
+
* store this field. This choice minimizes the risk that code which only
|
|
79
|
+
* compares this value to 0 would be affected by the new purpose of the
|
|
80
|
+
* flag. It also ensures the performance of the existing {@link ATNConfig}
|
|
81
|
+
* constructors as well as certain operations like
|
|
82
|
+
* {@link ATNConfigSet#add(ATNConfig, DoubleKeyMap)} method are
|
|
83
|
+
* <em>completely</em> unaffected by the change.</p>
|
|
84
|
+
*/
|
|
85
|
+
size_t reachesIntoOuterContext = 0;
|
|
86
|
+
|
|
87
|
+
/// Can be shared between multiple ATNConfig instances.
|
|
88
|
+
Ref<const SemanticContext> semanticContext;
|
|
89
|
+
|
|
90
|
+
ATNConfig(ATNState *state, size_t alt, Ref<const PredictionContext> context);
|
|
91
|
+
ATNConfig(ATNState *state, size_t alt, Ref<const PredictionContext> context, Ref<const SemanticContext> semanticContext);
|
|
92
|
+
|
|
93
|
+
ATNConfig(ATNConfig const& other, Ref<const SemanticContext> semanticContext);
|
|
94
|
+
ATNConfig(ATNConfig const& other, ATNState *state);
|
|
95
|
+
ATNConfig(ATNConfig const& other, ATNState *state, Ref<const SemanticContext> semanticContext);
|
|
96
|
+
ATNConfig(ATNConfig const& other, ATNState *state, Ref<const PredictionContext> context);
|
|
97
|
+
ATNConfig(ATNConfig const& other, ATNState *state, Ref<const PredictionContext> context, Ref<const SemanticContext> semanticContext);
|
|
98
|
+
|
|
99
|
+
ATNConfig(ATNConfig const&) = default;
|
|
100
|
+
|
|
101
|
+
ATNConfig(ATNConfig&&) = default;
|
|
102
|
+
|
|
103
|
+
virtual ~ATNConfig() = default;
|
|
104
|
+
|
|
105
|
+
virtual size_t hashCode() const;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* This method gets the value of the {@link #reachesIntoOuterContext} field
|
|
109
|
+
* as it existed prior to the introduction of the
|
|
110
|
+
* {@link #isPrecedenceFilterSuppressed} method.
|
|
111
|
+
*/
|
|
112
|
+
size_t getOuterContextDepth() const;
|
|
113
|
+
bool isPrecedenceFilterSuppressed() const;
|
|
114
|
+
void setPrecedenceFilterSuppressed(bool value);
|
|
115
|
+
|
|
116
|
+
/// An ATN configuration is equal to another if both have
|
|
117
|
+
/// the same state, they predict the same alternative, and
|
|
118
|
+
/// syntactic/semantic contexts are the same.
|
|
119
|
+
bool operator==(const ATNConfig &other) const;
|
|
120
|
+
bool operator!=(const ATNConfig &other) const;
|
|
121
|
+
|
|
122
|
+
virtual std::string toString() const;
|
|
123
|
+
std::string toString(bool showAlt) const;
|
|
124
|
+
|
|
125
|
+
private:
|
|
126
|
+
ATNConfig(ATNState *state, size_t alt, Ref<const PredictionContext> context, size_t reachesIntoOuterContext, Ref<const SemanticContext> semanticContext);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
} // namespace atn
|
|
130
|
+
} // namespace antlr4
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
// Hash function for ATNConfig.
|
|
134
|
+
|
|
135
|
+
namespace std {
|
|
136
|
+
using antlr4::atn::ATNConfig;
|
|
137
|
+
|
|
138
|
+
template <> struct hash<ATNConfig>
|
|
139
|
+
{
|
|
140
|
+
size_t operator() (const ATNConfig &x) const
|
|
141
|
+
{
|
|
142
|
+
return x.hashCode();
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
template <> struct hash<std::vector<Ref<ATNConfig>>>
|
|
147
|
+
{
|
|
148
|
+
size_t operator() (const std::vector<Ref<ATNConfig>> &vector) const
|
|
149
|
+
{
|
|
150
|
+
std::size_t seed = 0;
|
|
151
|
+
for (const auto &config : vector) {
|
|
152
|
+
seed ^= config->hashCode() + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
|
153
|
+
}
|
|
154
|
+
return seed;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
@@ -0,0 +1,232 @@
|
|
|
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/PredictionContext.h"
|
|
7
|
+
#include "atn/ATNConfig.h"
|
|
8
|
+
#include "atn/ATNSimulator.h"
|
|
9
|
+
#include "Exceptions.h"
|
|
10
|
+
#include "atn/SemanticContext.h"
|
|
11
|
+
#include "support/Arrays.h"
|
|
12
|
+
|
|
13
|
+
#include "atn/ATNConfigSet.h"
|
|
14
|
+
|
|
15
|
+
using namespace antlr4::atn;
|
|
16
|
+
using namespace antlrcpp;
|
|
17
|
+
|
|
18
|
+
namespace {
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
ATNConfigSet::ATNConfigSet() : ATNConfigSet(true) {}
|
|
23
|
+
|
|
24
|
+
ATNConfigSet::ATNConfigSet(const ATNConfigSet &other)
|
|
25
|
+
: fullCtx(other.fullCtx), _configLookup(other._configLookup.bucket_count(), ATNConfigHasher{this}, ATNConfigComparer{this}) {
|
|
26
|
+
addAll(other);
|
|
27
|
+
uniqueAlt = other.uniqueAlt;
|
|
28
|
+
conflictingAlts = other.conflictingAlts;
|
|
29
|
+
hasSemanticContext = other.hasSemanticContext;
|
|
30
|
+
dipsIntoOuterContext = other.dipsIntoOuterContext;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
ATNConfigSet::ATNConfigSet(bool fullCtx)
|
|
34
|
+
: fullCtx(fullCtx), _configLookup(0, ATNConfigHasher{this}, ATNConfigComparer{this}) {}
|
|
35
|
+
|
|
36
|
+
bool ATNConfigSet::add(const Ref<ATNConfig> &config) {
|
|
37
|
+
return add(config, nullptr);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
bool ATNConfigSet::add(const Ref<ATNConfig> &config, PredictionContextMergeCache *mergeCache) {
|
|
41
|
+
assert(config);
|
|
42
|
+
|
|
43
|
+
if (_readonly) {
|
|
44
|
+
throw IllegalStateException("This set is readonly");
|
|
45
|
+
}
|
|
46
|
+
if (config->semanticContext != SemanticContext::NONE) {
|
|
47
|
+
hasSemanticContext = true;
|
|
48
|
+
}
|
|
49
|
+
if (config->getOuterContextDepth() > 0) {
|
|
50
|
+
dipsIntoOuterContext = true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
auto existing = _configLookup.find(config.get());
|
|
54
|
+
if (existing == _configLookup.end()) {
|
|
55
|
+
_configLookup.insert(config.get());
|
|
56
|
+
_cachedHashCode = 0;
|
|
57
|
+
configs.push_back(config); // track order here
|
|
58
|
+
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// a previous (s,i,pi,_), merge with it and save result
|
|
63
|
+
bool rootIsWildcard = !fullCtx;
|
|
64
|
+
Ref<const PredictionContext> merged = PredictionContext::merge((*existing)->context, config->context, rootIsWildcard, mergeCache);
|
|
65
|
+
// no need to check for existing.context, config.context in cache
|
|
66
|
+
// since only way to create new graphs is "call rule" and here. We
|
|
67
|
+
// cache at both places.
|
|
68
|
+
(*existing)->reachesIntoOuterContext = std::max((*existing)->reachesIntoOuterContext, config->reachesIntoOuterContext);
|
|
69
|
+
|
|
70
|
+
// make sure to preserve the precedence filter suppression during the merge
|
|
71
|
+
if (config->isPrecedenceFilterSuppressed()) {
|
|
72
|
+
(*existing)->setPrecedenceFilterSuppressed(true);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
(*existing)->context = std::move(merged); // replace context; no need to alt mapping
|
|
76
|
+
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
bool ATNConfigSet::addAll(const ATNConfigSet &other) {
|
|
81
|
+
for (const auto &c : other.configs) {
|
|
82
|
+
add(c);
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
std::vector<ATNState*> ATNConfigSet::getStates() const {
|
|
88
|
+
std::vector<ATNState*> states;
|
|
89
|
+
states.reserve(configs.size());
|
|
90
|
+
for (const auto &c : configs) {
|
|
91
|
+
states.push_back(c->state);
|
|
92
|
+
}
|
|
93
|
+
return states;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Gets the complete set of represented alternatives for the configuration
|
|
98
|
+
* set.
|
|
99
|
+
*
|
|
100
|
+
* @return the set of represented alternatives in this configuration set
|
|
101
|
+
*
|
|
102
|
+
* @since 4.3
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
BitSet ATNConfigSet::getAlts() const {
|
|
106
|
+
BitSet alts;
|
|
107
|
+
for (const auto &config : configs) {
|
|
108
|
+
alts.set(config->alt);
|
|
109
|
+
}
|
|
110
|
+
return alts;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
std::vector<Ref<const SemanticContext>> ATNConfigSet::getPredicates() const {
|
|
114
|
+
std::vector<Ref<const SemanticContext>> preds;
|
|
115
|
+
preds.reserve(configs.size());
|
|
116
|
+
for (const auto &c : configs) {
|
|
117
|
+
if (c->semanticContext != SemanticContext::NONE) {
|
|
118
|
+
preds.push_back(c->semanticContext);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return preds;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const Ref<ATNConfig>& ATNConfigSet::get(size_t i) const {
|
|
125
|
+
return configs[i];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
void ATNConfigSet::optimizeConfigs(ATNSimulator *interpreter) {
|
|
129
|
+
assert(interpreter);
|
|
130
|
+
|
|
131
|
+
if (_readonly) {
|
|
132
|
+
throw IllegalStateException("This set is readonly");
|
|
133
|
+
}
|
|
134
|
+
if (_configLookup.empty())
|
|
135
|
+
return;
|
|
136
|
+
|
|
137
|
+
for (const auto &config : configs) {
|
|
138
|
+
config->context = interpreter->getCachedContext(config->context);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
bool ATNConfigSet::equals(const ATNConfigSet &other) const {
|
|
143
|
+
if (&other == this) {
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (configs.size() != other.configs.size())
|
|
148
|
+
return false;
|
|
149
|
+
|
|
150
|
+
if (fullCtx != other.fullCtx || uniqueAlt != other.uniqueAlt ||
|
|
151
|
+
conflictingAlts != other.conflictingAlts || hasSemanticContext != other.hasSemanticContext ||
|
|
152
|
+
dipsIntoOuterContext != other.dipsIntoOuterContext) // includes stack context
|
|
153
|
+
return false;
|
|
154
|
+
|
|
155
|
+
return Arrays::equals(configs, other.configs);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
size_t ATNConfigSet::hashCode() const {
|
|
159
|
+
size_t cachedHashCode = _cachedHashCode.load(std::memory_order_relaxed);
|
|
160
|
+
if (!isReadonly() || cachedHashCode == 0) {
|
|
161
|
+
cachedHashCode = 1;
|
|
162
|
+
for (const auto &i : configs) {
|
|
163
|
+
cachedHashCode = 31 * cachedHashCode + i->hashCode(); // Same as Java's list hashCode impl.
|
|
164
|
+
}
|
|
165
|
+
_cachedHashCode.store(cachedHashCode, std::memory_order_relaxed);
|
|
166
|
+
}
|
|
167
|
+
return cachedHashCode;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
size_t ATNConfigSet::size() const {
|
|
171
|
+
return configs.size();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
bool ATNConfigSet::isEmpty() const {
|
|
175
|
+
return configs.empty();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
void ATNConfigSet::clear() {
|
|
179
|
+
if (_readonly) {
|
|
180
|
+
throw IllegalStateException("This set is readonly");
|
|
181
|
+
}
|
|
182
|
+
configs.clear();
|
|
183
|
+
_cachedHashCode = 0;
|
|
184
|
+
_configLookup.clear();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
bool ATNConfigSet::isReadonly() const {
|
|
188
|
+
return _readonly;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
void ATNConfigSet::setReadonly(bool readonly) {
|
|
192
|
+
_readonly = readonly;
|
|
193
|
+
LookupContainer(0, ATNConfigHasher{this}, ATNConfigComparer{this}).swap(_configLookup);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
std::string ATNConfigSet::toString() const {
|
|
197
|
+
std::stringstream ss;
|
|
198
|
+
ss << "[";
|
|
199
|
+
for (size_t i = 0; i < configs.size(); i++) {
|
|
200
|
+
ss << configs[i]->toString();
|
|
201
|
+
}
|
|
202
|
+
ss << "]";
|
|
203
|
+
|
|
204
|
+
if (hasSemanticContext) {
|
|
205
|
+
ss << ",hasSemanticContext = " << hasSemanticContext;
|
|
206
|
+
}
|
|
207
|
+
if (uniqueAlt != ATN::INVALID_ALT_NUMBER) {
|
|
208
|
+
ss << ",uniqueAlt = " << uniqueAlt;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (conflictingAlts.size() > 0) {
|
|
212
|
+
ss << ",conflictingAlts = ";
|
|
213
|
+
ss << conflictingAlts.toString();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (dipsIntoOuterContext) {
|
|
217
|
+
ss << ", dipsIntoOuterContext";
|
|
218
|
+
}
|
|
219
|
+
return ss.str();
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
size_t ATNConfigSet::hashCode(const ATNConfig &other) const {
|
|
223
|
+
size_t hashCode = 7;
|
|
224
|
+
hashCode = 31 * hashCode + other.state->stateNumber;
|
|
225
|
+
hashCode = 31 * hashCode + other.alt;
|
|
226
|
+
hashCode = 31 * hashCode + other.semanticContext->hashCode();
|
|
227
|
+
return hashCode;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
bool ATNConfigSet::equals(const ATNConfig &lhs, const ATNConfig &rhs) const {
|
|
231
|
+
return lhs.state->stateNumber == rhs.state->stateNumber && lhs.alt == rhs.alt && *lhs.semanticContext == *rhs.semanticContext;
|
|
232
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
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 <cassert>
|
|
9
|
+
|
|
10
|
+
#include "support/BitSet.h"
|
|
11
|
+
#include "atn/PredictionContext.h"
|
|
12
|
+
#include "atn/ATNConfig.h"
|
|
13
|
+
|
|
14
|
+
namespace antlr4 {
|
|
15
|
+
namespace atn {
|
|
16
|
+
|
|
17
|
+
/// Specialized set that can track info about the set, with support for combining similar configurations using a
|
|
18
|
+
/// graph-structured stack.
|
|
19
|
+
class ANTLR4CPP_PUBLIC ATNConfigSet {
|
|
20
|
+
public:
|
|
21
|
+
/// Track the elements as they are added to the set; supports get(i)
|
|
22
|
+
std::vector<Ref<ATNConfig>> configs;
|
|
23
|
+
|
|
24
|
+
// TODO: these fields make me pretty uncomfortable but nice to pack up info together, saves recomputation
|
|
25
|
+
// TODO: can we track conflicts as they are added to save scanning configs later?
|
|
26
|
+
size_t uniqueAlt = 0;
|
|
27
|
+
|
|
28
|
+
/** Currently this is only used when we detect SLL conflict; this does
|
|
29
|
+
* not necessarily represent the ambiguous alternatives. In fact,
|
|
30
|
+
* I should also point out that this seems to include predicated alternatives
|
|
31
|
+
* that have predicates that evaluate to false. Computed in computeTargetState().
|
|
32
|
+
*/
|
|
33
|
+
antlrcpp::BitSet conflictingAlts;
|
|
34
|
+
|
|
35
|
+
// Used in parser and lexer. In lexer, it indicates we hit a pred
|
|
36
|
+
// while computing a closure operation. Don't make a DFA state from this.
|
|
37
|
+
bool hasSemanticContext = false;
|
|
38
|
+
bool dipsIntoOuterContext = false;
|
|
39
|
+
|
|
40
|
+
/// Indicates that this configuration set is part of a full context
|
|
41
|
+
/// LL prediction. It will be used to determine how to merge $. With SLL
|
|
42
|
+
/// it's a wildcard whereas it is not for LL context merge.
|
|
43
|
+
const bool fullCtx = true;
|
|
44
|
+
|
|
45
|
+
ATNConfigSet();
|
|
46
|
+
|
|
47
|
+
ATNConfigSet(const ATNConfigSet &other);
|
|
48
|
+
|
|
49
|
+
ATNConfigSet(ATNConfigSet&&) = delete;
|
|
50
|
+
|
|
51
|
+
explicit ATNConfigSet(bool fullCtx);
|
|
52
|
+
|
|
53
|
+
virtual ~ATNConfigSet() = default;
|
|
54
|
+
|
|
55
|
+
bool add(const Ref<ATNConfig> &config);
|
|
56
|
+
|
|
57
|
+
/// <summary>
|
|
58
|
+
/// Adding a new config means merging contexts with existing configs for
|
|
59
|
+
/// {@code (s, i, pi, _)}, where {@code s} is the
|
|
60
|
+
/// <seealso cref="ATNConfig#state"/>, {@code i} is the <seealso cref="ATNConfig#alt"/>, and
|
|
61
|
+
/// {@code pi} is the <seealso cref="ATNConfig#semanticContext"/>. We use
|
|
62
|
+
/// {@code (s,i,pi)} as key.
|
|
63
|
+
/// <p/>
|
|
64
|
+
/// This method updates <seealso cref="#dipsIntoOuterContext"/> and
|
|
65
|
+
/// <seealso cref="#hasSemanticContext"/> when necessary.
|
|
66
|
+
/// </summary>
|
|
67
|
+
bool add(const Ref<ATNConfig> &config, PredictionContextMergeCache *mergeCache);
|
|
68
|
+
|
|
69
|
+
bool addAll(const ATNConfigSet &other);
|
|
70
|
+
|
|
71
|
+
std::vector<ATNState*> getStates() const;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Gets the complete set of represented alternatives for the configuration
|
|
75
|
+
* set.
|
|
76
|
+
*
|
|
77
|
+
* @return the set of represented alternatives in this configuration set
|
|
78
|
+
*
|
|
79
|
+
* @since 4.3
|
|
80
|
+
*/
|
|
81
|
+
antlrcpp::BitSet getAlts() const;
|
|
82
|
+
std::vector<Ref<const SemanticContext>> getPredicates() const;
|
|
83
|
+
|
|
84
|
+
const Ref<ATNConfig>& get(size_t i) const;
|
|
85
|
+
|
|
86
|
+
void optimizeConfigs(ATNSimulator *interpreter);
|
|
87
|
+
|
|
88
|
+
size_t size() const;
|
|
89
|
+
bool isEmpty() const;
|
|
90
|
+
void clear();
|
|
91
|
+
bool isReadonly() const;
|
|
92
|
+
void setReadonly(bool readonly);
|
|
93
|
+
|
|
94
|
+
virtual size_t hashCode() const;
|
|
95
|
+
|
|
96
|
+
virtual bool equals(const ATNConfigSet &other) const;
|
|
97
|
+
|
|
98
|
+
virtual std::string toString() const;
|
|
99
|
+
|
|
100
|
+
private:
|
|
101
|
+
struct ATNConfigHasher final {
|
|
102
|
+
const ATNConfigSet* atnConfigSet;
|
|
103
|
+
|
|
104
|
+
size_t operator()(const ATNConfig *other) const {
|
|
105
|
+
assert(other != nullptr);
|
|
106
|
+
return atnConfigSet->hashCode(*other);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
struct ATNConfigComparer final {
|
|
111
|
+
const ATNConfigSet* atnConfigSet;
|
|
112
|
+
|
|
113
|
+
bool operator()(const ATNConfig *lhs, const ATNConfig *rhs) const {
|
|
114
|
+
assert(lhs != nullptr);
|
|
115
|
+
assert(rhs != nullptr);
|
|
116
|
+
return atnConfigSet->equals(*lhs, *rhs);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
mutable std::atomic<size_t> _cachedHashCode = 0;
|
|
121
|
+
|
|
122
|
+
/// Indicates that the set of configurations is read-only. Do not
|
|
123
|
+
/// allow any code to manipulate the set; DFA states will point at
|
|
124
|
+
/// the sets and they must not change. This does not protect the other
|
|
125
|
+
/// fields; in particular, conflictingAlts is set after
|
|
126
|
+
/// we've made this readonly.
|
|
127
|
+
bool _readonly = false;
|
|
128
|
+
|
|
129
|
+
virtual size_t hashCode(const ATNConfig &atnConfig) const;
|
|
130
|
+
|
|
131
|
+
virtual bool equals(const ATNConfig &lhs, const ATNConfig &rhs) const;
|
|
132
|
+
|
|
133
|
+
using LookupContainer = std::unordered_set<ATNConfig*, ATNConfigHasher, ATNConfigComparer>;
|
|
134
|
+
|
|
135
|
+
/// All configs but hashed by (s, i, _, pi) not including context. Wiped out
|
|
136
|
+
/// when we go readonly as this set becomes a DFA state.
|
|
137
|
+
LookupContainer _configLookup;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
inline bool operator==(const ATNConfigSet &lhs, const ATNConfigSet &rhs) { return lhs.equals(rhs); }
|
|
141
|
+
|
|
142
|
+
inline bool operator!=(const ATNConfigSet &lhs, const ATNConfigSet &rhs) { return !operator==(lhs, rhs); }
|
|
143
|
+
|
|
144
|
+
} // namespace atn
|
|
145
|
+
} // namespace antlr4
|
|
146
|
+
|
|
147
|
+
namespace std {
|
|
148
|
+
|
|
149
|
+
template <>
|
|
150
|
+
struct hash<::antlr4::atn::ATNConfigSet> {
|
|
151
|
+
size_t operator()(const ::antlr4::atn::ATNConfigSet &atnConfigSet) const {
|
|
152
|
+
return atnConfigSet.hashCode();
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
} // namespace std
|
|
@@ -0,0 +1,54 @@
|
|
|
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/ATNDeserializationOptions.h"
|
|
7
|
+
#include "Exceptions.h"
|
|
8
|
+
|
|
9
|
+
#include <memory>
|
|
10
|
+
#include <mutex>
|
|
11
|
+
|
|
12
|
+
using namespace antlr4;
|
|
13
|
+
using namespace antlr4::atn;
|
|
14
|
+
|
|
15
|
+
namespace {
|
|
16
|
+
|
|
17
|
+
std::once_flag defaultATNDeserializationOptionsOnceFlag;
|
|
18
|
+
std::unique_ptr<ATNDeserializationOptions> defaultATNDeserializationOptions;
|
|
19
|
+
|
|
20
|
+
void initializeDefaultATNDeserializationOptions() {
|
|
21
|
+
defaultATNDeserializationOptions.reset(new ATNDeserializationOptions());
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
ATNDeserializationOptions::ATNDeserializationOptions(ATNDeserializationOptions *options)
|
|
27
|
+
: _readOnly(false), _verifyATN(options->_verifyATN),
|
|
28
|
+
_generateRuleBypassTransitions(options->_generateRuleBypassTransitions) {}
|
|
29
|
+
|
|
30
|
+
const ATNDeserializationOptions& ATNDeserializationOptions::getDefaultOptions() {
|
|
31
|
+
std::call_once(defaultATNDeserializationOptionsOnceFlag,
|
|
32
|
+
initializeDefaultATNDeserializationOptions);
|
|
33
|
+
return *defaultATNDeserializationOptions;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
void ATNDeserializationOptions::makeReadOnly() {
|
|
37
|
+
_readOnly = true;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
void ATNDeserializationOptions::setVerifyATN(bool verify) {
|
|
41
|
+
throwIfReadOnly();
|
|
42
|
+
_verifyATN = verify;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
void ATNDeserializationOptions::setGenerateRuleBypassTransitions(bool generate) {
|
|
46
|
+
throwIfReadOnly();
|
|
47
|
+
_generateRuleBypassTransitions = generate;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
void ATNDeserializationOptions::throwIfReadOnly() const {
|
|
51
|
+
if (isReadOnly()) {
|
|
52
|
+
throw IllegalStateException("ATNDeserializationOptions is read only.");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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 "antlr4-common.h"
|
|
9
|
+
|
|
10
|
+
namespace antlr4 {
|
|
11
|
+
namespace atn {
|
|
12
|
+
|
|
13
|
+
class ANTLR4CPP_PUBLIC ATNDeserializationOptions final {
|
|
14
|
+
public:
|
|
15
|
+
ATNDeserializationOptions()
|
|
16
|
+
: _readOnly(false), _verifyATN(true), _generateRuleBypassTransitions(false) {}
|
|
17
|
+
|
|
18
|
+
// TODO: Is this useful? If so we should mark it as explicit, otherwise remove it.
|
|
19
|
+
ATNDeserializationOptions(ATNDeserializationOptions *options);
|
|
20
|
+
|
|
21
|
+
ATNDeserializationOptions(const ATNDeserializationOptions&) = default;
|
|
22
|
+
|
|
23
|
+
ATNDeserializationOptions& operator=(const ATNDeserializationOptions&) = default;
|
|
24
|
+
|
|
25
|
+
static const ATNDeserializationOptions& getDefaultOptions();
|
|
26
|
+
|
|
27
|
+
bool isReadOnly() const { return _readOnly; }
|
|
28
|
+
|
|
29
|
+
void makeReadOnly();
|
|
30
|
+
|
|
31
|
+
bool isVerifyATN() const { return _verifyATN; }
|
|
32
|
+
|
|
33
|
+
void setVerifyATN(bool verify);
|
|
34
|
+
|
|
35
|
+
bool isGenerateRuleBypassTransitions() const { return _generateRuleBypassTransitions; }
|
|
36
|
+
|
|
37
|
+
void setGenerateRuleBypassTransitions(bool generate);
|
|
38
|
+
|
|
39
|
+
private:
|
|
40
|
+
void throwIfReadOnly() const;
|
|
41
|
+
|
|
42
|
+
bool _readOnly;
|
|
43
|
+
bool _verifyATN;
|
|
44
|
+
bool _generateRuleBypassTransitions;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
} // namespace atn
|
|
48
|
+
} // namespace antlr4
|