expressir 1.2.3 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +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
@@ -5,80 +5,27 @@
|
|
5
5
|
|
6
6
|
#pragma once
|
7
7
|
|
8
|
-
#include "atn/LexerAction.h"
|
9
8
|
#include "atn/ATNDeserializationOptions.h"
|
9
|
+
#include "atn/SerializedATNView.h"
|
10
|
+
#include "atn/LexerAction.h"
|
11
|
+
#include "atn/Transition.h"
|
10
12
|
|
11
13
|
namespace antlr4 {
|
12
14
|
namespace atn {
|
13
15
|
|
14
|
-
class ANTLR4CPP_PUBLIC ATNDeserializer {
|
16
|
+
class ANTLR4CPP_PUBLIC ATNDeserializer final {
|
15
17
|
public:
|
16
|
-
static
|
17
|
-
|
18
|
-
/// This is the current serialized UUID.
|
19
|
-
// ml: defined as function to avoid the “static initialization order fiasco”.
|
20
|
-
static Guid SERIALIZED_UUID();
|
18
|
+
static constexpr size_t SERIALIZED_VERSION = 4;
|
21
19
|
|
22
20
|
ATNDeserializer();
|
23
|
-
ATNDeserializer(const ATNDeserializationOptions& dso);
|
24
|
-
virtual ~ATNDeserializer();
|
25
|
-
|
26
|
-
static Guid toUUID(const unsigned short *data, size_t offset);
|
27
|
-
|
28
|
-
virtual ATN deserialize(const std::vector<uint16_t> &input);
|
29
|
-
virtual void verifyATN(const ATN &atn);
|
30
|
-
|
31
|
-
static void checkCondition(bool condition);
|
32
|
-
static void checkCondition(bool condition, const std::string &message);
|
33
21
|
|
34
|
-
|
35
|
-
size_t arg3, const std::vector<misc::IntervalSet> &sets);
|
22
|
+
explicit ATNDeserializer(ATNDeserializationOptions deserializationOptions);
|
36
23
|
|
37
|
-
|
38
|
-
|
39
|
-
protected:
|
40
|
-
/// Determines if a particular serialized representation of an ATN supports
|
41
|
-
/// a particular feature, identified by the <seealso cref="UUID"/> used for serializing
|
42
|
-
/// the ATN at the time the feature was first introduced.
|
43
|
-
///
|
44
|
-
/// <param name="feature"> The <seealso cref="UUID"/> marking the first time the feature was
|
45
|
-
/// supported in the serialized ATN. </param>
|
46
|
-
/// <param name="actualUuid"> The <seealso cref="UUID"/> of the actual serialized ATN which is
|
47
|
-
/// currently being deserialized. </param>
|
48
|
-
/// <returns> {@code true} if the {@code actualUuid} value represents a
|
49
|
-
/// serialized ATN at or after the feature identified by {@code feature} was
|
50
|
-
/// introduced; otherwise, {@code false}. </returns>
|
51
|
-
virtual bool isFeatureSupported(const Guid &feature, const Guid &actualUuid);
|
52
|
-
void markPrecedenceDecisions(const ATN &atn);
|
53
|
-
Ref<LexerAction> lexerActionFactory(LexerActionType type, int data1, int data2);
|
24
|
+
std::unique_ptr<ATN> deserialize(SerializedATNView input) const;
|
25
|
+
void verifyATN(const ATN &atn) const;
|
54
26
|
|
55
27
|
private:
|
56
|
-
|
57
|
-
static Guid BASE_SERIALIZED_UUID();
|
58
|
-
|
59
|
-
/// This UUID indicates an extension of <seealso cref="BASE_SERIALIZED_UUID"/> for the
|
60
|
-
/// addition of precedence predicates.
|
61
|
-
static Guid ADDED_PRECEDENCE_TRANSITIONS();
|
62
|
-
|
63
|
-
/**
|
64
|
-
* This UUID indicates an extension of ADDED_PRECEDENCE_TRANSITIONS
|
65
|
-
* for the addition of lexer actions encoded as a sequence of
|
66
|
-
* LexerAction instances.
|
67
|
-
*/
|
68
|
-
static Guid ADDED_LEXER_ACTIONS();
|
69
|
-
|
70
|
-
/**
|
71
|
-
* This UUID indicates the serialized ATN contains two sets of
|
72
|
-
* IntervalSets, where the second set's values are encoded as
|
73
|
-
* 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
|
74
|
-
*/
|
75
|
-
static Guid ADDED_UNICODE_SMP();
|
76
|
-
|
77
|
-
/// This list contains all of the currently supported UUIDs, ordered by when
|
78
|
-
/// the feature first appeared in this branch.
|
79
|
-
static std::vector<Guid>& SUPPORTED_UUIDS();
|
80
|
-
|
81
|
-
ATNDeserializationOptions deserializationOptions;
|
28
|
+
const ATNDeserializationOptions _deserializationOptions;
|
82
29
|
};
|
83
30
|
|
84
31
|
} // namespace atn
|
@@ -3,61 +3,31 @@
|
|
3
3
|
* can be found in the LICENSE.txt file in the project root.
|
4
4
|
*/
|
5
5
|
|
6
|
-
#include "atn/
|
6
|
+
#include "atn/ATNSimulator.h"
|
7
|
+
|
7
8
|
#include "atn/ATNConfigSet.h"
|
8
|
-
#include "dfa/DFAState.h"
|
9
9
|
#include "atn/ATNDeserializer.h"
|
10
|
-
#include "atn/
|
11
|
-
|
12
|
-
#include "atn/ATNSimulator.h"
|
10
|
+
#include "atn/ATNType.h"
|
11
|
+
#include "dfa/DFAState.h"
|
13
12
|
|
14
13
|
using namespace antlr4;
|
15
14
|
using namespace antlr4::dfa;
|
16
15
|
using namespace antlr4::atn;
|
17
16
|
|
18
|
-
const Ref<DFAState> ATNSimulator::ERROR = std::make_shared<DFAState>(
|
19
|
-
antlrcpp::SingleWriteMultipleReadLock ATNSimulator::_stateLock;
|
20
|
-
antlrcpp::SingleWriteMultipleReadLock ATNSimulator::_edgeLock;
|
17
|
+
const Ref<DFAState> ATNSimulator::ERROR = std::make_shared<DFAState>(std::numeric_limits<int>::max());
|
21
18
|
|
22
19
|
ATNSimulator::ATNSimulator(const ATN &atn, PredictionContextCache &sharedContextCache)
|
23
|
-
: atn(atn), _sharedContextCache(sharedContextCache) {
|
24
|
-
}
|
25
|
-
|
26
|
-
ATNSimulator::~ATNSimulator() {
|
27
|
-
}
|
20
|
+
: atn(atn), _sharedContextCache(sharedContextCache) {}
|
28
21
|
|
29
22
|
void ATNSimulator::clearDFA() {
|
30
23
|
throw UnsupportedOperationException("This ATN simulator does not support clearing the DFA.");
|
31
24
|
}
|
32
25
|
|
33
|
-
PredictionContextCache& ATNSimulator::getSharedContextCache() {
|
26
|
+
PredictionContextCache& ATNSimulator::getSharedContextCache() const {
|
34
27
|
return _sharedContextCache;
|
35
28
|
}
|
36
29
|
|
37
|
-
Ref<PredictionContext> ATNSimulator::getCachedContext(Ref<PredictionContext>
|
30
|
+
Ref<const PredictionContext> ATNSimulator::getCachedContext(const Ref<const PredictionContext> &context) {
|
38
31
|
// This function must only be called with an active state lock, as we are going to change a shared structure.
|
39
|
-
|
40
|
-
return PredictionContext::getCachedContext(context, _sharedContextCache, visited);
|
41
|
-
}
|
42
|
-
|
43
|
-
ATN ATNSimulator::deserialize(const std::vector<uint16_t> &data) {
|
44
|
-
ATNDeserializer deserializer;
|
45
|
-
return deserializer.deserialize(data);
|
46
|
-
}
|
47
|
-
|
48
|
-
void ATNSimulator::checkCondition(bool condition) {
|
49
|
-
ATNDeserializer::checkCondition(condition);
|
50
|
-
}
|
51
|
-
|
52
|
-
void ATNSimulator::checkCondition(bool condition, const std::string &message) {
|
53
|
-
ATNDeserializer::checkCondition(condition, message);
|
54
|
-
}
|
55
|
-
|
56
|
-
Transition *ATNSimulator::edgeFactory(const ATN &atn, int type, int src, int trg, int arg1, int arg2, int arg3,
|
57
|
-
const std::vector<misc::IntervalSet> &sets) {
|
58
|
-
return ATNDeserializer::edgeFactory(atn, type, src, trg, arg1, arg2, arg3, sets);
|
59
|
-
}
|
60
|
-
|
61
|
-
ATNState *ATNSimulator::stateFactory(int type, int ruleIndex) {
|
62
|
-
return ATNDeserializer::stateFactory(type, ruleIndex);
|
32
|
+
return PredictionContext::getCachedContext(context, getSharedContextCache());
|
63
33
|
}
|
@@ -6,9 +6,10 @@
|
|
6
6
|
#pragma once
|
7
7
|
|
8
8
|
#include "atn/ATN.h"
|
9
|
+
#include "atn/PredictionContext.h"
|
10
|
+
#include "atn/PredictionContextCache.h"
|
9
11
|
#include "misc/IntervalSet.h"
|
10
12
|
#include "support/CPPUtils.h"
|
11
|
-
#include "atn/PredictionContext.h"
|
12
13
|
|
13
14
|
namespace antlr4 {
|
14
15
|
namespace atn {
|
@@ -20,7 +21,8 @@ namespace atn {
|
|
20
21
|
const ATN &atn;
|
21
22
|
|
22
23
|
ATNSimulator(const ATN &atn, PredictionContextCache &sharedContextCache);
|
23
|
-
|
24
|
+
|
25
|
+
virtual ~ATNSimulator() = default;
|
24
26
|
|
25
27
|
virtual void reset() = 0;
|
26
28
|
|
@@ -36,29 +38,11 @@ namespace atn {
|
|
36
38
|
* @since 4.3
|
37
39
|
*/
|
38
40
|
virtual void clearDFA();
|
39
|
-
virtual PredictionContextCache& getSharedContextCache();
|
40
|
-
virtual Ref<PredictionContext> getCachedContext(Ref<PredictionContext> const& context);
|
41
|
-
|
42
|
-
/// @deprecated Use <seealso cref="ATNDeserializer#deserialize"/> instead.
|
43
|
-
static ATN deserialize(const std::vector<uint16_t> &data);
|
44
41
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
/// @deprecated Use <seealso cref="ATNDeserializer#checkCondition(boolean, String)"/> instead.
|
49
|
-
static void checkCondition(bool condition, const std::string &message);
|
50
|
-
|
51
|
-
/// @deprecated Use <seealso cref="ATNDeserializer#edgeFactory"/> instead.
|
52
|
-
static Transition *edgeFactory(const ATN &atn, int type, int src, int trg, int arg1, int arg2, int arg3,
|
53
|
-
const std::vector<misc::IntervalSet> &sets);
|
54
|
-
|
55
|
-
/// @deprecated Use <seealso cref="ATNDeserializer#stateFactory"/> instead.
|
56
|
-
static ATNState *stateFactory(int type, int ruleIndex);
|
42
|
+
PredictionContextCache& getSharedContextCache() const;
|
43
|
+
Ref<const PredictionContext> getCachedContext(const Ref<const PredictionContext> &context);
|
57
44
|
|
58
45
|
protected:
|
59
|
-
static antlrcpp::SingleWriteMultipleReadLock _stateLock; // Lock for DFA states.
|
60
|
-
static antlrcpp::SingleWriteMultipleReadLock _edgeLock; // Lock for the sparse edge map in DFA states.
|
61
|
-
|
62
46
|
/// <summary>
|
63
47
|
/// The context cache maps all PredictionContext objects that are equals()
|
64
48
|
/// to a single cached copy. This cache is shared across all contexts
|
@@ -13,30 +13,15 @@
|
|
13
13
|
using namespace antlr4::atn;
|
14
14
|
using namespace antlrcpp;
|
15
15
|
|
16
|
-
ATNState::
|
17
|
-
}
|
18
|
-
|
19
|
-
ATNState::~ATNState() {
|
20
|
-
for (auto transition : transitions) {
|
21
|
-
delete transition;
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
const std::vector<std::string> ATNState::serializationNames = {
|
26
|
-
"INVALID", "BASIC", "RULE_START", "BLOCK_START",
|
27
|
-
"PLUS_BLOCK_START", "STAR_BLOCK_START", "TOKEN_START", "RULE_STOP",
|
28
|
-
"BLOCK_END", "STAR_LOOP_BACK", "STAR_LOOP_ENTRY", "PLUS_LOOP_BACK", "LOOP_END"
|
29
|
-
};
|
30
|
-
|
31
|
-
size_t ATNState::hashCode() {
|
16
|
+
size_t ATNState::hashCode() const {
|
32
17
|
return stateNumber;
|
33
18
|
}
|
34
19
|
|
35
|
-
bool ATNState::
|
20
|
+
bool ATNState::equals(const ATNState &other) const {
|
36
21
|
return stateNumber == other.stateNumber;
|
37
22
|
}
|
38
23
|
|
39
|
-
bool ATNState::isNonGreedyExitState() {
|
24
|
+
bool ATNState::isNonGreedyExitState() const {
|
40
25
|
return false;
|
41
26
|
}
|
42
27
|
|
@@ -44,14 +29,13 @@ std::string ATNState::toString() const {
|
|
44
29
|
return std::to_string(stateNumber);
|
45
30
|
}
|
46
31
|
|
47
|
-
void ATNState::addTransition(
|
48
|
-
addTransition(transitions.size(), e);
|
32
|
+
void ATNState::addTransition(ConstTransitionPtr e) {
|
33
|
+
addTransition(transitions.size(), std::move(e));
|
49
34
|
}
|
50
35
|
|
51
|
-
void ATNState::addTransition(size_t index,
|
52
|
-
for (
|
36
|
+
void ATNState::addTransition(size_t index, ConstTransitionPtr e) {
|
37
|
+
for (const auto &transition : transitions)
|
53
38
|
if (transition->target->stateNumber == e->target->stateNumber) {
|
54
|
-
delete e;
|
55
39
|
return;
|
56
40
|
}
|
57
41
|
|
@@ -62,11 +46,11 @@ void ATNState::addTransition(size_t index, Transition *e) {
|
|
62
46
|
epsilonOnlyTransitions = false;
|
63
47
|
}
|
64
48
|
|
65
|
-
transitions.insert(transitions.begin() + index, e);
|
49
|
+
transitions.insert(transitions.begin() + index, std::move(e));
|
66
50
|
}
|
67
51
|
|
68
|
-
|
69
|
-
|
52
|
+
ConstTransitionPtr ATNState::removeTransition(size_t index) {
|
53
|
+
ConstTransitionPtr result = std::move(transitions[index]);
|
70
54
|
transitions.erase(transitions.begin() + index);
|
71
55
|
return result;
|
72
56
|
}
|
@@ -6,6 +6,8 @@
|
|
6
6
|
#pragma once
|
7
7
|
|
8
8
|
#include "misc/IntervalSet.h"
|
9
|
+
#include "atn/Transition.h"
|
10
|
+
#include "atn/ATNStateType.h"
|
9
11
|
|
10
12
|
namespace antlr4 {
|
11
13
|
namespace atn {
|
@@ -70,55 +72,53 @@ namespace atn {
|
|
70
72
|
///
|
71
73
|
/// <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
|
72
74
|
/// </summary>
|
75
|
+
|
76
|
+
// GCC generates a warning here if ATN has already been declared due to the
|
77
|
+
// attributes added by ANTLR4CPP_PUBLIC.
|
78
|
+
// See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39159
|
79
|
+
// Only forward-declare if it hasn't already been declared.
|
80
|
+
#ifndef ANTLR4CPP_ATN_DECLARED
|
73
81
|
class ANTLR4CPP_PUBLIC ATN;
|
82
|
+
#endif
|
74
83
|
|
75
84
|
class ANTLR4CPP_PUBLIC ATNState {
|
76
85
|
public:
|
77
|
-
|
86
|
+
static constexpr size_t INITIAL_NUM_TRANSITIONS = 4;
|
87
|
+
static constexpr size_t INVALID_STATE_NUMBER = std::numeric_limits<size_t>::max();
|
88
|
+
|
89
|
+
size_t stateNumber = INVALID_STATE_NUMBER;
|
90
|
+
size_t ruleIndex = 0; // at runtime, we don't have Rule objects
|
91
|
+
bool epsilonOnlyTransitions = false;
|
92
|
+
|
93
|
+
/// Track the transitions emanating from this ATN state.
|
94
|
+
std::vector<ConstTransitionPtr> transitions;
|
95
|
+
|
96
|
+
ATNState() = delete;
|
97
|
+
|
78
98
|
ATNState(ATNState const&) = delete;
|
79
99
|
|
80
|
-
|
100
|
+
ATNState(ATNState&&) = delete;
|
101
|
+
|
102
|
+
virtual ~ATNState() = default;
|
81
103
|
|
82
104
|
ATNState& operator=(ATNState const&) = delete;
|
83
105
|
|
84
|
-
|
85
|
-
static const size_t INVALID_STATE_NUMBER = static_cast<size_t>(-1); // std::numeric_limits<size_t>::max();
|
86
|
-
|
87
|
-
enum {
|
88
|
-
ATN_INVALID_TYPE = 0,
|
89
|
-
BASIC = 1,
|
90
|
-
RULE_START = 2,
|
91
|
-
BLOCK_START = 3,
|
92
|
-
PLUS_BLOCK_START = 4,
|
93
|
-
STAR_BLOCK_START = 5,
|
94
|
-
TOKEN_START = 6,
|
95
|
-
RULE_STOP = 7,
|
96
|
-
BLOCK_END = 8,
|
97
|
-
STAR_LOOP_BACK = 9,
|
98
|
-
STAR_LOOP_ENTRY = 10,
|
99
|
-
PLUS_LOOP_BACK = 11,
|
100
|
-
LOOP_END = 12
|
101
|
-
};
|
102
|
-
|
103
|
-
static const std::vector<std::string> serializationNames;
|
106
|
+
ATNState& operator=(ATNState&&) = delete;
|
104
107
|
|
105
|
-
|
106
|
-
size_t
|
107
|
-
|
108
|
+
void addTransition(ConstTransitionPtr e);
|
109
|
+
void addTransition(size_t index, ConstTransitionPtr e);
|
110
|
+
ConstTransitionPtr removeTransition(size_t index);
|
108
111
|
|
109
|
-
|
110
|
-
virtual
|
111
|
-
bool operator == (const ATNState &other);
|
112
|
-
|
113
|
-
/// Track the transitions emanating from this ATN state.
|
114
|
-
std::vector<Transition*> transitions;
|
112
|
+
virtual size_t hashCode() const;
|
113
|
+
virtual bool equals(const ATNState &other) const;
|
115
114
|
|
116
|
-
virtual bool isNonGreedyExitState();
|
115
|
+
virtual bool isNonGreedyExitState() const;
|
117
116
|
virtual std::string toString() const;
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
117
|
+
|
118
|
+
ATNStateType getStateType() const { return _stateType; }
|
119
|
+
|
120
|
+
protected:
|
121
|
+
explicit ATNState(ATNStateType stateType) : _stateType(stateType) {}
|
122
122
|
|
123
123
|
private:
|
124
124
|
/// Used to cache lookahead during parsing, not used during construction.
|
@@ -126,8 +126,14 @@ namespace atn {
|
|
126
126
|
misc::IntervalSet _nextTokenWithinRule;
|
127
127
|
std::atomic<bool> _nextTokenUpdated { false };
|
128
128
|
|
129
|
+
const ATNStateType _stateType;
|
130
|
+
|
129
131
|
friend class ATN;
|
130
132
|
};
|
131
133
|
|
134
|
+
inline bool operator==(const ATNState &lhs, const ATNState &rhs) { return lhs.equals(rhs); }
|
135
|
+
|
136
|
+
inline bool operator!=(const ATNState &lhs, const ATNState &rhs) { return !operator==(lhs, rhs); }
|
137
|
+
|
132
138
|
} // namespace atn
|
133
139
|
} // namespace antlr4
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#include "atn/ATNStateType.h"
|
2
|
+
|
3
|
+
std::string antlr4::atn::atnStateTypeName(ATNStateType atnStateType) {
|
4
|
+
switch (atnStateType) {
|
5
|
+
case ATNStateType::INVALID:
|
6
|
+
return "INVALID";
|
7
|
+
case ATNStateType::BASIC:
|
8
|
+
return "BASIC";
|
9
|
+
case ATNStateType::RULE_START:
|
10
|
+
return "RULE_START";
|
11
|
+
case ATNStateType::BLOCK_START:
|
12
|
+
return "BLOCK_START";
|
13
|
+
case ATNStateType::PLUS_BLOCK_START:
|
14
|
+
return "PLUS_BLOCK_START";
|
15
|
+
case ATNStateType::STAR_BLOCK_START:
|
16
|
+
return "STAR_BLOCK_START";
|
17
|
+
case ATNStateType::TOKEN_START:
|
18
|
+
return "TOKEN_START";
|
19
|
+
case ATNStateType::RULE_STOP:
|
20
|
+
return "RULE_STOP";
|
21
|
+
case ATNStateType::BLOCK_END:
|
22
|
+
return "BLOCK_END";
|
23
|
+
case ATNStateType::STAR_LOOP_BACK:
|
24
|
+
return "STAR_LOOP_BACK";
|
25
|
+
case ATNStateType::STAR_LOOP_ENTRY:
|
26
|
+
return "STAR_LOOP_ENTRY";
|
27
|
+
case ATNStateType::PLUS_LOOP_BACK:
|
28
|
+
return "PLUS_LOOP_BACK";
|
29
|
+
case ATNStateType::LOOP_END:
|
30
|
+
return "LOOP_END";
|
31
|
+
}
|
32
|
+
return "UNKNOWN";
|
33
|
+
}
|
@@ -0,0 +1,36 @@
|
|
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
|
+
#include <string>
|
10
|
+
|
11
|
+
#include "antlr4-common.h"
|
12
|
+
|
13
|
+
namespace antlr4 {
|
14
|
+
namespace atn {
|
15
|
+
|
16
|
+
// Constants for ATNState serialization.
|
17
|
+
enum class ATNStateType : size_t {
|
18
|
+
INVALID = 0,
|
19
|
+
BASIC = 1,
|
20
|
+
RULE_START = 2,
|
21
|
+
BLOCK_START = 3,
|
22
|
+
PLUS_BLOCK_START = 4,
|
23
|
+
STAR_BLOCK_START = 5,
|
24
|
+
TOKEN_START = 6,
|
25
|
+
RULE_STOP = 7,
|
26
|
+
BLOCK_END = 8,
|
27
|
+
STAR_LOOP_BACK = 9,
|
28
|
+
STAR_LOOP_ENTRY = 10,
|
29
|
+
PLUS_LOOP_BACK = 11,
|
30
|
+
LOOP_END = 12,
|
31
|
+
};
|
32
|
+
|
33
|
+
ANTLR4CPP_PUBLIC std::string atnStateTypeName(ATNStateType atnStateType);
|
34
|
+
|
35
|
+
} // namespace atn
|
36
|
+
} // namespace antlr4
|
@@ -8,15 +8,11 @@
|
|
8
8
|
using namespace antlr4::atn;
|
9
9
|
|
10
10
|
ActionTransition::ActionTransition(ATNState *target, size_t ruleIndex)
|
11
|
-
: Transition(target), ruleIndex(ruleIndex), actionIndex(INVALID_INDEX), isCtxDependent(false) {
|
11
|
+
: Transition(TransitionType::ACTION, target), ruleIndex(ruleIndex), actionIndex(INVALID_INDEX), isCtxDependent(false) {
|
12
12
|
}
|
13
13
|
|
14
14
|
ActionTransition::ActionTransition(ATNState *target, size_t ruleIndex, size_t actionIndex, bool isCtxDependent)
|
15
|
-
: Transition(target), ruleIndex(ruleIndex), actionIndex(actionIndex), isCtxDependent(isCtxDependent) {
|
16
|
-
}
|
17
|
-
|
18
|
-
Transition::SerializationType ActionTransition::getSerializationType() const {
|
19
|
-
return ACTION;
|
15
|
+
: Transition(TransitionType::ACTION, target), ruleIndex(ruleIndex), actionIndex(actionIndex), isCtxDependent(isCtxDependent) {
|
20
16
|
}
|
21
17
|
|
22
18
|
bool ActionTransition::isEpsilon() const {
|
@@ -12,6 +12,10 @@ namespace atn {
|
|
12
12
|
|
13
13
|
class ANTLR4CPP_PUBLIC ActionTransition final : public Transition {
|
14
14
|
public:
|
15
|
+
static bool is(const Transition &transition) { return transition.getTransitionType() == TransitionType::ACTION; }
|
16
|
+
|
17
|
+
static bool is(const Transition *transition) { return transition != nullptr && is(*transition); }
|
18
|
+
|
15
19
|
const size_t ruleIndex;
|
16
20
|
const size_t actionIndex;
|
17
21
|
const bool isCtxDependent; // e.g., $i ref in action
|
@@ -20,8 +24,6 @@ namespace atn {
|
|
20
24
|
|
21
25
|
ActionTransition(ATNState *target, size_t ruleIndex, size_t actionIndex, bool isCtxDependent);
|
22
26
|
|
23
|
-
virtual SerializationType getSerializationType() const override;
|
24
|
-
|
25
27
|
virtual bool isEpsilon() const override;
|
26
28
|
|
27
29
|
virtual bool matches(size_t symbol, size_t minVocabSymbol, size_t maxVocabSymbol) const override;
|
data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.cpp
CHANGED
@@ -3,25 +3,39 @@
|
|
3
3
|
* can be found in the LICENSE.txt file in the project root.
|
4
4
|
*/
|
5
5
|
|
6
|
-
#include "support/Arrays.h"
|
7
|
-
#include "atn/SingletonPredictionContext.h"
|
8
|
-
|
9
6
|
#include "atn/ArrayPredictionContext.h"
|
10
7
|
|
8
|
+
#include <cstring>
|
9
|
+
|
10
|
+
#include "atn/SingletonPredictionContext.h"
|
11
|
+
#include "misc/MurmurHash.h"
|
12
|
+
#include "support/Casts.h"
|
13
|
+
|
11
14
|
using namespace antlr4::atn;
|
15
|
+
using namespace antlr4::misc;
|
16
|
+
using namespace antlrcpp;
|
12
17
|
|
13
|
-
|
14
|
-
|
15
|
-
|
18
|
+
namespace {
|
19
|
+
|
20
|
+
bool cachedHashCodeEqual(size_t lhs, size_t rhs) {
|
21
|
+
return lhs == rhs || lhs == 0 || rhs == 0;
|
22
|
+
}
|
23
|
+
|
24
|
+
bool predictionContextEqual(const Ref<const PredictionContext> &lhs, const Ref<const PredictionContext> &rhs) {
|
25
|
+
return *lhs == *rhs;
|
26
|
+
}
|
16
27
|
|
17
|
-
ArrayPredictionContext::ArrayPredictionContext(std::vector<Ref<PredictionContext>> const& parents_,
|
18
|
-
std::vector<size_t> const& returnStates)
|
19
|
-
: PredictionContext(calculateHashCode(parents_, returnStates)), parents(parents_), returnStates(returnStates) {
|
20
|
-
assert(parents.size() > 0);
|
21
|
-
assert(returnStates.size() > 0);
|
22
28
|
}
|
23
29
|
|
24
|
-
ArrayPredictionContext
|
30
|
+
ArrayPredictionContext::ArrayPredictionContext(const SingletonPredictionContext &predictionContext)
|
31
|
+
: ArrayPredictionContext({ predictionContext.parent }, { predictionContext.returnState }) {}
|
32
|
+
|
33
|
+
ArrayPredictionContext::ArrayPredictionContext(std::vector<Ref<const PredictionContext>> parents,
|
34
|
+
std::vector<size_t> returnStates)
|
35
|
+
: PredictionContext(PredictionContextType::ARRAY), parents(std::move(parents)), returnStates(std::move(returnStates)) {
|
36
|
+
assert(this->parents.size() > 0);
|
37
|
+
assert(this->returnStates.size() > 0);
|
38
|
+
assert(this->parents.size() == this->returnStates.size());
|
25
39
|
}
|
26
40
|
|
27
41
|
bool ArrayPredictionContext::isEmpty() const {
|
@@ -33,7 +47,7 @@ size_t ArrayPredictionContext::size() const {
|
|
33
47
|
return returnStates.size();
|
34
48
|
}
|
35
49
|
|
36
|
-
Ref<PredictionContext
|
50
|
+
const Ref<const PredictionContext>& ArrayPredictionContext::getParent(size_t index) const {
|
37
51
|
return parents[index];
|
38
52
|
}
|
39
53
|
|
@@ -41,18 +55,31 @@ size_t ArrayPredictionContext::getReturnState(size_t index) const {
|
|
41
55
|
return returnStates[index];
|
42
56
|
}
|
43
57
|
|
44
|
-
|
45
|
-
|
46
|
-
|
58
|
+
size_t ArrayPredictionContext::hashCodeImpl() const {
|
59
|
+
size_t hash = MurmurHash::initialize();
|
60
|
+
hash = MurmurHash::update(hash, static_cast<size_t>(getContextType()));
|
61
|
+
for (const auto &parent : parents) {
|
62
|
+
hash = MurmurHash::update(hash, parent);
|
47
63
|
}
|
48
|
-
|
49
|
-
|
50
|
-
if (other == nullptr || hashCode() != other->hashCode()) {
|
51
|
-
return false; // can't be same if hash is different
|
64
|
+
for (const auto &returnState : returnStates) {
|
65
|
+
hash = MurmurHash::update(hash, returnState);
|
52
66
|
}
|
67
|
+
return MurmurHash::finish(hash, 1 + parents.size() + returnStates.size());
|
68
|
+
}
|
53
69
|
|
54
|
-
|
55
|
-
|
70
|
+
bool ArrayPredictionContext::equals(const PredictionContext &other) const {
|
71
|
+
if (this == std::addressof(other)) {
|
72
|
+
return true;
|
73
|
+
}
|
74
|
+
if (getContextType() != other.getContextType()) {
|
75
|
+
return false;
|
76
|
+
}
|
77
|
+
const auto &array = downCast<const ArrayPredictionContext&>(other);
|
78
|
+
return returnStates.size() == array.returnStates.size() &&
|
79
|
+
parents.size() == array.parents.size() &&
|
80
|
+
cachedHashCodeEqual(cachedHashCode(), array.cachedHashCode()) &&
|
81
|
+
std::memcmp(returnStates.data(), array.returnStates.data(), returnStates.size() * sizeof(decltype(returnStates)::value_type)) == 0 &&
|
82
|
+
std::equal(parents.begin(), parents.end(), array.parents.begin(), predictionContextEqual);
|
56
83
|
}
|
57
84
|
|
58
85
|
std::string ArrayPredictionContext::toString() const {
|
data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.h
CHANGED
@@ -13,29 +13,37 @@ namespace atn {
|
|
13
13
|
|
14
14
|
class SingletonPredictionContext;
|
15
15
|
|
16
|
-
class ANTLR4CPP_PUBLIC ArrayPredictionContext : public PredictionContext {
|
16
|
+
class ANTLR4CPP_PUBLIC ArrayPredictionContext final : public PredictionContext {
|
17
17
|
public:
|
18
|
+
static bool is(const PredictionContext &predictionContext) { return predictionContext.getContextType() == PredictionContextType::ARRAY; }
|
19
|
+
|
20
|
+
static bool is(const PredictionContext *predictionContext) { return predictionContext != nullptr && is(*predictionContext); }
|
21
|
+
|
18
22
|
/// Parent can be empty only if full ctx mode and we make an array
|
19
23
|
/// from EMPTY and non-empty. We merge EMPTY by using null parent and
|
20
24
|
/// returnState == EMPTY_RETURN_STATE.
|
21
25
|
// Also here: we use a strong reference to our parents to avoid having them freed prematurely.
|
22
26
|
// See also SinglePredictionContext.
|
23
|
-
|
27
|
+
std::vector<Ref<const PredictionContext>> parents;
|
24
28
|
|
25
29
|
/// Sorted for merge, no duplicates; if present, EMPTY_RETURN_STATE is always last.
|
26
|
-
|
30
|
+
std::vector<size_t> returnStates;
|
31
|
+
|
32
|
+
explicit ArrayPredictionContext(const SingletonPredictionContext &predictionContext);
|
33
|
+
|
34
|
+
ArrayPredictionContext(std::vector<Ref<const PredictionContext>> parents, std::vector<size_t> returnStates);
|
27
35
|
|
28
|
-
ArrayPredictionContext(
|
29
|
-
ArrayPredictionContext(std::vector<Ref<PredictionContext>> const& parents_, std::vector<size_t> const& returnStates);
|
30
|
-
virtual ~ArrayPredictionContext();
|
36
|
+
ArrayPredictionContext(ArrayPredictionContext&&) = default;
|
31
37
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
bool
|
38
|
+
bool isEmpty() const override;
|
39
|
+
size_t size() const override;
|
40
|
+
const Ref<const PredictionContext>& getParent(size_t index) const override;
|
41
|
+
size_t getReturnState(size_t index) const override;
|
42
|
+
bool equals(const PredictionContext &other) const override;
|
43
|
+
std::string toString() const override;
|
37
44
|
|
38
|
-
|
45
|
+
protected:
|
46
|
+
size_t hashCodeImpl() const override;
|
39
47
|
};
|
40
48
|
|
41
49
|
} // namespace atn
|
@@ -11,11 +11,7 @@
|
|
11
11
|
using namespace antlr4::misc;
|
12
12
|
using namespace antlr4::atn;
|
13
13
|
|
14
|
-
AtomTransition::AtomTransition(ATNState *target, size_t label) : Transition(target), _label(label) {
|
15
|
-
}
|
16
|
-
|
17
|
-
Transition::SerializationType AtomTransition::getSerializationType() const {
|
18
|
-
return ATOM;
|
14
|
+
AtomTransition::AtomTransition(ATNState *target, size_t label) : Transition(TransitionType::ATOM, target), _label(label) {
|
19
15
|
}
|
20
16
|
|
21
17
|
IntervalSet AtomTransition::label() const {
|