did_parser 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6c1f03e9daca35f40998cf7614d0234cfcdb20af2347772ab40c2b3c70b01b53
|
4
|
+
data.tar.gz: 06512717a46166a61c5be2069e760e239b6d6b9347e5ed9a4855756996432508
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 968350bbc95800fb281648fb725b41985c4ca6a2474bab9ae8b87575596b97ab7acb6e1ee48cf7b82d63e785fa483cd6697a3f2c1927381961e6ce3851303f35
|
7
|
+
data.tar.gz: ef9144d50d7dcf9202a00feed0726f8cf9965efdade2b1d031a0e989ff34dd83d45f1f759ece2121e720b44ad3bc73efe840003ff49a1a3e099f62ac8ad060af
|
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
|
3
|
+
require 'antlr4-native'
|
4
|
+
require 'etc'
|
5
|
+
|
6
|
+
def ruby_installer?
|
7
|
+
Object.const_defined?(:RubyInstaller)
|
8
|
+
end
|
9
|
+
|
10
|
+
Bundler::GemHelper.install_tasks
|
11
|
+
|
12
|
+
task :generate do
|
13
|
+
generator = Antlr4Native::Generator.new(
|
14
|
+
grammar_files: ["./DIDLexer.g4", "./DIDParser.g4"],
|
15
|
+
output_dir: 'ext/',
|
16
|
+
parser_root_method: 'actor'
|
17
|
+
)
|
18
|
+
|
19
|
+
generator.generate
|
20
|
+
end
|
21
|
+
|
22
|
+
task :compile do
|
23
|
+
Dir.chdir(File.join(%w(ext did_parser))) do
|
24
|
+
load 'extconf.rb'
|
25
|
+
RubyInstaller::Runtime.enable_msys_apps if ruby_installer?
|
26
|
+
exec "make -j #{Etc.nprocessors}"
|
27
|
+
end
|
28
|
+
end
|
data/did_parser.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__), 'lib')
|
2
|
+
require 'did_parser/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'did_parser'
|
6
|
+
s.version = ::DIDParser::VERSION
|
7
|
+
s.authors = ['Terry Tu']
|
8
|
+
s.email = ['tuminfei1981@gmail.com']
|
9
|
+
s.homepage = 'https://github.com/tuminfei/did-parser-rb'
|
10
|
+
|
11
|
+
s.description = s.summary = 'A DID parser for Ruby'
|
12
|
+
|
13
|
+
s.platform = Gem::Platform::RUBY
|
14
|
+
|
15
|
+
s.add_dependency 'rice', '~> 4.0'
|
16
|
+
|
17
|
+
s.extensions = File.join(*%w(ext did_parser extconf.rb))
|
18
|
+
|
19
|
+
s.require_path = 'lib'
|
20
|
+
s.files = Dir[
|
21
|
+
'{lib,spec}/**/*',
|
22
|
+
'ext/did_parser/*.{cpp,h}',
|
23
|
+
'ext/did_parser/extconf.rb',
|
24
|
+
'ext/did_parser/antlrgen/*',
|
25
|
+
'ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/**/*.{cpp,h}',
|
26
|
+
'Gemfile',
|
27
|
+
'README.md',
|
28
|
+
'Rakefile',
|
29
|
+
'did_parser.gemspec'
|
30
|
+
]
|
31
|
+
end
|
@@ -0,0 +1,10 @@
|
|
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 "ANTLRErrorListener.h"
|
7
|
+
|
8
|
+
antlr4::ANTLRErrorListener::~ANTLRErrorListener()
|
9
|
+
{
|
10
|
+
}
|
@@ -0,0 +1,167 @@
|
|
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 "RecognitionException.h"
|
9
|
+
|
10
|
+
namespace antlrcpp {
|
11
|
+
class BitSet;
|
12
|
+
}
|
13
|
+
|
14
|
+
namespace antlr4 {
|
15
|
+
|
16
|
+
/// How to emit recognition errors (an interface in Java).
|
17
|
+
class ANTLR4CPP_PUBLIC ANTLRErrorListener {
|
18
|
+
public:
|
19
|
+
virtual ~ANTLRErrorListener();
|
20
|
+
|
21
|
+
/// <summary>
|
22
|
+
/// Upon syntax error, notify any interested parties. This is not how to
|
23
|
+
/// recover from errors or compute error messages. <seealso cref="ANTLRErrorStrategy"/>
|
24
|
+
/// specifies how to recover from syntax errors and how to compute error
|
25
|
+
/// messages. This listener's job is simply to emit a computed message,
|
26
|
+
/// though it has enough information to create its own message in many cases.
|
27
|
+
/// <p/>
|
28
|
+
/// The <seealso cref="RecognitionException"/> is non-null for all syntax errors except
|
29
|
+
/// when we discover mismatched token errors that we can recover from
|
30
|
+
/// in-line, without returning from the surrounding rule (via the single
|
31
|
+
/// token insertion and deletion mechanism).
|
32
|
+
/// </summary>
|
33
|
+
/// <param name="recognizer">
|
34
|
+
/// What parser got the error. From this
|
35
|
+
/// object, you can access the context as well
|
36
|
+
/// as the input stream. </param>
|
37
|
+
/// <param name="offendingSymbol">
|
38
|
+
/// The offending token in the input token
|
39
|
+
/// stream, unless recognizer is a lexer (then it's null). If
|
40
|
+
/// no viable alternative error, {@code e} has token at which we
|
41
|
+
/// started production for the decision. </param>
|
42
|
+
/// <param name="line">
|
43
|
+
/// The line number in the input where the error occurred. </param>
|
44
|
+
/// <param name="charPositionInLine">
|
45
|
+
/// The character position within that line where the error occurred. </param>
|
46
|
+
/// <param name="msg">
|
47
|
+
/// The message to emit. </param>
|
48
|
+
/// <param name="e">
|
49
|
+
/// The exception generated by the parser that led to
|
50
|
+
/// the reporting of an error. It is null in the case where
|
51
|
+
/// the parser was able to recover in line without exiting the
|
52
|
+
/// surrounding rule. </param>
|
53
|
+
virtual void syntaxError(Recognizer *recognizer, Token *offendingSymbol, size_t line,
|
54
|
+
size_t charPositionInLine, const std::string &msg, std::exception_ptr e) = 0;
|
55
|
+
|
56
|
+
/**
|
57
|
+
* This method is called by the parser when a full-context prediction
|
58
|
+
* results in an ambiguity.
|
59
|
+
*
|
60
|
+
* <p>Each full-context prediction which does not result in a syntax error
|
61
|
+
* will call either {@link #reportContextSensitivity} or
|
62
|
+
* {@link #reportAmbiguity}.</p>
|
63
|
+
*
|
64
|
+
* <p>When {@code ambigAlts} is not null, it contains the set of potentially
|
65
|
+
* viable alternatives identified by the prediction algorithm. When
|
66
|
+
* {@code ambigAlts} is null, use {@link ATNConfigSet#getAlts} to obtain the
|
67
|
+
* represented alternatives from the {@code configs} argument.</p>
|
68
|
+
*
|
69
|
+
* <p>When {@code exact} is {@code true}, <em>all</em> of the potentially
|
70
|
+
* viable alternatives are truly viable, i.e. this is reporting an exact
|
71
|
+
* ambiguity. When {@code exact} is {@code false}, <em>at least two</em> of
|
72
|
+
* the potentially viable alternatives are viable for the current input, but
|
73
|
+
* the prediction algorithm terminated as soon as it determined that at
|
74
|
+
* least the <em>minimum</em> potentially viable alternative is truly
|
75
|
+
* viable.</p>
|
76
|
+
*
|
77
|
+
* <p>When the {@link PredictionMode#LL_EXACT_AMBIG_DETECTION} prediction
|
78
|
+
* mode is used, the parser is required to identify exact ambiguities so
|
79
|
+
* {@code exact} will always be {@code true}.</p>
|
80
|
+
*
|
81
|
+
* <p>This method is not used by lexers.</p>
|
82
|
+
*
|
83
|
+
* @param recognizer the parser instance
|
84
|
+
* @param dfa the DFA for the current decision
|
85
|
+
* @param startIndex the input index where the decision started
|
86
|
+
* @param stopIndex the input input where the ambiguity was identified
|
87
|
+
* @param exact {@code true} if the ambiguity is exactly known, otherwise
|
88
|
+
* {@code false}. This is always {@code true} when
|
89
|
+
* {@link PredictionMode#LL_EXACT_AMBIG_DETECTION} is used.
|
90
|
+
* @param ambigAlts the potentially ambiguous alternatives, or {@code null}
|
91
|
+
* to indicate that the potentially ambiguous alternatives are the complete
|
92
|
+
* set of represented alternatives in {@code configs}
|
93
|
+
* @param configs the ATN configuration set where the ambiguity was
|
94
|
+
* identified
|
95
|
+
*/
|
96
|
+
virtual void reportAmbiguity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex, bool exact,
|
97
|
+
const antlrcpp::BitSet &ambigAlts, atn::ATNConfigSet *configs) = 0;
|
98
|
+
|
99
|
+
/**
|
100
|
+
* This method is called when an SLL conflict occurs and the parser is about
|
101
|
+
* to use the full context information to make an LL decision.
|
102
|
+
*
|
103
|
+
* <p>If one or more configurations in {@code configs} contains a semantic
|
104
|
+
* predicate, the predicates are evaluated before this method is called. The
|
105
|
+
* subset of alternatives which are still viable after predicates are
|
106
|
+
* evaluated is reported in {@code conflictingAlts}.</p>
|
107
|
+
*
|
108
|
+
* <p>This method is not used by lexers.</p>
|
109
|
+
*
|
110
|
+
* @param recognizer the parser instance
|
111
|
+
* @param dfa the DFA for the current decision
|
112
|
+
* @param startIndex the input index where the decision started
|
113
|
+
* @param stopIndex the input index where the SLL conflict occurred
|
114
|
+
* @param conflictingAlts The specific conflicting alternatives. If this is
|
115
|
+
* {@code null}, the conflicting alternatives are all alternatives
|
116
|
+
* represented in {@code configs}. At the moment, conflictingAlts is non-null
|
117
|
+
* (for the reference implementation, but Sam's optimized version can see this
|
118
|
+
* as null).
|
119
|
+
* @param configs the ATN configuration set where the SLL conflict was
|
120
|
+
* detected
|
121
|
+
*/
|
122
|
+
virtual void reportAttemptingFullContext(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex,
|
123
|
+
const antlrcpp::BitSet &conflictingAlts, atn::ATNConfigSet *configs) = 0;
|
124
|
+
|
125
|
+
/**
|
126
|
+
* This method is called by the parser when a full-context prediction has a
|
127
|
+
* unique result.
|
128
|
+
*
|
129
|
+
* <p>Each full-context prediction which does not result in a syntax error
|
130
|
+
* will call either {@link #reportContextSensitivity} or
|
131
|
+
* {@link #reportAmbiguity}.</p>
|
132
|
+
*
|
133
|
+
* <p>For prediction implementations that only evaluate full-context
|
134
|
+
* predictions when an SLL conflict is found (including the default
|
135
|
+
* {@link ParserATNSimulator} implementation), this method reports cases
|
136
|
+
* where SLL conflicts were resolved to unique full-context predictions,
|
137
|
+
* i.e. the decision was context-sensitive. This report does not necessarily
|
138
|
+
* indicate a problem, and it may appear even in completely unambiguous
|
139
|
+
* grammars.</p>
|
140
|
+
*
|
141
|
+
* <p>{@code configs} may have more than one represented alternative if the
|
142
|
+
* full-context prediction algorithm does not evaluate predicates before
|
143
|
+
* beginning the full-context prediction. In all cases, the final prediction
|
144
|
+
* is passed as the {@code prediction} argument.</p>
|
145
|
+
*
|
146
|
+
* <p>Note that the definition of "context sensitivity" in this method
|
147
|
+
* differs from the concept in {@link DecisionInfo#contextSensitivities}.
|
148
|
+
* This method reports all instances where an SLL conflict occurred but LL
|
149
|
+
* parsing produced a unique result, whether or not that unique result
|
150
|
+
* matches the minimum alternative in the SLL conflicting set.</p>
|
151
|
+
*
|
152
|
+
* <p>This method is not used by lexers.</p>
|
153
|
+
*
|
154
|
+
* @param recognizer the parser instance
|
155
|
+
* @param dfa the DFA for the current decision
|
156
|
+
* @param startIndex the input index where the decision started
|
157
|
+
* @param stopIndex the input index where the context sensitivity was
|
158
|
+
* finally determined
|
159
|
+
* @param prediction the unambiguous result of the full-context prediction
|
160
|
+
* @param configs the ATN configuration set where the unambiguous prediction
|
161
|
+
* was determined
|
162
|
+
*/
|
163
|
+
virtual void reportContextSensitivity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex,
|
164
|
+
size_t prediction, atn::ATNConfigSet *configs) = 0;
|
165
|
+
};
|
166
|
+
|
167
|
+
} // namespace antlr4
|
@@ -0,0 +1,10 @@
|
|
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 "ANTLRErrorStrategy.h"
|
7
|
+
|
8
|
+
antlr4::ANTLRErrorStrategy::~ANTLRErrorStrategy()
|
9
|
+
{
|
10
|
+
}
|
@@ -0,0 +1,121 @@
|
|
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
|
+
/// <summary>
|
13
|
+
/// The interface for defining strategies to deal with syntax errors encountered
|
14
|
+
/// during a parse by ANTLR-generated parsers. We distinguish between three
|
15
|
+
/// different kinds of errors:
|
16
|
+
///
|
17
|
+
/// <ul>
|
18
|
+
/// <li>The parser could not figure out which path to take in the ATN (none of
|
19
|
+
/// the available alternatives could possibly match)</li>
|
20
|
+
/// <li>The current input does not match what we were looking for</li>
|
21
|
+
/// <li>A predicate evaluated to false</li>
|
22
|
+
/// </ul>
|
23
|
+
///
|
24
|
+
/// Implementations of this interface report syntax errors by calling
|
25
|
+
/// <seealso cref="Parser#notifyErrorListeners"/>.
|
26
|
+
/// <p/>
|
27
|
+
/// TODO: what to do about lexers
|
28
|
+
/// </summary>
|
29
|
+
class ANTLR4CPP_PUBLIC ANTLRErrorStrategy {
|
30
|
+
public:
|
31
|
+
|
32
|
+
/// <summary>
|
33
|
+
/// Reset the error handler state for the specified {@code recognizer}. </summary>
|
34
|
+
/// <param name="recognizer"> the parser instance </param>
|
35
|
+
virtual ~ANTLRErrorStrategy();
|
36
|
+
|
37
|
+
virtual void reset(Parser *recognizer) = 0;
|
38
|
+
|
39
|
+
/**
|
40
|
+
* This method is called when an unexpected symbol is encountered during an
|
41
|
+
* inline match operation, such as {@link Parser#match}. If the error
|
42
|
+
* strategy successfully recovers from the match failure, this method
|
43
|
+
* returns the {@link Token} instance which should be treated as the
|
44
|
+
* successful result of the match.
|
45
|
+
*
|
46
|
+
* <p>This method handles the consumption of any tokens - the caller should
|
47
|
+
* <b>not</b> call {@link Parser#consume} after a successful recovery.</p>
|
48
|
+
*
|
49
|
+
* <p>Note that the calling code will not report an error if this method
|
50
|
+
* returns successfully. The error strategy implementation is responsible
|
51
|
+
* for calling {@link Parser#notifyErrorListeners} as appropriate.</p>
|
52
|
+
*
|
53
|
+
* @param recognizer the parser instance
|
54
|
+
* @throws RecognitionException if the error strategy was not able to
|
55
|
+
* recover from the unexpected input symbol
|
56
|
+
*/
|
57
|
+
virtual Token* recoverInline(Parser *recognizer) = 0;
|
58
|
+
|
59
|
+
/// <summary>
|
60
|
+
/// This method is called to recover from exception {@code e}. This method is
|
61
|
+
/// called after <seealso cref="#reportError"/> by the default exception handler
|
62
|
+
/// generated for a rule method.
|
63
|
+
/// </summary>
|
64
|
+
/// <seealso cref= #reportError
|
65
|
+
/// </seealso>
|
66
|
+
/// <param name="recognizer"> the parser instance </param>
|
67
|
+
/// <param name="e"> the recognition exception to recover from </param>
|
68
|
+
/// <exception cref="RecognitionException"> if the error strategy could not recover from
|
69
|
+
/// the recognition exception </exception>
|
70
|
+
virtual void recover(Parser *recognizer, std::exception_ptr e) = 0;
|
71
|
+
|
72
|
+
/// <summary>
|
73
|
+
/// This method provides the error handler with an opportunity to handle
|
74
|
+
/// syntactic or semantic errors in the input stream before they result in a
|
75
|
+
/// <seealso cref="RecognitionException"/>.
|
76
|
+
/// <p/>
|
77
|
+
/// The generated code currently contains calls to <seealso cref="#sync"/> after
|
78
|
+
/// entering the decision state of a closure block ({@code (...)*} or
|
79
|
+
/// {@code (...)+}).
|
80
|
+
/// <p/>
|
81
|
+
/// For an implementation based on Jim Idle's "magic sync" mechanism, see
|
82
|
+
/// <seealso cref="DefaultErrorStrategy#sync"/>.
|
83
|
+
/// </summary>
|
84
|
+
/// <seealso cref= DefaultErrorStrategy#sync
|
85
|
+
/// </seealso>
|
86
|
+
/// <param name="recognizer"> the parser instance </param>
|
87
|
+
/// <exception cref="RecognitionException"> if an error is detected by the error
|
88
|
+
/// strategy but cannot be automatically recovered at the current state in
|
89
|
+
/// the parsing process </exception>
|
90
|
+
virtual void sync(Parser *recognizer) = 0;
|
91
|
+
|
92
|
+
/// <summary>
|
93
|
+
/// Tests whether or not {@code recognizer} is in the process of recovering
|
94
|
+
/// from an error. In error recovery mode, <seealso cref="Parser#consume"/> adds
|
95
|
+
/// symbols to the parse tree by calling
|
96
|
+
/// {@link Parser#createErrorNode(ParserRuleContext, Token)} then
|
97
|
+
/// {@link ParserRuleContext#addErrorNode(ErrorNode)} instead of
|
98
|
+
/// {@link Parser#createTerminalNode(ParserRuleContext, Token)}.
|
99
|
+
/// </summary>
|
100
|
+
/// <param name="recognizer"> the parser instance </param>
|
101
|
+
/// <returns> {@code true} if the parser is currently recovering from a parse
|
102
|
+
/// error, otherwise {@code false} </returns>
|
103
|
+
virtual bool inErrorRecoveryMode(Parser *recognizer) = 0;
|
104
|
+
|
105
|
+
/// <summary>
|
106
|
+
/// This method is called by when the parser successfully matches an input
|
107
|
+
/// symbol.
|
108
|
+
/// </summary>
|
109
|
+
/// <param name="recognizer"> the parser instance </param>
|
110
|
+
virtual void reportMatch(Parser *recognizer) = 0;
|
111
|
+
|
112
|
+
/// <summary>
|
113
|
+
/// Report any kind of <seealso cref="RecognitionException"/>. This method is called by
|
114
|
+
/// the default exception handler generated for a rule method.
|
115
|
+
/// </summary>
|
116
|
+
/// <param name="recognizer"> the parser instance </param>
|
117
|
+
/// <param name="e"> the recognition exception to report </param>
|
118
|
+
virtual void reportError(Parser *recognizer, const RecognitionException &e) = 0;
|
119
|
+
};
|
120
|
+
|
121
|
+
} // namespace antlr4
|
@@ -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
|
+
#include "ANTLRFileStream.h"
|
7
|
+
|
8
|
+
using namespace antlr4;
|
9
|
+
|
10
|
+
void ANTLRFileStream::loadFromFile(const std::string &fileName) {
|
11
|
+
_fileName = fileName;
|
12
|
+
if (_fileName.empty()) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
|
16
|
+
std::ifstream stream(fileName, std::ios::binary);
|
17
|
+
|
18
|
+
ANTLRInputStream::load(stream);
|
19
|
+
}
|
20
|
+
|
21
|
+
std::string ANTLRFileStream::getSourceName() const {
|
22
|
+
return _fileName;
|
23
|
+
}
|
@@ -0,0 +1,30 @@
|
|
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 "ANTLRInputStream.h"
|
9
|
+
|
10
|
+
namespace antlr4 {
|
11
|
+
|
12
|
+
/// This is an ANTLRInputStream that is loaded from a file all at once
|
13
|
+
/// when you construct the object (or call load()).
|
14
|
+
// TODO: this class needs testing.
|
15
|
+
class ANTLR4CPP_PUBLIC ANTLRFileStream : public ANTLRInputStream {
|
16
|
+
public:
|
17
|
+
ANTLRFileStream() = default;
|
18
|
+
ANTLRFileStream(const std::string &) = delete;
|
19
|
+
ANTLRFileStream(const char *data, size_t length) = delete;
|
20
|
+
ANTLRFileStream(std::istream &stream) = delete;
|
21
|
+
|
22
|
+
// Assumes a file name encoded in UTF-8 and file content in the same encoding (with or w/o BOM).
|
23
|
+
virtual void loadFromFile(const std::string &fileName);
|
24
|
+
virtual std::string getSourceName() const override;
|
25
|
+
|
26
|
+
private:
|
27
|
+
std::string _fileName; // UTF-8 encoded file name.
|
28
|
+
};
|
29
|
+
|
30
|
+
} // namespace antlr4
|
@@ -0,0 +1,180 @@
|
|
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 <string.h>
|
7
|
+
|
8
|
+
#include "Exceptions.h"
|
9
|
+
#include "misc/Interval.h"
|
10
|
+
#include "IntStream.h"
|
11
|
+
|
12
|
+
#include "support/Utf8.h"
|
13
|
+
#include "support/CPPUtils.h"
|
14
|
+
|
15
|
+
#include "ANTLRInputStream.h"
|
16
|
+
|
17
|
+
using namespace antlr4;
|
18
|
+
using namespace antlrcpp;
|
19
|
+
|
20
|
+
using misc::Interval;
|
21
|
+
|
22
|
+
ANTLRInputStream::ANTLRInputStream() {
|
23
|
+
InitializeInstanceFields();
|
24
|
+
}
|
25
|
+
|
26
|
+
ANTLRInputStream::ANTLRInputStream(std::string_view input): ANTLRInputStream() {
|
27
|
+
load(input.data(), input.length());
|
28
|
+
}
|
29
|
+
|
30
|
+
ANTLRInputStream::ANTLRInputStream(const char *data, size_t length) {
|
31
|
+
load(data, length);
|
32
|
+
}
|
33
|
+
|
34
|
+
ANTLRInputStream::ANTLRInputStream(std::istream &stream): ANTLRInputStream() {
|
35
|
+
load(stream);
|
36
|
+
}
|
37
|
+
|
38
|
+
void ANTLRInputStream::load(const std::string &input, bool lenient) {
|
39
|
+
load(input.data(), input.size(), lenient);
|
40
|
+
}
|
41
|
+
|
42
|
+
void ANTLRInputStream::load(const char *data, size_t length, bool lenient) {
|
43
|
+
// Remove the UTF-8 BOM if present.
|
44
|
+
const char *bom = "\xef\xbb\xbf";
|
45
|
+
if (length >= 3 && strncmp(data, bom, 3) == 0) {
|
46
|
+
data += 3;
|
47
|
+
length -= 3;
|
48
|
+
}
|
49
|
+
if (lenient) {
|
50
|
+
_data = Utf8::lenientDecode(std::string_view(data, length));
|
51
|
+
} else {
|
52
|
+
auto maybe_utf32 = Utf8::strictDecode(std::string_view(data, length));
|
53
|
+
if (!maybe_utf32.has_value()) {
|
54
|
+
throw IllegalArgumentException("UTF-8 string contains an illegal byte sequence");
|
55
|
+
}
|
56
|
+
_data = std::move(maybe_utf32).value();
|
57
|
+
}
|
58
|
+
p = 0;
|
59
|
+
}
|
60
|
+
|
61
|
+
void ANTLRInputStream::load(std::istream &stream, bool lenient) {
|
62
|
+
if (!stream.good() || stream.eof()) // No fail, bad or EOF.
|
63
|
+
return;
|
64
|
+
|
65
|
+
_data.clear();
|
66
|
+
|
67
|
+
std::string s((std::istreambuf_iterator<char>(stream)), std::istreambuf_iterator<char>());
|
68
|
+
load(s.data(), s.length(), lenient);
|
69
|
+
}
|
70
|
+
|
71
|
+
void ANTLRInputStream::reset() {
|
72
|
+
p = 0;
|
73
|
+
}
|
74
|
+
|
75
|
+
void ANTLRInputStream::consume() {
|
76
|
+
if (p >= _data.size()) {
|
77
|
+
assert(LA(1) == IntStream::EOF);
|
78
|
+
throw IllegalStateException("cannot consume EOF");
|
79
|
+
}
|
80
|
+
|
81
|
+
if (p < _data.size()) {
|
82
|
+
p++;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
size_t ANTLRInputStream::LA(ssize_t i) {
|
87
|
+
if (i == 0) {
|
88
|
+
return 0; // undefined
|
89
|
+
}
|
90
|
+
|
91
|
+
ssize_t position = static_cast<ssize_t>(p);
|
92
|
+
if (i < 0) {
|
93
|
+
i++; // e.g., translate LA(-1) to use offset i=0; then _data[p+0-1]
|
94
|
+
if ((position + i - 1) < 0) {
|
95
|
+
return IntStream::EOF; // invalid; no char before first char
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
if ((position + i - 1) >= static_cast<ssize_t>(_data.size())) {
|
100
|
+
return IntStream::EOF;
|
101
|
+
}
|
102
|
+
|
103
|
+
return _data[static_cast<size_t>((position + i - 1))];
|
104
|
+
}
|
105
|
+
|
106
|
+
size_t ANTLRInputStream::LT(ssize_t i) {
|
107
|
+
return LA(i);
|
108
|
+
}
|
109
|
+
|
110
|
+
size_t ANTLRInputStream::index() {
|
111
|
+
return p;
|
112
|
+
}
|
113
|
+
|
114
|
+
size_t ANTLRInputStream::size() {
|
115
|
+
return _data.size();
|
116
|
+
}
|
117
|
+
|
118
|
+
// Mark/release do nothing. We have entire buffer.
|
119
|
+
ssize_t ANTLRInputStream::mark() {
|
120
|
+
return -1;
|
121
|
+
}
|
122
|
+
|
123
|
+
void ANTLRInputStream::release(ssize_t /* marker */) {
|
124
|
+
}
|
125
|
+
|
126
|
+
void ANTLRInputStream::seek(size_t index) {
|
127
|
+
if (index <= p) {
|
128
|
+
p = index; // just jump; don't update stream state (line, ...)
|
129
|
+
return;
|
130
|
+
}
|
131
|
+
// seek forward, consume until p hits index or n (whichever comes first)
|
132
|
+
index = std::min(index, _data.size());
|
133
|
+
while (p < index) {
|
134
|
+
consume();
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
std::string ANTLRInputStream::getText(const Interval &interval) {
|
139
|
+
if (interval.a < 0 || interval.b < 0) {
|
140
|
+
return "";
|
141
|
+
}
|
142
|
+
|
143
|
+
size_t start = static_cast<size_t>(interval.a);
|
144
|
+
size_t stop = static_cast<size_t>(interval.b);
|
145
|
+
|
146
|
+
|
147
|
+
if (stop >= _data.size()) {
|
148
|
+
stop = _data.size() - 1;
|
149
|
+
}
|
150
|
+
|
151
|
+
size_t count = stop - start + 1;
|
152
|
+
if (start >= _data.size()) {
|
153
|
+
return "";
|
154
|
+
}
|
155
|
+
|
156
|
+
auto maybeUtf8 = Utf8::strictEncode(std::u32string_view(_data).substr(start, count));
|
157
|
+
if (!maybeUtf8.has_value()) {
|
158
|
+
throw IllegalArgumentException("Input stream contains invalid Unicode code points");
|
159
|
+
}
|
160
|
+
return std::move(maybeUtf8).value();
|
161
|
+
}
|
162
|
+
|
163
|
+
std::string ANTLRInputStream::getSourceName() const {
|
164
|
+
if (name.empty()) {
|
165
|
+
return IntStream::UNKNOWN_SOURCE_NAME;
|
166
|
+
}
|
167
|
+
return name;
|
168
|
+
}
|
169
|
+
|
170
|
+
std::string ANTLRInputStream::toString() const {
|
171
|
+
auto maybeUtf8 = Utf8::strictEncode(_data);
|
172
|
+
if (!maybeUtf8.has_value()) {
|
173
|
+
throw IllegalArgumentException("Input stream contains invalid Unicode code points");
|
174
|
+
}
|
175
|
+
return std::move(maybeUtf8).value();
|
176
|
+
}
|
177
|
+
|
178
|
+
void ANTLRInputStream::InitializeInstanceFields() {
|
179
|
+
p = 0;
|
180
|
+
}
|