expressir 1.2.3 → 1.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cross_rubies +0 -6
- data/.github/workflows/rake.yml +223 -31
- data/.gitignore +7 -1
- data/.gitmodules +3 -0
- data/.rubocop.yml +13 -4
- data/README.adoc +8 -0
- data/Rakefile +4 -1
- data/bin/console +0 -1
- data/bin/rspec +3 -3
- data/exe/expressir +4 -2
- data/exe/format +1 -1
- data/exe/format-test +25 -25
- data/exe/generate-parser +16 -13
- data/expressir.gemspec +11 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/CMakeLists.txt +44 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj +11 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj.filters +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj +11 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj.filters +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2017.vcxproj +11 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2017.vcxproj.filters +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj +19 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj.filters +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj +51 -35
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4.xcscheme +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_ios.xcscheme +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_static.xcscheme +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.cpp +1 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.h +9 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +43 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.h +16 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.cpp +2 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp +16 -13
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.h +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.cpp +5 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.cpp +2 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.h +9 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.cpp +0 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.h +1 -7
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.h +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.cpp +51 -31
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.h +1 -7
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.cpp +27 -39
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.h +1 -7
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.cpp +20 -23
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.h +21 -21
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.cpp +4 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.cpp +0 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.cpp +16 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.h +12 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.cpp +4 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.h +5 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.cpp +2 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.h +7 -7
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp +6 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp +15 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.h +12 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Version.h +42 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.cpp +13 -53
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.h +11 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-common.h +19 -58
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-runtime.h +7 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.cpp +6 -57
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.h +35 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.cpp +29 -36
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.h +36 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp +58 -54
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.h +77 -31
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.cpp +22 -32
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.h +22 -24
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp +335 -464
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.h +9 -62
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.cpp +9 -39
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.h +6 -22
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.cpp +10 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.h +42 -36
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.cpp +33 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.h +36 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.cpp +2 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.cpp +49 -22
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.h +20 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.cpp +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.h +5 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.h +5 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.h +10 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.cpp +0 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.h +12 -8
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.cpp +2 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.h +6 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp +139 -108
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.h +10 -43
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.cpp +16 -33
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.h +12 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp +69 -82
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.h +17 -28
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.cpp +12 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.h +45 -11
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.cpp +48 -44
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.h +31 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionType.h +3 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.cpp +14 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.cpp +15 -32
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.h +12 -24
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.cpp +23 -29
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.h +13 -19
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp +13 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.cpp +6 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.cpp +6 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.cpp +13 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.cpp +6 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.h +11 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.cpp +13 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.h +13 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.h +5 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.cpp +1 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.cpp +6 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.h +8 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp +169 -152
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.h +26 -19
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulatorOptions.h +50 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.h +5 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.h +5 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.cpp +2 -11
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.h +15 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.h +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.cpp +4 -14
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.h +22 -11
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.cpp +255 -338
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.h +87 -116
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.cpp +56 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.h +64 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.cpp +167 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.h +101 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCacheOptions.h +71 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextType.h +21 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.cpp +18 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.h +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.cpp +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.h +4 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.cpp +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.h +5 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.cpp +197 -156
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.h +92 -81
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContextType.h +23 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SerializedATNView.h +101 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.cpp +2 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.h +11 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp +39 -34
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.h +17 -10
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.h +5 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.cpp +6 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.h +6 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.h +5 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.cpp +1 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.h +11 -22
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.cpp +27 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.h +33 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.cpp +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.cpp +11 -23
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.h +20 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.cpp +2 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.h +4 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.cpp +9 -50
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.h +57 -48
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.cpp +1 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.h +3 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.h +3 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.cpp +1 -29
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.h +10 -10
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.cpp +15 -28
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.h +1 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.cpp +54 -68
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.h +35 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.cpp +0 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.h +1 -155
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.h +39 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/BitSet.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.cpp +13 -54
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.h +16 -29
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Casts.h +34 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Declarations.h +0 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.cpp +25 -23
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.h +2 -40
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Unicode.h +28 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.cpp +242 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.h +54 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h +13 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.h +7 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.cpp +36 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.h +14 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.cpp +14 -19
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.cpp +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.h +14 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeType.h +22 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.h +4 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.cpp +8 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.h +30 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.h +10 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp +2 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.h +4 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp +1 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.cpp +128 -119
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.h +18 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/tests/Utf8Test.cpp +110 -0
- data/ext/express-parser/antlrgen/Express.interp +1 -1
- data/ext/express-parser/antlrgen/ExpressBaseListener.cpp +1 -1
- data/ext/express-parser/antlrgen/ExpressBaseListener.h +1 -1
- data/ext/express-parser/antlrgen/ExpressBaseVisitor.cpp +1 -1
- data/ext/express-parser/antlrgen/ExpressBaseVisitor.h +200 -200
- data/ext/express-parser/antlrgen/ExpressLexer.cpp +645 -1129
- data/ext/express-parser/antlrgen/ExpressLexer.h +20 -27
- data/ext/express-parser/antlrgen/ExpressLexer.interp +1 -1
- data/ext/express-parser/antlrgen/ExpressListener.cpp +1 -1
- data/ext/express-parser/antlrgen/ExpressListener.h +1 -1
- data/ext/express-parser/antlrgen/ExpressParser.cpp +1754 -1447
- data/ext/express-parser/antlrgen/ExpressParser.h +219 -223
- data/ext/express-parser/antlrgen/ExpressVisitor.cpp +1 -1
- data/ext/express-parser/antlrgen/ExpressVisitor.h +200 -200
- data/ext/express-parser/express_parser.cpp +165 -101
- data/ext/express-parser/extconf.rb +14 -14
- data/lib/expressir/config.rb +1 -1
- data/lib/expressir/express/parser.rb +17 -15
- data/lib/expressir/express/visitor.rb +7 -3
- data/lib/expressir/model.rb +78 -78
- data/lib/expressir/version.rb +1 -1
- data/rakelib/antlr4-native.rake +161 -0
- data/rakelib/cross-ruby.rake +213 -162
- data/spec/acceptance/version_spec.rb +17 -2
- data/spec/expressir/express/cache_spec.rb +23 -5
- data/spec/expressir/express/formatter_spec.rb +54 -8
- data/spec/expressir/express/parser_spec.rb +47 -11
- data/spec/expressir/model/model_element_spec.rb +198 -146
- data/spec/spec_helper.rb +7 -0
- metadata +79 -91
- data/demo.rb +0 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.cpp +0 -621
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.h +0 -61
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.cpp +0 -14
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.h +0 -24
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.cpp +0 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.cpp +0 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.cpp +0 -35
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.h +0 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Makefile +0 -67
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.cpp +0 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.cpp +0 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/guid.cpp +0 -303
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/guid.h +0 -112
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.cpp +0 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.cpp +0 -9
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.exp +0 -9589
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.owl +0 -36619
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.xml +0 -13294
- data/original/examples/employment/eclipse/.project +0 -17
- data/original/examples/employment/eclipse/Export/Employment.png +0 -0
- data/original/examples/employment/eclipse/Express/employment_schema.exp +0 -33
- data/original/examples/employment/eclipse/Express/employment_schema.xmi +0 -77
- data/original/examples/employment/eclipse/Express/employment_schema.xml +0 -93
- data/original/examples/employment/eclipse/Models/Employment.uml +0 -4
- data/original/examples/employment/eclipse/Models/Employment.umldi +0 -240
- data/original/examples/employment/eclipse/readme.txt +0 -7
- data/original/examples/employment/employment_schema.exp +0 -33
- data/original/examples/employment/employment_schema.rb +0 -232
- data/original/examples/employment/employment_schema.xml +0 -93
- data/original/examples/employment/employment_schema___module.rb +0 -46
- data/original/examples/employment/employment_schema___p28attr.rb +0 -126
- data/original/examples/employment/employment_schema___p28inst.rb +0 -26
- data/original/examples/employment/example_employment_data.xml +0 -1
- data/original/examples/employment/example_employment_data_copy.xml +0 -1
- data/original/examples/employment/example_employment_reader.rb +0 -30
- data/original/examples/employment/example_employment_writer.rb +0 -51
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.exp +0 -3710
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.owl +0 -35880
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xmi +0 -15357
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xml +0 -9468
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.exp +0 -8404
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.owl +0 -43147
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xmi +0 -18341
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xml +0 -11632
- data/original/exp2ruby.rb +0 -525
- data/original/expsm.rb +0 -34
- data/original/mapping_owl.rb +0 -1018
- data/original/mapping_sysml.rb +0 -2281
- data/original/mapping_uml2.rb +0 -599
- data/original/mapping_uml2_eclipse.rb +0 -433
- data/original/reeper.rb +0 -134
- data/spec/expressr_spec.rb +0 -5
@@ -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 <cstddef>
|
9
|
+
|
10
|
+
#include "antlr4-common.h"
|
11
|
+
|
12
|
+
namespace antlr4 {
|
13
|
+
namespace tree {
|
14
|
+
|
15
|
+
enum class ParseTreeType : size_t {
|
16
|
+
TERMINAL = 1,
|
17
|
+
ERROR = 2,
|
18
|
+
RULE = 3,
|
19
|
+
};
|
20
|
+
|
21
|
+
} // namespace tree
|
22
|
+
} // namespace antlr4
|
@@ -27,7 +27,7 @@ namespace tree {
|
|
27
27
|
/// </summary>
|
28
28
|
/// <param name="tree"> The <seealso cref="ParseTree"/> to visit. </param>
|
29
29
|
/// <returns> The result of visiting the parse tree. </returns>
|
30
|
-
virtual
|
30
|
+
virtual std::any visit(ParseTree *tree) = 0;
|
31
31
|
|
32
32
|
/// <summary>
|
33
33
|
/// Visit the children of a node, and return a user-defined result of the
|
@@ -35,21 +35,21 @@ namespace tree {
|
|
35
35
|
/// </summary>
|
36
36
|
/// <param name="node"> The <seealso cref="ParseTree"/> whose children should be visited. </param>
|
37
37
|
/// <returns> The result of visiting the children of the node. </returns>
|
38
|
-
virtual
|
38
|
+
virtual std::any visitChildren(ParseTree *node) = 0;
|
39
39
|
|
40
40
|
/// <summary>
|
41
41
|
/// Visit a terminal node, and return a user-defined result of the operation.
|
42
42
|
/// </summary>
|
43
43
|
/// <param name="node"> The <seealso cref="TerminalNode"/> to visit. </param>
|
44
44
|
/// <returns> The result of visiting the node. </returns>
|
45
|
-
virtual
|
45
|
+
virtual std::any visitTerminal(TerminalNode *node) = 0;
|
46
46
|
|
47
47
|
/// <summary>
|
48
48
|
/// Visit an error node, and return a user-defined result of the operation.
|
49
49
|
/// </summary>
|
50
50
|
/// <param name="node"> The <seealso cref="ErrorNode"/> to visit. </param>
|
51
51
|
/// <returns> The result of visiting the node. </returns>
|
52
|
-
virtual
|
52
|
+
virtual std::any visitErrorNode(ErrorNode *node) = 0;
|
53
53
|
|
54
54
|
};
|
55
55
|
|
@@ -7,6 +7,7 @@
|
|
7
7
|
#include "ParserRuleContext.h"
|
8
8
|
#include "tree/ParseTreeListener.h"
|
9
9
|
#include "support/CPPUtils.h"
|
10
|
+
#include "support/Casts.h"
|
10
11
|
|
11
12
|
#include "tree/IterativeParseTreeWalker.h"
|
12
13
|
#include "tree/ParseTreeWalker.h"
|
@@ -17,15 +18,13 @@ using namespace antlrcpp;
|
|
17
18
|
static IterativeParseTreeWalker defaultWalker;
|
18
19
|
ParseTreeWalker &ParseTreeWalker::DEFAULT = defaultWalker;
|
19
20
|
|
20
|
-
ParseTreeWalker::~ParseTreeWalker() {
|
21
|
-
}
|
22
|
-
|
23
21
|
void ParseTreeWalker::walk(ParseTreeListener *listener, ParseTree *t) const {
|
24
|
-
if (is
|
25
|
-
listener->visitErrorNode(
|
22
|
+
if (ErrorNode::is(*t)) {
|
23
|
+
listener->visitErrorNode(downCast<ErrorNode*>(t));
|
26
24
|
return;
|
27
|
-
}
|
28
|
-
|
25
|
+
}
|
26
|
+
if (TerminalNode::is(*t)) {
|
27
|
+
listener->visitTerminal(downCast<TerminalNode*>(t));
|
29
28
|
return;
|
30
29
|
}
|
31
30
|
|
@@ -37,13 +36,13 @@ void ParseTreeWalker::walk(ParseTreeListener *listener, ParseTree *t) const {
|
|
37
36
|
}
|
38
37
|
|
39
38
|
void ParseTreeWalker::enterRule(ParseTreeListener *listener, ParseTree *r) const {
|
40
|
-
|
39
|
+
auto *ctx = downCast<ParserRuleContext*>(r);
|
41
40
|
listener->enterEveryRule(ctx);
|
42
41
|
ctx->enterRule(listener);
|
43
42
|
}
|
44
43
|
|
45
44
|
void ParseTreeWalker::exitRule(ParseTreeListener *listener, ParseTree *r) const {
|
46
|
-
|
45
|
+
auto *ctx = downCast<ParserRuleContext*>(r);
|
47
46
|
ctx->exitRule(listener);
|
48
47
|
listener->exitEveryRule(ctx);
|
49
48
|
}
|
@@ -14,16 +14,40 @@ namespace tree {
|
|
14
14
|
public:
|
15
15
|
static ParseTreeWalker &DEFAULT;
|
16
16
|
|
17
|
-
virtual ~ParseTreeWalker();
|
18
|
-
|
17
|
+
virtual ~ParseTreeWalker() = default;
|
18
|
+
|
19
|
+
/**
|
20
|
+
* <summary>
|
21
|
+
* Performs a walk on the given parse tree starting at the root and going down recursively
|
22
|
+
* with depth-first search. On each node, <seealso cref="ParseTreeWalker#enterRule"/> is called before
|
23
|
+
* recursively walking down into child nodes, then
|
24
|
+
* <seealso cref="ParseTreeWalker#exitRule"/> is called after the recursive call to wind up.
|
25
|
+
* </summary>
|
26
|
+
* <param name='listener'> The listener used by the walker to process grammar rules </param>
|
27
|
+
* <param name='t'> The parse tree to be walked on </param>
|
28
|
+
*/
|
19
29
|
virtual void walk(ParseTreeListener *listener, ParseTree *t) const;
|
20
30
|
|
21
31
|
protected:
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
32
|
+
|
33
|
+
/**
|
34
|
+
* <summary>
|
35
|
+
* Enters a grammar rule by first triggering the generic event <seealso cref="ParseTreeListener#enterEveryRule"/>
|
36
|
+
* then by triggering the event specific to the given parse tree node
|
37
|
+
* </summary>
|
38
|
+
* <param name='listener'> The listener responding to the trigger events </param>
|
39
|
+
* <param name='r'> The grammar rule containing the rule context </param>
|
40
|
+
*/
|
26
41
|
virtual void enterRule(ParseTreeListener *listener, ParseTree *r) const;
|
42
|
+
|
43
|
+
/**
|
44
|
+
* <summary>
|
45
|
+
* Exits a grammar rule by first triggering the event specific to the given parse tree node
|
46
|
+
* then by triggering the generic event <seealso cref="ParseTreeListener#exitEveryRule"/>
|
47
|
+
* </summary>
|
48
|
+
* <param name='listener'> The listener responding to the trigger events </param>
|
49
|
+
* <param name='r'> The grammar rule containing the rule context </param>
|
50
|
+
*/
|
27
51
|
virtual void exitRule(ParseTreeListener *listener, ParseTree *r) const;
|
28
52
|
};
|
29
53
|
|
@@ -12,9 +12,14 @@ namespace tree {
|
|
12
12
|
|
13
13
|
class ANTLR4CPP_PUBLIC TerminalNode : public ParseTree {
|
14
14
|
public:
|
15
|
-
|
15
|
+
static bool is(const tree::ParseTree &parseTree) {
|
16
|
+
const auto treeType = parseTree.getTreeType();
|
17
|
+
return treeType == ParseTreeType::TERMINAL || treeType == ParseTreeType::ERROR;
|
18
|
+
}
|
16
19
|
|
17
|
-
|
20
|
+
static bool is(const tree::ParseTree *parseTree) { return parseTree != nullptr && is(*parseTree); }
|
21
|
+
|
22
|
+
virtual Token* getSymbol() const = 0;
|
18
23
|
|
19
24
|
/** Set the parent for this leaf node.
|
20
25
|
*
|
@@ -26,6 +31,9 @@ namespace tree {
|
|
26
31
|
* @since 4.7
|
27
32
|
*/
|
28
33
|
virtual void setParent(RuleContext *parent) = 0;
|
34
|
+
|
35
|
+
protected:
|
36
|
+
using ParseTree::ParseTree;
|
29
37
|
};
|
30
38
|
|
31
39
|
} // namespace tree
|
@@ -13,10 +13,7 @@
|
|
13
13
|
using namespace antlr4;
|
14
14
|
using namespace antlr4::tree;
|
15
15
|
|
16
|
-
TerminalNodeImpl::
|
17
|
-
}
|
18
|
-
|
19
|
-
Token* TerminalNodeImpl::getSymbol() {
|
16
|
+
Token* TerminalNodeImpl::getSymbol() const {
|
20
17
|
return symbol;
|
21
18
|
}
|
22
19
|
|
@@ -33,7 +30,7 @@ misc::Interval TerminalNodeImpl::getSourceInterval() {
|
|
33
30
|
return misc::Interval(tokenIndex, tokenIndex);
|
34
31
|
}
|
35
32
|
|
36
|
-
|
33
|
+
std::any TerminalNodeImpl::accept(ParseTreeVisitor *visitor) {
|
37
34
|
return visitor->visitTerminal(this);
|
38
35
|
}
|
39
36
|
|
@@ -10,23 +10,22 @@
|
|
10
10
|
namespace antlr4 {
|
11
11
|
namespace tree {
|
12
12
|
|
13
|
-
class ANTLR4CPP_PUBLIC TerminalNodeImpl : public
|
13
|
+
class ANTLR4CPP_PUBLIC TerminalNodeImpl : public TerminalNode {
|
14
14
|
public:
|
15
15
|
Token *symbol;
|
16
16
|
|
17
|
-
TerminalNodeImpl(Token *symbol)
|
17
|
+
explicit TerminalNodeImpl(Token *symbol) : TerminalNode(ParseTreeType::TERMINAL), symbol(symbol) {}
|
18
18
|
|
19
|
-
virtual Token* getSymbol() override;
|
19
|
+
virtual Token* getSymbol() const override;
|
20
20
|
virtual void setParent(RuleContext *parent) override;
|
21
21
|
virtual misc::Interval getSourceInterval() override;
|
22
22
|
|
23
|
-
virtual
|
23
|
+
virtual std::any accept(ParseTreeVisitor *visitor) override;
|
24
24
|
|
25
25
|
virtual std::string getText() override;
|
26
26
|
virtual std::string toStringTree(Parser *parser, bool pretty = false) override;
|
27
27
|
virtual std::string toString() override;
|
28
28
|
virtual std::string toStringTree(bool pretty = false) override;
|
29
|
-
|
30
29
|
};
|
31
30
|
|
32
31
|
} // namespace tree
|
@@ -192,7 +192,7 @@ std::vector<ParseTree *> Trees::getDescendants(ParseTree *t) {
|
|
192
192
|
std::size_t n = t->children.size();
|
193
193
|
for (size_t i = 0 ; i < n ; i++) {
|
194
194
|
auto descentants = getDescendants(t->children[i]);
|
195
|
-
for (auto entry: descentants) {
|
195
|
+
for (auto *entry: descentants) {
|
196
196
|
nodes.push_back(entry);
|
197
197
|
}
|
198
198
|
}
|
data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp
CHANGED
@@ -37,7 +37,7 @@ std::vector<ParseTreeMatch> ParseTreePattern::findAll(ParseTree *tree, const std
|
|
37
37
|
xpath::XPath finder(_matcher->getParser(), xpath);
|
38
38
|
std::vector<ParseTree *> subtrees = finder.evaluate(tree);
|
39
39
|
std::vector<ParseTreeMatch> matches;
|
40
|
-
for (auto t : subtrees) {
|
40
|
+
for (auto *t : subtrees) {
|
41
41
|
ParseTreeMatch aMatch = match(t);
|
42
42
|
if (aMatch.succeeded()) {
|
43
43
|
matches.push_back(aMatch);
|
@@ -21,7 +21,6 @@
|
|
21
21
|
#include "ANTLRInputStream.h"
|
22
22
|
#include "support/Arrays.h"
|
23
23
|
#include "Exceptions.h"
|
24
|
-
#include "support/StringUtils.h"
|
25
24
|
#include "support/CPPUtils.h"
|
26
25
|
|
27
26
|
#include "tree/pattern/ParseTreePatternMatcher.h"
|
@@ -109,7 +108,7 @@ ParseTreePattern ParseTreePatternMatcher::compile(const std::string &pattern, in
|
|
109
108
|
throw e;
|
110
109
|
#else
|
111
110
|
} catch (std::exception & /*e*/) {
|
112
|
-
std::throw_with_nested((
|
111
|
+
std::throw_with_nested(RuntimeException("Cannot invoke start rule")); // Wrap any other exception.
|
113
112
|
#endif
|
114
113
|
}
|
115
114
|
|
@@ -137,7 +137,7 @@ std::vector<ParseTree *> XPath::evaluate(ParseTree *t) {
|
|
137
137
|
|
138
138
|
while (i < elements.size()) {
|
139
139
|
std::vector<ParseTree *> next;
|
140
|
-
for (auto node : work) {
|
140
|
+
for (auto *node : work) {
|
141
141
|
if (!node->children.empty()) {
|
142
142
|
// only try to match next element if it has children
|
143
143
|
// e.g., //func/*/stat might have a token node for which
|
@@ -1,11 +1,125 @@
|
|
1
|
+
|
2
|
+
// Generated from XPathLexer.g4 by ANTLR 4.9.3
|
3
|
+
|
4
|
+
|
1
5
|
#include "XPathLexer.h"
|
2
6
|
|
3
7
|
|
4
8
|
using namespace antlr4;
|
5
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, 0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|
+
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
|
+
}
|
6
119
|
|
7
120
|
XPathLexer::XPathLexer(CharStream *input) : Lexer(input) {
|
8
|
-
|
121
|
+
XPathLexer::initialize();
|
122
|
+
_interpreter = new atn::LexerATNSimulator(this, *xpathLexerStaticData->atn, xpathLexerStaticData->decisionToDFA, xpathLexerStaticData->sharedContextCache);
|
9
123
|
}
|
10
124
|
|
11
125
|
XPathLexer::~XPathLexer() {
|
@@ -17,46 +131,41 @@ std::string XPathLexer::getGrammarFileName() const {
|
|
17
131
|
}
|
18
132
|
|
19
133
|
const std::vector<std::string>& XPathLexer::getRuleNames() const {
|
20
|
-
return
|
134
|
+
return xpathLexerStaticData->ruleNames;
|
21
135
|
}
|
22
136
|
|
23
137
|
const std::vector<std::string>& XPathLexer::getChannelNames() const {
|
24
|
-
return
|
138
|
+
return xpathLexerStaticData->channelNames;
|
25
139
|
}
|
26
140
|
|
27
141
|
const std::vector<std::string>& XPathLexer::getModeNames() const {
|
28
|
-
return
|
29
|
-
}
|
30
|
-
|
31
|
-
const std::vector<std::string>& XPathLexer::getTokenNames() const {
|
32
|
-
return _tokenNames;
|
142
|
+
return xpathLexerStaticData->modeNames;
|
33
143
|
}
|
34
144
|
|
35
|
-
dfa::Vocabulary& XPathLexer::getVocabulary() const {
|
36
|
-
return
|
145
|
+
const dfa::Vocabulary& XPathLexer::getVocabulary() const {
|
146
|
+
return xpathLexerStaticData->vocabulary;
|
37
147
|
}
|
38
148
|
|
39
|
-
|
40
|
-
return
|
149
|
+
antlr4::atn::SerializedATNView XPathLexer::getSerializedATN() const {
|
150
|
+
return xpathLexerStaticData->serializedATN;
|
41
151
|
}
|
42
152
|
|
43
153
|
const atn::ATN& XPathLexer::getATN() const {
|
44
|
-
return
|
154
|
+
return *xpathLexerStaticData->atn;
|
45
155
|
}
|
46
156
|
|
47
|
-
|
48
157
|
void XPathLexer::action(RuleContext *context, size_t ruleIndex, size_t actionIndex) {
|
49
158
|
switch (ruleIndex) {
|
50
|
-
case 4: IDAction(
|
159
|
+
case 4: IDAction(antlrcpp::downCast<antlr4::RuleContext *>(context), actionIndex); break;
|
51
160
|
|
52
161
|
default:
|
53
162
|
break;
|
54
163
|
}
|
55
164
|
}
|
56
165
|
|
57
|
-
void XPathLexer::IDAction(antlr4::RuleContext *
|
166
|
+
void XPathLexer::IDAction(antlr4::RuleContext *context, size_t actionIndex) {
|
58
167
|
switch (actionIndex) {
|
59
|
-
case 0:
|
168
|
+
case 0:
|
60
169
|
if (isupper(getText()[0]))
|
61
170
|
setType(TOKEN_REF);
|
62
171
|
else
|
@@ -68,106 +177,6 @@ void XPathLexer::IDAction(antlr4::RuleContext * /*context*/, size_t actionIndex)
|
|
68
177
|
}
|
69
178
|
}
|
70
179
|
|
71
|
-
|
72
|
-
|
73
|
-
// Static vars and initialization.
|
74
|
-
std::vector<dfa::DFA> XPathLexer::_decisionToDFA;
|
75
|
-
atn::PredictionContextCache XPathLexer::_sharedContextCache;
|
76
|
-
|
77
|
-
// We own the ATN which in turn owns the ATN states.
|
78
|
-
atn::ATN XPathLexer::_atn;
|
79
|
-
std::vector<uint16_t> XPathLexer::_serializedATN;
|
80
|
-
|
81
|
-
std::vector<std::string> XPathLexer::_ruleNames = {
|
82
|
-
"ANYWHERE", "ROOT", "WILDCARD", "BANG", "ID", "NameChar", "NameStartChar",
|
83
|
-
"STRING"
|
84
|
-
};
|
85
|
-
|
86
|
-
std::vector<std::string> XPathLexer::_channelNames = {
|
87
|
-
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
|
88
|
-
};
|
89
|
-
|
90
|
-
std::vector<std::string> XPathLexer::_modeNames = {
|
91
|
-
"DEFAULT_MODE"
|
92
|
-
};
|
93
|
-
|
94
|
-
std::vector<std::string> XPathLexer::_literalNames = {
|
95
|
-
"", "", "", "'//'", "'/'", "'*'", "'!'"
|
96
|
-
};
|
97
|
-
|
98
|
-
std::vector<std::string> XPathLexer::_symbolicNames = {
|
99
|
-
"", "TOKEN_REF", "RULE_REF", "ANYWHERE", "ROOT", "WILDCARD", "BANG", "ID",
|
100
|
-
"STRING"
|
101
|
-
};
|
102
|
-
|
103
|
-
dfa::Vocabulary XPathLexer::_vocabulary(_literalNames, _symbolicNames);
|
104
|
-
|
105
|
-
std::vector<std::string> XPathLexer::_tokenNames;
|
106
|
-
|
107
|
-
XPathLexer::Initializer::Initializer() {
|
108
|
-
// This code could be in a static initializer lambda, but VS doesn't allow access to private class members from there.
|
109
|
-
for (size_t i = 0; i < _symbolicNames.size(); ++i) {
|
110
|
-
std::string name = _vocabulary.getLiteralName(i);
|
111
|
-
if (name.empty()) {
|
112
|
-
name = _vocabulary.getSymbolicName(i);
|
113
|
-
}
|
114
|
-
|
115
|
-
if (name.empty()) {
|
116
|
-
_tokenNames.push_back("<INVALID>");
|
117
|
-
} else {
|
118
|
-
_tokenNames.push_back(name);
|
119
|
-
}
|
120
|
-
}
|
121
|
-
|
122
|
-
_serializedATN = {
|
123
|
-
0x3, 0x430, 0xd6d1, 0x8206, 0xad2d, 0x4417, 0xaef1, 0x8d80, 0xaadd,
|
124
|
-
0x2, 0xa, 0x34, 0x8, 0x1, 0x4, 0x2, 0x9, 0x2, 0x4, 0x3, 0x9, 0x3, 0x4,
|
125
|
-
0x4, 0x9, 0x4, 0x4, 0x5, 0x9, 0x5, 0x4, 0x6, 0x9, 0x6, 0x4, 0x7, 0x9,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0x25, 0x3, 0x2, 0x2, 0x2, 0x27, 0x26, 0x3, 0x2, 0x2, 0x2,
|
154
|
-
0x28, 0xe, 0x3, 0x2, 0x2, 0x2, 0x29, 0x2a, 0x9, 0x3, 0x2, 0x2, 0x2a,
|
155
|
-
0x10, 0x3, 0x2, 0x2, 0x2, 0x2b, 0x2f, 0x7, 0x29, 0x2, 0x2, 0x2c, 0x2e,
|
156
|
-
0xb, 0x2, 0x2, 0x2, 0x2d, 0x2c, 0x3, 0x2, 0x2, 0x2, 0x2e, 0x31, 0x3,
|
157
|
-
0x2, 0x2, 0x2, 0x2f, 0x30, 0x3, 0x2, 0x2, 0x2, 0x2f, 0x2d, 0x3, 0x2,
|
158
|
-
0x2, 0x2, 0x30, 0x32, 0x3, 0x2, 0x2, 0x2, 0x31, 0x2f, 0x3, 0x2, 0x2,
|
159
|
-
0x2, 0x32, 0x33, 0x7, 0x29, 0x2, 0x2, 0x33, 0x12, 0x3, 0x2, 0x2, 0x2,
|
160
|
-
0x6, 0x2, 0x20, 0x27, 0x2f, 0x3, 0x3, 0x6, 0x2,
|
161
|
-
};
|
162
|
-
|
163
|
-
atn::ATNDeserializer deserializer;
|
164
|
-
_atn = deserializer.deserialize(_serializedATN);
|
165
|
-
|
166
|
-
size_t count = _atn.getNumberOfDecisions();
|
167
|
-
_decisionToDFA.reserve(count);
|
168
|
-
for (size_t i = 0; i < count; i++) {
|
169
|
-
_decisionToDFA.emplace_back(_atn.getDecisionState(i), i);
|
170
|
-
}
|
180
|
+
void XPathLexer::initialize() {
|
181
|
+
std::call_once(xpathLexerOnceFlag, xpathLexerInitialize);
|
171
182
|
}
|
172
|
-
|
173
|
-
XPathLexer::Initializer XPathLexer::_init;
|
@@ -1,56 +1,47 @@
|
|
1
|
-
#pragma once
|
2
1
|
|
2
|
+
// Generated from XPathLexer.g4 by ANTLR 4.9.3
|
3
3
|
|
4
|
-
#
|
4
|
+
#pragma once
|
5
5
|
|
6
6
|
|
7
|
+
#include "antlr4-runtime.h"
|
7
8
|
|
8
9
|
|
9
10
|
class XPathLexer : public antlr4::Lexer {
|
10
11
|
public:
|
11
12
|
enum {
|
12
|
-
TOKEN_REF = 1, RULE_REF = 2, ANYWHERE = 3, ROOT = 4, WILDCARD = 5, BANG = 6,
|
13
|
+
TOKEN_REF = 1, RULE_REF = 2, ANYWHERE = 3, ROOT = 4, WILDCARD = 5, BANG = 6,
|
13
14
|
ID = 7, STRING = 8
|
14
15
|
};
|
15
16
|
|
16
|
-
XPathLexer(antlr4::CharStream *input);
|
17
|
-
|
17
|
+
explicit XPathLexer(antlr4::CharStream *input);
|
18
|
+
|
19
|
+
~XPathLexer() override;
|
18
20
|
|
19
21
|
virtual std::string getGrammarFileName() const override;
|
22
|
+
|
20
23
|
virtual const std::vector<std::string>& getRuleNames() const override;
|
21
24
|
|
22
25
|
virtual const std::vector<std::string>& getChannelNames() const override;
|
26
|
+
|
23
27
|
virtual const std::vector<std::string>& getModeNames() const override;
|
24
|
-
virtual const std::vector<std::string>& getTokenNames() const override; // deprecated, use vocabulary instead
|
25
|
-
virtual antlr4::dfa::Vocabulary& getVocabulary() const override;
|
26
28
|
|
27
|
-
virtual const
|
28
|
-
virtual const antlr4::atn::ATN& getATN() const override;
|
29
|
+
virtual const antlr4::dfa::Vocabulary& getVocabulary() const override;
|
29
30
|
|
30
|
-
virtual
|
31
|
-
private:
|
32
|
-
static std::vector<antlr4::dfa::DFA> _decisionToDFA;
|
33
|
-
static antlr4::atn::PredictionContextCache _sharedContextCache;
|
34
|
-
static std::vector<std::string> _ruleNames;
|
35
|
-
static std::vector<std::string> _tokenNames;
|
36
|
-
static std::vector<std::string> _channelNames;
|
37
|
-
static std::vector<std::string> _modeNames;
|
31
|
+
virtual antlr4::atn::SerializedATNView getSerializedATN() const override;
|
38
32
|
|
39
|
-
|
40
|
-
static std::vector<std::string> _symbolicNames;
|
41
|
-
static antlr4::dfa::Vocabulary _vocabulary;
|
42
|
-
static antlr4::atn::ATN _atn;
|
43
|
-
static std::vector<uint16_t> _serializedATN;
|
33
|
+
virtual const antlr4::atn::ATN& getATN() const override;
|
44
34
|
|
35
|
+
virtual void action(antlr4::RuleContext *context, size_t ruleIndex, size_t actionIndex) override;
|
45
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:
|
46
42
|
// Individual action functions triggered by action() above.
|
47
43
|
void IDAction(antlr4::RuleContext *context, size_t actionIndex);
|
48
44
|
|
49
45
|
// Individual semantic predicate functions triggered by sempred() above.
|
50
|
-
|
51
|
-
struct Initializer {
|
52
|
-
Initializer();
|
53
|
-
};
|
54
|
-
static Initializer _init;
|
55
46
|
};
|
56
47
|
|
data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp
CHANGED
@@ -18,7 +18,7 @@ XPathRuleElement::XPathRuleElement(const std::string &ruleName, size_t ruleIndex
|
|
18
18
|
std::vector<ParseTree *> XPathRuleElement::evaluate(ParseTree *t) {
|
19
19
|
// return all children of t that match nodeName
|
20
20
|
std::vector<ParseTree *> nodes;
|
21
|
-
for (auto c : t->children) {
|
21
|
+
for (auto *c : t->children) {
|
22
22
|
if (antlrcpp::is<ParserRuleContext *>(c)) {
|
23
23
|
ParserRuleContext *ctx = dynamic_cast<ParserRuleContext *>(c);
|
24
24
|
if ((ctx->getRuleIndex() == _ruleIndex && !_invert) || (ctx->getRuleIndex() != _ruleIndex && _invert)) {
|
data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp
CHANGED
@@ -21,7 +21,7 @@ XPathTokenElement::XPathTokenElement(const std::string &tokenName, size_t tokenT
|
|
21
21
|
std::vector<ParseTree *> XPathTokenElement::evaluate(ParseTree *t) {
|
22
22
|
// return all children of t that match nodeName
|
23
23
|
std::vector<ParseTree *> nodes;
|
24
|
-
for (auto c : t->children) {
|
24
|
+
for (auto *c : t->children) {
|
25
25
|
if (antlrcpp::is<TerminalNode *>(c)) {
|
26
26
|
TerminalNode *tnode = dynamic_cast<TerminalNode *>(c);
|
27
27
|
if ((tnode->getSymbol()->getType() == _tokenType && !_invert) || (tnode->getSymbol()->getType() != _tokenType && _invert)) {
|