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,8 @@
|
|
7
7
|
|
8
8
|
#include "antlr4-common.h"
|
9
9
|
|
10
|
+
#include "atn/ATNConfigSet.h"
|
11
|
+
|
10
12
|
namespace antlr4 {
|
11
13
|
namespace dfa {
|
12
14
|
|
@@ -35,23 +37,25 @@ namespace dfa {
|
|
35
37
|
/// but with different ATN contexts (with same or different alts)
|
36
38
|
/// meaning that state was reached via a different set of rule invocations.
|
37
39
|
/// </summary>
|
38
|
-
class ANTLR4CPP_PUBLIC DFAState {
|
40
|
+
class ANTLR4CPP_PUBLIC DFAState final {
|
39
41
|
public:
|
40
|
-
|
42
|
+
struct ANTLR4CPP_PUBLIC PredPrediction final {
|
41
43
|
public:
|
42
|
-
Ref<atn::SemanticContext> pred; // never null; at least SemanticContext.NONE
|
44
|
+
Ref<const atn::SemanticContext> pred; // never null; at least SemanticContext.NONE
|
43
45
|
int alt;
|
44
46
|
|
45
|
-
PredPrediction(
|
46
|
-
virtual ~PredPrediction();
|
47
|
+
PredPrediction() = delete;
|
47
48
|
|
48
|
-
|
49
|
+
PredPrediction(const PredPrediction&) = default;
|
50
|
+
PredPrediction(PredPrediction&&) = default;
|
49
51
|
|
50
|
-
|
51
|
-
void InitializeInstanceFields();
|
52
|
-
};
|
52
|
+
PredPrediction(Ref<const atn::SemanticContext> pred, int alt) : pred(std::move(pred)), alt(alt) {}
|
53
53
|
|
54
|
-
|
54
|
+
PredPrediction& operator=(const PredPrediction&) = default;
|
55
|
+
PredPrediction& operator=(PredPrediction&&) = default;
|
56
|
+
|
57
|
+
std::string toString() const;
|
58
|
+
};
|
55
59
|
|
56
60
|
std::unique_ptr<atn::ATNConfigSet> configs;
|
57
61
|
|
@@ -59,24 +63,14 @@ namespace dfa {
|
|
59
63
|
/// <seealso cref="Token#EOF"/> maps to {@code edges[0]}.
|
60
64
|
// ml: this is a sparse list, so we use a map instead of a vector.
|
61
65
|
// Watch out: we no longer have the -1 offset, as it isn't needed anymore.
|
62
|
-
std::unordered_map<size_t, DFAState
|
63
|
-
|
64
|
-
bool isAcceptState;
|
66
|
+
std::unordered_map<size_t, DFAState*> edges;
|
65
67
|
|
66
68
|
/// if accept state, what ttype do we match or alt do we predict?
|
67
69
|
/// This is set to <seealso cref="ATN#INVALID_ALT_NUMBER"/> when <seealso cref="#predicates"/>{@code !=null} or
|
68
70
|
/// <seealso cref="#requiresFullContext"/>.
|
69
|
-
size_t prediction;
|
70
|
-
|
71
|
-
Ref<atn::LexerActionExecutor> lexerActionExecutor;
|
71
|
+
size_t prediction = 0;
|
72
72
|
|
73
|
-
|
74
|
-
/// Indicates that this state was created during SLL prediction that
|
75
|
-
/// discovered a conflict between the configurations in the state. Future
|
76
|
-
/// <seealso cref="ParserATNSimulator#execATN"/> invocations immediately jumped doing
|
77
|
-
/// full context prediction if this field is true.
|
78
|
-
/// </summary>
|
79
|
-
bool requiresFullContext;
|
73
|
+
Ref<const atn::LexerActionExecutor> lexerActionExecutor;
|
80
74
|
|
81
75
|
/// <summary>
|
82
76
|
/// During SLL parsing, this is a list of predicates associated with the
|
@@ -91,21 +85,34 @@ namespace dfa {
|
|
91
85
|
/// <p/>
|
92
86
|
/// This list is computed by <seealso cref="ParserATNSimulator#predicateDFAState"/>.
|
93
87
|
/// </summary>
|
94
|
-
std::vector<PredPrediction
|
88
|
+
std::vector<PredPrediction> predicates;
|
89
|
+
|
90
|
+
int stateNumber = -1;
|
91
|
+
|
92
|
+
bool isAcceptState = false;
|
93
|
+
|
94
|
+
/// <summary>
|
95
|
+
/// Indicates that this state was created during SLL prediction that
|
96
|
+
/// discovered a conflict between the configurations in the state. Future
|
97
|
+
/// <seealso cref="ParserATNSimulator#execATN"/> invocations immediately jumped doing
|
98
|
+
/// full context prediction if this field is true.
|
99
|
+
/// </summary>
|
100
|
+
bool requiresFullContext = false;
|
95
101
|
|
96
102
|
/// Map a predicate to a predicted alternative.
|
97
|
-
DFAState();
|
98
|
-
|
99
|
-
DFAState(
|
100
|
-
|
103
|
+
DFAState() = default;
|
104
|
+
|
105
|
+
explicit DFAState(int stateNumber) : stateNumber(stateNumber) {}
|
106
|
+
|
107
|
+
explicit DFAState(std::unique_ptr<atn::ATNConfigSet> configs) : configs(std::move(configs)) {}
|
101
108
|
|
102
109
|
/// <summary>
|
103
110
|
/// Get the set of all alts mentioned by all ATN configurations in this
|
104
111
|
/// DFA state.
|
105
112
|
/// </summary>
|
106
|
-
|
113
|
+
std::set<size_t> getAltSet() const;
|
107
114
|
|
108
|
-
|
115
|
+
size_t hashCode() const;
|
109
116
|
|
110
117
|
/// Two DFAState instances are equal if their ATN configuration sets
|
111
118
|
/// are the same. This method is used to see if a state already exists.
|
@@ -118,27 +125,29 @@ namespace dfa {
|
|
118
125
|
/// ParserATNSimulator#addDFAState we need to know if any other state
|
119
126
|
/// exists that has this exact set of ATN configurations. The
|
120
127
|
/// stateNumber is irrelevant.
|
121
|
-
bool
|
128
|
+
bool equals(const DFAState &other) const;
|
122
129
|
|
123
|
-
|
130
|
+
std::string toString() const;
|
131
|
+
};
|
124
132
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
return k->hashCode();
|
129
|
-
}
|
130
|
-
};
|
133
|
+
inline bool operator==(const DFAState &lhs, const DFAState &rhs) {
|
134
|
+
return lhs.equals(rhs);
|
135
|
+
}
|
131
136
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
137
|
+
inline bool operator!=(const DFAState &lhs, const DFAState &rhs) {
|
138
|
+
return !operator==(lhs, rhs);
|
139
|
+
}
|
140
|
+
|
141
|
+
} // namespace dfa
|
142
|
+
} // namespace antlr4
|
143
|
+
|
144
|
+
namespace std {
|
138
145
|
|
139
|
-
|
140
|
-
|
146
|
+
template <>
|
147
|
+
struct hash<::antlr4::dfa::DFAState> {
|
148
|
+
size_t operator()(const ::antlr4::dfa::DFAState &dfaState) const {
|
149
|
+
return dfaState.hashCode();
|
150
|
+
}
|
141
151
|
};
|
142
152
|
|
143
|
-
}
|
144
|
-
} // namespace antlr4
|
153
|
+
} // namespace std
|
@@ -9,10 +9,7 @@
|
|
9
9
|
|
10
10
|
using namespace antlr4::dfa;
|
11
11
|
|
12
|
-
LexerDFASerializer::LexerDFASerializer(DFA *dfa) : DFASerializer(dfa, Vocabulary
|
13
|
-
}
|
14
|
-
|
15
|
-
LexerDFASerializer::~LexerDFASerializer() {
|
12
|
+
LexerDFASerializer::LexerDFASerializer(const DFA *dfa) : DFASerializer(dfa, Vocabulary()) {
|
16
13
|
}
|
17
14
|
|
18
15
|
std::string LexerDFASerializer::getEdgeLabel(size_t i) const {
|
@@ -10,13 +10,12 @@
|
|
10
10
|
namespace antlr4 {
|
11
11
|
namespace dfa {
|
12
12
|
|
13
|
-
class ANTLR4CPP_PUBLIC LexerDFASerializer : public DFASerializer {
|
13
|
+
class ANTLR4CPP_PUBLIC LexerDFASerializer final : public DFASerializer {
|
14
14
|
public:
|
15
|
-
LexerDFASerializer(DFA *dfa);
|
16
|
-
virtual ~LexerDFASerializer();
|
15
|
+
explicit LexerDFASerializer(const DFA *dfa);
|
17
16
|
|
18
17
|
protected:
|
19
|
-
|
18
|
+
std::string getEdgeLabel(size_t i) const override;
|
20
19
|
};
|
21
20
|
|
22
21
|
} // namespace atn
|
data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.cpp
CHANGED
@@ -101,7 +101,7 @@ InterpreterData InterpreterDataReader::parseFile(std::string const& fileName) {
|
|
101
101
|
};
|
102
102
|
}
|
103
103
|
|
104
|
-
std::vector<
|
104
|
+
std::vector<int32_t> serializedATN;
|
105
105
|
|
106
106
|
std::getline(input, line, '\n');
|
107
107
|
assert(line == "atn:");
|
@@ -115,7 +115,7 @@ InterpreterData InterpreterDataReader::parseFile(std::string const& fileName) {
|
|
115
115
|
number = std::strtoul(&value[1], nullptr, 10);
|
116
116
|
else
|
117
117
|
number = std::strtoul(value.c_str(), nullptr, 10);
|
118
|
-
serializedATN.push_back(static_cast<
|
118
|
+
serializedATN.push_back(static_cast<int32_t>(number));
|
119
119
|
}
|
120
120
|
|
121
121
|
ATNDeserializer deserializer;
|
data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.h
CHANGED
@@ -6,12 +6,14 @@
|
|
6
6
|
#pragma once
|
7
7
|
|
8
8
|
#include "antlr4-common.h"
|
9
|
+
#include "atn/ATN.h"
|
10
|
+
#include "Vocabulary.h"
|
9
11
|
|
10
12
|
namespace antlr4 {
|
11
13
|
namespace misc {
|
12
14
|
|
13
15
|
struct InterpreterData {
|
14
|
-
atn::ATN atn;
|
16
|
+
std::unique_ptr<atn::ATN> atn;
|
15
17
|
dfa::Vocabulary vocabulary;
|
16
18
|
std::vector<std::string> ruleNames;
|
17
19
|
std::vector<std::string> channels; // Only valid for lexer grammars.
|
@@ -7,35 +7,7 @@
|
|
7
7
|
|
8
8
|
using namespace antlr4::misc;
|
9
9
|
|
10
|
-
|
11
|
-
return static_cast<size_t>(v);
|
12
|
-
}
|
13
|
-
|
14
|
-
ssize_t antlr4::misc::symbolToNumeric(size_t v) {
|
15
|
-
return static_cast<ssize_t>(v);
|
16
|
-
}
|
17
|
-
|
18
|
-
Interval const Interval::INVALID;
|
19
|
-
|
20
|
-
Interval::Interval() : Interval(static_cast<ssize_t>(-1), -2) { // Need an explicit cast here for VS.
|
21
|
-
}
|
22
|
-
|
23
|
-
Interval::Interval(size_t a_, size_t b_) : Interval(symbolToNumeric(a_), symbolToNumeric(b_)) {
|
24
|
-
}
|
25
|
-
|
26
|
-
Interval::Interval(ssize_t a_, ssize_t b_) : a(a_), b(b_) {
|
27
|
-
}
|
28
|
-
|
29
|
-
size_t Interval::length() const {
|
30
|
-
if (b < a) {
|
31
|
-
return 0;
|
32
|
-
}
|
33
|
-
return size_t(b - a + 1);
|
34
|
-
}
|
35
|
-
|
36
|
-
bool Interval::operator == (const Interval &other) const {
|
37
|
-
return a == other.a && b == other.b;
|
38
|
-
}
|
10
|
+
const Interval Interval::INVALID;
|
39
11
|
|
40
12
|
size_t Interval::hashCode() const {
|
41
13
|
size_t hash = 23;
|
@@ -13,11 +13,11 @@ namespace misc {
|
|
13
13
|
// Helpers to convert certain unsigned symbols (e.g. Token::EOF) to their original numeric value (e.g. -1)
|
14
14
|
// and vice versa. This is needed mostly for intervals to keep their original order and for toString()
|
15
15
|
// methods to print the original numeric value (e.g. for tests).
|
16
|
-
size_t numericToSymbol(ssize_t v);
|
17
|
-
ssize_t symbolToNumeric(size_t v);
|
16
|
+
constexpr size_t numericToSymbol(ssize_t v) { return static_cast<size_t>(v); }
|
17
|
+
constexpr ssize_t symbolToNumeric(size_t v) { return static_cast<ssize_t>(v); }
|
18
18
|
|
19
19
|
/// An immutable inclusive interval a..b
|
20
|
-
class ANTLR4CPP_PUBLIC Interval {
|
20
|
+
class ANTLR4CPP_PUBLIC Interval final {
|
21
21
|
public:
|
22
22
|
static const Interval INVALID;
|
23
23
|
|
@@ -25,15 +25,17 @@ namespace misc {
|
|
25
25
|
ssize_t a;
|
26
26
|
ssize_t b;
|
27
27
|
|
28
|
-
Interval()
|
29
|
-
|
30
|
-
Interval(
|
28
|
+
constexpr Interval() : Interval(static_cast<ssize_t>(-1), static_cast<ssize_t>(-2)) {}
|
29
|
+
|
30
|
+
constexpr explicit Interval(size_t a_, size_t b_) : Interval(symbolToNumeric(a_), symbolToNumeric(b_)) {}
|
31
|
+
|
32
|
+
constexpr Interval(ssize_t a_, ssize_t b_) : a(a_), b(b_) {}
|
31
33
|
|
32
34
|
/// return number of elements between a and b inclusively. x..x is length 1.
|
33
35
|
/// if b < a, then length is 0. 9..10 has length 2.
|
34
|
-
size_t length() const;
|
36
|
+
constexpr size_t length() const { return b >= a ? static_cast<size_t>(b - a + 1) : 0; }
|
35
37
|
|
36
|
-
bool operator
|
38
|
+
constexpr bool operator==(const Interval &other) const { return a == other.a && b == other.b; }
|
37
39
|
|
38
40
|
size_t hashCode() const;
|
39
41
|
|
@@ -76,8 +78,6 @@ namespace misc {
|
|
76
78
|
Interval intersection(const Interval &other) const;
|
77
79
|
|
78
80
|
std::string toString() const;
|
79
|
-
|
80
|
-
private:
|
81
81
|
};
|
82
82
|
|
83
83
|
} // namespace atn
|
@@ -13,7 +13,7 @@
|
|
13
13
|
using namespace antlr4;
|
14
14
|
using namespace antlr4::misc;
|
15
15
|
|
16
|
-
IntervalSet const IntervalSet::COMPLETE_CHAR_SET =
|
16
|
+
IntervalSet const IntervalSet::COMPLETE_CHAR_SET =
|
17
17
|
IntervalSet::of(Lexer::MIN_CHAR_VALUE, Lexer::MAX_CHAR_VALUE);
|
18
18
|
|
19
19
|
IntervalSet const IntervalSet::EMPTY_SET;
|
@@ -112,7 +112,7 @@ void IntervalSet::add(const Interval &addition) {
|
|
112
112
|
|
113
113
|
IntervalSet IntervalSet::Or(const std::vector<IntervalSet> &sets) {
|
114
114
|
IntervalSet result;
|
115
|
-
for (auto &s : sets) {
|
115
|
+
for (const auto &s : sets) {
|
116
116
|
result.addAll(s);
|
117
117
|
}
|
118
118
|
return result;
|
@@ -265,18 +265,13 @@ bool IntervalSet::contains(size_t el) const {
|
|
265
265
|
}
|
266
266
|
|
267
267
|
bool IntervalSet::contains(ssize_t el) const {
|
268
|
-
if (_intervals.empty())
|
268
|
+
if (_intervals.empty() || el < _intervals.front().a || el > _intervals.back().b) {
|
269
269
|
return false;
|
270
|
-
|
271
|
-
if (el < _intervals[0].a) // list is sorted and el is before first interval; not here
|
272
|
-
return false;
|
273
|
-
|
274
|
-
for (auto &interval : _intervals) {
|
275
|
-
if (el >= interval.a && el <= interval.b) {
|
276
|
-
return true; // found in this interval
|
277
|
-
}
|
278
270
|
}
|
279
|
-
|
271
|
+
|
272
|
+
return std::binary_search(_intervals.begin(), _intervals.end(), Interval(el, el), [](const Interval &lhs, const Interval &rhs) {
|
273
|
+
return lhs.b < rhs.a;
|
274
|
+
});
|
280
275
|
}
|
281
276
|
|
282
277
|
bool IntervalSet::isEmpty() const {
|
@@ -306,7 +301,7 @@ ssize_t IntervalSet::getMinElement() const {
|
|
306
301
|
return Token::INVALID_TYPE;
|
307
302
|
}
|
308
303
|
|
309
|
-
return _intervals
|
304
|
+
return _intervals.front().a;
|
310
305
|
}
|
311
306
|
|
312
307
|
std::vector<Interval> const& IntervalSet::getIntervals() const {
|
@@ -315,7 +310,7 @@ std::vector<Interval> const& IntervalSet::getIntervals() const {
|
|
315
310
|
|
316
311
|
size_t IntervalSet::hashCode() const {
|
317
312
|
size_t hash = MurmurHash::initialize();
|
318
|
-
for (auto &interval : _intervals) {
|
313
|
+
for (const auto &interval : _intervals) {
|
319
314
|
hash = MurmurHash::update(hash, interval.a);
|
320
315
|
hash = MurmurHash::update(hash, interval.b);
|
321
316
|
}
|
@@ -349,7 +344,7 @@ std::string IntervalSet::toString(bool elemAreChar) const {
|
|
349
344
|
}
|
350
345
|
|
351
346
|
bool firstEntry = true;
|
352
|
-
for (auto &interval : _intervals) {
|
347
|
+
for (const auto &interval : _intervals) {
|
353
348
|
if (!firstEntry)
|
354
349
|
ss << ", ";
|
355
350
|
firstEntry = false;
|
@@ -379,10 +374,6 @@ std::string IntervalSet::toString(bool elemAreChar) const {
|
|
379
374
|
return ss.str();
|
380
375
|
}
|
381
376
|
|
382
|
-
std::string IntervalSet::toString(const std::vector<std::string> &tokenNames) const {
|
383
|
-
return toString(dfa::Vocabulary::fromTokenNames(tokenNames));
|
384
|
-
}
|
385
|
-
|
386
377
|
std::string IntervalSet::toString(const dfa::Vocabulary &vocabulary) const {
|
387
378
|
if (_intervals.empty()) {
|
388
379
|
return "{}";
|
@@ -395,7 +386,7 @@ std::string IntervalSet::toString(const dfa::Vocabulary &vocabulary) const {
|
|
395
386
|
}
|
396
387
|
|
397
388
|
bool firstEntry = true;
|
398
|
-
for (auto &interval : _intervals) {
|
389
|
+
for (const auto &interval : _intervals) {
|
399
390
|
if (!firstEntry)
|
400
391
|
ss << ", ";
|
401
392
|
firstEntry = false;
|
@@ -420,10 +411,6 @@ std::string IntervalSet::toString(const dfa::Vocabulary &vocabulary) const {
|
|
420
411
|
return ss.str();
|
421
412
|
}
|
422
413
|
|
423
|
-
std::string IntervalSet::elementName(const std::vector<std::string> &tokenNames, ssize_t a) const {
|
424
|
-
return elementName(dfa::Vocabulary::fromTokenNames(tokenNames), a);
|
425
|
-
}
|
426
|
-
|
427
414
|
std::string IntervalSet::elementName(const dfa::Vocabulary &vocabulary, ssize_t a) const {
|
428
415
|
if (a == -1) {
|
429
416
|
return "<EOF>";
|
@@ -436,7 +423,7 @@ std::string IntervalSet::elementName(const dfa::Vocabulary &vocabulary, ssize_t
|
|
436
423
|
|
437
424
|
size_t IntervalSet::size() const {
|
438
425
|
size_t result = 0;
|
439
|
-
for (auto &interval : _intervals) {
|
426
|
+
for (const auto &interval : _intervals) {
|
440
427
|
result += size_t(interval.b - interval.a + 1);
|
441
428
|
}
|
442
429
|
return result;
|
@@ -444,7 +431,7 @@ size_t IntervalSet::size() const {
|
|
444
431
|
|
445
432
|
std::vector<ssize_t> IntervalSet::toList() const {
|
446
433
|
std::vector<ssize_t> result;
|
447
|
-
for (auto &interval : _intervals) {
|
434
|
+
for (const auto &interval : _intervals) {
|
448
435
|
ssize_t a = interval.a;
|
449
436
|
ssize_t b = interval.b;
|
450
437
|
for (ssize_t v = a; v <= b; v++) {
|
@@ -456,7 +443,7 @@ std::vector<ssize_t> IntervalSet::toList() const {
|
|
456
443
|
|
457
444
|
std::set<ssize_t> IntervalSet::toSet() const {
|
458
445
|
std::set<ssize_t> result;
|
459
|
-
for (auto &interval : _intervals) {
|
446
|
+
for (const auto &interval : _intervals) {
|
460
447
|
ssize_t a = interval.a;
|
461
448
|
ssize_t b = interval.b;
|
462
449
|
for (ssize_t v = a; v <= b; v++) {
|
@@ -468,7 +455,7 @@ std::set<ssize_t> IntervalSet::toSet() const {
|
|
468
455
|
|
469
456
|
ssize_t IntervalSet::get(size_t i) const {
|
470
457
|
size_t index = 0;
|
471
|
-
for (auto &interval : _intervals) {
|
458
|
+
for (const auto &interval : _intervals) {
|
472
459
|
ssize_t a = interval.a;
|
473
460
|
ssize_t b = interval.b;
|
474
461
|
for (ssize_t v = a; v <= b; v++) {
|
@@ -23,7 +23,7 @@ namespace misc {
|
|
23
23
|
* the range {@link Integer#MIN_VALUE} to {@link Integer#MAX_VALUE}
|
24
24
|
* (inclusive).</p>
|
25
25
|
*/
|
26
|
-
class ANTLR4CPP_PUBLIC IntervalSet {
|
26
|
+
class ANTLR4CPP_PUBLIC IntervalSet final {
|
27
27
|
public:
|
28
28
|
static IntervalSet const COMPLETE_CHAR_SET;
|
29
29
|
static IntervalSet const EMPTY_SET;
|
@@ -151,17 +151,9 @@ namespace misc {
|
|
151
151
|
std::string toString() const;
|
152
152
|
std::string toString(bool elemAreChar) const;
|
153
153
|
|
154
|
-
/**
|
155
|
-
* @deprecated Use {@link #toString(Vocabulary)} instead.
|
156
|
-
*/
|
157
|
-
std::string toString(const std::vector<std::string> &tokenNames) const;
|
158
154
|
std::string toString(const dfa::Vocabulary &vocabulary) const;
|
159
155
|
|
160
156
|
protected:
|
161
|
-
/**
|
162
|
-
* @deprecated Use {@link #elementName(Vocabulary, int)} instead.
|
163
|
-
*/
|
164
|
-
std::string elementName(const std::vector<std::string> &tokenNames, ssize_t a) const;
|
165
157
|
std::string elementName(const dfa::Vocabulary &vocabulary, ssize_t a) const;
|
166
158
|
|
167
159
|
public:
|
@@ -3,6 +3,10 @@
|
|
3
3
|
* can be found in the LICENSE.txt file in the project root.
|
4
4
|
*/
|
5
5
|
|
6
|
+
#include <cstddef>
|
7
|
+
#include <cstdint>
|
8
|
+
#include <cstring>
|
9
|
+
|
6
10
|
#include "misc/MurmurHash.h"
|
7
11
|
|
8
12
|
using namespace antlr4::misc;
|
@@ -17,118 +21,100 @@ using namespace antlr4::misc;
|
|
17
21
|
|
18
22
|
#if defined(_MSC_VER)
|
19
23
|
|
20
|
-
#define FORCE_INLINE __forceinline
|
21
|
-
|
22
24
|
#include <stdlib.h>
|
23
25
|
|
24
26
|
#define ROTL32(x,y) _rotl(x,y)
|
25
27
|
#define ROTL64(x,y) _rotl64(x,y)
|
26
28
|
|
27
|
-
#
|
29
|
+
#elif ANTLR4CPP_HAVE_BUILTIN(__builtin_rotateleft32) && ANTLR4CPP_HAVE_BUILTIN(__builtin_rotateleft64)
|
30
|
+
|
31
|
+
#define ROTL32(x, y) __builtin_rotateleft32(x, y)
|
32
|
+
#define ROTL64(x, y) __builtin_rotateleft64(x, y)
|
28
33
|
|
29
34
|
#else // defined(_MSC_VER)
|
30
35
|
|
31
36
|
// Other compilers
|
32
37
|
|
33
|
-
|
38
|
+
namespace {
|
34
39
|
|
35
|
-
|
36
|
-
{
|
40
|
+
constexpr uint32_t ROTL32(uint32_t x, int r) {
|
37
41
|
return (x << r) | (x >> (32 - r));
|
38
42
|
}
|
39
|
-
|
40
|
-
inline uint64_t rotl64 (uint64_t x, int8_t r)
|
41
|
-
{
|
43
|
+
constexpr uint64_t ROTL64(uint64_t x, int r) {
|
42
44
|
return (x << r) | (x >> (64 - r));
|
43
45
|
}
|
44
46
|
|
45
|
-
#define ROTL32(x,y) rotl32(x,y)
|
46
|
-
#define ROTL64(x,y) rotl64(x,y)
|
47
|
-
|
48
|
-
#define BIG_CONSTANT(x) (x##LLU)
|
49
|
-
|
50
|
-
#endif // !defined(_MSC_VER)
|
51
|
-
|
52
|
-
size_t MurmurHash::initialize() {
|
53
|
-
return initialize(DEFAULT_SEED);
|
54
|
-
}
|
55
|
-
|
56
|
-
size_t MurmurHash::initialize(size_t seed) {
|
57
|
-
return seed;
|
58
47
|
}
|
59
48
|
|
60
|
-
#
|
61
|
-
#if _WIN64
|
62
|
-
#define ENVIRONMENT64
|
63
|
-
#else
|
64
|
-
#define ENVIRONMENT32
|
65
|
-
#endif
|
66
|
-
#endif
|
67
|
-
|
68
|
-
#if defined(__GNUC__)
|
69
|
-
#if defined(__x86_64__) || defined(__ppc64__)
|
70
|
-
#define ENVIRONMENT64
|
71
|
-
#else
|
72
|
-
#define ENVIRONMENT32
|
73
|
-
#endif
|
74
|
-
#endif
|
49
|
+
#endif // !defined(_MSC_VER)
|
75
50
|
|
76
|
-
#if
|
51
|
+
#if SIZE_MAX == UINT64_MAX
|
77
52
|
|
78
53
|
size_t MurmurHash::update(size_t hash, size_t value) {
|
79
|
-
static const size_t c1 = 0xCC9E2D51;
|
80
|
-
static const size_t c2 = 0x1B873593;
|
81
|
-
|
82
54
|
size_t k1 = value;
|
83
|
-
k1 *=
|
84
|
-
k1 =
|
85
|
-
k1 *=
|
55
|
+
k1 *= UINT64_C(0x87c37b91114253d5);
|
56
|
+
k1 = ROTL64(k1, 31);
|
57
|
+
k1 *= UINT64_C(0x4cf5ad432745937f);
|
86
58
|
|
87
59
|
hash ^= k1;
|
88
|
-
hash =
|
89
|
-
hash = hash * 5 +
|
60
|
+
hash = ROTL64(hash, 27);
|
61
|
+
hash = hash * 5 + UINT64_C(0x52dce729);
|
90
62
|
|
91
63
|
return hash;
|
92
64
|
}
|
93
65
|
|
66
|
+
size_t MurmurHash::update(size_t hash, const void *data, size_t size) {
|
67
|
+
size_t value;
|
68
|
+
const uint8_t *bytes = static_cast<const uint8_t*>(data);
|
69
|
+
while (size >= sizeof(size_t)) {
|
70
|
+
std::memcpy(&value, bytes, sizeof(size_t));
|
71
|
+
hash = update(hash, value);
|
72
|
+
bytes += sizeof(size_t);
|
73
|
+
size -= sizeof(size_t);
|
74
|
+
}
|
75
|
+
if (size != 0) {
|
76
|
+
value = 0;
|
77
|
+
std::memcpy(&value, bytes, size);
|
78
|
+
hash = update(hash, value);
|
79
|
+
}
|
80
|
+
return hash;
|
81
|
+
}
|
94
82
|
|
95
83
|
size_t MurmurHash::finish(size_t hash, size_t entryCount) {
|
96
|
-
hash ^= entryCount *
|
97
|
-
hash ^= hash >>
|
98
|
-
hash *=
|
99
|
-
hash ^= hash >>
|
100
|
-
hash *=
|
101
|
-
hash ^= hash >>
|
84
|
+
hash ^= entryCount * 8;
|
85
|
+
hash ^= hash >> 33;
|
86
|
+
hash *= UINT64_C(0xff51afd7ed558ccd);
|
87
|
+
hash ^= hash >> 33;
|
88
|
+
hash *= UINT64_C(0xc4ceb9fe1a85ec53);
|
89
|
+
hash ^= hash >> 33;
|
102
90
|
return hash;
|
103
91
|
}
|
104
92
|
|
105
|
-
#
|
93
|
+
#elif SIZE_MAX == UINT32_MAX
|
106
94
|
|
107
95
|
size_t MurmurHash::update(size_t hash, size_t value) {
|
108
|
-
static const size_t c1 = BIG_CONSTANT(0x87c37b91114253d5);
|
109
|
-
static const size_t c2 = BIG_CONSTANT(0x4cf5ad432745937f);
|
110
|
-
|
111
96
|
size_t k1 = value;
|
112
|
-
k1 *=
|
113
|
-
k1 =
|
114
|
-
k1 *=
|
97
|
+
k1 *= UINT32_C(0xCC9E2D51);
|
98
|
+
k1 = ROTL32(k1, 15);
|
99
|
+
k1 *= UINT32_C(0x1B873593);
|
115
100
|
|
116
101
|
hash ^= k1;
|
117
|
-
hash =
|
118
|
-
hash = hash * 5 +
|
102
|
+
hash = ROTL32(hash, 13);
|
103
|
+
hash = hash * 5 + UINT32_C(0xE6546B64);
|
119
104
|
|
120
105
|
return hash;
|
121
106
|
}
|
122
107
|
|
123
|
-
|
124
108
|
size_t MurmurHash::finish(size_t hash, size_t entryCount) {
|
125
|
-
hash ^= entryCount *
|
126
|
-
hash ^= hash >>
|
127
|
-
hash *=
|
128
|
-
hash ^= hash >>
|
129
|
-
hash *=
|
130
|
-
hash ^= hash >>
|
109
|
+
hash ^= entryCount * 4;
|
110
|
+
hash ^= hash >> 16;
|
111
|
+
hash *= UINT32_C(0x85EBCA6B);
|
112
|
+
hash ^= hash >> 13;
|
113
|
+
hash *= UINT32_C(0xC2B2AE35);
|
114
|
+
hash ^= hash >> 16;
|
131
115
|
return hash;
|
132
116
|
}
|
133
117
|
|
118
|
+
#else
|
119
|
+
#error "Expected sizeof(size_t) to be 4 or 8."
|
134
120
|
#endif
|