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,86 @@
|
|
|
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 tree {
|
|
12
|
+
namespace xpath {
|
|
13
|
+
|
|
14
|
+
/// Represent a subset of XPath XML path syntax for use in identifying nodes in
|
|
15
|
+
/// parse trees.
|
|
16
|
+
///
|
|
17
|
+
/// <para>
|
|
18
|
+
/// Split path into words and separators {@code /} and {@code //} via ANTLR
|
|
19
|
+
/// itself then walk path elements from left to right. At each separator-word
|
|
20
|
+
/// pair, find set of nodes. Next stage uses those as work list.</para>
|
|
21
|
+
///
|
|
22
|
+
/// <para>
|
|
23
|
+
/// The basic interface is
|
|
24
|
+
/// <seealso cref="XPath#findAll ParseTree.findAll"/>{@code (tree, pathString, parser)}.
|
|
25
|
+
/// But that is just shorthand for:</para>
|
|
26
|
+
///
|
|
27
|
+
/// <pre>
|
|
28
|
+
/// <seealso cref="XPath"/> p = new <seealso cref="XPath#XPath XPath"/>(parser, pathString);
|
|
29
|
+
/// return p.<seealso cref="#evaluate evaluate"/>(tree);
|
|
30
|
+
/// </pre>
|
|
31
|
+
///
|
|
32
|
+
/// <para>
|
|
33
|
+
/// See {@code org.antlr.v4.test.TestXPath} for descriptions. In short, this
|
|
34
|
+
/// allows operators:</para>
|
|
35
|
+
///
|
|
36
|
+
/// <dl>
|
|
37
|
+
/// <dt>/</dt> <dd>root</dd>
|
|
38
|
+
/// <dt>//</dt> <dd>anywhere</dd>
|
|
39
|
+
/// <dt>!</dt> <dd>invert; this must appear directly after root or anywhere
|
|
40
|
+
/// operator</dd>
|
|
41
|
+
/// </dl>
|
|
42
|
+
///
|
|
43
|
+
/// <para>
|
|
44
|
+
/// and path elements:</para>
|
|
45
|
+
///
|
|
46
|
+
/// <dl>
|
|
47
|
+
/// <dt>ID</dt> <dd>token name</dd>
|
|
48
|
+
/// <dt>'string'</dt> <dd>any string literal token from the grammar</dd>
|
|
49
|
+
/// <dt>expr</dt> <dd>rule name</dd>
|
|
50
|
+
/// <dt>*</dt> <dd>wildcard matching any node</dd>
|
|
51
|
+
/// </dl>
|
|
52
|
+
///
|
|
53
|
+
/// <para>
|
|
54
|
+
/// Whitespace is not allowed.</para>
|
|
55
|
+
|
|
56
|
+
class ANTLR4CPP_PUBLIC XPath {
|
|
57
|
+
public:
|
|
58
|
+
static const std::string WILDCARD; // word not operator/separator
|
|
59
|
+
static const std::string NOT; // word for invert operator
|
|
60
|
+
|
|
61
|
+
XPath(Parser *parser, const std::string &path);
|
|
62
|
+
virtual ~XPath() {}
|
|
63
|
+
|
|
64
|
+
// TODO: check for invalid token/rule names, bad syntax
|
|
65
|
+
virtual std::vector<std::unique_ptr<XPathElement>> split(const std::string &path);
|
|
66
|
+
|
|
67
|
+
static std::vector<ParseTree *> findAll(ParseTree *tree, std::string const& xpath, Parser *parser);
|
|
68
|
+
|
|
69
|
+
/// Return a list of all nodes starting at {@code t} as root that satisfy the
|
|
70
|
+
/// path. The root {@code /} is relative to the node passed to
|
|
71
|
+
/// <seealso cref="#evaluate"/>.
|
|
72
|
+
virtual std::vector<ParseTree *> evaluate(ParseTree *t);
|
|
73
|
+
|
|
74
|
+
protected:
|
|
75
|
+
std::string _path;
|
|
76
|
+
Parser *_parser;
|
|
77
|
+
|
|
78
|
+
/// Convert word like {@code *} or {@code ID} or {@code expr} to a path
|
|
79
|
+
/// element. {@code anywhere} is {@code true} if {@code //} precedes the
|
|
80
|
+
/// word.
|
|
81
|
+
virtual std::unique_ptr<XPathElement> getXPathElement(Token *wordToken, bool anywhere);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
} // namespace xpath
|
|
85
|
+
} // namespace tree
|
|
86
|
+
} // namespace antlr4
|
|
@@ -0,0 +1,31 @@
|
|
|
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 "support/CPPUtils.h"
|
|
7
|
+
|
|
8
|
+
#include "XPathElement.h"
|
|
9
|
+
|
|
10
|
+
using namespace antlr4::tree;
|
|
11
|
+
using namespace antlr4::tree::xpath;
|
|
12
|
+
|
|
13
|
+
XPathElement::XPathElement(const std::string &nodeName) {
|
|
14
|
+
_nodeName = nodeName;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
XPathElement::~XPathElement() {
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
std::vector<ParseTree *> XPathElement::evaluate(ParseTree * /*t*/) {
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
std::string XPathElement::toString() const {
|
|
25
|
+
std::string inv = _invert ? "!" : "";
|
|
26
|
+
return antlrcpp::toString(*this) + "[" + inv + _nodeName + "]";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
void XPathElement::setInvert(bool value) {
|
|
30
|
+
_invert = value;
|
|
31
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 tree {
|
|
12
|
+
class ParseTree;
|
|
13
|
+
|
|
14
|
+
namespace xpath {
|
|
15
|
+
|
|
16
|
+
class ANTLR4CPP_PUBLIC XPathElement {
|
|
17
|
+
public:
|
|
18
|
+
/// Construct element like {@code /ID} or {@code ID} or {@code /*} etc...
|
|
19
|
+
/// op is null if just node
|
|
20
|
+
XPathElement(const std::string &nodeName);
|
|
21
|
+
XPathElement(XPathElement const&) = default;
|
|
22
|
+
virtual ~XPathElement();
|
|
23
|
+
|
|
24
|
+
XPathElement& operator=(XPathElement const&) = default;
|
|
25
|
+
|
|
26
|
+
/// Given tree rooted at {@code t} return all nodes matched by this path
|
|
27
|
+
/// element.
|
|
28
|
+
virtual std::vector<ParseTree *> evaluate(ParseTree *t);
|
|
29
|
+
virtual std::string toString() const;
|
|
30
|
+
|
|
31
|
+
void setInvert(bool value);
|
|
32
|
+
|
|
33
|
+
protected:
|
|
34
|
+
std::string _nodeName;
|
|
35
|
+
bool _invert = false;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
} // namespace xpath
|
|
39
|
+
} // namespace tree
|
|
40
|
+
} // namespace antlr4
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
|
|
2
|
+
// Generated from XPathLexer.g4 by ANTLR 4.9.3
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
#include "XPathLexer.h"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
using namespace antlr4;
|
|
9
|
+
|
|
10
|
+
namespace {
|
|
11
|
+
|
|
12
|
+
struct XPathLexerStaticData final {
|
|
13
|
+
XPathLexerStaticData(std::vector<std::string> ruleNames,
|
|
14
|
+
std::vector<std::string> channelNames,
|
|
15
|
+
std::vector<std::string> modeNames,
|
|
16
|
+
std::vector<std::string> literalNames,
|
|
17
|
+
std::vector<std::string> symbolicNames)
|
|
18
|
+
: ruleNames(std::move(ruleNames)), channelNames(std::move(channelNames)),
|
|
19
|
+
modeNames(std::move(modeNames)), literalNames(std::move(literalNames)),
|
|
20
|
+
symbolicNames(std::move(symbolicNames)),
|
|
21
|
+
vocabulary(this->literalNames, this->symbolicNames) {}
|
|
22
|
+
|
|
23
|
+
XPathLexerStaticData(const XPathLexerStaticData&) = delete;
|
|
24
|
+
XPathLexerStaticData(XPathLexerStaticData&&) = delete;
|
|
25
|
+
XPathLexerStaticData& operator=(const XPathLexerStaticData&) = delete;
|
|
26
|
+
XPathLexerStaticData& operator=(XPathLexerStaticData&&) = delete;
|
|
27
|
+
|
|
28
|
+
std::vector<antlr4::dfa::DFA> decisionToDFA;
|
|
29
|
+
antlr4::atn::PredictionContextCache sharedContextCache;
|
|
30
|
+
const std::vector<std::string> ruleNames;
|
|
31
|
+
const std::vector<std::string> channelNames;
|
|
32
|
+
const std::vector<std::string> modeNames;
|
|
33
|
+
const std::vector<std::string> literalNames;
|
|
34
|
+
const std::vector<std::string> symbolicNames;
|
|
35
|
+
const antlr4::dfa::Vocabulary vocabulary;
|
|
36
|
+
antlr4::atn::SerializedATNView serializedATN;
|
|
37
|
+
std::unique_ptr<antlr4::atn::ATN> atn;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
std::once_flag xpathLexerOnceFlag;
|
|
41
|
+
XPathLexerStaticData *xpathLexerStaticData = nullptr;
|
|
42
|
+
|
|
43
|
+
void xpathLexerInitialize() {
|
|
44
|
+
assert(xpathLexerStaticData == nullptr);
|
|
45
|
+
auto staticData = std::make_unique<XPathLexerStaticData>(
|
|
46
|
+
std::vector<std::string>{
|
|
47
|
+
"ANYWHERE", "ROOT", "WILDCARD", "BANG", "ID", "NameChar", "NameStartChar",
|
|
48
|
+
"STRING"
|
|
49
|
+
},
|
|
50
|
+
std::vector<std::string>{
|
|
51
|
+
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
|
|
52
|
+
},
|
|
53
|
+
std::vector<std::string>{
|
|
54
|
+
"DEFAULT_MODE"
|
|
55
|
+
},
|
|
56
|
+
std::vector<std::string>{
|
|
57
|
+
"", "", "", "'//'", "'/'", "'*'", "'!'"
|
|
58
|
+
},
|
|
59
|
+
std::vector<std::string>{
|
|
60
|
+
"", "TOKEN_REF", "RULE_REF", "ANYWHERE", "ROOT", "WILDCARD", "BANG", "ID",
|
|
61
|
+
"STRING"
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
static const int32_t serializedATNSegment[] = {
|
|
65
|
+
0x4, 0x0, 0x8, 0x32, 0x6, -1, 0x2, 0x0, 0x7, 0x0, 0x2, 0x1, 0x7,
|
|
66
|
+
0x1, 0x2, 0x2, 0x7, 0x2, 0x2, 0x3, 0x7, 0x3, 0x2, 0x4, 0x7, 0x4,
|
|
67
|
+
0x2, 0x5, 0x7, 0x5, 0x2, 0x6, 0x7, 0x6, 0x2, 0x7, 0x7, 0x7, 0x1,
|
|
68
|
+
0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2,
|
|
69
|
+
0x1, 0x3, 0x1, 0x3, 0x1, 0x4, 0x1, 0x4, 0x5, 0x4, 0x1d, 0x8, 0x4,
|
|
70
|
+
0xa, 0x4, 0xc, 0x4, 0x20, 0x9, 0x4, 0x1, 0x4, 0x1, 0x4, 0x1, 0x5,
|
|
71
|
+
0x1, 0x5, 0x3, 0x5, 0x26, 0x8, 0x5, 0x1, 0x6, 0x1, 0x6, 0x1, 0x7,
|
|
72
|
+
0x1, 0x7, 0x5, 0x7, 0x2c, 0x8, 0x7, 0xa, 0x7, 0xc, 0x7, 0x2f, 0x9,
|
|
73
|
+
0x7, 0x1, 0x7, 0x1, 0x7, 0x1, 0x2d, 0x0, 0x8, 0x1, 0x3, 0x3, 0x4,
|
|
74
|
+
0x5, 0x5, 0x7, 0x6, 0x9, 0x7, 0xb, 0x0, 0xd, 0x0, 0xf, 0x8, 0x1,
|
|
75
|
+
0x0, 0x2, 0x5, 0x0, 0x30, 0x39, 0x5f, 0x5f, 0xb7, 0xb7, 0x300, 0x36f,
|
|
76
|
+
0x203f, 0x2040, 0xd, 0x0, 0x41, 0x5a, 0x61, 0x7a, 0xc0, 0xd6, 0xd8,
|
|
77
|
+
0xf6, 0xf8, 0x2ff, 0x370, 0x37d, 0x37f, 0x1fff, 0x200c, 0x200d, 0x2070,
|
|
78
|
+
0x218f, 0x2c00, 0x2fef, 0x3001, 0xd7ff, 0xf900, 0xfdcf, 0xfdf0, -1,
|
|
79
|
+
0x0, 0x32, 0x0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x3, 0x1, 0x0, 0x0,
|
|
80
|
+
0x0, 0x0, 0x5, 0x1, 0x0, 0x0, 0x0, 0x0, 0x7, 0x1, 0x0, 0x0, 0x0,
|
|
81
|
+
0x0, 0x9, 0x1, 0x0, 0x0, 0x0, 0x0, 0xf, 0x1, 0x0, 0x0, 0x0, 0x1,
|
|
82
|
+
0x11, 0x1, 0x0, 0x0, 0x0, 0x3, 0x14, 0x1, 0x0, 0x0, 0x0, 0x5, 0x16,
|
|
83
|
+
0x1, 0x0, 0x0, 0x0, 0x7, 0x18, 0x1, 0x0, 0x0, 0x0, 0x9, 0x1a, 0x1,
|
|
84
|
+
0x0, 0x0, 0x0, 0xb, 0x25, 0x1, 0x0, 0x0, 0x0, 0xd, 0x27, 0x1, 0x0,
|
|
85
|
+
0x0, 0x0, 0xf, 0x29, 0x1, 0x0, 0x0, 0x0, 0x11, 0x12, 0x5, 0x2f, 0x0,
|
|
86
|
+
0x0, 0x12, 0x13, 0x5, 0x2f, 0x0, 0x0, 0x13, 0x2, 0x1, 0x0, 0x0, 0x0,
|
|
87
|
+
0x14, 0x15, 0x5, 0x2f, 0x0, 0x0, 0x15, 0x4, 0x1, 0x0, 0x0, 0x0, 0x16,
|
|
88
|
+
0x17, 0x5, 0x2a, 0x0, 0x0, 0x17, 0x6, 0x1, 0x0, 0x0, 0x0, 0x18, 0x19,
|
|
89
|
+
0x5, 0x21, 0x0, 0x0, 0x19, 0x8, 0x1, 0x0, 0x0, 0x0, 0x1a, 0x1e, 0x3,
|
|
90
|
+
0xd, 0x6, 0x0, 0x1b, 0x1d, 0x3, 0xb, 0x5, 0x0, 0x1c, 0x1b, 0x1, 0x0,
|
|
91
|
+
0x0, 0x0, 0x1d, 0x20, 0x1, 0x0, 0x0, 0x0, 0x1e, 0x1c, 0x1, 0x0, 0x0,
|
|
92
|
+
0x0, 0x1e, 0x1f, 0x1, 0x0, 0x0, 0x0, 0x1f, 0x21, 0x1, 0x0, 0x0, 0x0,
|
|
93
|
+
0x20, 0x1e, 0x1, 0x0, 0x0, 0x0, 0x21, 0x22, 0x6, 0x4, 0x0, 0x0, 0x22,
|
|
94
|
+
0xa, 0x1, 0x0, 0x0, 0x0, 0x23, 0x26, 0x3, 0xd, 0x6, 0x0, 0x24, 0x26,
|
|
95
|
+
0x7, 0x0, 0x0, 0x0, 0x25, 0x23, 0x1, 0x0, 0x0, 0x0, 0x25, 0x24, 0x1,
|
|
96
|
+
0x0, 0x0, 0x0, 0x26, 0xc, 0x1, 0x0, 0x0, 0x0, 0x27, 0x28, 0x7, 0x1,
|
|
97
|
+
0x0, 0x0, 0x28, 0xe, 0x1, 0x0, 0x0, 0x0, 0x29, 0x2d, 0x5, 0x27, 0x0,
|
|
98
|
+
0x0, 0x2a, 0x2c, 0x9, 0x0, 0x0, 0x0, 0x2b, 0x2a, 0x1, 0x0, 0x0, 0x0,
|
|
99
|
+
0x2c, 0x2f, 0x1, 0x0, 0x0, 0x0, 0x2d, 0x2e, 0x1, 0x0, 0x0, 0x0, 0x2d,
|
|
100
|
+
0x2b, 0x1, 0x0, 0x0, 0x0, 0x2e, 0x30, 0x1, 0x0, 0x0, 0x0, 0x2f, 0x2d,
|
|
101
|
+
0x1, 0x0, 0x0, 0x0, 0x30, 0x31, 0x5, 0x27, 0x0, 0x0, 0x31, 0x10,
|
|
102
|
+
0x1, 0x0, 0x0, 0x0, 0x4, 0x0, 0x1e, 0x25, 0x2d, 0x1, 0x1, 0x4, 0x0,
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
staticData->serializedATN = antlr4::atn::SerializedATNView(serializedATNSegment, sizeof(serializedATNSegment) / sizeof(serializedATNSegment[0]));
|
|
106
|
+
|
|
107
|
+
atn::ATNDeserializer deserializer;
|
|
108
|
+
staticData->atn = deserializer.deserialize(staticData->serializedATN);
|
|
109
|
+
|
|
110
|
+
size_t count = staticData->atn->getNumberOfDecisions();
|
|
111
|
+
staticData->decisionToDFA.reserve(count);
|
|
112
|
+
for (size_t i = 0; i < count; i++) {
|
|
113
|
+
staticData->decisionToDFA.emplace_back(staticData->atn->getDecisionState(i), i);
|
|
114
|
+
}
|
|
115
|
+
xpathLexerStaticData = staticData.release();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
XPathLexer::XPathLexer(CharStream *input) : Lexer(input) {
|
|
121
|
+
XPathLexer::initialize();
|
|
122
|
+
_interpreter = new atn::LexerATNSimulator(this, *xpathLexerStaticData->atn, xpathLexerStaticData->decisionToDFA, xpathLexerStaticData->sharedContextCache);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
XPathLexer::~XPathLexer() {
|
|
126
|
+
delete _interpreter;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
std::string XPathLexer::getGrammarFileName() const {
|
|
130
|
+
return "XPathLexer.g4";
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const std::vector<std::string>& XPathLexer::getRuleNames() const {
|
|
134
|
+
return xpathLexerStaticData->ruleNames;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const std::vector<std::string>& XPathLexer::getChannelNames() const {
|
|
138
|
+
return xpathLexerStaticData->channelNames;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const std::vector<std::string>& XPathLexer::getModeNames() const {
|
|
142
|
+
return xpathLexerStaticData->modeNames;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const dfa::Vocabulary& XPathLexer::getVocabulary() const {
|
|
146
|
+
return xpathLexerStaticData->vocabulary;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
antlr4::atn::SerializedATNView XPathLexer::getSerializedATN() const {
|
|
150
|
+
return xpathLexerStaticData->serializedATN;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const atn::ATN& XPathLexer::getATN() const {
|
|
154
|
+
return *xpathLexerStaticData->atn;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
void XPathLexer::action(RuleContext *context, size_t ruleIndex, size_t actionIndex) {
|
|
158
|
+
switch (ruleIndex) {
|
|
159
|
+
case 4: IDAction(antlrcpp::downCast<antlr4::RuleContext *>(context), actionIndex); break;
|
|
160
|
+
|
|
161
|
+
default:
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
void XPathLexer::IDAction(antlr4::RuleContext *context, size_t actionIndex) {
|
|
167
|
+
switch (actionIndex) {
|
|
168
|
+
case 0:
|
|
169
|
+
if (isupper(getText()[0]))
|
|
170
|
+
setType(TOKEN_REF);
|
|
171
|
+
else
|
|
172
|
+
setType(RULE_REF);
|
|
173
|
+
break;
|
|
174
|
+
|
|
175
|
+
default:
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
void XPathLexer::initialize() {
|
|
181
|
+
std::call_once(xpathLexerOnceFlag, xpathLexerInitialize);
|
|
182
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
// Generated from XPathLexer.g4 by ANTLR 4.9.3
|
|
3
|
+
|
|
4
|
+
#pragma once
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
#include "antlr4-runtime.h"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class XPathLexer : public antlr4::Lexer {
|
|
11
|
+
public:
|
|
12
|
+
enum {
|
|
13
|
+
TOKEN_REF = 1, RULE_REF = 2, ANYWHERE = 3, ROOT = 4, WILDCARD = 5, BANG = 6,
|
|
14
|
+
ID = 7, STRING = 8
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
explicit XPathLexer(antlr4::CharStream *input);
|
|
18
|
+
|
|
19
|
+
~XPathLexer() override;
|
|
20
|
+
|
|
21
|
+
virtual std::string getGrammarFileName() const override;
|
|
22
|
+
|
|
23
|
+
virtual const std::vector<std::string>& getRuleNames() const override;
|
|
24
|
+
|
|
25
|
+
virtual const std::vector<std::string>& getChannelNames() const override;
|
|
26
|
+
|
|
27
|
+
virtual const std::vector<std::string>& getModeNames() const override;
|
|
28
|
+
|
|
29
|
+
virtual const antlr4::dfa::Vocabulary& getVocabulary() const override;
|
|
30
|
+
|
|
31
|
+
virtual antlr4::atn::SerializedATNView getSerializedATN() const override;
|
|
32
|
+
|
|
33
|
+
virtual const antlr4::atn::ATN& getATN() const override;
|
|
34
|
+
|
|
35
|
+
virtual void action(antlr4::RuleContext *context, size_t ruleIndex, size_t actionIndex) override;
|
|
36
|
+
|
|
37
|
+
// By default the static state used to implement the lexer is lazily initialized during the first
|
|
38
|
+
// call to the constructor. You can call this function if you wish to initialize the static state
|
|
39
|
+
// ahead of time.
|
|
40
|
+
static void initialize();
|
|
41
|
+
private:
|
|
42
|
+
// Individual action functions triggered by action() above.
|
|
43
|
+
void IDAction(antlr4::RuleContext *context, size_t actionIndex);
|
|
44
|
+
|
|
45
|
+
// Individual semantic predicate functions triggered by sempred() above.
|
|
46
|
+
};
|
|
47
|
+
|
data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.cpp
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
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 "XPathLexerErrorListener.h"
|
|
7
|
+
|
|
8
|
+
using namespace antlr4;
|
|
9
|
+
using namespace antlr4::tree::xpath;
|
|
10
|
+
|
|
11
|
+
void XPathLexerErrorListener::syntaxError(Recognizer * /*recognizer*/, Token * /*offendingSymbol*/,
|
|
12
|
+
size_t /*line*/, size_t /*charPositionInLine*/, const std::string &/*msg*/, std::exception_ptr /*e*/) {
|
|
13
|
+
}
|
data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.h
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
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 "BaseErrorListener.h"
|
|
9
|
+
|
|
10
|
+
namespace antlr4 {
|
|
11
|
+
namespace tree {
|
|
12
|
+
namespace xpath {
|
|
13
|
+
|
|
14
|
+
class ANTLR4CPP_PUBLIC XPathLexerErrorListener : public BaseErrorListener {
|
|
15
|
+
public:
|
|
16
|
+
virtual void syntaxError(Recognizer *recognizer, Token *offendingSymbol, size_t line,
|
|
17
|
+
size_t charPositionInLine, const std::string &msg, std::exception_ptr e) override;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
} // namespace xpath
|
|
21
|
+
} // namespace tree
|
|
22
|
+
} // namespace antlr4
|
data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.cpp
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
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 "tree/ParseTree.h"
|
|
7
|
+
#include "tree/Trees.h"
|
|
8
|
+
|
|
9
|
+
#include "tree/xpath/XPathRuleAnywhereElement.h"
|
|
10
|
+
|
|
11
|
+
using namespace antlr4::tree;
|
|
12
|
+
using namespace antlr4::tree::xpath;
|
|
13
|
+
|
|
14
|
+
XPathRuleAnywhereElement::XPathRuleAnywhereElement(const std::string &ruleName, int ruleIndex) : XPathElement(ruleName) {
|
|
15
|
+
_ruleIndex = ruleIndex;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
std::vector<ParseTree *> XPathRuleAnywhereElement::evaluate(ParseTree *t) {
|
|
19
|
+
return Trees::findAllRuleNodes(t, _ruleIndex);
|
|
20
|
+
}
|
data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.h
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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 "XPathElement.h"
|
|
9
|
+
|
|
10
|
+
namespace antlr4 {
|
|
11
|
+
namespace tree {
|
|
12
|
+
namespace xpath {
|
|
13
|
+
|
|
14
|
+
/// Either {@code ID} at start of path or {@code ...//ID} in middle of path.
|
|
15
|
+
class ANTLR4CPP_PUBLIC XPathRuleAnywhereElement : public XPathElement {
|
|
16
|
+
public:
|
|
17
|
+
XPathRuleAnywhereElement(const std::string &ruleName, int ruleIndex);
|
|
18
|
+
|
|
19
|
+
virtual std::vector<ParseTree *> evaluate(ParseTree *t) override;
|
|
20
|
+
|
|
21
|
+
protected:
|
|
22
|
+
int _ruleIndex = 0;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
} // namespace xpath
|
|
26
|
+
} // namespace tree
|
|
27
|
+
} // namespace antlr4
|
|
@@ -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
|
+
#include "tree/ParseTree.h"
|
|
7
|
+
#include "tree/Trees.h"
|
|
8
|
+
|
|
9
|
+
#include "XPathRuleElement.h"
|
|
10
|
+
|
|
11
|
+
using namespace antlr4::tree;
|
|
12
|
+
using namespace antlr4::tree::xpath;
|
|
13
|
+
|
|
14
|
+
XPathRuleElement::XPathRuleElement(const std::string &ruleName, size_t ruleIndex) : XPathElement(ruleName) {
|
|
15
|
+
_ruleIndex = ruleIndex;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
std::vector<ParseTree *> XPathRuleElement::evaluate(ParseTree *t) {
|
|
19
|
+
// return all children of t that match nodeName
|
|
20
|
+
std::vector<ParseTree *> nodes;
|
|
21
|
+
for (auto *c : t->children) {
|
|
22
|
+
if (antlrcpp::is<ParserRuleContext *>(c)) {
|
|
23
|
+
ParserRuleContext *ctx = dynamic_cast<ParserRuleContext *>(c);
|
|
24
|
+
if ((ctx->getRuleIndex() == _ruleIndex && !_invert) || (ctx->getRuleIndex() != _ruleIndex && _invert)) {
|
|
25
|
+
nodes.push_back(ctx);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return nodes;
|
|
30
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 "XPathElement.h"
|
|
9
|
+
|
|
10
|
+
namespace antlr4 {
|
|
11
|
+
namespace tree {
|
|
12
|
+
namespace xpath {
|
|
13
|
+
|
|
14
|
+
class ANTLR4CPP_PUBLIC XPathRuleElement : public XPathElement {
|
|
15
|
+
public:
|
|
16
|
+
XPathRuleElement(const std::string &ruleName, size_t ruleIndex);
|
|
17
|
+
|
|
18
|
+
virtual std::vector<ParseTree *> evaluate(ParseTree *t) override;
|
|
19
|
+
|
|
20
|
+
protected:
|
|
21
|
+
size_t _ruleIndex = 0;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
} // namespace xpath
|
|
25
|
+
} // namespace tree
|
|
26
|
+
} // namespace antlr4
|
data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.cpp
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
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 "tree/ParseTree.h"
|
|
7
|
+
#include "tree/Trees.h"
|
|
8
|
+
|
|
9
|
+
#include "XPathTokenAnywhereElement.h"
|
|
10
|
+
|
|
11
|
+
using namespace antlr4::tree;
|
|
12
|
+
using namespace antlr4::tree::xpath;
|
|
13
|
+
|
|
14
|
+
XPathTokenAnywhereElement::XPathTokenAnywhereElement(const std::string &tokenName, int tokenType) : XPathElement(tokenName) {
|
|
15
|
+
this->tokenType = tokenType;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
std::vector<ParseTree *> XPathTokenAnywhereElement::evaluate(ParseTree *t) {
|
|
19
|
+
return Trees::findAllTokenNodes(t, tokenType);
|
|
20
|
+
}
|
data/ext/did_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.h
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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 "XPathElement.h"
|
|
9
|
+
|
|
10
|
+
namespace antlr4 {
|
|
11
|
+
namespace tree {
|
|
12
|
+
namespace xpath {
|
|
13
|
+
|
|
14
|
+
class ANTLR4CPP_PUBLIC XPathTokenAnywhereElement : public XPathElement {
|
|
15
|
+
protected:
|
|
16
|
+
int tokenType = 0;
|
|
17
|
+
public:
|
|
18
|
+
XPathTokenAnywhereElement(const std::string &tokenName, int tokenType);
|
|
19
|
+
|
|
20
|
+
virtual std::vector<ParseTree *> evaluate(ParseTree *t) override;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
} // namespace xpath
|
|
24
|
+
} // namespace tree
|
|
25
|
+
} // namespace antlr4
|
|
@@ -0,0 +1,33 @@
|
|
|
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 "tree/ParseTree.h"
|
|
7
|
+
#include "tree/Trees.h"
|
|
8
|
+
#include "support/CPPUtils.h"
|
|
9
|
+
#include "Token.h"
|
|
10
|
+
|
|
11
|
+
#include "XPathTokenElement.h"
|
|
12
|
+
|
|
13
|
+
using namespace antlr4;
|
|
14
|
+
using namespace antlr4::tree;
|
|
15
|
+
using namespace antlr4::tree::xpath;
|
|
16
|
+
|
|
17
|
+
XPathTokenElement::XPathTokenElement(const std::string &tokenName, size_t tokenType) : XPathElement(tokenName) {
|
|
18
|
+
_tokenType = tokenType;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
std::vector<ParseTree *> XPathTokenElement::evaluate(ParseTree *t) {
|
|
22
|
+
// return all children of t that match nodeName
|
|
23
|
+
std::vector<ParseTree *> nodes;
|
|
24
|
+
for (auto *c : t->children) {
|
|
25
|
+
if (antlrcpp::is<TerminalNode *>(c)) {
|
|
26
|
+
TerminalNode *tnode = dynamic_cast<TerminalNode *>(c);
|
|
27
|
+
if ((tnode->getSymbol()->getType() == _tokenType && !_invert) || (tnode->getSymbol()->getType() != _tokenType && _invert)) {
|
|
28
|
+
nodes.push_back(tnode);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return nodes;
|
|
33
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 "XPathElement.h"
|
|
9
|
+
|
|
10
|
+
namespace antlr4 {
|
|
11
|
+
namespace tree {
|
|
12
|
+
namespace xpath {
|
|
13
|
+
|
|
14
|
+
class ANTLR4CPP_PUBLIC XPathTokenElement : public XPathElement {
|
|
15
|
+
public:
|
|
16
|
+
XPathTokenElement(const std::string &tokenName, size_t tokenType);
|
|
17
|
+
|
|
18
|
+
virtual std::vector<ParseTree *> evaluate(ParseTree *t) override;
|
|
19
|
+
|
|
20
|
+
protected:
|
|
21
|
+
size_t _tokenType = 0;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
} // namespace xpath
|
|
25
|
+
} // namespace tree
|
|
26
|
+
} // 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 "XPath.h"
|
|
7
|
+
#include "tree/ParseTree.h"
|
|
8
|
+
#include "tree/Trees.h"
|
|
9
|
+
|
|
10
|
+
#include "XPathWildcardAnywhereElement.h"
|
|
11
|
+
|
|
12
|
+
using namespace antlr4::tree;
|
|
13
|
+
using namespace antlr4::tree::xpath;
|
|
14
|
+
|
|
15
|
+
XPathWildcardAnywhereElement::XPathWildcardAnywhereElement() : XPathElement(XPath::WILDCARD) {
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
std::vector<ParseTree *> XPathWildcardAnywhereElement::evaluate(ParseTree *t) {
|
|
19
|
+
if (_invert) {
|
|
20
|
+
return {}; // !* is weird but valid (empty)
|
|
21
|
+
}
|
|
22
|
+
return Trees::getDescendants(t);
|
|
23
|
+
}
|