expressir 1.2.4 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cross_rubies +0 -6
- data/.github/workflows/rake.yml +200 -21
- data/.gitignore +7 -2
- 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 +12 -10
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/CMakeLists.txt +44 -34
- 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 +11 -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 +20 -20
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.cpp +0 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +30 -19
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.h +13 -10
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.cpp +2 -4
- 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 +0 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.cpp +0 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.h +0 -13
- 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/Parser.cpp +47 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.h +0 -6
- 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 +19 -22
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.h +20 -20
- 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 +10 -21
- 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 +0 -32
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.h +2 -7
- 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 -45
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.h +11 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-common.h +19 -61
- 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 +4 -55
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.h +34 -20
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.cpp +30 -35
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.h +35 -32
- 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 -462
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.h +9 -68
- 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 +41 -42
- 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 -106
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.h +9 -48
- 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 +15 -33
- 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 +164 -151
- 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 +86 -127
- 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 +9 -21
- 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 +1 -8
- 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 +7 -20
- 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 +34 -14
- 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.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 +12 -53
- 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 -33
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.h +2 -62
- 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 +13 -4
- 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 +4 -4
- 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/pattern/ParseTreePatternMatcher.cpp +1 -2
- 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/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 +294 -86
- data/ext/express-parser/extconf.rb +13 -12
- data/lib/expressir/config.rb +1 -1
- data/lib/expressir/express/parser.rb +3 -4
- data/lib/expressir/express/visitor.rb +7 -5
- 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 +81 -93
- 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
@@ -12,9 +12,13 @@ namespace atn {
|
|
12
12
|
|
13
13
|
class ANTLR4CPP_PUBLIC StarLoopbackState final : public ATNState {
|
14
14
|
public:
|
15
|
-
|
15
|
+
static bool is(const ATNState &atnState) { return atnState.getStateType() == ATNStateType::STAR_LOOP_BACK; }
|
16
16
|
|
17
|
-
|
17
|
+
static bool is(const ATNState *atnState) { return atnState != nullptr && is(*atnState); }
|
18
|
+
|
19
|
+
StarLoopbackState() : ATNState(ATNStateType::STAR_LOOP_BACK) {}
|
20
|
+
|
21
|
+
StarLoopEntryState *getLoopEntryState() const;
|
18
22
|
};
|
19
23
|
|
20
24
|
} // namespace atn
|
@@ -12,9 +12,12 @@ namespace atn {
|
|
12
12
|
|
13
13
|
/// The Tokens rule start state linking to each lexer rule start state.
|
14
14
|
class ANTLR4CPP_PUBLIC TokensStartState final : public DecisionState {
|
15
|
-
|
16
15
|
public:
|
17
|
-
|
16
|
+
static bool is(const ATNState &atnState) { return atnState.getStateType() == ATNStateType::TOKEN_START; }
|
17
|
+
|
18
|
+
static bool is(const ATNState *atnState) { return atnState != nullptr && is(*atnState); }
|
19
|
+
|
20
|
+
TokensStartState() : DecisionState(ATNStateType::TOKEN_START) {}
|
18
21
|
};
|
19
22
|
|
20
23
|
} // namespace atn
|
@@ -10,14 +10,9 @@
|
|
10
10
|
|
11
11
|
using namespace antlr4;
|
12
12
|
using namespace antlr4::atn;
|
13
|
-
|
14
13
|
using namespace antlrcpp;
|
15
14
|
|
16
|
-
|
17
|
-
"INVALID", "EPSILON", "RANGE", "RULE", "PREDICATE", "ATOM", "ACTION", "SET", "NOT_SET", "WILDCARD", "PRECEDENCE"
|
18
|
-
};
|
19
|
-
|
20
|
-
Transition::Transition(ATNState *target) {
|
15
|
+
Transition::Transition(TransitionType transitionType, ATNState *target) : _transitionType(transitionType) {
|
21
16
|
if (target == nullptr) {
|
22
17
|
throw NullPointerException("target cannot be null.");
|
23
18
|
}
|
@@ -25,9 +20,6 @@ Transition::Transition(ATNState *target) {
|
|
25
20
|
this->target = target;
|
26
21
|
}
|
27
22
|
|
28
|
-
Transition::~Transition() {
|
29
|
-
}
|
30
|
-
|
31
23
|
bool Transition::isEpsilon() const {
|
32
24
|
return false;
|
33
25
|
}
|
@@ -6,6 +6,7 @@
|
|
6
6
|
#pragma once
|
7
7
|
|
8
8
|
#include "misc/IntervalSet.h"
|
9
|
+
#include "atn/TransitionType.h"
|
9
10
|
|
10
11
|
namespace antlr4 {
|
11
12
|
namespace atn {
|
@@ -25,33 +26,13 @@ namespace atn {
|
|
25
26
|
/// </summary>
|
26
27
|
class ANTLR4CPP_PUBLIC Transition {
|
27
28
|
public:
|
28
|
-
// constants for serialization
|
29
|
-
enum SerializationType {
|
30
|
-
EPSILON = 1,
|
31
|
-
RANGE = 2,
|
32
|
-
RULE = 3,
|
33
|
-
PREDICATE = 4, // e.g., {isType(input.LT(1))}?
|
34
|
-
ATOM = 5,
|
35
|
-
ACTION = 6,
|
36
|
-
SET = 7, // ~(A|B) or ~atom, wildcard, which convert to next 2
|
37
|
-
NOT_SET = 8,
|
38
|
-
WILDCARD = 9,
|
39
|
-
PRECEDENCE = 10,
|
40
|
-
};
|
41
|
-
|
42
|
-
static const std::vector<std::string> serializationNames;
|
43
|
-
|
44
29
|
/// The target of this transition.
|
45
30
|
// ml: this is a reference into the ATN.
|
46
31
|
ATNState *target;
|
47
32
|
|
48
|
-
virtual ~Transition();
|
33
|
+
virtual ~Transition() = default;
|
49
34
|
|
50
|
-
|
51
|
-
Transition(ATNState *target);
|
52
|
-
|
53
|
-
public:
|
54
|
-
virtual SerializationType getSerializationType() const = 0;
|
35
|
+
TransitionType getTransitionType() const { return _transitionType; }
|
55
36
|
|
56
37
|
/**
|
57
38
|
* Determines if the transition is an "epsilon" transition.
|
@@ -70,7 +51,15 @@ namespace atn {
|
|
70
51
|
|
71
52
|
Transition(Transition const&) = delete;
|
72
53
|
Transition& operator=(Transition const&) = delete;
|
54
|
+
|
55
|
+
protected:
|
56
|
+
Transition(TransitionType transitionType, ATNState *target);
|
57
|
+
|
58
|
+
private:
|
59
|
+
const TransitionType _transitionType;
|
73
60
|
};
|
74
61
|
|
62
|
+
using ConstTransitionPtr = std::unique_ptr<const Transition>;
|
63
|
+
|
75
64
|
} // namespace atn
|
76
65
|
} // namespace antlr4
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#include "atn/TransitionType.h"
|
2
|
+
|
3
|
+
std::string antlr4::atn::transitionTypeName(TransitionType transitionType) {
|
4
|
+
switch (transitionType) {
|
5
|
+
case TransitionType::EPSILON:
|
6
|
+
return "EPSILON";
|
7
|
+
case TransitionType::RANGE:
|
8
|
+
return "RANGE";
|
9
|
+
case TransitionType::RULE:
|
10
|
+
return "RULE";
|
11
|
+
case TransitionType::PREDICATE:
|
12
|
+
return "PREDICATE";
|
13
|
+
case TransitionType::ATOM:
|
14
|
+
return "ATOM";
|
15
|
+
case TransitionType::ACTION:
|
16
|
+
return "ACTION";
|
17
|
+
case TransitionType::SET:
|
18
|
+
return "SET";
|
19
|
+
case TransitionType::NOT_SET:
|
20
|
+
return "NOT_SET";
|
21
|
+
case TransitionType::WILDCARD:
|
22
|
+
return "WILDCARD";
|
23
|
+
case TransitionType::PRECEDENCE:
|
24
|
+
return "PRECEDENCE";
|
25
|
+
}
|
26
|
+
return "UNKNOWN";
|
27
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
2
|
+
* Use of this file is governed by the BSD 3-clause license that
|
3
|
+
* can be found in the LICENSE.txt file in the project root.
|
4
|
+
*/
|
5
|
+
|
6
|
+
#pragma once
|
7
|
+
|
8
|
+
#include <cstddef>
|
9
|
+
#include <string>
|
10
|
+
|
11
|
+
#include "antlr4-common.h"
|
12
|
+
|
13
|
+
namespace antlr4 {
|
14
|
+
namespace atn {
|
15
|
+
|
16
|
+
// Constants for transition serialization.
|
17
|
+
enum class TransitionType : size_t {
|
18
|
+
EPSILON = 1,
|
19
|
+
RANGE = 2,
|
20
|
+
RULE = 3,
|
21
|
+
PREDICATE = 4, // e.g., {isType(input.LT(1))}?
|
22
|
+
ATOM = 5,
|
23
|
+
ACTION = 6,
|
24
|
+
SET = 7, // ~(A|B) or ~atom, wildcard, which convert to next 2
|
25
|
+
NOT_SET = 8,
|
26
|
+
WILDCARD = 9,
|
27
|
+
PRECEDENCE = 10,
|
28
|
+
};
|
29
|
+
|
30
|
+
ANTLR4CPP_PUBLIC std::string transitionTypeName(TransitionType transitionType);
|
31
|
+
|
32
|
+
} // namespace atn
|
33
|
+
} // namespace antlr4
|
@@ -9,11 +9,7 @@
|
|
9
9
|
|
10
10
|
using namespace antlr4::atn;
|
11
11
|
|
12
|
-
WildcardTransition::WildcardTransition(ATNState *target) : Transition(target) {
|
13
|
-
}
|
14
|
-
|
15
|
-
Transition::SerializationType WildcardTransition::getSerializationType() const {
|
16
|
-
return WILDCARD;
|
12
|
+
WildcardTransition::WildcardTransition(ATNState *target) : Transition(TransitionType::WILDCARD, target) {
|
17
13
|
}
|
18
14
|
|
19
15
|
bool WildcardTransition::matches(size_t symbol, size_t minVocabSymbol, size_t maxVocabSymbol) const {
|
@@ -12,9 +12,11 @@ namespace atn {
|
|
12
12
|
|
13
13
|
class ANTLR4CPP_PUBLIC WildcardTransition final : public Transition {
|
14
14
|
public:
|
15
|
-
|
15
|
+
static bool is(const Transition &transition) { return transition.getTransitionType() == TransitionType::WILDCARD; }
|
16
16
|
|
17
|
-
|
17
|
+
static bool is(const Transition *transition) { return transition != nullptr && is(*transition); }
|
18
|
+
|
19
|
+
explicit WildcardTransition(ATNState *target);
|
18
20
|
|
19
21
|
virtual bool matches(size_t symbol, size_t minVocabSymbol, size_t maxVocabSymbol) const override;
|
20
22
|
|
@@ -8,6 +8,7 @@
|
|
8
8
|
#include "support/CPPUtils.h"
|
9
9
|
#include "atn/StarLoopEntryState.h"
|
10
10
|
#include "atn/ATNConfigSet.h"
|
11
|
+
#include "support/Casts.h"
|
11
12
|
|
12
13
|
#include "dfa/DFA.h"
|
13
14
|
|
@@ -22,8 +23,8 @@ DFA::DFA(atn::DecisionState *atnStartState, size_t decision)
|
|
22
23
|
: atnStartState(atnStartState), s0(nullptr), decision(decision) {
|
23
24
|
|
24
25
|
_precedenceDfa = false;
|
25
|
-
if (
|
26
|
-
if (
|
26
|
+
if (atn::StarLoopEntryState::is(atnStartState)) {
|
27
|
+
if (downCast<atn::StarLoopEntryState*>(atnStartState)->isPrecedenceDecision) {
|
27
28
|
_precedenceDfa = true;
|
28
29
|
s0 = new DFAState(std::unique_ptr<atn::ATNConfigSet>(new atn::ATNConfigSet()));
|
29
30
|
s0->isAcceptState = false;
|
@@ -32,13 +33,12 @@ DFA::DFA(atn::DecisionState *atnStartState, size_t decision)
|
|
32
33
|
}
|
33
34
|
}
|
34
35
|
|
35
|
-
DFA::DFA(DFA &&other) : atnStartState(other.atnStartState), decision(other.decision) {
|
36
|
+
DFA::DFA(DFA &&other) : atnStartState(other.atnStartState), s0(other.s0), decision(other.decision) {
|
36
37
|
// Source states are implicitly cleared by the move.
|
37
38
|
states = std::move(other.states);
|
38
39
|
|
39
40
|
other.atnStartState = nullptr;
|
40
41
|
other.decision = 0;
|
41
|
-
s0 = other.s0;
|
42
42
|
other.s0 = nullptr;
|
43
43
|
_precedenceDfa = other._precedenceDfa;
|
44
44
|
other._precedenceDfa = false;
|
@@ -52,8 +52,9 @@ DFA::~DFA() {
|
|
52
52
|
delete state;
|
53
53
|
}
|
54
54
|
|
55
|
-
if (!s0InList)
|
55
|
+
if (!s0InList) {
|
56
56
|
delete s0;
|
57
|
+
}
|
57
58
|
}
|
58
59
|
|
59
60
|
bool DFA::isPrecedenceDfa() const {
|
@@ -70,7 +71,7 @@ DFAState* DFA::getPrecedenceStartState(int precedence) const {
|
|
70
71
|
return iterator->second;
|
71
72
|
}
|
72
73
|
|
73
|
-
void DFA::setPrecedenceStartState(int precedence, DFAState *startState
|
74
|
+
void DFA::setPrecedenceStartState(int precedence, DFAState *startState) {
|
74
75
|
if (!isPrecedenceDfa()) {
|
75
76
|
throw IllegalStateException("Only precedence DFAs may contain a precedence start state.");
|
76
77
|
}
|
@@ -79,11 +80,7 @@ void DFA::setPrecedenceStartState(int precedence, DFAState *startState, SingleWr
|
|
79
80
|
return;
|
80
81
|
}
|
81
82
|
|
82
|
-
|
83
|
-
lock.writeLock();
|
84
|
-
s0->edges[precedence] = startState;
|
85
|
-
lock.writeUnlock();
|
86
|
-
}
|
83
|
+
s0->edges[precedence] = startState;
|
87
84
|
}
|
88
85
|
|
89
86
|
std::vector<DFAState *> DFA::getStates() const {
|
@@ -98,15 +95,6 @@ std::vector<DFAState *> DFA::getStates() const {
|
|
98
95
|
return result;
|
99
96
|
}
|
100
97
|
|
101
|
-
std::string DFA::toString(const std::vector<std::string> &tokenNames) {
|
102
|
-
if (s0 == nullptr) {
|
103
|
-
return "";
|
104
|
-
}
|
105
|
-
DFASerializer serializer(this, tokenNames);
|
106
|
-
|
107
|
-
return serializer.toString();
|
108
|
-
}
|
109
|
-
|
110
98
|
std::string DFA::toString(const Vocabulary &vocabulary) const {
|
111
99
|
if (s0 == nullptr) {
|
112
100
|
return "";
|
@@ -116,7 +104,7 @@ std::string DFA::toString(const Vocabulary &vocabulary) const {
|
|
116
104
|
return serializer.toString();
|
117
105
|
}
|
118
106
|
|
119
|
-
std::string DFA::toLexerString() {
|
107
|
+
std::string DFA::toLexerString() const {
|
120
108
|
if (s0 == nullptr) {
|
121
109
|
return "";
|
122
110
|
}
|
@@ -7,29 +7,38 @@
|
|
7
7
|
|
8
8
|
#include "dfa/DFAState.h"
|
9
9
|
|
10
|
-
namespace antlrcpp {
|
11
|
-
class SingleWriteMultipleReadLock;
|
12
|
-
}
|
13
|
-
|
14
10
|
namespace antlr4 {
|
15
11
|
namespace dfa {
|
16
12
|
|
17
|
-
class ANTLR4CPP_PUBLIC DFA {
|
13
|
+
class ANTLR4CPP_PUBLIC DFA final {
|
14
|
+
private:
|
15
|
+
struct DFAStateHasher final {
|
16
|
+
size_t operator()(const DFAState *dfaState) const {
|
17
|
+
return dfaState->hashCode();
|
18
|
+
}
|
19
|
+
};
|
20
|
+
|
21
|
+
struct DFAStateComparer final {
|
22
|
+
bool operator()(const DFAState *lhs, const DFAState *rhs) const {
|
23
|
+
return lhs == rhs || *lhs == *rhs;
|
24
|
+
}
|
25
|
+
};
|
26
|
+
|
18
27
|
public:
|
19
28
|
/// A set of all DFA states. Use a map so we can get old state back.
|
20
29
|
/// Set only allows you to see if it's there.
|
21
30
|
|
22
31
|
/// From which ATN state did we create this DFA?
|
23
32
|
atn::DecisionState *atnStartState;
|
24
|
-
std::unordered_set<DFAState
|
33
|
+
std::unordered_set<DFAState*, DFAStateHasher, DFAStateComparer> states; // States are owned by this class.
|
25
34
|
DFAState *s0;
|
26
35
|
size_t decision;
|
27
36
|
|
28
|
-
DFA(atn::DecisionState *atnStartState);
|
37
|
+
explicit DFA(atn::DecisionState *atnStartState);
|
29
38
|
DFA(atn::DecisionState *atnStartState, size_t decision);
|
30
39
|
DFA(const DFA &other) = delete;
|
31
40
|
DFA(DFA &&other);
|
32
|
-
|
41
|
+
~DFA();
|
33
42
|
|
34
43
|
/**
|
35
44
|
* Gets whether this DFA is a precedence DFA. Precedence DFAs use a special
|
@@ -66,18 +75,14 @@ namespace dfa {
|
|
66
75
|
* @throws IllegalStateException if this is not a precedence DFA.
|
67
76
|
* @see #isPrecedenceDfa()
|
68
77
|
*/
|
69
|
-
void setPrecedenceStartState(int precedence, DFAState *startState
|
78
|
+
void setPrecedenceStartState(int precedence, DFAState *startState);
|
70
79
|
|
71
80
|
/// Return a list of all states in this DFA, ordered by state number.
|
72
|
-
|
81
|
+
std::vector<DFAState *> getStates() const;
|
73
82
|
|
74
|
-
/**
|
75
|
-
* @deprecated Use {@link #toString(Vocabulary)} instead.
|
76
|
-
*/
|
77
|
-
virtual std::string toString(const std::vector<std::string>& tokenNames);
|
78
83
|
std::string toString(const Vocabulary &vocabulary) const;
|
79
84
|
|
80
|
-
|
85
|
+
std::string toLexerString() const;
|
81
86
|
|
82
87
|
private:
|
83
88
|
/**
|
@@ -10,16 +10,9 @@
|
|
10
10
|
|
11
11
|
using namespace antlr4::dfa;
|
12
12
|
|
13
|
-
DFASerializer::DFASerializer(const DFA *dfa, const std::vector<std::string>& tokenNames)
|
14
|
-
: DFASerializer(dfa, Vocabulary::fromTokenNames(tokenNames)) {
|
15
|
-
}
|
16
|
-
|
17
13
|
DFASerializer::DFASerializer(const DFA *dfa, const Vocabulary &vocabulary) : _dfa(dfa), _vocabulary(vocabulary) {
|
18
14
|
}
|
19
15
|
|
20
|
-
DFASerializer::~DFASerializer() {
|
21
|
-
}
|
22
|
-
|
23
16
|
std::string DFASerializer::toString() const {
|
24
17
|
if (_dfa->s0 == nullptr) {
|
25
18
|
return "";
|
@@ -55,7 +48,7 @@ std::string DFASerializer::getStateString(DFAState *s) const {
|
|
55
48
|
if (!s->predicates.empty()) {
|
56
49
|
std::string buf;
|
57
50
|
for (size_t i = 0; i < s->predicates.size(); i++) {
|
58
|
-
buf.append(s->predicates[i]
|
51
|
+
buf.append(s->predicates[i].toString());
|
59
52
|
}
|
60
53
|
return baseStateStr + "=>" + buf;
|
61
54
|
} else {
|
@@ -13,15 +13,15 @@ namespace dfa {
|
|
13
13
|
/// A DFA walker that knows how to dump them to serialized strings.
|
14
14
|
class ANTLR4CPP_PUBLIC DFASerializer {
|
15
15
|
public:
|
16
|
-
DFASerializer(const DFA *dfa, const std::vector<std::string>& tnames);
|
17
16
|
DFASerializer(const DFA *dfa, const Vocabulary &vocabulary);
|
18
|
-
virtual ~DFASerializer();
|
19
17
|
|
20
|
-
virtual
|
18
|
+
virtual ~DFASerializer() = default;
|
19
|
+
|
20
|
+
std::string toString() const;
|
21
21
|
|
22
22
|
protected:
|
23
23
|
virtual std::string getEdgeLabel(size_t i) const;
|
24
|
-
|
24
|
+
std::string getStateString(DFAState *s) const;
|
25
25
|
|
26
26
|
private:
|
27
27
|
const DFA *_dfa;
|
@@ -13,41 +13,11 @@
|
|
13
13
|
using namespace antlr4::dfa;
|
14
14
|
using namespace antlr4::atn;
|
15
15
|
|
16
|
-
DFAState::PredPrediction::
|
17
|
-
InitializeInstanceFields();
|
18
|
-
this->alt = alt;
|
19
|
-
}
|
20
|
-
|
21
|
-
DFAState::PredPrediction::~PredPrediction() {
|
22
|
-
}
|
23
|
-
|
24
|
-
std::string DFAState::PredPrediction::toString() {
|
16
|
+
std::string DFAState::PredPrediction::toString() const {
|
25
17
|
return std::string("(") + pred->toString() + ", " + std::to_string(alt) + ")";
|
26
18
|
}
|
27
19
|
|
28
|
-
|
29
|
-
alt = 0;
|
30
|
-
}
|
31
|
-
|
32
|
-
DFAState::DFAState() {
|
33
|
-
InitializeInstanceFields();
|
34
|
-
}
|
35
|
-
|
36
|
-
DFAState::DFAState(int state) : DFAState() {
|
37
|
-
stateNumber = state;
|
38
|
-
}
|
39
|
-
|
40
|
-
DFAState::DFAState(std::unique_ptr<ATNConfigSet> configs_) : DFAState() {
|
41
|
-
configs = std::move(configs_);
|
42
|
-
}
|
43
|
-
|
44
|
-
DFAState::~DFAState() {
|
45
|
-
for (auto *predicate : predicates) {
|
46
|
-
delete predicate;
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
std::set<size_t> DFAState::getAltSet() {
|
20
|
+
std::set<size_t> DFAState::getAltSet() const {
|
51
21
|
std::set<size_t> alts;
|
52
22
|
if (configs != nullptr) {
|
53
23
|
for (size_t i = 0; i < configs->size(); i++) {
|
@@ -58,22 +28,18 @@ std::set<size_t> DFAState::getAltSet() {
|
|
58
28
|
}
|
59
29
|
|
60
30
|
size_t DFAState::hashCode() const {
|
61
|
-
|
62
|
-
hash = misc::MurmurHash::update(hash, configs->hashCode());
|
63
|
-
hash = misc::MurmurHash::finish(hash, 1);
|
64
|
-
return hash;
|
31
|
+
return configs != nullptr ? configs->hashCode() : 0;
|
65
32
|
}
|
66
33
|
|
67
|
-
bool DFAState::
|
68
|
-
|
69
|
-
if (this == &o) {
|
34
|
+
bool DFAState::equals(const DFAState &other) const {
|
35
|
+
if (this == std::addressof(other)) {
|
70
36
|
return true;
|
71
37
|
}
|
72
|
-
|
73
|
-
|
38
|
+
return configs == other.configs ||
|
39
|
+
(configs != nullptr && other.configs != nullptr && *configs == *other.configs);
|
74
40
|
}
|
75
41
|
|
76
|
-
std::string DFAState::toString() {
|
42
|
+
std::string DFAState::toString() const {
|
77
43
|
std::stringstream ss;
|
78
44
|
ss << stateNumber;
|
79
45
|
if (configs) {
|
@@ -83,7 +49,7 @@ std::string DFAState::toString() {
|
|
83
49
|
ss << " => ";
|
84
50
|
if (!predicates.empty()) {
|
85
51
|
for (size_t i = 0; i < predicates.size(); i++) {
|
86
|
-
ss << predicates[i]
|
52
|
+
ss << predicates[i].toString();
|
87
53
|
}
|
88
54
|
} else {
|
89
55
|
ss << prediction;
|
@@ -91,10 +57,3 @@ std::string DFAState::toString() {
|
|
91
57
|
}
|
92
58
|
return ss.str();
|
93
59
|
}
|
94
|
-
|
95
|
-
void DFAState::InitializeInstanceFields() {
|
96
|
-
stateNumber = -1;
|
97
|
-
isAcceptState = false;
|
98
|
-
prediction = 0;
|
99
|
-
requiresFullContext = false;
|
100
|
-
}
|
@@ -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
|