expressir 1.2.4 → 1.2.5
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 +200 -9
- data/.gitignore +7 -2
- data/.gitmodules +3 -0
- data/.rubocop.yml +13 -4
- 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 -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 +207 -75
- data/ext/express-parser/extconf.rb +10 -9
- data/lib/expressir/config.rb +1 -1
- data/lib/expressir/express/parser.rb +2 -2
- 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 +63 -0
- data/rakelib/cross-ruby.rake +213 -162
- data/spec/acceptance/version_spec.rb +7 -2
- data/spec/expressir/express/cache_spec.rb +8 -5
- data/spec/expressir/express/formatter_spec.rb +16 -8
- data/spec/expressir/express/parser_spec.rb +17 -11
- data/spec/expressir/model/model_element_spec.rb +154 -146
- 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
|
@@ -6,39 +6,34 @@
|
|
|
6
6
|
#pragma once
|
|
7
7
|
|
|
8
8
|
#include <algorithm>
|
|
9
|
-
#include <
|
|
9
|
+
#include <any>
|
|
10
10
|
#include <atomic>
|
|
11
|
-
#include <
|
|
11
|
+
#include <bitset>
|
|
12
|
+
#include <cassert>
|
|
13
|
+
#include <climits>
|
|
14
|
+
#include <cstddef>
|
|
15
|
+
#include <cstdint>
|
|
16
|
+
#include <cstdlib>
|
|
17
|
+
#include <exception>
|
|
12
18
|
#include <fstream>
|
|
13
19
|
#include <iostream>
|
|
14
20
|
#include <iterator>
|
|
15
21
|
#include <limits>
|
|
16
|
-
#include <limits.h>
|
|
17
|
-
#include <list>
|
|
18
22
|
#include <map>
|
|
19
23
|
#include <memory>
|
|
24
|
+
#include <mutex>
|
|
20
25
|
#include <set>
|
|
21
|
-
#include <
|
|
22
|
-
#include <stdint.h>
|
|
23
|
-
#include <stdlib.h>
|
|
26
|
+
#include <shared_mutex>
|
|
24
27
|
#include <sstream>
|
|
25
28
|
#include <stack>
|
|
26
29
|
#include <string>
|
|
30
|
+
#include <string_view>
|
|
27
31
|
#include <typeinfo>
|
|
28
32
|
#include <type_traits>
|
|
29
33
|
#include <unordered_map>
|
|
30
34
|
#include <unordered_set>
|
|
31
35
|
#include <utility>
|
|
32
36
|
#include <vector>
|
|
33
|
-
#include <mutex>
|
|
34
|
-
#include <exception>
|
|
35
|
-
#include <bitset>
|
|
36
|
-
#include <condition_variable>
|
|
37
|
-
#include <functional>
|
|
38
|
-
|
|
39
|
-
#ifndef USE_UTF8_INSTEAD_OF_CODECVT
|
|
40
|
-
#include <codecvt>
|
|
41
|
-
#endif
|
|
42
37
|
|
|
43
38
|
// Defines for the Guid class and other platform dependent stuff.
|
|
44
39
|
#ifdef _WIN32
|
|
@@ -52,25 +47,12 @@
|
|
|
52
47
|
#endif
|
|
53
48
|
#endif
|
|
54
49
|
|
|
55
|
-
#define GUID_WINDOWS
|
|
56
|
-
|
|
57
50
|
#ifdef _WIN64
|
|
58
51
|
typedef __int64 ssize_t;
|
|
59
52
|
#else
|
|
60
53
|
typedef __int32 ssize_t;
|
|
61
54
|
#endif
|
|
62
55
|
|
|
63
|
-
#if _MSC_VER >= 1900 && _MSC_VER < 2000
|
|
64
|
-
// VS 2015 has a known bug when using std::codecvt_utf8<char32_t>
|
|
65
|
-
// so we have to temporarily use __int32 instead.
|
|
66
|
-
// https://connect.microsoft.com/VisualStudio/feedback/details/1403302/unresolved-external-when-using-codecvt-utf8
|
|
67
|
-
typedef std::basic_string<__int32> i32string;
|
|
68
|
-
|
|
69
|
-
typedef i32string UTF32String;
|
|
70
|
-
#else
|
|
71
|
-
typedef std::u32string UTF32String;
|
|
72
|
-
#endif
|
|
73
|
-
|
|
74
56
|
#ifdef ANTLR4CPP_EXPORTS
|
|
75
57
|
#define ANTLR4CPP_PUBLIC __declspec(dllexport)
|
|
76
58
|
#else
|
|
@@ -81,26 +63,13 @@
|
|
|
81
63
|
#endif
|
|
82
64
|
#endif
|
|
83
65
|
|
|
84
|
-
#if defined(_MSC_VER) && !defined(__clang__)
|
|
85
|
-
// clang-cl should escape this to prevent [ignored-attributes].
|
|
86
|
-
namespace std {
|
|
87
|
-
class ANTLR4CPP_PUBLIC exception; // Prevents warning C4275 from MSVC.
|
|
88
|
-
} // namespace std
|
|
89
|
-
#endif
|
|
90
|
-
|
|
91
66
|
#elif defined(__APPLE__)
|
|
92
|
-
typedef std::u32string UTF32String;
|
|
93
|
-
|
|
94
|
-
#define GUID_CFUUID
|
|
95
67
|
#if __GNUC__ >= 4
|
|
96
68
|
#define ANTLR4CPP_PUBLIC __attribute__ ((visibility ("default")))
|
|
97
69
|
#else
|
|
98
70
|
#define ANTLR4CPP_PUBLIC
|
|
99
71
|
#endif
|
|
100
72
|
#else
|
|
101
|
-
typedef std::u32string UTF32String;
|
|
102
|
-
|
|
103
|
-
#define GUID_LIBUUID
|
|
104
73
|
#if __GNUC__ >= 6
|
|
105
74
|
#define ANTLR4CPP_PUBLIC __attribute__ ((visibility ("default")))
|
|
106
75
|
#else
|
|
@@ -108,27 +77,16 @@
|
|
|
108
77
|
#endif
|
|
109
78
|
#endif
|
|
110
79
|
|
|
111
|
-
#
|
|
112
|
-
#
|
|
80
|
+
#ifdef __has_builtin
|
|
81
|
+
#define ANTLR4CPP_HAVE_BUILTIN(x) __has_builtin(x)
|
|
82
|
+
#else
|
|
83
|
+
#define ANTLR4CPP_HAVE_BUILTIN(x) 0
|
|
84
|
+
#endif
|
|
113
85
|
|
|
114
|
-
#
|
|
115
|
-
|
|
116
|
-
#if __has_feature(cxx_noexcept)
|
|
117
|
-
#define HAS_NOEXCEPT
|
|
118
|
-
#endif
|
|
119
|
-
#else
|
|
120
|
-
#if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ * 10 + __GNUC_MINOR__ >= 46 || \
|
|
121
|
-
defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026
|
|
122
|
-
#define HAS_NOEXCEPT
|
|
123
|
-
#endif
|
|
124
|
-
#endif
|
|
86
|
+
#define ANTLR4CPP_INTERNAL_STRINGIFY(x) #x
|
|
87
|
+
#define ANTLR4CPP_STRINGIFY(x) ANTLR4CPP_INTERNAL_STRINGIFY(x)
|
|
125
88
|
|
|
126
|
-
|
|
127
|
-
#define NOEXCEPT noexcept
|
|
128
|
-
#else
|
|
129
|
-
#define NOEXCEPT
|
|
130
|
-
#endif
|
|
131
|
-
#endif
|
|
89
|
+
#include "support/Declarations.h"
|
|
132
90
|
|
|
133
91
|
// We have to undefine this symbol as ANTLR will use this name for own members and even
|
|
134
92
|
// generated functions. Because EOF is a global macro we cannot use e.g. a namespace scope to disambiguate.
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
#include "TokenStreamRewriter.h"
|
|
50
50
|
#include "UnbufferedCharStream.h"
|
|
51
51
|
#include "UnbufferedTokenStream.h"
|
|
52
|
+
#include "Version.h"
|
|
52
53
|
#include "Vocabulary.h"
|
|
53
54
|
#include "Vocabulary.h"
|
|
54
55
|
#include "WritableToken.h"
|
|
@@ -57,11 +58,9 @@
|
|
|
57
58
|
#include "atn/ATNConfigSet.h"
|
|
58
59
|
#include "atn/ATNDeserializationOptions.h"
|
|
59
60
|
#include "atn/ATNDeserializer.h"
|
|
60
|
-
#include "atn/ATNSerializer.h"
|
|
61
61
|
#include "atn/ATNSimulator.h"
|
|
62
62
|
#include "atn/ATNState.h"
|
|
63
63
|
#include "atn/ATNType.h"
|
|
64
|
-
#include "atn/AbstractPredicateTransition.h"
|
|
65
64
|
#include "atn/ActionTransition.h"
|
|
66
65
|
#include "atn/AmbiguityInfo.h"
|
|
67
66
|
#include "atn/ArrayPredictionContext.h"
|
|
@@ -74,7 +73,6 @@
|
|
|
74
73
|
#include "atn/DecisionEventInfo.h"
|
|
75
74
|
#include "atn/DecisionInfo.h"
|
|
76
75
|
#include "atn/DecisionState.h"
|
|
77
|
-
#include "atn/EmptyPredictionContext.h"
|
|
78
76
|
#include "atn/EpsilonTransition.h"
|
|
79
77
|
#include "atn/ErrorInfo.h"
|
|
80
78
|
#include "atn/LL1Analyzer.h"
|
|
@@ -98,12 +96,16 @@
|
|
|
98
96
|
#include "atn/OrderedATNConfigSet.h"
|
|
99
97
|
#include "atn/ParseInfo.h"
|
|
100
98
|
#include "atn/ParserATNSimulator.h"
|
|
99
|
+
#include "atn/ParserATNSimulatorOptions.h"
|
|
101
100
|
#include "atn/PlusBlockStartState.h"
|
|
102
101
|
#include "atn/PlusLoopbackState.h"
|
|
103
102
|
#include "atn/PrecedencePredicateTransition.h"
|
|
104
103
|
#include "atn/PredicateEvalInfo.h"
|
|
105
104
|
#include "atn/PredicateTransition.h"
|
|
106
105
|
#include "atn/PredictionContext.h"
|
|
106
|
+
#include "atn/PredictionContextCache.h"
|
|
107
|
+
#include "atn/PredictionContextMergeCache.h"
|
|
108
|
+
#include "atn/PredictionContextMergeCacheOptions.h"
|
|
107
109
|
#include "atn/PredictionMode.h"
|
|
108
110
|
#include "atn/ProfilingATNSimulator.h"
|
|
109
111
|
#include "atn/RangeTransition.h"
|
|
@@ -111,6 +113,7 @@
|
|
|
111
113
|
#include "atn/RuleStopState.h"
|
|
112
114
|
#include "atn/RuleTransition.h"
|
|
113
115
|
#include "atn/SemanticContext.h"
|
|
116
|
+
#include "atn/SerializedATNView.h"
|
|
114
117
|
#include "atn/SetTransition.h"
|
|
115
118
|
#include "atn/SingletonPredictionContext.h"
|
|
116
119
|
#include "atn/StarBlockStartState.h"
|
|
@@ -131,9 +134,8 @@
|
|
|
131
134
|
#include "support/Any.h"
|
|
132
135
|
#include "support/Arrays.h"
|
|
133
136
|
#include "support/BitSet.h"
|
|
137
|
+
#include "support/Casts.h"
|
|
134
138
|
#include "support/CPPUtils.h"
|
|
135
|
-
#include "support/StringUtils.h"
|
|
136
|
-
#include "support/guid.h"
|
|
137
139
|
#include "tree/AbstractParseTreeVisitor.h"
|
|
138
140
|
#include "tree/ErrorNode.h"
|
|
139
141
|
#include "tree/ErrorNodeImpl.h"
|
|
@@ -20,24 +20,9 @@ using namespace antlr4;
|
|
|
20
20
|
using namespace antlr4::atn;
|
|
21
21
|
using namespace antlrcpp;
|
|
22
22
|
|
|
23
|
-
ATN::ATN() : ATN(ATNType::LEXER, 0) {
|
|
24
|
-
}
|
|
23
|
+
ATN::ATN() : ATN(ATNType::LEXER, 0) {}
|
|
25
24
|
|
|
26
|
-
ATN::ATN(
|
|
27
|
-
// All source vectors are implicitly cleared by the moves.
|
|
28
|
-
states = std::move(other.states);
|
|
29
|
-
decisionToState = std::move(other.decisionToState);
|
|
30
|
-
ruleToStartState = std::move(other.ruleToStartState);
|
|
31
|
-
ruleToStopState = std::move(other.ruleToStopState);
|
|
32
|
-
grammarType = std::move(other.grammarType);
|
|
33
|
-
maxTokenType = std::move(other.maxTokenType);
|
|
34
|
-
ruleToTokenType = std::move(other.ruleToTokenType);
|
|
35
|
-
lexerActions = std::move(other.lexerActions);
|
|
36
|
-
modeToStartState = std::move(other.modeToStartState);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
ATN::ATN(ATNType grammarType_, size_t maxTokenType_) : grammarType(grammarType_), maxTokenType(maxTokenType_) {
|
|
40
|
-
}
|
|
25
|
+
ATN::ATN(ATNType grammarType_, size_t maxTokenType_) : grammarType(grammarType_), maxTokenType(maxTokenType_) {}
|
|
41
26
|
|
|
42
27
|
ATN::~ATN() {
|
|
43
28
|
for (ATNState *state : states) {
|
|
@@ -45,42 +30,6 @@ ATN::~ATN() {
|
|
|
45
30
|
}
|
|
46
31
|
}
|
|
47
32
|
|
|
48
|
-
/**
|
|
49
|
-
* Required to be defined (even though not used) as we have an explicit move assignment operator.
|
|
50
|
-
*/
|
|
51
|
-
ATN& ATN::operator = (ATN &other) NOEXCEPT {
|
|
52
|
-
states = other.states;
|
|
53
|
-
decisionToState = other.decisionToState;
|
|
54
|
-
ruleToStartState = other.ruleToStartState;
|
|
55
|
-
ruleToStopState = other.ruleToStopState;
|
|
56
|
-
grammarType = other.grammarType;
|
|
57
|
-
maxTokenType = other.maxTokenType;
|
|
58
|
-
ruleToTokenType = other.ruleToTokenType;
|
|
59
|
-
lexerActions = other.lexerActions;
|
|
60
|
-
modeToStartState = other.modeToStartState;
|
|
61
|
-
|
|
62
|
-
return *this;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Explicit move assignment operator to make this the preferred assignment. With implicit copy/move assignment
|
|
67
|
-
* operators it seems the copy operator is preferred causing trouble when releasing the allocated ATNState instances.
|
|
68
|
-
*/
|
|
69
|
-
ATN& ATN::operator = (ATN &&other) NOEXCEPT {
|
|
70
|
-
// All source vectors are implicitly cleared by the moves.
|
|
71
|
-
states = std::move(other.states);
|
|
72
|
-
decisionToState = std::move(other.decisionToState);
|
|
73
|
-
ruleToStartState = std::move(other.ruleToStartState);
|
|
74
|
-
ruleToStopState = std::move(other.ruleToStopState);
|
|
75
|
-
grammarType = std::move(other.grammarType);
|
|
76
|
-
maxTokenType = std::move(other.maxTokenType);
|
|
77
|
-
ruleToTokenType = std::move(other.ruleToTokenType);
|
|
78
|
-
lexerActions = std::move(other.lexerActions);
|
|
79
|
-
modeToStartState = std::move(other.modeToStartState);
|
|
80
|
-
|
|
81
|
-
return *this;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
33
|
misc::IntervalSet ATN::nextTokens(ATNState *s, RuleContext *ctx) const {
|
|
85
34
|
LL1Analyzer analyzer(*this);
|
|
86
35
|
return analyzer.LOOK(s, ctx);
|
|
@@ -89,7 +38,7 @@ misc::IntervalSet ATN::nextTokens(ATNState *s, RuleContext *ctx) const {
|
|
|
89
38
|
|
|
90
39
|
misc::IntervalSet const& ATN::nextTokens(ATNState *s) const {
|
|
91
40
|
if (!s->_nextTokenUpdated) {
|
|
92
|
-
std::unique_lock<std::mutex> lock
|
|
41
|
+
std::unique_lock<std::mutex> lock(_mutex);
|
|
93
42
|
if (!s->_nextTokenUpdated) {
|
|
94
43
|
s->_nextTokenWithinRule = nextTokens(s, nullptr);
|
|
95
44
|
s->_nextTokenUpdated = true;
|
|
@@ -146,7 +95,7 @@ misc::IntervalSet ATN::getExpectedTokens(size_t stateNumber, RuleContext *contex
|
|
|
146
95
|
expected.remove(Token::EPSILON);
|
|
147
96
|
while (ctx && ctx->invokingState != ATNState::INVALID_STATE_NUMBER && following.contains(Token::EPSILON)) {
|
|
148
97
|
ATNState *invokingState = states.at(ctx->invokingState);
|
|
149
|
-
RuleTransition *rt = static_cast<RuleTransition*>(invokingState->transitions[0]);
|
|
98
|
+
const RuleTransition *rt = static_cast<const RuleTransition*>(invokingState->transitions[0].get());
|
|
150
99
|
following = nextTokens(rt->followState);
|
|
151
100
|
expected.addAll(following);
|
|
152
101
|
expected.remove(Token::EPSILON);
|
|
@@ -7,24 +7,36 @@
|
|
|
7
7
|
|
|
8
8
|
#include "RuleContext.h"
|
|
9
9
|
|
|
10
|
+
// GCC generates a warning when forward-declaring ATN if ATN has already been
|
|
11
|
+
// declared due to the attributes added by ANTLR4CPP_PUBLIC.
|
|
12
|
+
// See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39159
|
|
13
|
+
// Add constant that can be checked so forward-declarations can be omitted.
|
|
14
|
+
#define ANTLR4CPP_ATN_DECLARED
|
|
15
|
+
|
|
10
16
|
namespace antlr4 {
|
|
11
17
|
namespace atn {
|
|
12
18
|
|
|
19
|
+
class LexerATNSimulator;
|
|
20
|
+
class ParserATNSimulator;
|
|
21
|
+
|
|
13
22
|
class ANTLR4CPP_PUBLIC ATN {
|
|
14
23
|
public:
|
|
15
|
-
#if __cplusplus >= 201703L
|
|
16
24
|
static constexpr size_t INVALID_ALT_NUMBER = 0;
|
|
17
|
-
#else
|
|
18
|
-
enum : size_t {
|
|
19
|
-
INVALID_ALT_NUMBER = 0,
|
|
20
|
-
};
|
|
21
|
-
#endif
|
|
22
25
|
|
|
23
26
|
/// Used for runtime deserialization of ATNs from strings.
|
|
24
27
|
ATN();
|
|
25
|
-
|
|
28
|
+
|
|
26
29
|
ATN(ATNType grammarType, size_t maxTokenType);
|
|
27
|
-
|
|
30
|
+
|
|
31
|
+
ATN(const ATN&) = delete;
|
|
32
|
+
|
|
33
|
+
ATN(ATN&&) = delete;
|
|
34
|
+
|
|
35
|
+
~ATN();
|
|
36
|
+
|
|
37
|
+
ATN& operator=(const ATN&) = delete;
|
|
38
|
+
|
|
39
|
+
ATN& operator=(ATN&&) = delete;
|
|
28
40
|
|
|
29
41
|
std::vector<ATNState *> states;
|
|
30
42
|
|
|
@@ -56,37 +68,34 @@ namespace atn {
|
|
|
56
68
|
|
|
57
69
|
/// For lexer ATNs, this is an array of {@link LexerAction} objects which may
|
|
58
70
|
/// be referenced by action transitions in the ATN.
|
|
59
|
-
std::vector<Ref<LexerAction>> lexerActions;
|
|
71
|
+
std::vector<Ref<const LexerAction>> lexerActions;
|
|
60
72
|
|
|
61
73
|
std::vector<TokensStartState *> modeToStartState;
|
|
62
74
|
|
|
63
|
-
ATN& operator = (ATN &other) NOEXCEPT;
|
|
64
|
-
ATN& operator = (ATN &&other) NOEXCEPT;
|
|
65
|
-
|
|
66
75
|
/// <summary>
|
|
67
76
|
/// Compute the set of valid tokens that can occur starting in state {@code s}.
|
|
68
77
|
/// If {@code ctx} is null, the set of tokens will not include what can follow
|
|
69
78
|
/// the rule surrounding {@code s}. In other words, the set will be
|
|
70
79
|
/// restricted to tokens reachable staying within {@code s}'s rule.
|
|
71
80
|
/// </summary>
|
|
72
|
-
|
|
81
|
+
misc::IntervalSet nextTokens(ATNState *s, RuleContext *ctx) const;
|
|
73
82
|
|
|
74
83
|
/// <summary>
|
|
75
84
|
/// Compute the set of valid tokens that can occur starting in {@code s} and
|
|
76
85
|
/// staying in same rule. <seealso cref="Token#EPSILON"/> is in set if we reach end of
|
|
77
86
|
/// rule.
|
|
78
87
|
/// </summary>
|
|
79
|
-
|
|
88
|
+
misc::IntervalSet const& nextTokens(ATNState *s) const;
|
|
80
89
|
|
|
81
|
-
|
|
90
|
+
void addState(ATNState *state);
|
|
82
91
|
|
|
83
|
-
|
|
92
|
+
void removeState(ATNState *state);
|
|
84
93
|
|
|
85
|
-
|
|
94
|
+
int defineDecisionState(DecisionState *s);
|
|
86
95
|
|
|
87
|
-
|
|
96
|
+
DecisionState *getDecisionState(size_t decision) const;
|
|
88
97
|
|
|
89
|
-
|
|
98
|
+
size_t getNumberOfDecisions() const;
|
|
90
99
|
|
|
91
100
|
/// <summary>
|
|
92
101
|
/// Computes the set of input symbols which could follow ATN state number
|
|
@@ -106,12 +115,17 @@ namespace atn {
|
|
|
106
115
|
/// specified state in the specified context. </returns>
|
|
107
116
|
/// <exception cref="IllegalArgumentException"> if the ATN does not contain a state with
|
|
108
117
|
/// number {@code stateNumber} </exception>
|
|
109
|
-
|
|
118
|
+
misc::IntervalSet getExpectedTokens(size_t stateNumber, RuleContext *context) const;
|
|
110
119
|
|
|
111
120
|
std::string toString() const;
|
|
112
121
|
|
|
113
122
|
private:
|
|
123
|
+
friend class LexerATNSimulator;
|
|
124
|
+
friend class ParserATNSimulator;
|
|
125
|
+
|
|
114
126
|
mutable std::mutex _mutex;
|
|
127
|
+
mutable std::shared_mutex _stateMutex;
|
|
128
|
+
mutable std::shared_mutex _edgeMutex;
|
|
115
129
|
};
|
|
116
130
|
|
|
117
131
|
} // namespace atn
|
|
@@ -11,41 +11,40 @@
|
|
|
11
11
|
|
|
12
12
|
using namespace antlr4::atn;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
: ATNConfig(state_, alt_, context_, SemanticContext::NONE) {
|
|
16
|
-
}
|
|
14
|
+
namespace {
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
16
|
+
/**
|
|
17
|
+
* This field stores the bit mask for implementing the
|
|
18
|
+
* {@link #isPrecedenceFilterSuppressed} property as a bit within the
|
|
19
|
+
* existing {@link #reachesIntoOuterContext} field.
|
|
20
|
+
*/
|
|
21
|
+
inline constexpr size_t SUPPRESS_PRECEDENCE_FILTER = 0x40000000;
|
|
22
22
|
|
|
23
|
-
ATNConfig::ATNConfig(Ref<ATNConfig> const& c) : ATNConfig(c, c->state, c->context, c->semanticContext) {
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
ATNConfig::ATNConfig(
|
|
27
|
-
}
|
|
25
|
+
ATNConfig::ATNConfig(ATNState *state, size_t alt, Ref<const PredictionContext> context)
|
|
26
|
+
: ATNConfig(state, alt, std::move(context), 0, SemanticContext::NONE) {}
|
|
28
27
|
|
|
29
|
-
ATNConfig::ATNConfig(Ref<
|
|
30
|
-
|
|
31
|
-
}
|
|
28
|
+
ATNConfig::ATNConfig(ATNState *state, size_t alt, Ref<const PredictionContext> context, Ref<const SemanticContext> semanticContext)
|
|
29
|
+
: ATNConfig(state, alt, std::move(context), 0, std::move(semanticContext)) {}
|
|
32
30
|
|
|
33
|
-
ATNConfig::ATNConfig(
|
|
34
|
-
|
|
35
|
-
}
|
|
31
|
+
ATNConfig::ATNConfig(ATNConfig const& other, Ref<const SemanticContext> semanticContext)
|
|
32
|
+
: ATNConfig(other.state, other.alt, other.context, other.reachesIntoOuterContext, std::move(semanticContext)) {}
|
|
36
33
|
|
|
37
|
-
ATNConfig::ATNConfig(
|
|
38
|
-
|
|
39
|
-
}
|
|
34
|
+
ATNConfig::ATNConfig(ATNConfig const& other, ATNState *state)
|
|
35
|
+
: ATNConfig(state, other.alt, other.context, other.reachesIntoOuterContext, other.semanticContext) {}
|
|
40
36
|
|
|
41
|
-
ATNConfig::ATNConfig(
|
|
42
|
-
|
|
43
|
-
: state(state), alt(c->alt), context(context), reachesIntoOuterContext(c->reachesIntoOuterContext),
|
|
44
|
-
semanticContext(semanticContext) {
|
|
45
|
-
}
|
|
37
|
+
ATNConfig::ATNConfig(ATNConfig const& other, ATNState *state, Ref<const SemanticContext> semanticContext)
|
|
38
|
+
: ATNConfig(state, other.alt, other.context, other.reachesIntoOuterContext, std::move(semanticContext)) {}
|
|
46
39
|
|
|
47
|
-
ATNConfig
|
|
48
|
-
}
|
|
40
|
+
ATNConfig::ATNConfig(ATNConfig const& other, ATNState *state, Ref<const PredictionContext> context)
|
|
41
|
+
: ATNConfig(state, other.alt, std::move(context), other.reachesIntoOuterContext, other.semanticContext) {}
|
|
42
|
+
|
|
43
|
+
ATNConfig::ATNConfig(ATNConfig const& other, ATNState *state, Ref<const PredictionContext> context, Ref<const SemanticContext> semanticContext)
|
|
44
|
+
: ATNConfig(state, other.alt, std::move(context), other.reachesIntoOuterContext, std::move(semanticContext)) {}
|
|
45
|
+
|
|
46
|
+
ATNConfig::ATNConfig(ATNState *state, size_t alt, Ref<const PredictionContext> context, size_t reachesIntoOuterContext, Ref<const SemanticContext> semanticContext)
|
|
47
|
+
: state(state), alt(alt), context(std::move(context)), reachesIntoOuterContext(reachesIntoOuterContext), semanticContext(std::move(semanticContext)) {}
|
|
49
48
|
|
|
50
49
|
size_t ATNConfig::hashCode() const {
|
|
51
50
|
size_t hashCode = misc::MurmurHash::initialize(7);
|
|
@@ -73,22 +72,18 @@ void ATNConfig::setPrecedenceFilterSuppressed(bool value) {
|
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
74
|
|
|
76
|
-
bool ATNConfig::operator
|
|
75
|
+
bool ATNConfig::operator==(const ATNConfig &other) const {
|
|
77
76
|
return state->stateNumber == other.state->stateNumber && alt == other.alt &&
|
|
78
77
|
((context == other.context) || (*context == *other.context)) &&
|
|
79
78
|
*semanticContext == *other.semanticContext &&
|
|
80
79
|
isPrecedenceFilterSuppressed() == other.isPrecedenceFilterSuppressed();
|
|
81
80
|
}
|
|
82
81
|
|
|
83
|
-
|
|
84
|
-
return !operator==(other);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
std::string ATNConfig::toString() {
|
|
82
|
+
std::string ATNConfig::toString() const {
|
|
88
83
|
return toString(true);
|
|
89
84
|
}
|
|
90
85
|
|
|
91
|
-
std::string ATNConfig::toString(bool showAlt) {
|
|
86
|
+
std::string ATNConfig::toString(bool showAlt) const {
|
|
92
87
|
std::stringstream ss;
|
|
93
88
|
ss << "(";
|
|
94
89
|
|
|
@@ -100,12 +95,12 @@ std::string ATNConfig::toString(bool showAlt) {
|
|
|
100
95
|
ss << ",[" << context->toString() << "]";
|
|
101
96
|
}
|
|
102
97
|
if (semanticContext != nullptr && semanticContext != SemanticContext::NONE) {
|
|
103
|
-
ss << "," << semanticContext
|
|
98
|
+
ss << ",[" << semanticContext->toString() << "]";
|
|
104
99
|
}
|
|
105
100
|
if (getOuterContextDepth() > 0) {
|
|
106
101
|
ss << ",up=" << getOuterContextDepth();
|
|
107
102
|
}
|
|
108
|
-
ss <<
|
|
103
|
+
ss << ")";
|
|
109
104
|
|
|
110
105
|
return ss.str();
|
|
111
106
|
}
|
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
#pragma once
|
|
7
7
|
|
|
8
|
+
#include <cassert>
|
|
9
|
+
|
|
10
|
+
#include "antlr4-common.h"
|
|
11
|
+
#include "atn/SemanticContext.h"
|
|
12
|
+
|
|
8
13
|
namespace antlr4 {
|
|
9
14
|
namespace atn {
|
|
10
15
|
|
|
@@ -20,32 +25,39 @@ namespace atn {
|
|
|
20
25
|
public:
|
|
21
26
|
struct Hasher
|
|
22
27
|
{
|
|
28
|
+
size_t operator()(Ref<ATNConfig> const& k) const {
|
|
29
|
+
return k->hashCode();
|
|
30
|
+
}
|
|
31
|
+
|
|
23
32
|
size_t operator()(ATNConfig const& k) const {
|
|
24
33
|
return k.hashCode();
|
|
25
34
|
}
|
|
26
35
|
};
|
|
27
36
|
|
|
28
37
|
struct Comparer {
|
|
38
|
+
bool operator()(Ref<ATNConfig> const& lhs, Ref<ATNConfig> const& rhs) const {
|
|
39
|
+
return (lhs == rhs) || (*lhs == *rhs);
|
|
40
|
+
}
|
|
41
|
+
|
|
29
42
|
bool operator()(ATNConfig const& lhs, ATNConfig const& rhs) const {
|
|
30
43
|
return (&lhs == &rhs) || (lhs == rhs);
|
|
31
44
|
}
|
|
32
45
|
};
|
|
33
46
|
|
|
34
|
-
|
|
35
47
|
using Set = std::unordered_set<Ref<ATNConfig>, Hasher, Comparer>;
|
|
36
48
|
|
|
37
49
|
/// The ATN state associated with this configuration.
|
|
38
|
-
ATNState *
|
|
50
|
+
ATNState *state = nullptr;
|
|
39
51
|
|
|
40
52
|
/// What alt (or lexer rule) is predicted by this configuration.
|
|
41
|
-
const size_t alt;
|
|
53
|
+
const size_t alt = 0;
|
|
42
54
|
|
|
43
55
|
/// The stack of invoking states leading to the rule/states associated
|
|
44
56
|
/// with this config. We track only those contexts pushed during
|
|
45
57
|
/// execution of the ATN simulator.
|
|
46
58
|
///
|
|
47
59
|
/// Can be shared between multiple ANTConfig instances.
|
|
48
|
-
Ref<PredictionContext> context;
|
|
60
|
+
Ref<const PredictionContext> context;
|
|
49
61
|
|
|
50
62
|
/**
|
|
51
63
|
* We cannot execute predicates dependent upon local context unless
|
|
@@ -70,23 +82,25 @@ namespace atn {
|
|
|
70
82
|
* {@link ATNConfigSet#add(ATNConfig, DoubleKeyMap)} method are
|
|
71
83
|
* <em>completely</em> unaffected by the change.</p>
|
|
72
84
|
*/
|
|
73
|
-
size_t reachesIntoOuterContext;
|
|
85
|
+
size_t reachesIntoOuterContext = 0;
|
|
74
86
|
|
|
75
87
|
/// Can be shared between multiple ATNConfig instances.
|
|
76
|
-
Ref<SemanticContext> semanticContext;
|
|
88
|
+
Ref<const SemanticContext> semanticContext;
|
|
77
89
|
|
|
78
|
-
ATNConfig(ATNState *state, size_t alt, Ref<PredictionContext>
|
|
79
|
-
ATNConfig(ATNState *state, size_t alt, Ref<PredictionContext>
|
|
90
|
+
ATNConfig(ATNState *state, size_t alt, Ref<const PredictionContext> context);
|
|
91
|
+
ATNConfig(ATNState *state, size_t alt, Ref<const PredictionContext> context, Ref<const SemanticContext> semanticContext);
|
|
80
92
|
|
|
81
|
-
ATNConfig(
|
|
82
|
-
ATNConfig(
|
|
83
|
-
ATNConfig(
|
|
84
|
-
ATNConfig(
|
|
85
|
-
ATNConfig(
|
|
86
|
-
ATNConfig(Ref<ATNConfig> const& c, ATNState *state, Ref<PredictionContext> const& context, Ref<SemanticContext> const& semanticContext);
|
|
93
|
+
ATNConfig(ATNConfig const& other, Ref<const SemanticContext> semanticContext);
|
|
94
|
+
ATNConfig(ATNConfig const& other, ATNState *state);
|
|
95
|
+
ATNConfig(ATNConfig const& other, ATNState *state, Ref<const SemanticContext> semanticContext);
|
|
96
|
+
ATNConfig(ATNConfig const& other, ATNState *state, Ref<const PredictionContext> context);
|
|
97
|
+
ATNConfig(ATNConfig const& other, ATNState *state, Ref<const PredictionContext> context, Ref<const SemanticContext> semanticContext);
|
|
87
98
|
|
|
88
99
|
ATNConfig(ATNConfig const&) = default;
|
|
89
|
-
|
|
100
|
+
|
|
101
|
+
ATNConfig(ATNConfig&&) = default;
|
|
102
|
+
|
|
103
|
+
virtual ~ATNConfig() = default;
|
|
90
104
|
|
|
91
105
|
virtual size_t hashCode() const;
|
|
92
106
|
|
|
@@ -95,32 +109,21 @@ namespace atn {
|
|
|
95
109
|
* as it existed prior to the introduction of the
|
|
96
110
|
* {@link #isPrecedenceFilterSuppressed} method.
|
|
97
111
|
*/
|
|
98
|
-
size_t getOuterContextDepth() const
|
|
112
|
+
size_t getOuterContextDepth() const;
|
|
99
113
|
bool isPrecedenceFilterSuppressed() const;
|
|
100
114
|
void setPrecedenceFilterSuppressed(bool value);
|
|
101
115
|
|
|
102
116
|
/// An ATN configuration is equal to another if both have
|
|
103
117
|
/// the same state, they predict the same alternative, and
|
|
104
118
|
/// syntactic/semantic contexts are the same.
|
|
105
|
-
bool operator
|
|
106
|
-
bool operator
|
|
119
|
+
bool operator==(const ATNConfig &other) const;
|
|
120
|
+
bool operator!=(const ATNConfig &other) const;
|
|
107
121
|
|
|
108
|
-
virtual std::string toString();
|
|
109
|
-
std::string toString(bool showAlt);
|
|
122
|
+
virtual std::string toString() const;
|
|
123
|
+
std::string toString(bool showAlt) const;
|
|
110
124
|
|
|
111
125
|
private:
|
|
112
|
-
|
|
113
|
-
* This field stores the bit mask for implementing the
|
|
114
|
-
* {@link #isPrecedenceFilterSuppressed} property as a bit within the
|
|
115
|
-
* existing {@link #reachesIntoOuterContext} field.
|
|
116
|
-
*/
|
|
117
|
-
#if __cplusplus >= 201703L
|
|
118
|
-
static constexpr size_t SUPPRESS_PRECEDENCE_FILTER = 0x40000000;
|
|
119
|
-
#else
|
|
120
|
-
enum : size_t {
|
|
121
|
-
SUPPRESS_PRECEDENCE_FILTER = 0x40000000,
|
|
122
|
-
};
|
|
123
|
-
#endif
|
|
126
|
+
ATNConfig(ATNState *state, size_t alt, Ref<const PredictionContext> context, size_t reachesIntoOuterContext, Ref<const SemanticContext> semanticContext);
|
|
124
127
|
};
|
|
125
128
|
|
|
126
129
|
} // namespace atn
|