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
@@ -7,6 +7,7 @@
|
|
7
7
|
|
8
8
|
#include "Recognizer.h"
|
9
9
|
#include "support/CPPUtils.h"
|
10
|
+
#include "atn/SemanticContextType.h"
|
10
11
|
|
11
12
|
namespace antlr4 {
|
12
13
|
namespace atn {
|
@@ -19,36 +20,15 @@ namespace atn {
|
|
19
20
|
/// SemanticContext within the scope of this outer class.
|
20
21
|
class ANTLR4CPP_PUBLIC SemanticContext : public std::enable_shared_from_this<SemanticContext> {
|
21
22
|
public:
|
22
|
-
struct Hasher
|
23
|
-
{
|
24
|
-
size_t operator()(Ref<SemanticContext> const& k) const {
|
25
|
-
return k->hashCode();
|
26
|
-
}
|
27
|
-
};
|
28
|
-
|
29
|
-
struct Comparer {
|
30
|
-
bool operator()(Ref<SemanticContext> const& lhs, Ref<SemanticContext> const& rhs) const {
|
31
|
-
if (lhs == rhs)
|
32
|
-
return true;
|
33
|
-
return (lhs->hashCode() == rhs->hashCode()) && (*lhs == *rhs);
|
34
|
-
}
|
35
|
-
};
|
36
|
-
|
37
|
-
|
38
|
-
using Set = std::unordered_set<Ref<SemanticContext>, Hasher, Comparer>;
|
39
|
-
|
40
23
|
/**
|
41
24
|
* The default {@link SemanticContext}, which is semantically equivalent to
|
42
25
|
* a predicate of the form {@code {true}?}.
|
43
26
|
*/
|
44
|
-
static const Ref<SemanticContext> NONE;
|
27
|
+
static const Ref<const SemanticContext> NONE;
|
45
28
|
|
46
|
-
virtual ~SemanticContext();
|
29
|
+
virtual ~SemanticContext() = default;
|
47
30
|
|
48
|
-
|
49
|
-
virtual std::string toString() const = 0;
|
50
|
-
virtual bool operator == (const SemanticContext &other) const = 0;
|
51
|
-
virtual bool operator != (const SemanticContext &other) const;
|
31
|
+
SemanticContextType getContextType() const { return _contextType; }
|
52
32
|
|
53
33
|
/// <summary>
|
54
34
|
/// For context independent predicates, we evaluate them without a local
|
@@ -63,7 +43,7 @@ namespace atn {
|
|
63
43
|
/// prediction, so we passed in the outer context here in case of context
|
64
44
|
/// dependent predicate evaluation.
|
65
45
|
/// </summary>
|
66
|
-
virtual bool eval(Recognizer *parser, RuleContext *parserCallStack) = 0;
|
46
|
+
virtual bool eval(Recognizer *parser, RuleContext *parserCallStack) const = 0;
|
67
47
|
|
68
48
|
/**
|
69
49
|
* Evaluate the precedence predicates for the context and reduce the result.
|
@@ -83,12 +63,18 @@ namespace atn {
|
|
83
63
|
* semantic context after precedence predicates are evaluated.</li>
|
84
64
|
* </ul>
|
85
65
|
*/
|
86
|
-
virtual Ref<SemanticContext> evalPrecedence(Recognizer *parser, RuleContext *parserCallStack);
|
66
|
+
virtual Ref<const SemanticContext> evalPrecedence(Recognizer *parser, RuleContext *parserCallStack) const;
|
67
|
+
|
68
|
+
virtual size_t hashCode() const = 0;
|
69
|
+
|
70
|
+
virtual bool equals(const SemanticContext &other) const = 0;
|
87
71
|
|
88
|
-
|
72
|
+
virtual std::string toString() const = 0;
|
73
|
+
|
74
|
+
static Ref<const SemanticContext> And(Ref<const SemanticContext> a, Ref<const SemanticContext> b);
|
89
75
|
|
90
76
|
/// See also: ParserATNSimulator::getPredsForAmbigAlts.
|
91
|
-
static Ref<SemanticContext> Or(Ref<SemanticContext>
|
77
|
+
static Ref<const SemanticContext> Or(Ref<const SemanticContext> a, Ref<const SemanticContext> b);
|
92
78
|
|
93
79
|
class Predicate;
|
94
80
|
class PrecedencePredicate;
|
@@ -96,44 +82,54 @@ namespace atn {
|
|
96
82
|
class AND;
|
97
83
|
class OR;
|
98
84
|
|
85
|
+
protected:
|
86
|
+
explicit SemanticContext(SemanticContextType contextType) : _contextType(contextType) {}
|
87
|
+
|
99
88
|
private:
|
100
|
-
|
89
|
+
const SemanticContextType _contextType;
|
101
90
|
};
|
102
91
|
|
103
|
-
|
92
|
+
inline bool operator==(const SemanticContext &lhs, const SemanticContext &rhs) {
|
93
|
+
return lhs.equals(rhs);
|
94
|
+
}
|
95
|
+
|
96
|
+
inline bool operator!=(const SemanticContext &lhs, const SemanticContext &rhs) {
|
97
|
+
return !operator==(lhs, rhs);
|
98
|
+
}
|
99
|
+
|
100
|
+
class ANTLR4CPP_PUBLIC SemanticContext::Predicate final : public SemanticContext {
|
104
101
|
public:
|
102
|
+
static bool is(const SemanticContext &semanticContext) { return semanticContext.getContextType() == SemanticContextType::PREDICATE; }
|
103
|
+
|
104
|
+
static bool is(const SemanticContext *semanticContext) { return semanticContext != nullptr && is(*semanticContext); }
|
105
|
+
|
105
106
|
const size_t ruleIndex;
|
106
107
|
const size_t predIndex;
|
107
108
|
const bool isCtxDependent; // e.g., $i ref in pred
|
108
109
|
|
109
|
-
protected:
|
110
|
-
Predicate();
|
111
|
-
|
112
|
-
public:
|
113
110
|
Predicate(size_t ruleIndex, size_t predIndex, bool isCtxDependent);
|
114
111
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
112
|
+
bool eval(Recognizer *parser, RuleContext *parserCallStack) const override;
|
113
|
+
size_t hashCode() const override;
|
114
|
+
bool equals(const SemanticContext &other) const override;
|
115
|
+
std::string toString() const override;
|
119
116
|
};
|
120
117
|
|
121
|
-
class ANTLR4CPP_PUBLIC SemanticContext::PrecedencePredicate : public SemanticContext {
|
118
|
+
class ANTLR4CPP_PUBLIC SemanticContext::PrecedencePredicate final : public SemanticContext {
|
122
119
|
public:
|
120
|
+
static bool is(const SemanticContext &semanticContext) { return semanticContext.getContextType() == SemanticContextType::PRECEDENCE; }
|
121
|
+
|
122
|
+
static bool is(const SemanticContext *semanticContext) { return semanticContext != nullptr && is(*semanticContext); }
|
123
|
+
|
123
124
|
const int precedence;
|
124
125
|
|
125
|
-
|
126
|
-
PrecedencePredicate();
|
126
|
+
explicit PrecedencePredicate(int precedence);
|
127
127
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
virtual int compareTo(PrecedencePredicate *o);
|
134
|
-
virtual size_t hashCode() const override;
|
135
|
-
virtual bool operator == (const SemanticContext &other) const override;
|
136
|
-
virtual std::string toString() const override;
|
128
|
+
bool eval(Recognizer *parser, RuleContext *parserCallStack) const override;
|
129
|
+
Ref<const SemanticContext> evalPrecedence(Recognizer *parser, RuleContext *parserCallStack) const override;
|
130
|
+
size_t hashCode() const override;
|
131
|
+
bool equals(const SemanticContext &other) const override;
|
132
|
+
std::string toString() const override;
|
137
133
|
};
|
138
134
|
|
139
135
|
/**
|
@@ -144,7 +140,12 @@ namespace atn {
|
|
144
140
|
*/
|
145
141
|
class ANTLR4CPP_PUBLIC SemanticContext::Operator : public SemanticContext {
|
146
142
|
public:
|
147
|
-
|
143
|
+
static bool is(const SemanticContext &semanticContext) {
|
144
|
+
const auto contextType = semanticContext.getContextType();
|
145
|
+
return contextType == SemanticContextType::AND || contextType == SemanticContextType::OR;
|
146
|
+
}
|
147
|
+
|
148
|
+
static bool is(const SemanticContext *semanticContext) { return semanticContext != nullptr && is(*semanticContext); }
|
148
149
|
|
149
150
|
/**
|
150
151
|
* Gets the operands for the semantic context operator.
|
@@ -155,68 +156,78 @@ namespace atn {
|
|
155
156
|
* @since 4.3
|
156
157
|
*/
|
157
158
|
|
158
|
-
virtual std::vector<Ref<SemanticContext
|
159
|
+
virtual const std::vector<Ref<const SemanticContext>>& getOperands() const = 0;
|
160
|
+
|
161
|
+
protected:
|
162
|
+
using SemanticContext::SemanticContext;
|
159
163
|
};
|
160
164
|
|
161
165
|
/**
|
162
166
|
* A semantic context which is true whenever none of the contained contexts
|
163
167
|
* is false.
|
164
168
|
*/
|
165
|
-
class ANTLR4CPP_PUBLIC SemanticContext::AND : public SemanticContext::Operator {
|
169
|
+
class ANTLR4CPP_PUBLIC SemanticContext::AND final : public SemanticContext::Operator {
|
166
170
|
public:
|
167
|
-
|
171
|
+
static bool is(const SemanticContext &semanticContext) { return semanticContext.getContextType() == SemanticContextType::AND; }
|
172
|
+
|
173
|
+
static bool is(const SemanticContext *semanticContext) { return semanticContext != nullptr && is(*semanticContext); }
|
168
174
|
|
169
|
-
AND(Ref<SemanticContext>
|
175
|
+
AND(Ref<const SemanticContext> a, Ref<const SemanticContext> b) ;
|
170
176
|
|
171
|
-
|
172
|
-
virtual bool operator == (const SemanticContext &other) const override;
|
173
|
-
virtual size_t hashCode() const override;
|
177
|
+
const std::vector<Ref<const SemanticContext>>& getOperands() const override;
|
174
178
|
|
175
179
|
/**
|
176
180
|
* The evaluation of predicates by this context is short-circuiting, but
|
177
181
|
* unordered.</p>
|
178
182
|
*/
|
179
|
-
|
180
|
-
|
181
|
-
|
183
|
+
bool eval(Recognizer *parser, RuleContext *parserCallStack) const override;
|
184
|
+
Ref<const SemanticContext> evalPrecedence(Recognizer *parser, RuleContext *parserCallStack) const override;
|
185
|
+
size_t hashCode() const override;
|
186
|
+
bool equals(const SemanticContext &other) const override;
|
187
|
+
std::string toString() const override;
|
188
|
+
|
189
|
+
private:
|
190
|
+
std::vector<Ref<const SemanticContext>> _opnds;
|
182
191
|
};
|
183
192
|
|
184
193
|
/**
|
185
194
|
* A semantic context which is true whenever at least one of the contained
|
186
195
|
* contexts is true.
|
187
196
|
*/
|
188
|
-
class ANTLR4CPP_PUBLIC SemanticContext::OR : public SemanticContext::Operator {
|
197
|
+
class ANTLR4CPP_PUBLIC SemanticContext::OR final : public SemanticContext::Operator {
|
189
198
|
public:
|
190
|
-
|
199
|
+
static bool is(const SemanticContext &semanticContext) { return semanticContext.getContextType() == SemanticContextType::OR; }
|
200
|
+
|
201
|
+
static bool is(const SemanticContext *semanticContext) { return semanticContext != nullptr && is(*semanticContext); }
|
191
202
|
|
192
|
-
OR(Ref<SemanticContext>
|
203
|
+
OR(Ref<const SemanticContext> a, Ref<const SemanticContext> b);
|
193
204
|
|
194
|
-
|
195
|
-
virtual bool operator == (const SemanticContext &other) const override;
|
196
|
-
virtual size_t hashCode() const override;
|
205
|
+
const std::vector<Ref<const SemanticContext>>& getOperands() const override;
|
197
206
|
|
198
207
|
/**
|
199
208
|
* The evaluation of predicates by this context is short-circuiting, but
|
200
209
|
* unordered.
|
201
210
|
*/
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
211
|
+
bool eval(Recognizer *parser, RuleContext *parserCallStack) const override;
|
212
|
+
Ref<const SemanticContext> evalPrecedence(Recognizer *parser, RuleContext *parserCallStack) const override;
|
213
|
+
size_t hashCode() const override;
|
214
|
+
bool equals(const SemanticContext &other) const override;
|
215
|
+
std::string toString() const override;
|
206
216
|
|
207
|
-
|
208
|
-
|
217
|
+
private:
|
218
|
+
std::vector<Ref<const SemanticContext>> _opnds;
|
219
|
+
};
|
209
220
|
|
210
|
-
//
|
221
|
+
} // namespace atn
|
222
|
+
} // namespace antlr4
|
211
223
|
|
212
224
|
namespace std {
|
213
|
-
using antlr4::atn::SemanticContext;
|
214
225
|
|
215
|
-
template <>
|
216
|
-
{
|
217
|
-
size_t operator
|
218
|
-
|
219
|
-
return x.hashCode();
|
226
|
+
template <>
|
227
|
+
struct hash<::antlr4::atn::SemanticContext> {
|
228
|
+
size_t operator()(const ::antlr4::atn::SemanticContext &semanticContext) const {
|
229
|
+
return semanticContext.hashCode();
|
220
230
|
}
|
221
231
|
};
|
222
|
-
|
232
|
+
|
233
|
+
} // namespace std
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
2
|
+
* Use of this file is governed by the BSD 3-clause license that
|
3
|
+
* can be found in the LICENSE.txt file in the project root.
|
4
|
+
*/
|
5
|
+
|
6
|
+
#pragma once
|
7
|
+
|
8
|
+
#include <cstddef>
|
9
|
+
|
10
|
+
#include "antlr4-common.h"
|
11
|
+
|
12
|
+
namespace antlr4 {
|
13
|
+
namespace atn {
|
14
|
+
|
15
|
+
enum class SemanticContextType : size_t {
|
16
|
+
PREDICATE = 1,
|
17
|
+
PRECEDENCE = 2,
|
18
|
+
AND = 3,
|
19
|
+
OR = 4,
|
20
|
+
};
|
21
|
+
|
22
|
+
} // namespace atn
|
23
|
+
} // namespace antlr4
|
@@ -0,0 +1,101 @@
|
|
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 <cstdint>
|
10
|
+
#include <cstring>
|
11
|
+
#include <iterator>
|
12
|
+
#include <vector>
|
13
|
+
|
14
|
+
#include "antlr4-common.h"
|
15
|
+
#include "misc/MurmurHash.h"
|
16
|
+
|
17
|
+
namespace antlr4 {
|
18
|
+
namespace atn {
|
19
|
+
|
20
|
+
class ANTLR4CPP_PUBLIC SerializedATNView final {
|
21
|
+
public:
|
22
|
+
using value_type = int32_t;
|
23
|
+
using size_type = size_t;
|
24
|
+
using difference_type = ptrdiff_t;
|
25
|
+
using reference = int32_t&;
|
26
|
+
using const_reference = const int32_t&;
|
27
|
+
using pointer = int32_t*;
|
28
|
+
using const_pointer = const int32_t*;
|
29
|
+
using iterator = const_pointer;
|
30
|
+
using const_iterator = const_pointer;
|
31
|
+
using reverse_iterator = std::reverse_iterator<iterator>;
|
32
|
+
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
33
|
+
|
34
|
+
SerializedATNView() = default;
|
35
|
+
|
36
|
+
SerializedATNView(const_pointer data, size_type size) : _data(data), _size(size) {}
|
37
|
+
|
38
|
+
SerializedATNView(const std::vector<int32_t> &serializedATN) : _data(serializedATN.data()), _size(serializedATN.size()) {}
|
39
|
+
|
40
|
+
SerializedATNView(const SerializedATNView&) = default;
|
41
|
+
|
42
|
+
SerializedATNView& operator=(const SerializedATNView&) = default;
|
43
|
+
|
44
|
+
const_iterator begin() const { return data(); }
|
45
|
+
|
46
|
+
const_iterator cbegin() const { return data(); }
|
47
|
+
|
48
|
+
const_iterator end() const { return data() + size(); }
|
49
|
+
|
50
|
+
const_iterator cend() const { return data() + size(); }
|
51
|
+
|
52
|
+
const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
|
53
|
+
|
54
|
+
const_reverse_iterator crbegin() const { return const_reverse_iterator(cend()); }
|
55
|
+
|
56
|
+
const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
|
57
|
+
|
58
|
+
const_reverse_iterator crend() const { return const_reverse_iterator(cbegin()); }
|
59
|
+
|
60
|
+
bool empty() const { return size() == 0; }
|
61
|
+
|
62
|
+
const_pointer data() const { return _data; }
|
63
|
+
|
64
|
+
size_type size() const { return _size; }
|
65
|
+
|
66
|
+
size_type size_bytes() const { return size() * sizeof(value_type); }
|
67
|
+
|
68
|
+
const_reference operator[](size_type index) const { return _data[index]; }
|
69
|
+
|
70
|
+
private:
|
71
|
+
const_pointer _data = nullptr;
|
72
|
+
size_type _size = 0;
|
73
|
+
};
|
74
|
+
|
75
|
+
inline bool operator==(const SerializedATNView &lhs, const SerializedATNView &rhs) {
|
76
|
+
return (lhs.data() == rhs.data() && lhs.size() == rhs.size()) ||
|
77
|
+
(lhs.size() == rhs.size() && std::memcmp(lhs.data(), rhs.data(), lhs.size_bytes()) == 0);
|
78
|
+
}
|
79
|
+
|
80
|
+
inline bool operator!=(const SerializedATNView &lhs, const SerializedATNView &rhs) {
|
81
|
+
return !operator==(lhs, rhs);
|
82
|
+
}
|
83
|
+
|
84
|
+
inline bool operator<(const SerializedATNView &lhs, const SerializedATNView &rhs) {
|
85
|
+
int diff = std::memcmp(lhs.data(), rhs.data(), std::min(lhs.size_bytes(), rhs.size_bytes()));
|
86
|
+
return diff < 0 || (diff == 0 && lhs.size() < rhs.size());
|
87
|
+
}
|
88
|
+
|
89
|
+
} // namespace atn
|
90
|
+
} // namespace antlr4
|
91
|
+
|
92
|
+
namespace std {
|
93
|
+
|
94
|
+
template <>
|
95
|
+
struct hash<::antlr4::atn::SerializedATNView> {
|
96
|
+
size_t operator()(const ::antlr4::atn::SerializedATNView &serializedATNView) const {
|
97
|
+
return ::antlr4::misc::MurmurHash::hashCode(serializedATNView.data(), serializedATNView.size());
|
98
|
+
}
|
99
|
+
};
|
100
|
+
|
101
|
+
} // namespace std
|
@@ -11,12 +11,8 @@
|
|
11
11
|
using namespace antlr4;
|
12
12
|
using namespace antlr4::atn;
|
13
13
|
|
14
|
-
SetTransition::SetTransition(ATNState *target,
|
15
|
-
: Transition(target), set(aSet.isEmpty() ? misc::IntervalSet::of(Token::INVALID_TYPE) : aSet) {
|
16
|
-
}
|
17
|
-
|
18
|
-
Transition::SerializationType SetTransition::getSerializationType() const {
|
19
|
-
return SET;
|
14
|
+
SetTransition::SetTransition(TransitionType transitionType, ATNState *target, misc::IntervalSet aSet)
|
15
|
+
: Transition(transitionType, target), set(aSet.isEmpty() ? misc::IntervalSet::of(Token::INVALID_TYPE) : std::move(aSet)) {
|
20
16
|
}
|
21
17
|
|
22
18
|
misc::IntervalSet SetTransition::label() const {
|
@@ -14,16 +14,24 @@ namespace atn {
|
|
14
14
|
/// A transition containing a set of values. </summary>
|
15
15
|
class ANTLR4CPP_PUBLIC SetTransition : public Transition {
|
16
16
|
public:
|
17
|
-
const
|
17
|
+
static bool is(const Transition &transition) {
|
18
|
+
const auto transitionType = transition.getTransitionType();
|
19
|
+
return transitionType == TransitionType::SET || transitionType == TransitionType::NOT_SET;
|
20
|
+
}
|
21
|
+
|
22
|
+
static bool is(const Transition *transition) { return transition != nullptr && is(*transition); }
|
18
23
|
|
19
|
-
|
24
|
+
const misc::IntervalSet set;
|
20
25
|
|
21
|
-
|
26
|
+
SetTransition(ATNState *target, misc::IntervalSet set) : SetTransition(TransitionType::SET, target, std::move(set)) {}
|
22
27
|
|
23
28
|
virtual misc::IntervalSet label() const override;
|
24
29
|
virtual bool matches(size_t symbol, size_t minVocabSymbol, size_t maxVocabSymbol) const override;
|
25
30
|
|
26
31
|
virtual std::string toString() const override;
|
32
|
+
|
33
|
+
protected:
|
34
|
+
SetTransition(TransitionType transitionType, ATNState *target, misc::IntervalSet set);
|
27
35
|
};
|
28
36
|
|
29
37
|
} // namespace atn
|
data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp
CHANGED
@@ -3,69 +3,74 @@
|
|
3
3
|
* can be found in the LICENSE.txt file in the project root.
|
4
4
|
*/
|
5
5
|
|
6
|
-
#include "atn/EmptyPredictionContext.h"
|
7
|
-
|
8
6
|
#include "atn/SingletonPredictionContext.h"
|
9
7
|
|
8
|
+
#include "support/Casts.h"
|
9
|
+
#include "misc/MurmurHash.h"
|
10
|
+
|
10
11
|
using namespace antlr4::atn;
|
12
|
+
using namespace antlrcpp;
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
}
|
14
|
+
namespace {
|
15
|
+
|
16
|
+
bool cachedHashCodeEqual(size_t lhs, size_t rhs) {
|
17
|
+
return lhs == rhs || lhs == 0 || rhs == 0;
|
18
|
+
}
|
17
19
|
|
18
|
-
SingletonPredictionContext::~SingletonPredictionContext() {
|
19
20
|
}
|
20
21
|
|
21
|
-
|
22
|
+
SingletonPredictionContext::SingletonPredictionContext(Ref<const PredictionContext> parent, size_t returnState)
|
23
|
+
: PredictionContext(PredictionContextType::SINGLETON), parent(std::move(parent)), returnState(returnState) {
|
24
|
+
assert(returnState != ATNState::INVALID_STATE_NUMBER);
|
25
|
+
}
|
22
26
|
|
23
|
-
|
27
|
+
Ref<const SingletonPredictionContext> SingletonPredictionContext::create(Ref<const PredictionContext> parent, size_t returnState) {
|
28
|
+
if (returnState == EMPTY_RETURN_STATE && parent == nullptr) {
|
24
29
|
// someone can pass in the bits of an array ctx that mean $
|
25
|
-
return std::dynamic_pointer_cast<SingletonPredictionContext>(EMPTY);
|
30
|
+
return std::dynamic_pointer_cast<const SingletonPredictionContext>(EMPTY);
|
26
31
|
}
|
27
|
-
return std::make_shared<SingletonPredictionContext>(parent, returnState);
|
32
|
+
return std::make_shared<SingletonPredictionContext>(std::move(parent), returnState);
|
33
|
+
}
|
34
|
+
|
35
|
+
bool SingletonPredictionContext::isEmpty() const {
|
36
|
+
return parent == nullptr && returnState == EMPTY_RETURN_STATE;
|
28
37
|
}
|
29
38
|
|
30
39
|
size_t SingletonPredictionContext::size() const {
|
31
40
|
return 1;
|
32
41
|
}
|
33
42
|
|
34
|
-
Ref<PredictionContext
|
43
|
+
const Ref<const PredictionContext>& SingletonPredictionContext::getParent(size_t index) const {
|
35
44
|
assert(index == 0);
|
36
|
-
|
45
|
+
static_cast<void>(index);
|
37
46
|
return parent;
|
38
47
|
}
|
39
48
|
|
40
49
|
size_t SingletonPredictionContext::getReturnState(size_t index) const {
|
41
50
|
assert(index == 0);
|
42
|
-
|
51
|
+
static_cast<void>(index);
|
43
52
|
return returnState;
|
44
53
|
}
|
45
54
|
|
46
|
-
|
47
|
-
|
55
|
+
size_t SingletonPredictionContext::hashCodeImpl() const {
|
56
|
+
size_t hash = misc::MurmurHash::initialize();
|
57
|
+
hash = misc::MurmurHash::update(hash, static_cast<size_t>(getContextType()));
|
58
|
+
hash = misc::MurmurHash::update(hash, parent);
|
59
|
+
hash = misc::MurmurHash::update(hash, returnState);
|
60
|
+
return misc::MurmurHash::finish(hash, 3);
|
61
|
+
}
|
62
|
+
|
63
|
+
bool SingletonPredictionContext::equals(const PredictionContext &other) const {
|
64
|
+
if (this == std::addressof(other)) {
|
48
65
|
return true;
|
49
66
|
}
|
50
|
-
|
51
|
-
const SingletonPredictionContext *other = dynamic_cast<const SingletonPredictionContext*>(&o);
|
52
|
-
if (other == nullptr) {
|
67
|
+
if (getContextType() != other.getContextType()) {
|
53
68
|
return false;
|
54
69
|
}
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
if (returnState != other->returnState)
|
61
|
-
return false;
|
62
|
-
|
63
|
-
if (!parent && !other->parent)
|
64
|
-
return true;
|
65
|
-
if (!parent || !other->parent)
|
66
|
-
return false;
|
67
|
-
|
68
|
-
return *parent == *other->parent;
|
70
|
+
const auto &singleton = downCast<const SingletonPredictionContext&>(other);
|
71
|
+
return returnState == singleton.returnState &&
|
72
|
+
cachedHashCodeEqual(cachedHashCode(), singleton.cachedHashCode()) &&
|
73
|
+
(parent == singleton.parent || (parent != nullptr && singleton.parent != nullptr && *parent == *singleton.parent));
|
69
74
|
}
|
70
75
|
|
71
76
|
std::string SingletonPredictionContext::toString() const {
|
data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.h
CHANGED
@@ -10,26 +10,33 @@
|
|
10
10
|
namespace antlr4 {
|
11
11
|
namespace atn {
|
12
12
|
|
13
|
-
class ANTLR4CPP_PUBLIC SingletonPredictionContext : public PredictionContext {
|
13
|
+
class ANTLR4CPP_PUBLIC SingletonPredictionContext final : public PredictionContext {
|
14
14
|
public:
|
15
|
+
static bool is(const PredictionContext &predictionContext) { return predictionContext.getContextType() == PredictionContextType::SINGLETON; }
|
16
|
+
|
17
|
+
static bool is(const PredictionContext *predictionContext) { return predictionContext != nullptr && is(*predictionContext); }
|
18
|
+
|
19
|
+
static Ref<const SingletonPredictionContext> create(Ref<const PredictionContext> parent, size_t returnState);
|
20
|
+
|
15
21
|
// Usually a parent is linked via a weak ptr. Not so here as we have kinda reverse reference chain.
|
16
22
|
// There are no child contexts stored here and often the parent context is left dangling when it's
|
17
23
|
// owning ATNState is released. In order to avoid having this context released as well (leaving all other contexts
|
18
24
|
// which got this one as parent with a null reference) we use a shared_ptr here instead, to keep those left alone
|
19
25
|
// parent contexts alive.
|
20
|
-
const Ref<PredictionContext> parent;
|
26
|
+
const Ref<const PredictionContext> parent;
|
21
27
|
const size_t returnState;
|
22
28
|
|
23
|
-
SingletonPredictionContext(Ref<PredictionContext>
|
24
|
-
virtual ~SingletonPredictionContext();
|
29
|
+
SingletonPredictionContext(Ref<const PredictionContext> parent, size_t returnState);
|
25
30
|
|
26
|
-
|
31
|
+
bool isEmpty() const override;
|
32
|
+
size_t size() const override;
|
33
|
+
const Ref<const PredictionContext>& getParent(size_t index) const override;
|
34
|
+
size_t getReturnState(size_t index) const override;
|
35
|
+
bool equals(const PredictionContext &other) const override;
|
36
|
+
std::string toString() const override;
|
27
37
|
|
28
|
-
|
29
|
-
|
30
|
-
virtual size_t getReturnState(size_t index) const override;
|
31
|
-
virtual bool operator == (const PredictionContext &o) const override;
|
32
|
-
virtual std::string toString() const override;
|
38
|
+
protected:
|
39
|
+
size_t hashCodeImpl() const override;
|
33
40
|
};
|
34
41
|
|
35
42
|
} // namespace atn
|
@@ -12,9 +12,12 @@ namespace atn {
|
|
12
12
|
|
13
13
|
/// The block that begins a closure loop.
|
14
14
|
class ANTLR4CPP_PUBLIC StarBlockStartState final : public BlockStartState {
|
15
|
-
|
16
15
|
public:
|
17
|
-
|
16
|
+
static bool is(const ATNState &atnState) { return atnState.getStateType() == ATNStateType::STAR_BLOCK_START; }
|
17
|
+
|
18
|
+
static bool is(const ATNState *atnState) { return atnState != nullptr && is(*atnState); }
|
19
|
+
|
20
|
+
StarBlockStartState() : BlockStartState(ATNStateType::STAR_BLOCK_START) {}
|
18
21
|
};
|
19
22
|
|
20
23
|
} // namespace atn
|
@@ -12,7 +12,9 @@ namespace atn {
|
|
12
12
|
|
13
13
|
class ANTLR4CPP_PUBLIC StarLoopEntryState final : public DecisionState {
|
14
14
|
public:
|
15
|
-
|
15
|
+
static bool is(const ATNState &atnState) { return atnState.getStateType() == ATNStateType::STAR_LOOP_ENTRY; }
|
16
|
+
|
17
|
+
static bool is(const ATNState *atnState) { return atnState != nullptr && is(*atnState); }
|
16
18
|
|
17
19
|
/**
|
18
20
|
* Indicates whether this state can benefit from a precedence DFA during SLL
|
@@ -28,7 +30,7 @@ namespace atn {
|
|
28
30
|
|
29
31
|
StarLoopbackState *loopBackState = nullptr;
|
30
32
|
|
31
|
-
|
33
|
+
StarLoopEntryState() : DecisionState(ATNStateType::STAR_LOOP_ENTRY) {}
|
32
34
|
};
|
33
35
|
|
34
36
|
} // namespace atn
|
@@ -5,15 +5,15 @@
|
|
5
5
|
|
6
6
|
#include "atn/StarLoopEntryState.h"
|
7
7
|
#include "atn/Transition.h"
|
8
|
+
#include "support/Casts.h"
|
8
9
|
|
9
10
|
#include "atn/StarLoopbackState.h"
|
10
11
|
|
11
12
|
using namespace antlr4::atn;
|
12
13
|
|
13
|
-
StarLoopEntryState *StarLoopbackState::getLoopEntryState() {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
return STAR_LOOP_BACK;
|
14
|
+
StarLoopEntryState *StarLoopbackState::getLoopEntryState() const {
|
15
|
+
if (transitions[0]->target != nullptr && transitions[0]->target->getStateType() == ATNStateType::STAR_LOOP_ENTRY) {
|
16
|
+
return antlrcpp::downCast<StarLoopEntryState*>(transitions[0]->target);
|
17
|
+
}
|
18
|
+
return nullptr;
|
19
19
|
}
|