expressir 1.2.3 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.cross_rubies +0 -6
- data/.github/workflows/rake.yml +223 -31
- data/.gitignore +7 -1
- data/.gitmodules +3 -0
- data/.rubocop.yml +13 -4
- data/README.adoc +8 -0
- data/Rakefile +4 -1
- data/bin/console +0 -1
- data/bin/rspec +3 -3
- data/exe/expressir +4 -2
- data/exe/format +1 -1
- data/exe/format-test +25 -25
- data/exe/generate-parser +16 -13
- data/expressir.gemspec +11 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/CMakeLists.txt +44 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj +11 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj.filters +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj +11 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj.filters +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2017.vcxproj +11 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2017.vcxproj.filters +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj +19 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj.filters +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj +51 -35
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4.xcscheme +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_ios.xcscheme +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_static.xcscheme +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.cpp +1 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.h +9 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +43 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.h +16 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.cpp +2 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp +16 -13
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.h +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.cpp +5 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.cpp +2 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.h +9 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.cpp +0 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.h +1 -7
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.h +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.cpp +51 -31
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.h +1 -7
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.cpp +27 -39
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.h +1 -7
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.cpp +20 -23
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.h +21 -21
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.cpp +4 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.cpp +0 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.cpp +16 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.h +12 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.cpp +4 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.h +5 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.cpp +2 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.h +7 -7
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp +6 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp +15 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.h +12 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Version.h +42 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.cpp +13 -53
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.h +11 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-common.h +19 -58
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-runtime.h +7 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.cpp +6 -57
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.h +35 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.cpp +29 -36
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.h +36 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp +58 -54
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.h +77 -31
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.cpp +22 -32
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.h +22 -24
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp +335 -464
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.h +9 -62
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.cpp +9 -39
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.h +6 -22
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.cpp +10 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.h +42 -36
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.cpp +33 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.h +36 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.cpp +2 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.cpp +49 -22
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.h +20 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.cpp +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.h +5 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.h +5 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.h +10 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.cpp +0 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.h +12 -8
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.cpp +2 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.h +6 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp +139 -108
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.h +10 -43
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.cpp +16 -33
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.h +12 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp +69 -82
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.h +17 -28
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.cpp +12 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.h +45 -11
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.cpp +48 -44
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.h +31 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionType.h +3 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.cpp +14 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.cpp +15 -32
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.h +12 -24
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.cpp +23 -29
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.h +13 -19
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp +13 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.cpp +6 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.cpp +6 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.cpp +13 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.cpp +6 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.h +11 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.cpp +13 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.h +13 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.h +5 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.cpp +1 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.cpp +6 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.h +8 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp +169 -152
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.h +26 -19
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulatorOptions.h +50 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.h +5 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.h +5 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.cpp +2 -11
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.h +15 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.h +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.cpp +4 -14
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.h +22 -11
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.cpp +255 -338
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.h +87 -116
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.cpp +56 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.h +64 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.cpp +167 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.h +101 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCacheOptions.h +71 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextType.h +21 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.cpp +18 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.h +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.cpp +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.h +4 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.cpp +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.h +5 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.cpp +197 -156
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.h +92 -81
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContextType.h +23 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SerializedATNView.h +101 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.cpp +2 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.h +11 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp +39 -34
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.h +17 -10
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.h +5 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.cpp +6 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.h +6 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.h +5 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.cpp +1 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.h +11 -22
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.cpp +27 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.h +33 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.cpp +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.cpp +11 -23
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.h +20 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.cpp +2 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.h +4 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.cpp +9 -50
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.h +57 -48
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.cpp +1 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.h +3 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.h +3 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.cpp +1 -29
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.h +10 -10
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.cpp +15 -28
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.h +1 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.cpp +54 -68
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.h +35 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.cpp +0 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.h +1 -155
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.h +39 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/BitSet.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.cpp +13 -54
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.h +16 -29
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Casts.h +34 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Declarations.h +0 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.cpp +25 -23
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.h +2 -40
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Unicode.h +28 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.cpp +242 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.h +54 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h +13 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.h +7 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.cpp +36 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.h +14 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.cpp +14 -19
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.cpp +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.h +14 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeType.h +22 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.h +4 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.cpp +8 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.h +30 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.h +10 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp +2 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.h +4 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp +1 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.cpp +128 -119
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.h +18 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/tests/Utf8Test.cpp +110 -0
- data/ext/express-parser/antlrgen/Express.interp +1 -1
- data/ext/express-parser/antlrgen/ExpressBaseListener.cpp +1 -1
- data/ext/express-parser/antlrgen/ExpressBaseListener.h +1 -1
- data/ext/express-parser/antlrgen/ExpressBaseVisitor.cpp +1 -1
- data/ext/express-parser/antlrgen/ExpressBaseVisitor.h +200 -200
- data/ext/express-parser/antlrgen/ExpressLexer.cpp +645 -1129
- data/ext/express-parser/antlrgen/ExpressLexer.h +20 -27
- data/ext/express-parser/antlrgen/ExpressLexer.interp +1 -1
- data/ext/express-parser/antlrgen/ExpressListener.cpp +1 -1
- data/ext/express-parser/antlrgen/ExpressListener.h +1 -1
- data/ext/express-parser/antlrgen/ExpressParser.cpp +1754 -1447
- data/ext/express-parser/antlrgen/ExpressParser.h +219 -223
- data/ext/express-parser/antlrgen/ExpressVisitor.cpp +1 -1
- data/ext/express-parser/antlrgen/ExpressVisitor.h +200 -200
- data/ext/express-parser/express_parser.cpp +165 -101
- data/ext/express-parser/extconf.rb +14 -14
- data/lib/expressir/config.rb +1 -1
- data/lib/expressir/express/parser.rb +17 -15
- data/lib/expressir/express/visitor.rb +7 -3
- data/lib/expressir/model.rb +78 -78
- data/lib/expressir/version.rb +1 -1
- data/rakelib/antlr4-native.rake +161 -0
- data/rakelib/cross-ruby.rake +213 -162
- data/spec/acceptance/version_spec.rb +17 -2
- data/spec/expressir/express/cache_spec.rb +23 -5
- data/spec/expressir/express/formatter_spec.rb +54 -8
- data/spec/expressir/express/parser_spec.rb +47 -11
- data/spec/expressir/model/model_element_spec.rb +198 -146
- data/spec/spec_helper.rb +7 -0
- metadata +79 -91
- data/demo.rb +0 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.cpp +0 -621
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.h +0 -61
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.cpp +0 -14
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.h +0 -24
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.cpp +0 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.cpp +0 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.cpp +0 -35
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.h +0 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Makefile +0 -67
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.cpp +0 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.cpp +0 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/guid.cpp +0 -303
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/guid.h +0 -112
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.cpp +0 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.cpp +0 -9
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.exp +0 -9589
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.owl +0 -36619
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.xml +0 -13294
- data/original/examples/employment/eclipse/.project +0 -17
- data/original/examples/employment/eclipse/Export/Employment.png +0 -0
- data/original/examples/employment/eclipse/Express/employment_schema.exp +0 -33
- data/original/examples/employment/eclipse/Express/employment_schema.xmi +0 -77
- data/original/examples/employment/eclipse/Express/employment_schema.xml +0 -93
- data/original/examples/employment/eclipse/Models/Employment.uml +0 -4
- data/original/examples/employment/eclipse/Models/Employment.umldi +0 -240
- data/original/examples/employment/eclipse/readme.txt +0 -7
- data/original/examples/employment/employment_schema.exp +0 -33
- data/original/examples/employment/employment_schema.rb +0 -232
- data/original/examples/employment/employment_schema.xml +0 -93
- data/original/examples/employment/employment_schema___module.rb +0 -46
- data/original/examples/employment/employment_schema___p28attr.rb +0 -126
- data/original/examples/employment/employment_schema___p28inst.rb +0 -26
- data/original/examples/employment/example_employment_data.xml +0 -1
- data/original/examples/employment/example_employment_data_copy.xml +0 -1
- data/original/examples/employment/example_employment_reader.rb +0 -30
- data/original/examples/employment/example_employment_writer.rb +0 -51
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.exp +0 -3710
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.owl +0 -35880
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xmi +0 -15357
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xml +0 -9468
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.exp +0 -8404
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.owl +0 -43147
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xmi +0 -18341
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xml +0 -11632
- data/original/exp2ruby.rb +0 -525
- data/original/expsm.rb +0 -34
- data/original/mapping_owl.rb +0 -1018
- data/original/mapping_sysml.rb +0 -2281
- data/original/mapping_uml2.rb +0 -599
- data/original/mapping_uml2_eclipse.rb +0 -433
- data/original/reeper.rb +0 -134
- data/spec/expressr_spec.rb +0 -5
@@ -5,52 +5,39 @@
|
|
5
5
|
|
6
6
|
#include "misc/MurmurHash.h"
|
7
7
|
#include "Lexer.h"
|
8
|
+
#include "support/Casts.h"
|
8
9
|
|
9
10
|
#include "atn/LexerModeAction.h"
|
10
11
|
|
11
12
|
using namespace antlr4;
|
12
13
|
using namespace antlr4::atn;
|
13
14
|
using namespace antlr4::misc;
|
15
|
+
using namespace antlrcpp;
|
14
16
|
|
15
|
-
LexerModeAction::LexerModeAction(int mode) : _mode(mode) {
|
16
|
-
}
|
17
|
-
|
18
|
-
int LexerModeAction::getMode() {
|
19
|
-
return _mode;
|
20
|
-
}
|
21
|
-
|
22
|
-
LexerActionType LexerModeAction::getActionType() const {
|
23
|
-
return LexerActionType::MODE;
|
24
|
-
}
|
17
|
+
LexerModeAction::LexerModeAction(int mode) : LexerAction(LexerActionType::MODE, false), _mode(mode) {}
|
25
18
|
|
26
|
-
|
27
|
-
|
19
|
+
void LexerModeAction::execute(Lexer *lexer) const {
|
20
|
+
lexer->setMode(getMode());
|
28
21
|
}
|
29
22
|
|
30
|
-
|
31
|
-
lexer->setMode(_mode);
|
32
|
-
}
|
33
|
-
|
34
|
-
size_t LexerModeAction::hashCode() const {
|
23
|
+
size_t LexerModeAction::hashCodeImpl() const {
|
35
24
|
size_t hash = MurmurHash::initialize();
|
36
25
|
hash = MurmurHash::update(hash, static_cast<size_t>(getActionType()));
|
37
|
-
hash = MurmurHash::update(hash,
|
26
|
+
hash = MurmurHash::update(hash, getMode());
|
38
27
|
return MurmurHash::finish(hash, 2);
|
39
28
|
}
|
40
29
|
|
41
|
-
bool LexerModeAction::
|
42
|
-
if (
|
30
|
+
bool LexerModeAction::equals(const LexerAction &other) const {
|
31
|
+
if (this == std::addressof(other)) {
|
43
32
|
return true;
|
44
33
|
}
|
45
|
-
|
46
|
-
const LexerModeAction *action = dynamic_cast<const LexerModeAction *>(&obj);
|
47
|
-
if (action == nullptr) {
|
34
|
+
if (getActionType() != other.getActionType()) {
|
48
35
|
return false;
|
49
36
|
}
|
50
|
-
|
51
|
-
return
|
37
|
+
const auto &lexerAction = downCast<const LexerModeAction&>(other);
|
38
|
+
return getMode() == lexerAction.getMode();
|
52
39
|
}
|
53
40
|
|
54
41
|
std::string LexerModeAction::toString() const {
|
55
|
-
return "mode(" + std::to_string(
|
42
|
+
return "mode(" + std::to_string(getMode()) + ")";
|
56
43
|
}
|
@@ -20,26 +20,20 @@ namespace atn {
|
|
20
20
|
/// </summary>
|
21
21
|
class ANTLR4CPP_PUBLIC LexerModeAction final : public LexerAction {
|
22
22
|
public:
|
23
|
+
static bool is(const LexerAction &lexerAction) { return lexerAction.getActionType() == LexerActionType::MODE; }
|
24
|
+
|
25
|
+
static bool is(const LexerAction *lexerAction) { return lexerAction != nullptr && is(*lexerAction); }
|
26
|
+
|
23
27
|
/// <summary>
|
24
28
|
/// Constructs a new {@code mode} action with the specified mode value. </summary>
|
25
29
|
/// <param name="mode"> The mode value to pass to <seealso cref="Lexer#mode"/>. </param>
|
26
|
-
LexerModeAction(int mode);
|
30
|
+
explicit LexerModeAction(int mode);
|
27
31
|
|
28
32
|
/// <summary>
|
29
33
|
/// Get the lexer mode this action should transition the lexer to.
|
30
34
|
/// </summary>
|
31
35
|
/// <returns> The lexer mode for this {@code mode} command. </returns>
|
32
|
-
int getMode();
|
33
|
-
|
34
|
-
/// <summary>
|
35
|
-
/// {@inheritDoc} </summary>
|
36
|
-
/// <returns> This method returns <seealso cref="LexerActionType#MODE"/>. </returns>
|
37
|
-
virtual LexerActionType getActionType() const override;
|
38
|
-
|
39
|
-
/// <summary>
|
40
|
-
/// {@inheritDoc} </summary>
|
41
|
-
/// <returns> This method returns {@code false}. </returns>
|
42
|
-
virtual bool isPositionDependent() const override;
|
36
|
+
int getMode() const { return _mode; }
|
43
37
|
|
44
38
|
/// <summary>
|
45
39
|
/// {@inheritDoc}
|
@@ -47,11 +41,13 @@ namespace atn {
|
|
47
41
|
/// <para>This action is implemented by calling <seealso cref="Lexer#mode"/> with the
|
48
42
|
/// value provided by <seealso cref="#getMode"/>.</para>
|
49
43
|
/// </summary>
|
50
|
-
|
44
|
+
void execute(Lexer *lexer) const override;
|
45
|
+
|
46
|
+
bool equals(const LexerAction &obj) const override;
|
47
|
+
std::string toString() const override;
|
51
48
|
|
52
|
-
|
53
|
-
|
54
|
-
virtual std::string toString() const override;
|
49
|
+
protected:
|
50
|
+
size_t hashCodeImpl() const override;
|
55
51
|
|
56
52
|
private:
|
57
53
|
const int _mode;
|
@@ -12,34 +12,23 @@ using namespace antlr4;
|
|
12
12
|
using namespace antlr4::atn;
|
13
13
|
using namespace antlr4::misc;
|
14
14
|
|
15
|
-
const Ref<LexerMoreAction
|
16
|
-
static Ref<LexerMoreAction> instance(new LexerMoreAction());
|
15
|
+
const Ref<const LexerMoreAction>& LexerMoreAction::getInstance() {
|
16
|
+
static const Ref<const LexerMoreAction> instance(new LexerMoreAction());
|
17
17
|
return instance;
|
18
18
|
}
|
19
19
|
|
20
|
-
LexerMoreAction::
|
21
|
-
}
|
22
|
-
|
23
|
-
LexerActionType LexerMoreAction::getActionType() const {
|
24
|
-
return LexerActionType::MORE;
|
25
|
-
}
|
26
|
-
|
27
|
-
bool LexerMoreAction::isPositionDependent() const {
|
28
|
-
return false;
|
29
|
-
}
|
30
|
-
|
31
|
-
void LexerMoreAction::execute(Lexer *lexer) {
|
20
|
+
void LexerMoreAction::execute(Lexer *lexer) const {
|
32
21
|
lexer->more();
|
33
22
|
}
|
34
23
|
|
35
|
-
size_t LexerMoreAction::
|
24
|
+
size_t LexerMoreAction::hashCodeImpl() const {
|
36
25
|
size_t hash = MurmurHash::initialize();
|
37
26
|
hash = MurmurHash::update(hash, static_cast<size_t>(getActionType()));
|
38
27
|
return MurmurHash::finish(hash, 1);
|
39
28
|
}
|
40
29
|
|
41
|
-
bool LexerMoreAction::
|
42
|
-
return
|
30
|
+
bool LexerMoreAction::equals(const LexerAction &other) const {
|
31
|
+
return this == std::addressof(other);
|
43
32
|
}
|
44
33
|
|
45
34
|
std::string LexerMoreAction::toString() const {
|
@@ -22,35 +22,31 @@ namespace atn {
|
|
22
22
|
/// </summary>
|
23
23
|
class ANTLR4CPP_PUBLIC LexerMoreAction final : public LexerAction {
|
24
24
|
public:
|
25
|
-
|
26
|
-
/// Provides a singleton instance of this parameterless lexer action.
|
27
|
-
/// </summary>
|
28
|
-
static const Ref<LexerMoreAction> getInstance();
|
25
|
+
static bool is(const LexerAction &lexerAction) { return lexerAction.getActionType() == LexerActionType::MORE; }
|
29
26
|
|
30
|
-
|
31
|
-
/// {@inheritDoc} </summary>
|
32
|
-
/// <returns> This method returns <seealso cref="LexerActionType#MORE"/>. </returns>
|
33
|
-
virtual LexerActionType getActionType() const override;
|
27
|
+
static bool is(const LexerAction *lexerAction) { return lexerAction != nullptr && is(*lexerAction); }
|
34
28
|
|
35
29
|
/// <summary>
|
36
|
-
///
|
37
|
-
///
|
38
|
-
|
30
|
+
/// Provides a singleton instance of this parameterless lexer action.
|
31
|
+
/// </summary>
|
32
|
+
static const Ref<const LexerMoreAction>& getInstance();
|
39
33
|
|
40
34
|
/// <summary>
|
41
35
|
/// {@inheritDoc}
|
42
36
|
///
|
43
37
|
/// <para>This action is implemented by calling <seealso cref="Lexer#more"/>.</para>
|
44
38
|
/// </summary>
|
45
|
-
|
39
|
+
void execute(Lexer *lexer) const override;
|
40
|
+
|
41
|
+
bool equals(const LexerAction &obj) const override;
|
42
|
+
std::string toString() const override;
|
46
43
|
|
47
|
-
|
48
|
-
|
49
|
-
virtual std::string toString() const override;
|
44
|
+
protected:
|
45
|
+
size_t hashCodeImpl() const override;
|
50
46
|
|
51
47
|
private:
|
52
48
|
/// Constructs the singleton instance of the lexer {@code more} command.
|
53
|
-
LexerMoreAction()
|
49
|
+
LexerMoreAction() : LexerAction(LexerActionType::MORE, false) {}
|
54
50
|
};
|
55
51
|
|
56
52
|
} // namespace atn
|
@@ -12,34 +12,23 @@ using namespace antlr4;
|
|
12
12
|
using namespace antlr4::atn;
|
13
13
|
using namespace antlr4::misc;
|
14
14
|
|
15
|
-
const Ref<LexerPopModeAction
|
16
|
-
static Ref<LexerPopModeAction> instance(new LexerPopModeAction());
|
15
|
+
const Ref<const LexerPopModeAction>& LexerPopModeAction::getInstance() {
|
16
|
+
static const Ref<const LexerPopModeAction> instance(new LexerPopModeAction());
|
17
17
|
return instance;
|
18
18
|
}
|
19
19
|
|
20
|
-
LexerPopModeAction::
|
21
|
-
}
|
22
|
-
|
23
|
-
LexerActionType LexerPopModeAction::getActionType() const {
|
24
|
-
return LexerActionType::POP_MODE;
|
25
|
-
}
|
26
|
-
|
27
|
-
bool LexerPopModeAction::isPositionDependent() const {
|
28
|
-
return false;
|
29
|
-
}
|
30
|
-
|
31
|
-
void LexerPopModeAction::execute(Lexer *lexer) {
|
20
|
+
void LexerPopModeAction::execute(Lexer *lexer) const {
|
32
21
|
lexer->popMode();
|
33
22
|
}
|
34
23
|
|
35
|
-
size_t LexerPopModeAction::
|
24
|
+
size_t LexerPopModeAction::hashCodeImpl() const {
|
36
25
|
size_t hash = MurmurHash::initialize();
|
37
26
|
hash = MurmurHash::update(hash, static_cast<size_t>(getActionType()));
|
38
27
|
return MurmurHash::finish(hash, 1);
|
39
28
|
}
|
40
29
|
|
41
|
-
bool LexerPopModeAction::
|
42
|
-
return
|
30
|
+
bool LexerPopModeAction::equals(const LexerAction &other) const {
|
31
|
+
return this == std::addressof(other);
|
43
32
|
}
|
44
33
|
|
45
34
|
std::string LexerPopModeAction::toString() const {
|
@@ -22,35 +22,31 @@ namespace atn {
|
|
22
22
|
/// </summary>
|
23
23
|
class ANTLR4CPP_PUBLIC LexerPopModeAction final : public LexerAction {
|
24
24
|
public:
|
25
|
-
|
26
|
-
/// Provides a singleton instance of this parameterless lexer action.
|
27
|
-
/// </summary>
|
28
|
-
static const Ref<LexerPopModeAction> getInstance();
|
25
|
+
static bool is(const LexerAction &lexerAction) { return lexerAction.getActionType() == LexerActionType::POP_MODE; }
|
29
26
|
|
30
|
-
|
31
|
-
/// {@inheritDoc} </summary>
|
32
|
-
/// <returns> This method returns <seealso cref="LexerActionType#POP_MODE"/>. </returns>
|
33
|
-
virtual LexerActionType getActionType() const override;
|
27
|
+
static bool is(const LexerAction *lexerAction) { return lexerAction != nullptr && is(*lexerAction); }
|
34
28
|
|
35
29
|
/// <summary>
|
36
|
-
///
|
37
|
-
///
|
38
|
-
|
30
|
+
/// Provides a singleton instance of this parameterless lexer action.
|
31
|
+
/// </summary>
|
32
|
+
static const Ref<const LexerPopModeAction>& getInstance();
|
39
33
|
|
40
34
|
/// <summary>
|
41
35
|
/// {@inheritDoc}
|
42
36
|
///
|
43
37
|
/// <para>This action is implemented by calling <seealso cref="Lexer#popMode"/>.</para>
|
44
38
|
/// </summary>
|
45
|
-
|
39
|
+
void execute(Lexer *lexer) const override;
|
40
|
+
|
41
|
+
bool equals(const LexerAction &other) const override;
|
42
|
+
std::string toString() const override;
|
46
43
|
|
47
|
-
|
48
|
-
|
49
|
-
virtual std::string toString() const override;
|
44
|
+
protected:
|
45
|
+
size_t hashCodeImpl() const override;
|
50
46
|
|
51
47
|
private:
|
52
48
|
/// Constructs the singleton instance of the lexer {@code popMode} command.
|
53
|
-
LexerPopModeAction()
|
49
|
+
LexerPopModeAction() : LexerAction(LexerActionType::POP_MODE, false) {}
|
54
50
|
};
|
55
51
|
|
56
52
|
} // namespace atn
|
@@ -5,52 +5,39 @@
|
|
5
5
|
|
6
6
|
#include "misc/MurmurHash.h"
|
7
7
|
#include "Lexer.h"
|
8
|
+
#include "support/Casts.h"
|
8
9
|
|
9
10
|
#include "atn/LexerPushModeAction.h"
|
10
11
|
|
11
12
|
using namespace antlr4;
|
12
13
|
using namespace antlr4::atn;
|
13
14
|
using namespace antlr4::misc;
|
15
|
+
using namespace antlrcpp;
|
14
16
|
|
15
|
-
LexerPushModeAction::LexerPushModeAction(int mode) : _mode(mode) {
|
16
|
-
}
|
17
|
-
|
18
|
-
int LexerPushModeAction::getMode() const {
|
19
|
-
return _mode;
|
20
|
-
}
|
21
|
-
|
22
|
-
LexerActionType LexerPushModeAction::getActionType() const {
|
23
|
-
return LexerActionType::PUSH_MODE;
|
24
|
-
}
|
17
|
+
LexerPushModeAction::LexerPushModeAction(int mode) : LexerAction(LexerActionType::PUSH_MODE, false), _mode(mode) {}
|
25
18
|
|
26
|
-
|
27
|
-
|
19
|
+
void LexerPushModeAction::execute(Lexer *lexer) const {
|
20
|
+
lexer->pushMode(getMode());
|
28
21
|
}
|
29
22
|
|
30
|
-
|
31
|
-
lexer->pushMode(_mode);
|
32
|
-
}
|
33
|
-
|
34
|
-
size_t LexerPushModeAction::hashCode() const {
|
23
|
+
size_t LexerPushModeAction::hashCodeImpl() const {
|
35
24
|
size_t hash = MurmurHash::initialize();
|
36
25
|
hash = MurmurHash::update(hash, static_cast<size_t>(getActionType()));
|
37
|
-
hash = MurmurHash::update(hash,
|
26
|
+
hash = MurmurHash::update(hash, getMode());
|
38
27
|
return MurmurHash::finish(hash, 2);
|
39
28
|
}
|
40
29
|
|
41
|
-
bool LexerPushModeAction::
|
42
|
-
if (
|
30
|
+
bool LexerPushModeAction::equals(const LexerAction &other) const {
|
31
|
+
if (this == std::addressof(other)) {
|
43
32
|
return true;
|
44
33
|
}
|
45
|
-
|
46
|
-
const LexerPushModeAction *action = dynamic_cast<const LexerPushModeAction *>(&obj);
|
47
|
-
if (action == nullptr) {
|
34
|
+
if (getActionType() != other.getActionType()) {
|
48
35
|
return false;
|
49
36
|
}
|
50
|
-
|
51
|
-
return
|
37
|
+
const auto &lexerAction = downCast<const LexerPushModeAction&>(other);
|
38
|
+
return getMode() == lexerAction.getMode();
|
52
39
|
}
|
53
40
|
|
54
41
|
std::string LexerPushModeAction::toString() const {
|
55
|
-
return "pushMode(" + std::to_string(
|
42
|
+
return "pushMode(" + std::to_string(getMode()) + ")";
|
56
43
|
}
|
@@ -20,26 +20,20 @@ namespace atn {
|
|
20
20
|
/// </summary>
|
21
21
|
class ANTLR4CPP_PUBLIC LexerPushModeAction final : public LexerAction {
|
22
22
|
public:
|
23
|
+
static bool is(const LexerAction &lexerAction) { return lexerAction.getActionType() == LexerActionType::PUSH_MODE; }
|
24
|
+
|
25
|
+
static bool is(const LexerAction *lexerAction) { return lexerAction != nullptr && is(*lexerAction); }
|
26
|
+
|
23
27
|
/// <summary>
|
24
28
|
/// Constructs a new {@code pushMode} action with the specified mode value. </summary>
|
25
29
|
/// <param name="mode"> The mode value to pass to <seealso cref="Lexer#pushMode"/>. </param>
|
26
|
-
LexerPushModeAction(int mode);
|
30
|
+
explicit LexerPushModeAction(int mode);
|
27
31
|
|
28
32
|
/// <summary>
|
29
33
|
/// Get the lexer mode this action should transition the lexer to.
|
30
34
|
/// </summary>
|
31
35
|
/// <returns> The lexer mode for this {@code pushMode} command. </returns>
|
32
|
-
int getMode() const;
|
33
|
-
|
34
|
-
/// <summary>
|
35
|
-
/// {@inheritDoc} </summary>
|
36
|
-
/// <returns> This method returns <seealso cref="LexerActionType#PUSH_MODE"/>. </returns>
|
37
|
-
virtual LexerActionType getActionType() const override;
|
38
|
-
|
39
|
-
/// <summary>
|
40
|
-
/// {@inheritDoc} </summary>
|
41
|
-
/// <returns> This method returns {@code false}. </returns>
|
42
|
-
virtual bool isPositionDependent() const override;
|
36
|
+
int getMode() const { return _mode; }
|
43
37
|
|
44
38
|
/// <summary>
|
45
39
|
/// {@inheritDoc}
|
@@ -47,11 +41,13 @@ namespace atn {
|
|
47
41
|
/// <para>This action is implemented by calling <seealso cref="Lexer#pushMode"/> with the
|
48
42
|
/// value provided by <seealso cref="#getMode"/>.</para>
|
49
43
|
/// </summary>
|
50
|
-
|
44
|
+
void execute(Lexer *lexer) const override;
|
45
|
+
|
46
|
+
bool equals(const LexerAction &obj) const override;
|
47
|
+
std::string toString() const override;
|
51
48
|
|
52
|
-
|
53
|
-
|
54
|
-
virtual std::string toString() const override;
|
49
|
+
protected:
|
50
|
+
size_t hashCodeImpl() const override;
|
55
51
|
|
56
52
|
private:
|
57
53
|
const int _mode;
|
@@ -12,34 +12,23 @@ using namespace antlr4;
|
|
12
12
|
using namespace antlr4::atn;
|
13
13
|
using namespace antlr4::misc;
|
14
14
|
|
15
|
-
const Ref<LexerSkipAction
|
16
|
-
static Ref<LexerSkipAction> instance(new LexerSkipAction());
|
15
|
+
const Ref<const LexerSkipAction>& LexerSkipAction::getInstance() {
|
16
|
+
static const Ref<const LexerSkipAction> instance(new LexerSkipAction());
|
17
17
|
return instance;
|
18
18
|
}
|
19
19
|
|
20
|
-
LexerSkipAction::
|
21
|
-
}
|
22
|
-
|
23
|
-
LexerActionType LexerSkipAction::getActionType() const {
|
24
|
-
return LexerActionType::SKIP;
|
25
|
-
}
|
26
|
-
|
27
|
-
bool LexerSkipAction::isPositionDependent() const {
|
28
|
-
return false;
|
29
|
-
}
|
30
|
-
|
31
|
-
void LexerSkipAction::execute(Lexer *lexer) {
|
20
|
+
void LexerSkipAction::execute(Lexer *lexer) const {
|
32
21
|
lexer->skip();
|
33
22
|
}
|
34
23
|
|
35
|
-
size_t LexerSkipAction::
|
24
|
+
size_t LexerSkipAction::hashCodeImpl() const {
|
36
25
|
size_t hash = MurmurHash::initialize();
|
37
26
|
hash = MurmurHash::update(hash, static_cast<size_t>(getActionType()));
|
38
27
|
return MurmurHash::finish(hash, 1);
|
39
28
|
}
|
40
29
|
|
41
|
-
bool LexerSkipAction::
|
42
|
-
return
|
30
|
+
bool LexerSkipAction::equals(const LexerAction &other) const {
|
31
|
+
return this == std::addressof(other);
|
43
32
|
}
|
44
33
|
|
45
34
|
std::string LexerSkipAction::toString() const {
|
@@ -22,33 +22,29 @@ namespace atn {
|
|
22
22
|
/// </summary>
|
23
23
|
class ANTLR4CPP_PUBLIC LexerSkipAction final : public LexerAction {
|
24
24
|
public:
|
25
|
-
|
26
|
-
static const Ref<LexerSkipAction> getInstance();
|
25
|
+
static bool is(const LexerAction &lexerAction) { return lexerAction.getActionType() == LexerActionType::SKIP; }
|
27
26
|
|
28
|
-
|
29
|
-
/// {@inheritDoc} </summary>
|
30
|
-
/// <returns> This method returns <seealso cref="LexerActionType#SKIP"/>. </returns>
|
31
|
-
virtual LexerActionType getActionType() const override;
|
27
|
+
static bool is(const LexerAction *lexerAction) { return lexerAction != nullptr && is(*lexerAction); }
|
32
28
|
|
33
|
-
///
|
34
|
-
|
35
|
-
/// <returns> This method returns {@code false}. </returns>
|
36
|
-
virtual bool isPositionDependent() const override;
|
29
|
+
/// Provides a singleton instance of this parameterless lexer action.
|
30
|
+
static const Ref<const LexerSkipAction>& getInstance();
|
37
31
|
|
38
32
|
/// <summary>
|
39
33
|
/// {@inheritDoc}
|
40
34
|
///
|
41
35
|
/// <para>This action is implemented by calling <seealso cref="Lexer#skip"/>.</para>
|
42
36
|
/// </summary>
|
43
|
-
|
37
|
+
void execute(Lexer *lexer) const override;
|
38
|
+
|
39
|
+
bool equals(const LexerAction &obj) const override;
|
40
|
+
std::string toString() const override;
|
44
41
|
|
45
|
-
|
46
|
-
|
47
|
-
virtual std::string toString() const override;
|
42
|
+
protected:
|
43
|
+
size_t hashCodeImpl() const override;
|
48
44
|
|
49
45
|
private:
|
50
46
|
/// Constructs the singleton instance of the lexer {@code skip} command.
|
51
|
-
LexerSkipAction()
|
47
|
+
LexerSkipAction() : LexerAction(LexerActionType::SKIP, false) {}
|
52
48
|
};
|
53
49
|
|
54
50
|
} // namespace atn
|
@@ -5,52 +5,39 @@
|
|
5
5
|
|
6
6
|
#include "misc/MurmurHash.h"
|
7
7
|
#include "Lexer.h"
|
8
|
+
#include "support/Casts.h"
|
8
9
|
|
9
10
|
#include "atn/LexerTypeAction.h"
|
10
11
|
|
11
12
|
using namespace antlr4;
|
12
13
|
using namespace antlr4::atn;
|
13
14
|
using namespace antlr4::misc;
|
15
|
+
using namespace antlrcpp;
|
14
16
|
|
15
|
-
LexerTypeAction::LexerTypeAction(int type) : _type(type) {
|
16
|
-
}
|
17
|
-
|
18
|
-
int LexerTypeAction::getType() const {
|
19
|
-
return _type;
|
20
|
-
}
|
21
|
-
|
22
|
-
LexerActionType LexerTypeAction::getActionType() const {
|
23
|
-
return LexerActionType::TYPE;
|
24
|
-
}
|
17
|
+
LexerTypeAction::LexerTypeAction(int type) : LexerAction(LexerActionType::TYPE, false), _type(type) {}
|
25
18
|
|
26
|
-
|
27
|
-
|
19
|
+
void LexerTypeAction::execute(Lexer *lexer) const {
|
20
|
+
lexer->setType(getType());
|
28
21
|
}
|
29
22
|
|
30
|
-
|
31
|
-
lexer->setType(_type);
|
32
|
-
}
|
33
|
-
|
34
|
-
size_t LexerTypeAction::hashCode() const {
|
23
|
+
size_t LexerTypeAction::hashCodeImpl() const {
|
35
24
|
size_t hash = MurmurHash::initialize();
|
36
25
|
hash = MurmurHash::update(hash, static_cast<size_t>(getActionType()));
|
37
|
-
hash = MurmurHash::update(hash,
|
26
|
+
hash = MurmurHash::update(hash, getType());
|
38
27
|
return MurmurHash::finish(hash, 2);
|
39
28
|
}
|
40
29
|
|
41
|
-
bool LexerTypeAction::
|
42
|
-
if (
|
30
|
+
bool LexerTypeAction::equals(const LexerAction &other) const {
|
31
|
+
if (this == std::addressof(other)) {
|
43
32
|
return true;
|
44
33
|
}
|
45
|
-
|
46
|
-
const LexerTypeAction *action = dynamic_cast<const LexerTypeAction *>(&obj);
|
47
|
-
if (action == nullptr) {
|
34
|
+
if (getActionType() != other.getActionType()) {
|
48
35
|
return false;
|
49
36
|
}
|
50
|
-
|
51
|
-
return
|
37
|
+
const auto &lexerAction = downCast<const LexerTypeAction&>(other);
|
38
|
+
return getType() == lexerAction.getType();
|
52
39
|
}
|
53
40
|
|
54
41
|
std::string LexerTypeAction::toString() const {
|
55
|
-
return "type(" + std::to_string(
|
42
|
+
return "type(" + std::to_string(getType()) + ")";
|
56
43
|
}
|
@@ -13,27 +13,21 @@ namespace atn {
|
|
13
13
|
|
14
14
|
/// Implements the {@code type} lexer action by calling <seealso cref="Lexer#setType"/>
|
15
15
|
/// with the assigned type.
|
16
|
-
class ANTLR4CPP_PUBLIC LexerTypeAction : public LexerAction {
|
16
|
+
class ANTLR4CPP_PUBLIC LexerTypeAction final : public LexerAction {
|
17
17
|
public:
|
18
|
+
static bool is(const LexerAction &lexerAction) { return lexerAction.getActionType() == LexerActionType::TYPE; }
|
19
|
+
|
20
|
+
static bool is(const LexerAction *lexerAction) { return lexerAction != nullptr && is(*lexerAction); }
|
21
|
+
|
18
22
|
/// <summary>
|
19
23
|
/// Constructs a new {@code type} action with the specified token type value. </summary>
|
20
24
|
/// <param name="type"> The type to assign to the token using <seealso cref="Lexer#setType"/>. </param>
|
21
|
-
LexerTypeAction(int type);
|
25
|
+
explicit LexerTypeAction(int type);
|
22
26
|
|
23
27
|
/// <summary>
|
24
28
|
/// Gets the type to assign to a token created by the lexer. </summary>
|
25
29
|
/// <returns> The type to assign to a token created by the lexer. </returns>
|
26
|
-
|
27
|
-
|
28
|
-
/// <summary>
|
29
|
-
/// {@inheritDoc} </summary>
|
30
|
-
/// <returns> This method returns <seealso cref="LexerActionType#TYPE"/>. </returns>
|
31
|
-
virtual LexerActionType getActionType() const override;
|
32
|
-
|
33
|
-
/// <summary>
|
34
|
-
/// {@inheritDoc} </summary>
|
35
|
-
/// <returns> This method returns {@code false}. </returns>
|
36
|
-
virtual bool isPositionDependent() const override;
|
30
|
+
int getType() const { return _type; }
|
37
31
|
|
38
32
|
/// <summary>
|
39
33
|
/// {@inheritDoc}
|
@@ -41,11 +35,13 @@ namespace atn {
|
|
41
35
|
/// <para>This action is implemented by calling <seealso cref="Lexer#setType"/> with the
|
42
36
|
/// value provided by <seealso cref="#getType"/>.</para>
|
43
37
|
/// </summary>
|
44
|
-
|
38
|
+
void execute(Lexer *lexer) const override;
|
39
|
+
|
40
|
+
bool equals(const LexerAction &obj) const override;
|
41
|
+
std::string toString() const override;
|
45
42
|
|
46
|
-
|
47
|
-
|
48
|
-
virtual std::string toString() const override;
|
43
|
+
protected:
|
44
|
+
size_t hashCodeImpl() const override;
|
49
45
|
|
50
46
|
private:
|
51
47
|
const int _type;
|
@@ -13,9 +13,13 @@ namespace atn {
|
|
13
13
|
/// Mark the end of a * or + loop.
|
14
14
|
class ANTLR4CPP_PUBLIC LoopEndState final : public ATNState {
|
15
15
|
public:
|
16
|
+
static bool is(const ATNState &atnState) { return atnState.getStateType() == ATNStateType::LOOP_END; }
|
17
|
+
|
18
|
+
static bool is(const ATNState *atnState) { return atnState != nullptr && is(*atnState); }
|
19
|
+
|
16
20
|
ATNState *loopBackState = nullptr;
|
17
21
|
|
18
|
-
|
22
|
+
LoopEndState() : ATNState(ATNStateType::LOOP_END) {}
|
19
23
|
};
|
20
24
|
|
21
25
|
} // namespace atn
|
@@ -10,12 +10,7 @@
|
|
10
10
|
using namespace antlr4;
|
11
11
|
using namespace antlr4::atn;
|
12
12
|
|
13
|
-
NotSetTransition::NotSetTransition(ATNState *target,
|
14
|
-
}
|
15
|
-
|
16
|
-
Transition::SerializationType NotSetTransition::getSerializationType() const {
|
17
|
-
return NOT_SET;
|
18
|
-
}
|
13
|
+
NotSetTransition::NotSetTransition(ATNState *target, misc::IntervalSet set) : SetTransition(TransitionType::NOT_SET, target, std::move(set)) {}
|
19
14
|
|
20
15
|
bool NotSetTransition::matches(size_t symbol, size_t minVocabSymbol, size_t maxVocabSymbol) const {
|
21
16
|
return symbol >= minVocabSymbol && symbol <= maxVocabSymbol
|