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
@@ -26,6 +26,7 @@
|
|
26
26
|
#include "tree/ErrorNode.h"
|
27
27
|
|
28
28
|
#include "support/CPPUtils.h"
|
29
|
+
#include "support/Casts.h"
|
29
30
|
|
30
31
|
#include "ParserInterpreter.h"
|
31
32
|
|
@@ -35,19 +36,10 @@ using namespace antlr4::misc;
|
|
35
36
|
|
36
37
|
using namespace antlrcpp;
|
37
38
|
|
38
|
-
ParserInterpreter::ParserInterpreter(const std::string &grammarFileName, const std::vector<std::string>& tokenNames,
|
39
|
-
const std::vector<std::string>& ruleNames, const atn::ATN &atn, TokenStream *input)
|
40
|
-
: ParserInterpreter(grammarFileName, dfa::Vocabulary::fromTokenNames(tokenNames), ruleNames, atn, input) {
|
41
|
-
}
|
42
|
-
|
43
39
|
ParserInterpreter::ParserInterpreter(const std::string &grammarFileName, const dfa::Vocabulary &vocabulary,
|
44
40
|
const std::vector<std::string> &ruleNames, const atn::ATN &atn, TokenStream *input)
|
45
41
|
: Parser(input), _grammarFileName(grammarFileName), _atn(atn), _ruleNames(ruleNames), _vocabulary(vocabulary) {
|
46
42
|
|
47
|
-
for (size_t i = 0; i < atn.maxTokenType; ++i) {
|
48
|
-
_tokenNames.push_back(vocabulary.getDisplayName(i));
|
49
|
-
}
|
50
|
-
|
51
43
|
// init decision DFA
|
52
44
|
for (size_t i = 0; i < atn.getNumberOfDecisions(); ++i) {
|
53
45
|
atn::DecisionState *decisionState = atn.getDecisionState(i);
|
@@ -72,10 +64,6 @@ const atn::ATN& ParserInterpreter::getATN() const {
|
|
72
64
|
return _atn;
|
73
65
|
}
|
74
66
|
|
75
|
-
const std::vector<std::string>& ParserInterpreter::getTokenNames() const {
|
76
|
-
return _tokenNames;
|
77
|
-
}
|
78
|
-
|
79
67
|
const dfa::Vocabulary& ParserInterpreter::getVocabulary() const {
|
80
68
|
return _vocabulary;
|
81
69
|
}
|
@@ -102,7 +90,7 @@ ParserRuleContext* ParserInterpreter::parse(size_t startRuleIndex) {
|
|
102
90
|
while (true) {
|
103
91
|
atn::ATNState *p = getATNState();
|
104
92
|
switch (p->getStateType()) {
|
105
|
-
case atn::
|
93
|
+
case atn::ATNStateType::RULE_STOP :
|
106
94
|
// pop; return from rule
|
107
95
|
if (_ctx->isEmpty()) {
|
108
96
|
if (startRuleStartState->isLeftRecursiveRule) {
|
@@ -161,16 +149,16 @@ atn::ATNState* ParserInterpreter::getATNState() {
|
|
161
149
|
|
162
150
|
void ParserInterpreter::visitState(atn::ATNState *p) {
|
163
151
|
size_t predictedAlt = 1;
|
164
|
-
if (is
|
165
|
-
predictedAlt = visitDecisionState(
|
152
|
+
if (DecisionState::is(p)) {
|
153
|
+
predictedAlt = visitDecisionState(downCast<DecisionState*>(p));
|
166
154
|
}
|
167
155
|
|
168
|
-
atn::Transition *transition = p->transitions[predictedAlt - 1];
|
169
|
-
switch (transition->
|
170
|
-
case atn::
|
171
|
-
if (p->getStateType() ==
|
172
|
-
(
|
173
|
-
!is
|
156
|
+
const atn::Transition *transition = p->transitions[predictedAlt - 1].get();
|
157
|
+
switch (transition->getTransitionType()) {
|
158
|
+
case atn::TransitionType::EPSILON:
|
159
|
+
if (p->getStateType() == ATNStateType::STAR_LOOP_ENTRY &&
|
160
|
+
(downCast<StarLoopEntryState *>(p))->isPrecedenceDecision &&
|
161
|
+
!LoopEndState::is(transition->target)) {
|
174
162
|
// We are at the start of a left recursive rule's (...)* loop
|
175
163
|
// and we're not taking the exit branch of loop.
|
176
164
|
InterpreterRuleContext *localctx = createInterpreterRuleContext(_parentContextStack.top().first,
|
@@ -179,56 +167,56 @@ void ParserInterpreter::visitState(atn::ATNState *p) {
|
|
179
167
|
}
|
180
168
|
break;
|
181
169
|
|
182
|
-
case atn::
|
183
|
-
match(static_cast<int>(static_cast<atn::AtomTransition*>(transition)->_label));
|
170
|
+
case atn::TransitionType::ATOM:
|
171
|
+
match(static_cast<int>(static_cast<const atn::AtomTransition*>(transition)->_label));
|
184
172
|
break;
|
185
173
|
|
186
|
-
case atn::
|
187
|
-
case atn::
|
188
|
-
case atn::
|
174
|
+
case atn::TransitionType::RANGE:
|
175
|
+
case atn::TransitionType::SET:
|
176
|
+
case atn::TransitionType::NOT_SET:
|
189
177
|
if (!transition->matches(static_cast<int>(_input->LA(1)), Token::MIN_USER_TOKEN_TYPE, Lexer::MAX_CHAR_VALUE)) {
|
190
178
|
recoverInline();
|
191
179
|
}
|
192
180
|
matchWildcard();
|
193
181
|
break;
|
194
182
|
|
195
|
-
case atn::
|
183
|
+
case atn::TransitionType::WILDCARD:
|
196
184
|
matchWildcard();
|
197
185
|
break;
|
198
186
|
|
199
|
-
case atn::
|
187
|
+
case atn::TransitionType::RULE:
|
200
188
|
{
|
201
189
|
atn::RuleStartState *ruleStartState = static_cast<atn::RuleStartState*>(transition->target);
|
202
190
|
size_t ruleIndex = ruleStartState->ruleIndex;
|
203
191
|
InterpreterRuleContext *newctx = createInterpreterRuleContext(_ctx, p->stateNumber, ruleIndex);
|
204
192
|
if (ruleStartState->isLeftRecursiveRule) {
|
205
|
-
enterRecursionRule(newctx, ruleStartState->stateNumber, ruleIndex, static_cast<atn::RuleTransition*>(transition)->precedence);
|
193
|
+
enterRecursionRule(newctx, ruleStartState->stateNumber, ruleIndex, static_cast<const atn::RuleTransition*>(transition)->precedence);
|
206
194
|
} else {
|
207
195
|
enterRule(newctx, transition->target->stateNumber, ruleIndex);
|
208
196
|
}
|
209
197
|
}
|
210
198
|
break;
|
211
199
|
|
212
|
-
case atn::
|
200
|
+
case atn::TransitionType::PREDICATE:
|
213
201
|
{
|
214
|
-
atn::PredicateTransition *predicateTransition = static_cast<atn::PredicateTransition*>(transition);
|
215
|
-
if (!sempred(_ctx, predicateTransition->
|
202
|
+
const atn::PredicateTransition *predicateTransition = static_cast<const atn::PredicateTransition*>(transition);
|
203
|
+
if (!sempred(_ctx, predicateTransition->getRuleIndex(), predicateTransition->getPredIndex())) {
|
216
204
|
throw FailedPredicateException(this);
|
217
205
|
}
|
218
206
|
}
|
219
207
|
break;
|
220
208
|
|
221
|
-
case atn::
|
209
|
+
case atn::TransitionType::ACTION:
|
222
210
|
{
|
223
|
-
atn::ActionTransition *actionTransition = static_cast<atn::ActionTransition*>(transition);
|
211
|
+
const atn::ActionTransition *actionTransition = static_cast<const atn::ActionTransition*>(transition);
|
224
212
|
action(_ctx, actionTransition->ruleIndex, actionTransition->actionIndex);
|
225
213
|
}
|
226
214
|
break;
|
227
215
|
|
228
|
-
case atn::
|
216
|
+
case atn::TransitionType::PRECEDENCE:
|
229
217
|
{
|
230
|
-
if (!precpred(_ctx, static_cast<atn::PrecedencePredicateTransition*>(transition)->
|
231
|
-
throw FailedPredicateException(this, "precpred(_ctx, " + std::to_string(static_cast<atn::PrecedencePredicateTransition*>(transition)->
|
218
|
+
if (!precpred(_ctx, static_cast<const atn::PrecedencePredicateTransition*>(transition)->getPrecedence())) {
|
219
|
+
throw FailedPredicateException(this, "precpred(_ctx, " + std::to_string(static_cast<const atn::PrecedencePredicateTransition*>(transition)->getPrecedence()) + ")");
|
232
220
|
}
|
233
221
|
}
|
234
222
|
break;
|
@@ -272,7 +260,7 @@ void ParserInterpreter::visitRuleStopState(atn::ATNState *p) {
|
|
272
260
|
exitRule();
|
273
261
|
}
|
274
262
|
|
275
|
-
atn::RuleTransition *ruleTransition = static_cast<atn::RuleTransition*>(_atn.states[getState()]->transitions[0]);
|
263
|
+
const atn::RuleTransition *ruleTransition = static_cast<const atn::RuleTransition*>(_atn.states[getState()]->transitions[0].get());
|
276
264
|
setState(ruleTransition->followState->stateNumber);
|
277
265
|
}
|
278
266
|
|
@@ -9,6 +9,7 @@
|
|
9
9
|
#include "atn/ATN.h"
|
10
10
|
#include "support/BitSet.h"
|
11
11
|
#include "atn/PredictionContext.h"
|
12
|
+
#include "atn/PredictionContextCache.h"
|
12
13
|
#include "Vocabulary.h"
|
13
14
|
|
14
15
|
namespace antlr4 {
|
@@ -29,9 +30,6 @@ namespace antlr4 {
|
|
29
30
|
/// </summary>
|
30
31
|
class ANTLR4CPP_PUBLIC ParserInterpreter : public Parser {
|
31
32
|
public:
|
32
|
-
// @deprecated
|
33
|
-
ParserInterpreter(const std::string &grammarFileName, const std::vector<std::string>& tokenNames,
|
34
|
-
const std::vector<std::string>& ruleNames, const atn::ATN &atn, TokenStream *input);
|
35
33
|
ParserInterpreter(const std::string &grammarFileName, const dfa::Vocabulary &vocabulary,
|
36
34
|
const std::vector<std::string> &ruleNames, const atn::ATN &atn, TokenStream *input);
|
37
35
|
~ParserInterpreter();
|
@@ -40,9 +38,6 @@ namespace antlr4 {
|
|
40
38
|
|
41
39
|
virtual const atn::ATN& getATN() const override;
|
42
40
|
|
43
|
-
// @deprecated
|
44
|
-
virtual const std::vector<std::string>& getTokenNames() const override;
|
45
|
-
|
46
41
|
virtual const dfa::Vocabulary& getVocabulary() const override;
|
47
42
|
|
48
43
|
virtual const std::vector<std::string>& getRuleNames() const override;
|
@@ -110,7 +105,6 @@ namespace antlr4 {
|
|
110
105
|
|
111
106
|
protected:
|
112
107
|
const std::string _grammarFileName;
|
113
|
-
std::vector<std::string> _tokenNames;
|
114
108
|
const atn::ATN &_atn;
|
115
109
|
|
116
110
|
std::vector<std::string> _ruleNames;
|
@@ -9,6 +9,7 @@
|
|
9
9
|
#include "Parser.h"
|
10
10
|
#include "Token.h"
|
11
11
|
|
12
|
+
#include "support/Casts.h"
|
12
13
|
#include "support/CPPUtils.h"
|
13
14
|
|
14
15
|
#include "ParserRuleContext.h"
|
@@ -38,11 +39,10 @@ void ParserRuleContext::copyFrom(ParserRuleContext *ctx) {
|
|
38
39
|
|
39
40
|
// copy any error nodes to alt label node
|
40
41
|
if (!ctx->children.empty()) {
|
41
|
-
for (auto child : ctx->children) {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
children.push_back(errorNode);
|
42
|
+
for (auto *child : ctx->children) {
|
43
|
+
if (ErrorNode::is(child)) {
|
44
|
+
downCast<ErrorNode*>(child)->setParent(this);
|
45
|
+
children.push_back(child);
|
46
46
|
}
|
47
47
|
}
|
48
48
|
|
@@ -76,39 +76,36 @@ void ParserRuleContext::removeLastChild() {
|
|
76
76
|
}
|
77
77
|
}
|
78
78
|
|
79
|
-
tree::TerminalNode* ParserRuleContext::getToken(size_t ttype, size_t i) {
|
79
|
+
tree::TerminalNode* ParserRuleContext::getToken(size_t ttype, size_t i) const {
|
80
80
|
if (i >= children.size()) {
|
81
81
|
return nullptr;
|
82
82
|
}
|
83
|
-
|
84
83
|
size_t j = 0; // what token with ttype have we found?
|
85
|
-
for (auto
|
86
|
-
if (is
|
87
|
-
tree::TerminalNode *
|
88
|
-
Token *symbol =
|
84
|
+
for (auto *child : children) {
|
85
|
+
if (TerminalNode::is(child)) {
|
86
|
+
tree::TerminalNode *typedChild = downCast<tree::TerminalNode*>(child);
|
87
|
+
Token *symbol = typedChild->getSymbol();
|
89
88
|
if (symbol->getType() == ttype) {
|
90
89
|
if (j++ == i) {
|
91
|
-
return
|
90
|
+
return typedChild;
|
92
91
|
}
|
93
92
|
}
|
94
93
|
}
|
95
94
|
}
|
96
|
-
|
97
95
|
return nullptr;
|
98
96
|
}
|
99
97
|
|
100
|
-
std::vector<tree::TerminalNode *> ParserRuleContext::getTokens(size_t ttype) {
|
101
|
-
std::vector<tree::TerminalNode
|
102
|
-
for (auto
|
103
|
-
if (is
|
104
|
-
tree::TerminalNode *
|
105
|
-
Token *symbol =
|
98
|
+
std::vector<tree::TerminalNode *> ParserRuleContext::getTokens(size_t ttype) const {
|
99
|
+
std::vector<tree::TerminalNode*> tokens;
|
100
|
+
for (auto *child : children) {
|
101
|
+
if (TerminalNode::is(child)) {
|
102
|
+
tree::TerminalNode *typedChild = downCast<tree::TerminalNode*>(child);
|
103
|
+
Token *symbol = typedChild->getSymbol();
|
106
104
|
if (symbol->getType() == ttype) {
|
107
|
-
tokens.push_back(
|
105
|
+
tokens.push_back(typedChild);
|
108
106
|
}
|
109
107
|
}
|
110
108
|
}
|
111
|
-
|
112
109
|
return tokens;
|
113
110
|
}
|
114
111
|
|
@@ -123,11 +120,11 @@ misc::Interval ParserRuleContext::getSourceInterval() {
|
|
123
120
|
return misc::Interval(start->getTokenIndex(), stop->getTokenIndex());
|
124
121
|
}
|
125
122
|
|
126
|
-
Token* ParserRuleContext::getStart() {
|
123
|
+
Token* ParserRuleContext::getStart() const {
|
127
124
|
return start;
|
128
125
|
}
|
129
126
|
|
130
|
-
Token* ParserRuleContext::getStop() {
|
127
|
+
Token* ParserRuleContext::getStop() const {
|
131
128
|
return stop;
|
132
129
|
}
|
133
130
|
|
@@ -67,7 +67,6 @@ namespace antlr4 {
|
|
67
67
|
|
68
68
|
ParserRuleContext();
|
69
69
|
ParserRuleContext(ParserRuleContext *parent, size_t invokingStateNumber);
|
70
|
-
virtual ~ParserRuleContext() {}
|
71
70
|
|
72
71
|
/** COPY a ctx (I'm deliberately not using copy constructor) to avoid
|
73
72
|
* confusion with creating node with parent. Does not copy children
|
@@ -88,23 +87,22 @@ namespace antlr4 {
|
|
88
87
|
/// Used by enterOuterAlt to toss out a RuleContext previously added as
|
89
88
|
/// we entered a rule. If we have # label, we will need to remove
|
90
89
|
/// generic ruleContext object.
|
91
|
-
|
90
|
+
void removeLastChild();
|
92
91
|
|
93
|
-
|
92
|
+
tree::TerminalNode* getToken(size_t ttype, std::size_t i) const;
|
94
93
|
|
95
|
-
|
94
|
+
std::vector<tree::TerminalNode*> getTokens(size_t ttype) const;
|
96
95
|
|
97
96
|
template<typename T>
|
98
|
-
T* getRuleContext(size_t i) {
|
99
|
-
|
100
|
-
return nullptr;
|
101
|
-
}
|
102
|
-
|
97
|
+
T* getRuleContext(size_t i) const {
|
98
|
+
static_assert(std::is_base_of_v<RuleContext, T>, "T must be derived from RuleContext");
|
103
99
|
size_t j = 0; // what element have we found with ctxType?
|
104
|
-
for (auto
|
105
|
-
if (
|
106
|
-
if (
|
107
|
-
|
100
|
+
for (auto *child : children) {
|
101
|
+
if (RuleContext::is(child)) {
|
102
|
+
if (auto *typedChild = dynamic_cast<T*>(child); typedChild != nullptr) {
|
103
|
+
if (j++ == i) {
|
104
|
+
return typedChild;
|
105
|
+
}
|
108
106
|
}
|
109
107
|
}
|
110
108
|
}
|
@@ -112,14 +110,16 @@ namespace antlr4 {
|
|
112
110
|
}
|
113
111
|
|
114
112
|
template<typename T>
|
115
|
-
std::vector<T
|
116
|
-
std::
|
117
|
-
|
118
|
-
|
119
|
-
|
113
|
+
std::vector<T*> getRuleContexts() const {
|
114
|
+
static_assert(std::is_base_of_v<RuleContext, T>, "T must be derived from RuleContext");
|
115
|
+
std::vector<T*> contexts;
|
116
|
+
for (auto *child : children) {
|
117
|
+
if (RuleContext::is(child)) {
|
118
|
+
if (auto *typedChild = dynamic_cast<T*>(child); typedChild != nullptr) {
|
119
|
+
contexts.push_back(typedChild);
|
120
|
+
}
|
120
121
|
}
|
121
122
|
}
|
122
|
-
|
123
123
|
return contexts;
|
124
124
|
}
|
125
125
|
|
@@ -130,14 +130,14 @@ namespace antlr4 {
|
|
130
130
|
* Note that the range from start to stop is inclusive, so for rules that do not consume anything
|
131
131
|
* (for example, zero length or error productions) this token may exceed stop.
|
132
132
|
*/
|
133
|
-
|
133
|
+
Token* getStart() const;
|
134
134
|
|
135
135
|
/**
|
136
136
|
* Get the final token in this context.
|
137
137
|
* Note that the range from start to stop is inclusive, so for rules that do not consume anything
|
138
138
|
* (for example, zero length or error productions) this token may precede start.
|
139
139
|
*/
|
140
|
-
|
140
|
+
Token* getStop() const;
|
141
141
|
|
142
142
|
/// <summary>
|
143
143
|
/// Used for rule context info debugging during parse-time, not so much for ATN debugging </summary>
|
@@ -26,28 +26,28 @@ void ProxyErrorListener::removeErrorListeners() {
|
|
26
26
|
void ProxyErrorListener::syntaxError(Recognizer *recognizer, Token *offendingSymbol, size_t line,
|
27
27
|
size_t charPositionInLine, const std::string &msg, std::exception_ptr e) {
|
28
28
|
|
29
|
-
for (auto listener : _delegates) {
|
29
|
+
for (auto *listener : _delegates) {
|
30
30
|
listener->syntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, e);
|
31
31
|
}
|
32
32
|
}
|
33
33
|
|
34
34
|
void ProxyErrorListener::reportAmbiguity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex,
|
35
35
|
bool exact, const antlrcpp::BitSet &ambigAlts, atn::ATNConfigSet *configs) {
|
36
|
-
for (auto listener : _delegates) {
|
36
|
+
for (auto *listener : _delegates) {
|
37
37
|
listener->reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
|
38
38
|
}
|
39
39
|
}
|
40
40
|
|
41
41
|
void ProxyErrorListener::reportAttemptingFullContext(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex,
|
42
42
|
size_t stopIndex, const antlrcpp::BitSet &conflictingAlts, atn::ATNConfigSet *configs) {
|
43
|
-
for (auto listener : _delegates) {
|
43
|
+
for (auto *listener : _delegates) {
|
44
44
|
listener->reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs);
|
45
45
|
}
|
46
46
|
}
|
47
47
|
|
48
48
|
void ProxyErrorListener::reportContextSensitivity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex,
|
49
49
|
size_t prediction, atn::ATNConfigSet *configs) {
|
50
|
-
for (auto listener : _delegates) {
|
50
|
+
for (auto *listener : _delegates) {
|
51
51
|
listener->reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs);
|
52
52
|
}
|
53
53
|
}
|
@@ -6,11 +6,11 @@
|
|
6
6
|
#include "ConsoleErrorListener.h"
|
7
7
|
#include "RecognitionException.h"
|
8
8
|
#include "support/CPPUtils.h"
|
9
|
-
#include "support/StringUtils.h"
|
10
9
|
#include "Token.h"
|
11
10
|
#include "atn/ATN.h"
|
12
11
|
#include "atn/ATNSimulator.h"
|
13
12
|
#include "support/CPPUtils.h"
|
13
|
+
#include "support/StringUtils.h"
|
14
14
|
|
15
15
|
#include "Vocabulary.h"
|
16
16
|
|
@@ -19,7 +19,7 @@
|
|
19
19
|
using namespace antlr4;
|
20
20
|
using namespace antlr4::atn;
|
21
21
|
|
22
|
-
std::map<const dfa::Vocabulary*, std::map<std::
|
22
|
+
std::map<const dfa::Vocabulary*, std::map<std::string_view, size_t>> Recognizer::_tokenTypeMapCache;
|
23
23
|
std::map<std::vector<std::string>, std::map<std::string, size_t>> Recognizer::_ruleIndexMapCache;
|
24
24
|
|
25
25
|
Recognizer::Recognizer() {
|
@@ -30,31 +30,26 @@ Recognizer::Recognizer() {
|
|
30
30
|
Recognizer::~Recognizer() {
|
31
31
|
}
|
32
32
|
|
33
|
-
|
34
|
-
static dfa::Vocabulary vocabulary = dfa::Vocabulary::fromTokenNames(getTokenNames());
|
35
|
-
return vocabulary;
|
36
|
-
}
|
37
|
-
|
38
|
-
std::map<std::string, size_t> Recognizer::getTokenTypeMap() {
|
33
|
+
std::map<std::string_view, size_t> Recognizer::getTokenTypeMap() {
|
39
34
|
const dfa::Vocabulary& vocabulary = getVocabulary();
|
40
35
|
|
41
36
|
std::lock_guard<std::mutex> lck(_mutex);
|
42
|
-
std::map<std::
|
37
|
+
std::map<std::string_view, size_t> result;
|
43
38
|
auto iterator = _tokenTypeMapCache.find(&vocabulary);
|
44
39
|
if (iterator != _tokenTypeMapCache.end()) {
|
45
40
|
result = iterator->second;
|
46
41
|
} else {
|
47
42
|
for (size_t i = 0; i <= getATN().maxTokenType; ++i) {
|
48
|
-
std::
|
43
|
+
std::string_view literalName = vocabulary.getLiteralName(i);
|
49
44
|
if (!literalName.empty()) {
|
50
45
|
result[literalName] = i;
|
51
46
|
}
|
52
47
|
|
53
|
-
std::
|
48
|
+
std::string_view symbolicName = vocabulary.getSymbolicName(i);
|
54
49
|
if (!symbolicName.empty()) {
|
55
50
|
result[symbolicName] = i;
|
56
51
|
}
|
57
|
-
|
52
|
+
}
|
58
53
|
result["EOF"] = EOF;
|
59
54
|
_tokenTypeMapCache[&vocabulary] = result;
|
60
55
|
}
|
@@ -80,8 +75,8 @@ std::map<std::string, size_t> Recognizer::getRuleIndexMap() {
|
|
80
75
|
return result;
|
81
76
|
}
|
82
77
|
|
83
|
-
size_t Recognizer::getTokenType(
|
84
|
-
const std::map<std::
|
78
|
+
size_t Recognizer::getTokenType(std::string_view tokenName) {
|
79
|
+
const std::map<std::string_view, size_t> &map = getTokenTypeMap();
|
85
80
|
auto iterator = map.find(tokenName);
|
86
81
|
if (iterator == map.end())
|
87
82
|
return Token::INVALID_TYPE;
|
@@ -118,11 +113,13 @@ std::string Recognizer::getTokenErrorDisplay(Token *t) {
|
|
118
113
|
}
|
119
114
|
}
|
120
115
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
116
|
+
std::string result;
|
117
|
+
result.reserve(s.size() + 2);
|
118
|
+
result.push_back('\'');
|
119
|
+
antlrcpp::escapeWhitespace(result, s);
|
120
|
+
result.push_back('\'');
|
121
|
+
result.shrink_to_fit();
|
122
|
+
return result;
|
126
123
|
}
|
127
124
|
|
128
125
|
void Recognizer::addErrorListener(ANTLRErrorListener *listener) {
|
@@ -152,14 +149,6 @@ bool Recognizer::precpred(RuleContext * /*localctx*/, int /*precedence*/) {
|
|
152
149
|
void Recognizer::action(RuleContext * /*localctx*/, size_t /*ruleIndex*/, size_t /*actionIndex*/) {
|
153
150
|
}
|
154
151
|
|
155
|
-
size_t Recognizer::getState() const {
|
156
|
-
return _stateNumber;
|
157
|
-
}
|
158
|
-
|
159
|
-
void Recognizer::setState(size_t atnState) {
|
160
|
-
_stateNumber = atnState;
|
161
|
-
}
|
162
|
-
|
163
152
|
void Recognizer::InitializeInstanceFields() {
|
164
153
|
_stateNumber = ATNState::INVALID_STATE_NUMBER;
|
165
154
|
_interpreter = nullptr;
|
@@ -6,12 +6,14 @@
|
|
6
6
|
#pragma once
|
7
7
|
|
8
8
|
#include "ProxyErrorListener.h"
|
9
|
+
#include "support/Casts.h"
|
10
|
+
#include "atn/SerializedATNView.h"
|
9
11
|
|
10
12
|
namespace antlr4 {
|
11
13
|
|
12
14
|
class ANTLR4CPP_PUBLIC Recognizer {
|
13
15
|
public:
|
14
|
-
static
|
16
|
+
static constexpr size_t EOF = std::numeric_limits<size_t>::max();
|
15
17
|
|
16
18
|
Recognizer();
|
17
19
|
Recognizer(Recognizer const&) = delete;
|
@@ -19,13 +21,6 @@ namespace antlr4 {
|
|
19
21
|
|
20
22
|
Recognizer& operator=(Recognizer const&) = delete;
|
21
23
|
|
22
|
-
/** Used to print out token names like ID during debugging and
|
23
|
-
* error reporting. The generated parsers implement a method
|
24
|
-
* that overrides this to point to their String[] tokenNames.
|
25
|
-
*
|
26
|
-
* @deprecated Use {@link #getVocabulary()} instead.
|
27
|
-
*/
|
28
|
-
virtual std::vector<std::string> const& getTokenNames() const = 0;
|
29
24
|
virtual std::vector<std::string> const& getRuleNames() const = 0;
|
30
25
|
|
31
26
|
/**
|
@@ -34,14 +29,14 @@ namespace antlr4 {
|
|
34
29
|
* @return A {@link Vocabulary} instance providing information about the
|
35
30
|
* vocabulary used by the grammar.
|
36
31
|
*/
|
37
|
-
virtual dfa::Vocabulary const& getVocabulary() const;
|
32
|
+
virtual dfa::Vocabulary const& getVocabulary() const = 0;
|
38
33
|
|
39
34
|
/// <summary>
|
40
35
|
/// Get a map from token names to token types.
|
41
36
|
/// <p/>
|
42
37
|
/// Used for XPath and tree pattern compilation.
|
43
38
|
/// </summary>
|
44
|
-
virtual std::map<std::
|
39
|
+
virtual std::map<std::string_view, size_t> getTokenTypeMap();
|
45
40
|
|
46
41
|
/// <summary>
|
47
42
|
/// Get a map from rule names to rule indexes.
|
@@ -50,7 +45,7 @@ namespace antlr4 {
|
|
50
45
|
/// </summary>
|
51
46
|
virtual std::map<std::string, size_t> getRuleIndexMap();
|
52
47
|
|
53
|
-
virtual size_t getTokenType(
|
48
|
+
virtual size_t getTokenType(std::string_view tokenName);
|
54
49
|
|
55
50
|
/// <summary>
|
56
51
|
/// If this recognizer was generated, it will have a serialized ATN
|
@@ -59,7 +54,7 @@ namespace antlr4 {
|
|
59
54
|
/// For interpreters, we don't know their serialized ATN despite having
|
60
55
|
/// created the interpreter from it.
|
61
56
|
/// </summary>
|
62
|
-
virtual
|
57
|
+
virtual atn::SerializedATNView getSerializedATN() const {
|
63
58
|
throw "there is no serialized ATN";
|
64
59
|
}
|
65
60
|
|
@@ -73,7 +68,7 @@ namespace antlr4 {
|
|
73
68
|
/// @returns The ATN interpreter used by the recognizer for prediction.
|
74
69
|
template <class T>
|
75
70
|
T* getInterpreter() const {
|
76
|
-
return
|
71
|
+
return antlrcpp::downCast<T *>(_interpreter);
|
77
72
|
}
|
78
73
|
|
79
74
|
/**
|
@@ -119,7 +114,7 @@ namespace antlr4 {
|
|
119
114
|
|
120
115
|
virtual void action(RuleContext *localctx, size_t ruleIndex, size_t actionIndex);
|
121
116
|
|
122
|
-
|
117
|
+
size_t getState() const { return _stateNumber; }
|
123
118
|
|
124
119
|
// Get the ATN used by the recognizer for prediction.
|
125
120
|
virtual const atn::ATN& getATN() const = 0;
|
@@ -132,13 +127,13 @@ namespace antlr4 {
|
|
132
127
|
/// invoking rules. Combine this and we have complete ATN
|
133
128
|
/// configuration information.
|
134
129
|
/// </summary>
|
135
|
-
void setState(size_t atnState);
|
130
|
+
void setState(size_t atnState) { _stateNumber = atnState; }
|
136
131
|
|
137
132
|
virtual IntStream* getInputStream() = 0;
|
138
133
|
|
139
134
|
virtual void setInputStream(IntStream *input) = 0;
|
140
135
|
|
141
|
-
virtual
|
136
|
+
virtual TokenFactory<CommonToken>* getTokenFactory() = 0;
|
142
137
|
|
143
138
|
template<typename T1>
|
144
139
|
void setTokenFactory(TokenFactory<T1> *input);
|
@@ -150,7 +145,7 @@ namespace antlr4 {
|
|
150
145
|
std::mutex _mutex;
|
151
146
|
|
152
147
|
private:
|
153
|
-
static std::map<const dfa::Vocabulary*, std::map<std::
|
148
|
+
static std::map<const dfa::Vocabulary*, std::map<std::string_view, size_t>> _tokenTypeMapCache;
|
154
149
|
static std::map<std::vector<std::string>, std::map<std::string, size_t>> _ruleIndexMapCache;
|
155
150
|
|
156
151
|
ProxyErrorListener _proxListener; // Manages a collection of listeners.
|
@@ -14,12 +14,13 @@
|
|
14
14
|
|
15
15
|
using namespace antlr4;
|
16
16
|
using namespace antlr4::atn;
|
17
|
+
using namespace antlr4::tree;
|
17
18
|
|
18
|
-
RuleContext::RuleContext() {
|
19
|
+
RuleContext::RuleContext() : ParseTree(ParseTreeType::RULE) {
|
19
20
|
InitializeInstanceFields();
|
20
21
|
}
|
21
22
|
|
22
|
-
RuleContext::RuleContext(RuleContext *parent_, size_t invokingState_) {
|
23
|
+
RuleContext::RuleContext(RuleContext *parent_, size_t invokingState_) : ParseTree(ParseTreeType::RULE) {
|
23
24
|
InitializeInstanceFields();
|
24
25
|
this->parent = parent_;
|
25
26
|
this->invokingState = invokingState_;
|
@@ -71,7 +72,7 @@ size_t RuleContext::getAltNumber() const {
|
|
71
72
|
void RuleContext::setAltNumber(size_t /*altNumber*/) {
|
72
73
|
}
|
73
74
|
|
74
|
-
|
75
|
+
std::any RuleContext::accept(tree::ParseTreeVisitor *visitor) {
|
75
76
|
return visitor->visitChildren(this);
|
76
77
|
}
|
77
78
|
|
@@ -61,6 +61,10 @@ namespace antlr4 {
|
|
61
61
|
*/
|
62
62
|
class ANTLR4CPP_PUBLIC RuleContext : public tree::ParseTree {
|
63
63
|
public:
|
64
|
+
static bool is(const tree::ParseTree &parseTree) { return parseTree.getTreeType() == tree::ParseTreeType::RULE; }
|
65
|
+
|
66
|
+
static bool is(const tree::ParseTree *parseTree) { return parseTree != nullptr && is(*parseTree); }
|
67
|
+
|
64
68
|
/// What state invoked the rule associated with this context?
|
65
69
|
/// The "return address" is the followState of invokingState
|
66
70
|
/// If parent is null, this should be -1 and this context object represents the start rule.
|
@@ -103,7 +107,7 @@ namespace antlr4 {
|
|
103
107
|
*/
|
104
108
|
virtual void setAltNumber(size_t altNumber);
|
105
109
|
|
106
|
-
virtual
|
110
|
+
virtual std::any accept(tree::ParseTreeVisitor *visitor) override;
|
107
111
|
|
108
112
|
/// <summary>
|
109
113
|
/// Print out a whole tree, not just a node, in LISP format
|