expressir 1.2.3 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.cross_rubies +0 -6
- data/.github/workflows/rake.yml +223 -31
- data/.gitignore +7 -1
- data/.gitmodules +3 -0
- data/.rubocop.yml +13 -4
- data/README.adoc +8 -0
- data/Rakefile +4 -1
- data/bin/console +0 -1
- data/bin/rspec +3 -3
- data/exe/expressir +4 -2
- data/exe/format +1 -1
- data/exe/format-test +25 -25
- data/exe/generate-parser +16 -13
- data/expressir.gemspec +11 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/CMakeLists.txt +44 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj +11 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj.filters +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj +11 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj.filters +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2017.vcxproj +11 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2017.vcxproj.filters +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj +19 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj.filters +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj +51 -35
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4.xcscheme +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_ios.xcscheme +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_static.xcscheme +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.cpp +1 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.h +9 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +43 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.h +16 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.cpp +2 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp +16 -13
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.h +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.cpp +5 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.cpp +2 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.h +9 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.cpp +0 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.h +1 -7
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.h +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.cpp +51 -31
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.h +1 -7
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.cpp +27 -39
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.h +1 -7
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.cpp +20 -23
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.h +21 -21
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.cpp +4 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.cpp +0 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.cpp +16 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.h +12 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.cpp +4 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.h +5 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.cpp +2 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.h +7 -7
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp +6 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp +15 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.h +12 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Version.h +42 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.cpp +13 -53
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.h +11 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-common.h +19 -58
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-runtime.h +7 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.cpp +6 -57
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.h +35 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.cpp +29 -36
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.h +36 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp +58 -54
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.h +77 -31
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.cpp +22 -32
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.h +22 -24
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp +335 -464
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.h +9 -62
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.cpp +9 -39
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.h +6 -22
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.cpp +10 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.h +42 -36
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.cpp +33 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.h +36 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.cpp +2 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.cpp +49 -22
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.h +20 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.cpp +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.h +5 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.h +5 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.h +10 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.cpp +0 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.h +12 -8
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.cpp +2 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.h +6 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp +139 -108
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.h +10 -43
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.cpp +16 -33
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.h +12 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp +69 -82
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.h +17 -28
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.cpp +12 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.h +45 -11
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.cpp +48 -44
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.h +31 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionType.h +3 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.cpp +14 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.cpp +15 -32
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.h +12 -24
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.cpp +23 -29
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.h +13 -19
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp +13 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.cpp +6 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.cpp +6 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.cpp +13 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.h +12 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.cpp +6 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.h +11 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.cpp +13 -26
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.h +13 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.h +5 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.cpp +1 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.cpp +6 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.h +8 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp +169 -152
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.h +26 -19
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulatorOptions.h +50 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.h +5 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.h +5 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.cpp +2 -11
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.h +15 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.h +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.cpp +4 -14
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.h +22 -11
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.cpp +255 -338
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.h +87 -116
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.cpp +56 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.h +64 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.cpp +167 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.h +101 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCacheOptions.h +71 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextType.h +21 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.cpp +18 -17
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.h +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.cpp +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.h +4 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.cpp +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.h +5 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.cpp +197 -156
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.h +92 -81
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContextType.h +23 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SerializedATNView.h +101 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.cpp +2 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.h +11 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp +39 -34
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.h +17 -10
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.h +5 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.cpp +6 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.h +6 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.h +5 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.cpp +1 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.h +11 -22
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.cpp +27 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.h +33 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.cpp +1 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.h +4 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.cpp +11 -23
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.h +20 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.cpp +2 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.h +4 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.cpp +9 -50
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.h +57 -48
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.cpp +1 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.h +3 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.h +3 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.cpp +1 -29
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.h +10 -10
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.cpp +15 -28
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.h +1 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.cpp +54 -68
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.h +35 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.cpp +0 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.h +1 -155
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.cpp +2 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.h +39 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/BitSet.h +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.cpp +13 -54
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.h +16 -29
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Casts.h +34 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Declarations.h +0 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.cpp +25 -23
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.h +2 -40
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Unicode.h +28 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.cpp +242 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.h +54 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h +13 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.h +7 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.cpp +36 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.h +14 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.cpp +14 -19
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.cpp +0 -3
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.h +14 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeType.h +22 -0
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.h +4 -4
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.cpp +8 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.h +30 -6
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.h +10 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp +2 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.h +4 -5
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp +1 -2
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.cpp +128 -119
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.h +18 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp +1 -1
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/tests/Utf8Test.cpp +110 -0
- data/ext/express-parser/antlrgen/Express.interp +1 -1
- data/ext/express-parser/antlrgen/ExpressBaseListener.cpp +1 -1
- data/ext/express-parser/antlrgen/ExpressBaseListener.h +1 -1
- data/ext/express-parser/antlrgen/ExpressBaseVisitor.cpp +1 -1
- data/ext/express-parser/antlrgen/ExpressBaseVisitor.h +200 -200
- data/ext/express-parser/antlrgen/ExpressLexer.cpp +645 -1129
- data/ext/express-parser/antlrgen/ExpressLexer.h +20 -27
- data/ext/express-parser/antlrgen/ExpressLexer.interp +1 -1
- data/ext/express-parser/antlrgen/ExpressListener.cpp +1 -1
- data/ext/express-parser/antlrgen/ExpressListener.h +1 -1
- data/ext/express-parser/antlrgen/ExpressParser.cpp +1754 -1447
- data/ext/express-parser/antlrgen/ExpressParser.h +219 -223
- data/ext/express-parser/antlrgen/ExpressVisitor.cpp +1 -1
- data/ext/express-parser/antlrgen/ExpressVisitor.h +200 -200
- data/ext/express-parser/express_parser.cpp +165 -101
- data/ext/express-parser/extconf.rb +14 -14
- data/lib/expressir/config.rb +1 -1
- data/lib/expressir/express/parser.rb +17 -15
- data/lib/expressir/express/visitor.rb +7 -3
- data/lib/expressir/model.rb +78 -78
- data/lib/expressir/version.rb +1 -1
- data/rakelib/antlr4-native.rake +161 -0
- data/rakelib/cross-ruby.rake +213 -162
- data/spec/acceptance/version_spec.rb +17 -2
- data/spec/expressir/express/cache_spec.rb +23 -5
- data/spec/expressir/express/formatter_spec.rb +54 -8
- data/spec/expressir/express/parser_spec.rb +47 -11
- data/spec/expressir/model/model_element_spec.rb +198 -146
- data/spec/spec_helper.rb +7 -0
- metadata +79 -91
- data/demo.rb +0 -18
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.cpp +0 -621
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.h +0 -61
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.cpp +0 -14
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AbstractPredicateTransition.h +0 -24
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.cpp +0 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.cpp +0 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.cpp +0 -35
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EmptyPredictionContext.h +0 -27
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Makefile +0 -67
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.cpp +0 -16
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.cpp +0 -15
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.cpp +0 -12
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/guid.cpp +0 -303
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/guid.h +0 -112
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.cpp +0 -9
- data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.cpp +0 -9
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.exp +0 -9589
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.owl +0 -36619
- data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.xml +0 -13294
- data/original/examples/employment/eclipse/.project +0 -17
- data/original/examples/employment/eclipse/Export/Employment.png +0 -0
- data/original/examples/employment/eclipse/Express/employment_schema.exp +0 -33
- data/original/examples/employment/eclipse/Express/employment_schema.xmi +0 -77
- data/original/examples/employment/eclipse/Express/employment_schema.xml +0 -93
- data/original/examples/employment/eclipse/Models/Employment.uml +0 -4
- data/original/examples/employment/eclipse/Models/Employment.umldi +0 -240
- data/original/examples/employment/eclipse/readme.txt +0 -7
- data/original/examples/employment/employment_schema.exp +0 -33
- data/original/examples/employment/employment_schema.rb +0 -232
- data/original/examples/employment/employment_schema.xml +0 -93
- data/original/examples/employment/employment_schema___module.rb +0 -46
- data/original/examples/employment/employment_schema___p28attr.rb +0 -126
- data/original/examples/employment/employment_schema___p28inst.rb +0 -26
- data/original/examples/employment/example_employment_data.xml +0 -1
- data/original/examples/employment/example_employment_data_copy.xml +0 -1
- data/original/examples/employment/example_employment_reader.rb +0 -30
- data/original/examples/employment/example_employment_writer.rb +0 -51
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.exp +0 -3710
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.owl +0 -35880
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xmi +0 -15357
- data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xml +0 -9468
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.exp +0 -8404
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.owl +0 -43147
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xmi +0 -18341
- data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xml +0 -11632
- data/original/exp2ruby.rb +0 -525
- data/original/expsm.rb +0 -34
- data/original/mapping_owl.rb +0 -1018
- data/original/mapping_sysml.rb +0 -2281
- data/original/mapping_uml2.rb +0 -599
- data/original/mapping_uml2_eclipse.rb +0 -433
- data/original/reeper.rb +0 -134
- data/spec/expressr_spec.rb +0 -5
@@ -4,10 +4,11 @@
|
|
4
4
|
*/
|
5
5
|
|
6
6
|
#include "RuntimeMetaData.h"
|
7
|
+
#include "Version.h"
|
7
8
|
|
8
9
|
using namespace antlr4;
|
9
10
|
|
10
|
-
const std::string RuntimeMetaData::VERSION =
|
11
|
+
const std::string RuntimeMetaData::VERSION = ANTLRCPP_VERSION_STRING;
|
11
12
|
|
12
13
|
std::string RuntimeMetaData::getRuntimeVersion() {
|
13
14
|
return VERSION;
|
@@ -14,24 +14,24 @@ namespace antlr4 {
|
|
14
14
|
/// we obtained this token.
|
15
15
|
class ANTLR4CPP_PUBLIC Token {
|
16
16
|
public:
|
17
|
-
static
|
17
|
+
static constexpr size_t INVALID_TYPE = 0;
|
18
18
|
|
19
19
|
/// During lookahead operations, this "token" signifies we hit rule end ATN state
|
20
20
|
/// and did not follow it despite needing to.
|
21
|
-
static
|
22
|
-
static
|
23
|
-
static
|
21
|
+
static constexpr size_t EPSILON = std::numeric_limits<size_t>::max() - 1;
|
22
|
+
static constexpr size_t MIN_USER_TOKEN_TYPE = 1;
|
23
|
+
static constexpr size_t EOF = IntStream::EOF;
|
24
24
|
|
25
25
|
virtual ~Token();
|
26
26
|
|
27
27
|
/// All tokens go to the parser (unless skip() is called in that rule)
|
28
28
|
/// on a particular "channel". The parser tunes to a particular channel
|
29
29
|
/// so that whitespace etc... can go to the parser on a "hidden" channel.
|
30
|
-
static
|
30
|
+
static constexpr size_t DEFAULT_CHANNEL = 0;
|
31
31
|
|
32
32
|
/// Anything on different channel than DEFAULT_CHANNEL is not parsed
|
33
33
|
/// by parser.
|
34
|
-
static
|
34
|
+
static constexpr size_t HIDDEN_CHANNEL = 1;
|
35
35
|
|
36
36
|
/**
|
37
37
|
* This is the minimum constant value which can be assigned to a
|
@@ -44,7 +44,7 @@ namespace antlr4 {
|
|
44
44
|
*
|
45
45
|
* @see Token#getChannel()
|
46
46
|
*/
|
47
|
-
static
|
47
|
+
static constexpr size_t MIN_USER_CHANNEL_VALUE = 2;
|
48
48
|
|
49
49
|
/// Get the text of the token.
|
50
50
|
virtual std::string getText() const = 0;
|
@@ -79,7 +79,7 @@ namespace antlr4 {
|
|
79
79
|
/// creating <seealso cref="Token"/> objects from the input.
|
80
80
|
/// </summary>
|
81
81
|
/// <returns> The <seealso cref="TokenFactory"/> currently used by this token source. </returns>
|
82
|
-
virtual
|
82
|
+
virtual TokenFactory<CommonToken>* getTokenFactory() = 0;
|
83
83
|
};
|
84
84
|
|
85
85
|
} // namespace antlr4
|
@@ -93,8 +93,8 @@ TokenStreamRewriter::TokenStreamRewriter(TokenStream *tokens_) : tokens(tokens_)
|
|
93
93
|
}
|
94
94
|
|
95
95
|
TokenStreamRewriter::~TokenStreamRewriter() {
|
96
|
-
for (auto program : _programs) {
|
97
|
-
for (auto operation : program.second) {
|
96
|
+
for (const auto &program : _programs) {
|
97
|
+
for (auto *operation : program.second) {
|
98
98
|
delete operation;
|
99
99
|
}
|
100
100
|
}
|
@@ -323,7 +323,7 @@ std::unordered_map<size_t, TokenStreamRewriter::RewriteOperation*> TokenStreamRe
|
|
323
323
|
|
324
324
|
// Wipe prior inserts within range
|
325
325
|
std::vector<InsertBeforeOp *> inserts = getKindOfOps<InsertBeforeOp>(rewrites, i);
|
326
|
-
for (auto iop : inserts) {
|
326
|
+
for (auto *iop : inserts) {
|
327
327
|
if (iop->index == rop->index) {
|
328
328
|
// E.g., insert before 2, delete 2..2; update replace
|
329
329
|
// text to include insert before, kill insert
|
@@ -339,7 +339,7 @@ std::unordered_map<size_t, TokenStreamRewriter::RewriteOperation*> TokenStreamRe
|
|
339
339
|
}
|
340
340
|
// Drop any prior replaces contained within
|
341
341
|
std::vector<ReplaceOp*> prevReplaces = getKindOfOps<ReplaceOp>(rewrites, i);
|
342
|
-
for (auto prevRop : prevReplaces) {
|
342
|
+
for (auto *prevRop : prevReplaces) {
|
343
343
|
if (prevRop->index >= rop->index && prevRop->lastIndex <= rop->lastIndex) {
|
344
344
|
// delete replace as it's a no-op.
|
345
345
|
delete rewrites[prevRop->instructionIndex];
|
@@ -373,7 +373,7 @@ std::unordered_map<size_t, TokenStreamRewriter::RewriteOperation*> TokenStreamRe
|
|
373
373
|
// combine current insert with prior if any at same index
|
374
374
|
|
375
375
|
std::vector<InsertBeforeOp *> prevInserts = getKindOfOps<InsertBeforeOp>(rewrites, i);
|
376
|
-
for (auto prevIop : prevInserts) {
|
376
|
+
for (auto *prevIop : prevInserts) {
|
377
377
|
if (prevIop->index == iop->index) { // combine objects
|
378
378
|
// convert to strings...we're in process of toString'ing
|
379
379
|
// whole token buffer so no lazy eval issue with any templates
|
@@ -385,7 +385,7 @@ std::unordered_map<size_t, TokenStreamRewriter::RewriteOperation*> TokenStreamRe
|
|
385
385
|
}
|
386
386
|
// look for replaces where iop.index is in range; error
|
387
387
|
std::vector<ReplaceOp*> prevReplaces = getKindOfOps<ReplaceOp>(rewrites, i);
|
388
|
-
for (auto rop : prevReplaces) {
|
388
|
+
for (auto *rop : prevReplaces) {
|
389
389
|
if (iop->index == rop->index) {
|
390
390
|
rop->text = catOpText(&iop->text, &rop->text);
|
391
391
|
delete rewrites[i];
|
@@ -5,6 +5,8 @@
|
|
5
5
|
|
6
6
|
#pragma once
|
7
7
|
|
8
|
+
#include "antlr4-common.h"
|
9
|
+
|
8
10
|
namespace antlr4 {
|
9
11
|
|
10
12
|
/**
|
@@ -86,8 +88,8 @@ namespace antlr4 {
|
|
86
88
|
class ANTLR4CPP_PUBLIC TokenStreamRewriter {
|
87
89
|
public:
|
88
90
|
static const std::string DEFAULT_PROGRAM_NAME;
|
89
|
-
static
|
90
|
-
static
|
91
|
+
static constexpr size_t PROGRAM_INIT_SIZE = 100;
|
92
|
+
static constexpr size_t MIN_TOKEN_INDEX = 0;
|
91
93
|
|
92
94
|
TokenStreamRewriter(TokenStream *tokens);
|
93
95
|
virtual ~TokenStreamRewriter();
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
#include "misc/Interval.h"
|
7
7
|
#include "Exceptions.h"
|
8
|
-
#include "support/
|
8
|
+
#include "support/Utf8.h"
|
9
9
|
|
10
10
|
#include "UnbufferedCharStream.h"
|
11
11
|
|
@@ -13,9 +13,8 @@ using namespace antlrcpp;
|
|
13
13
|
using namespace antlr4;
|
14
14
|
using namespace antlr4::misc;
|
15
15
|
|
16
|
-
UnbufferedCharStream::UnbufferedCharStream(std::wistream &input)
|
17
|
-
|
18
|
-
|
16
|
+
UnbufferedCharStream::UnbufferedCharStream(std::wistream &input)
|
17
|
+
: _p(0), _numMarkers(0), _lastChar(0), _lastCharBufferStart(0), _currentCharIndex(0), _input(input) {
|
19
18
|
// The vector's size is what used to be n in Java code.
|
20
19
|
fill(1); // prime
|
21
20
|
}
|
@@ -74,9 +73,7 @@ size_t UnbufferedCharStream::fill(size_t n) {
|
|
74
73
|
}
|
75
74
|
|
76
75
|
char32_t UnbufferedCharStream::nextChar() {
|
77
|
-
|
78
|
-
_input >> result;
|
79
|
-
return result;
|
76
|
+
return _input.get();
|
80
77
|
}
|
81
78
|
|
82
79
|
void UnbufferedCharStream::add(char32_t c) {
|
@@ -101,7 +98,7 @@ size_t UnbufferedCharStream::LA(ssize_t i) {
|
|
101
98
|
return EOF;
|
102
99
|
}
|
103
100
|
|
104
|
-
if (_data[static_cast<size_t>(index)] ==
|
101
|
+
if (_data[static_cast<size_t>(index)] == std::char_traits<wchar_t>::eof()) {
|
105
102
|
return EOF;
|
106
103
|
}
|
107
104
|
|
@@ -178,7 +175,7 @@ std::string UnbufferedCharStream::getSourceName() const {
|
|
178
175
|
}
|
179
176
|
|
180
177
|
std::string UnbufferedCharStream::getText(const misc::Interval &interval) {
|
181
|
-
if (interval.a < 0 || interval.b
|
178
|
+
if (interval.a < 0 || interval.b < interval.a - 1) {
|
182
179
|
throw IllegalArgumentException("invalid interval");
|
183
180
|
}
|
184
181
|
|
@@ -195,17 +192,17 @@ std::string UnbufferedCharStream::getText(const misc::Interval &interval) {
|
|
195
192
|
}
|
196
193
|
// convert from absolute to local index
|
197
194
|
size_t i = interval.a - bufferStartIndex;
|
198
|
-
|
195
|
+
auto maybeUtf8 = Utf8::strictEncode(std::u32string_view(_data).substr(i, interval.length()));
|
196
|
+
if (!maybeUtf8.has_value()) {
|
197
|
+
throw IllegalArgumentException("Unbuffered stream contains invalid Unicode code points");
|
198
|
+
}
|
199
|
+
return std::move(maybeUtf8).value();
|
199
200
|
}
|
200
201
|
|
201
|
-
|
202
|
-
|
202
|
+
std::string UnbufferedCharStream::toString() const {
|
203
|
+
throw UnsupportedOperationException("Unbuffered stream cannot be materialized to a string");
|
203
204
|
}
|
204
205
|
|
205
|
-
|
206
|
-
|
207
|
-
_numMarkers = 0;
|
208
|
-
_lastChar = 0;
|
209
|
-
_lastCharBufferStart = 0;
|
210
|
-
_currentCharIndex = 0;
|
206
|
+
size_t UnbufferedCharStream::getBufferStartIndex() const {
|
207
|
+
return _currentCharIndex - _p;
|
211
208
|
}
|
@@ -18,10 +18,10 @@ namespace antlr4 {
|
|
18
18
|
/// The name or source of this char stream.
|
19
19
|
std::string name;
|
20
20
|
|
21
|
-
UnbufferedCharStream(std::wistream &input);
|
21
|
+
explicit UnbufferedCharStream(std::wistream &input);
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
void consume() override;
|
24
|
+
size_t LA(ssize_t i) override;
|
25
25
|
|
26
26
|
/// <summary>
|
27
27
|
/// Return a marker that we can release later.
|
@@ -30,35 +30,32 @@ namespace antlr4 {
|
|
30
30
|
/// protection against misuse where {@code seek()} is called on a mark or
|
31
31
|
/// {@code release()} is called in the wrong order.
|
32
32
|
/// </summary>
|
33
|
-
|
33
|
+
ssize_t mark() override;
|
34
34
|
|
35
35
|
/// <summary>
|
36
36
|
/// Decrement number of markers, resetting buffer if we hit 0. </summary>
|
37
37
|
/// <param name="marker"> </param>
|
38
|
-
|
39
|
-
|
38
|
+
void release(ssize_t marker) override;
|
39
|
+
size_t index() override;
|
40
40
|
|
41
41
|
/// <summary>
|
42
42
|
/// Seek to absolute character index, which might not be in the current
|
43
43
|
/// sliding window. Move {@code p} to {@code index-bufferStartIndex}.
|
44
44
|
/// </summary>
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
void seek(size_t index) override;
|
46
|
+
size_t size() override;
|
47
|
+
std::string getSourceName() const override;
|
48
|
+
std::string getText(const misc::Interval &interval) override;
|
49
|
+
|
50
|
+
std::string toString() const override;
|
49
51
|
|
50
52
|
protected:
|
51
53
|
/// A moving window buffer of the data being scanned. While there's a marker,
|
52
54
|
/// we keep adding to buffer. Otherwise, <seealso cref="#consume consume()"/> resets so
|
53
55
|
/// we start filling at index 0 again.
|
54
56
|
// UTF-32 encoded.
|
55
|
-
#if defined(_MSC_VER) && _MSC_VER == 1900
|
56
|
-
i32string _data; // Custom type for VS 2015.
|
57
|
-
typedef __int32 storage_type;
|
58
|
-
#else
|
59
57
|
std::u32string _data;
|
60
58
|
typedef char32_t storage_type;
|
61
|
-
#endif
|
62
59
|
|
63
60
|
/// <summary>
|
64
61
|
/// 0..n-1 index into <seealso cref="#data data"/> of next character.
|
@@ -115,9 +112,6 @@ namespace antlr4 {
|
|
115
112
|
virtual char32_t nextChar();
|
116
113
|
virtual void add(char32_t c);
|
117
114
|
size_t getBufferStartIndex() const;
|
118
|
-
|
119
|
-
private:
|
120
|
-
void InitializeInstanceFields();
|
121
115
|
};
|
122
116
|
|
123
117
|
} // namespace antlr4
|
@@ -0,0 +1,42 @@
|
|
1
|
+
// Copyright 2012-2022 The ANTLR Project
|
2
|
+
//
|
3
|
+
// Redistribution and use in source and binary forms, with or without modification, are permitted
|
4
|
+
// provided that the following conditions are met:
|
5
|
+
//
|
6
|
+
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions
|
7
|
+
// and the following disclaimer.
|
8
|
+
//
|
9
|
+
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of
|
10
|
+
// conditions and the following disclaimer in the documentation and/or other materials provided
|
11
|
+
// with the distribution.
|
12
|
+
//
|
13
|
+
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to
|
14
|
+
// endorse or promote products derived from this software without specific prior written
|
15
|
+
// permission.
|
16
|
+
//
|
17
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
18
|
+
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
19
|
+
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
20
|
+
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
21
|
+
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
22
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
23
|
+
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
|
24
|
+
// WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
25
|
+
|
26
|
+
#pragma once
|
27
|
+
|
28
|
+
#include "antlr4-common.h"
|
29
|
+
|
30
|
+
#define ANTLRCPP_VERSION_MAJOR 4
|
31
|
+
#define ANTLRCPP_VERSION_MINOR 10
|
32
|
+
#define ANTLRCPP_VERSION_PATCH 1
|
33
|
+
|
34
|
+
#define ANTLRCPP_MAKE_VERSION(major, minor, patch) ((major) * 100000 + (minor) * 1000 + (patch))
|
35
|
+
|
36
|
+
#define ANTLRCPP_VERSION \
|
37
|
+
ANTLRCPP_MAKE_VERSION(ANTLR4CPP_VERSION_MAJOR, ANTLR4CPP_VERSION_MINOR, ANTLR4CPP_VERSION_PATCH)
|
38
|
+
|
39
|
+
#define ANTLRCPP_VERSION_STRING \
|
40
|
+
ANTLR4CPP_STRINGIFY(ANTLR4CPP_VERSION_MAJOR) "." \
|
41
|
+
ANTLR4CPP_STRINGIFY(ANTLR4CPP_VERSION_MINOR) "." \
|
42
|
+
ANTLR4CPP_STRINGIFY(ANTLR4CPP_VERSION_PATCH)
|
@@ -11,58 +11,18 @@ using namespace antlr4::dfa;
|
|
11
11
|
|
12
12
|
const Vocabulary Vocabulary::EMPTY_VOCABULARY;
|
13
13
|
|
14
|
-
Vocabulary::Vocabulary(
|
15
|
-
: Vocabulary(literalNames, symbolicNames, {}) {
|
14
|
+
Vocabulary::Vocabulary(std::vector<std::string> literalNames, std::vector<std::string> symbolicNames)
|
15
|
+
: Vocabulary(std::move(literalNames), std::move(symbolicNames), {}) {
|
16
16
|
}
|
17
17
|
|
18
|
-
Vocabulary::Vocabulary(
|
19
|
-
|
20
|
-
: _literalNames(literalNames), _symbolicNames(symbolicNames), _displayNames(displayNames),
|
18
|
+
Vocabulary::Vocabulary(std::vector<std::string> literalNames,
|
19
|
+
std::vector<std::string> symbolicNames, std::vector<std::string> displayNames)
|
20
|
+
: _literalNames(std::move(literalNames)), _symbolicNames(std::move(symbolicNames)), _displayNames(std::move(displayNames)),
|
21
21
|
_maxTokenType(std::max(_displayNames.size(), std::max(_literalNames.size(), _symbolicNames.size())) - 1) {
|
22
22
|
// See note here on -1 part: https://github.com/antlr/antlr4/pull/1146
|
23
23
|
}
|
24
24
|
|
25
|
-
Vocabulary
|
26
|
-
}
|
27
|
-
|
28
|
-
Vocabulary Vocabulary::fromTokenNames(const std::vector<std::string> &tokenNames) {
|
29
|
-
if (tokenNames.empty()) {
|
30
|
-
return EMPTY_VOCABULARY;
|
31
|
-
}
|
32
|
-
|
33
|
-
std::vector<std::string> literalNames = tokenNames;
|
34
|
-
std::vector<std::string> symbolicNames = tokenNames;
|
35
|
-
std::locale locale;
|
36
|
-
for (size_t i = 0; i < tokenNames.size(); i++) {
|
37
|
-
std::string tokenName = tokenNames[i];
|
38
|
-
if (tokenName == "") {
|
39
|
-
continue;
|
40
|
-
}
|
41
|
-
|
42
|
-
if (!tokenName.empty()) {
|
43
|
-
char firstChar = tokenName[0];
|
44
|
-
if (firstChar == '\'') {
|
45
|
-
symbolicNames[i] = "";
|
46
|
-
continue;
|
47
|
-
} else if (std::isupper(firstChar, locale)) {
|
48
|
-
literalNames[i] = "";
|
49
|
-
continue;
|
50
|
-
}
|
51
|
-
}
|
52
|
-
|
53
|
-
// wasn't a literal or symbolic name
|
54
|
-
literalNames[i] = "";
|
55
|
-
symbolicNames[i] = "";
|
56
|
-
}
|
57
|
-
|
58
|
-
return Vocabulary(literalNames, symbolicNames, tokenNames);
|
59
|
-
}
|
60
|
-
|
61
|
-
size_t Vocabulary::getMaxTokenType() const {
|
62
|
-
return _maxTokenType;
|
63
|
-
}
|
64
|
-
|
65
|
-
std::string Vocabulary::getLiteralName(size_t tokenType) const {
|
25
|
+
std::string_view Vocabulary::getLiteralName(size_t tokenType) const {
|
66
26
|
if (tokenType < _literalNames.size()) {
|
67
27
|
return _literalNames[tokenType];
|
68
28
|
}
|
@@ -70,7 +30,7 @@ std::string Vocabulary::getLiteralName(size_t tokenType) const {
|
|
70
30
|
return "";
|
71
31
|
}
|
72
32
|
|
73
|
-
std::
|
33
|
+
std::string_view Vocabulary::getSymbolicName(size_t tokenType) const {
|
74
34
|
if (tokenType == Token::EOF) {
|
75
35
|
return "EOF";
|
76
36
|
}
|
@@ -84,20 +44,20 @@ std::string Vocabulary::getSymbolicName(size_t tokenType) const {
|
|
84
44
|
|
85
45
|
std::string Vocabulary::getDisplayName(size_t tokenType) const {
|
86
46
|
if (tokenType < _displayNames.size()) {
|
87
|
-
std::
|
47
|
+
std::string_view displayName = _displayNames[tokenType];
|
88
48
|
if (!displayName.empty()) {
|
89
|
-
return displayName;
|
49
|
+
return std::string(displayName);
|
90
50
|
}
|
91
51
|
}
|
92
52
|
|
93
|
-
std::
|
53
|
+
std::string_view literalName = getLiteralName(tokenType);
|
94
54
|
if (!literalName.empty()) {
|
95
|
-
return literalName;
|
55
|
+
return std::string(literalName);
|
96
56
|
}
|
97
57
|
|
98
|
-
std::
|
58
|
+
std::string_view symbolicName = getSymbolicName(tokenType);
|
99
59
|
if (!symbolicName.empty()) {
|
100
|
-
return symbolicName;
|
60
|
+
return std::string(symbolicName);
|
101
61
|
}
|
102
62
|
|
103
63
|
return std::to_string(tokenType);
|
@@ -12,21 +12,20 @@ namespace dfa {
|
|
12
12
|
|
13
13
|
/// This class provides a default implementation of the <seealso cref="Vocabulary"/>
|
14
14
|
/// interface.
|
15
|
-
class ANTLR4CPP_PUBLIC Vocabulary {
|
15
|
+
class ANTLR4CPP_PUBLIC Vocabulary final {
|
16
16
|
public:
|
17
|
-
Vocabulary(Vocabulary const&) = default;
|
18
|
-
virtual ~Vocabulary();
|
19
|
-
|
20
17
|
/// Gets an empty <seealso cref="Vocabulary"/> instance.
|
21
18
|
///
|
22
19
|
/// <para>
|
23
20
|
/// No literal or symbol names are assigned to token types, so
|
24
21
|
/// <seealso cref="#getDisplayName(int)"/> returns the numeric value for all tokens
|
25
22
|
/// except <seealso cref="Token#EOF"/>.</para>
|
26
|
-
static const Vocabulary EMPTY_VOCABULARY;
|
23
|
+
[[deprecated("Use the default constructor of Vocabulary instead.")]] static const Vocabulary EMPTY_VOCABULARY;
|
27
24
|
|
28
25
|
Vocabulary() {}
|
29
26
|
|
27
|
+
Vocabulary(const Vocabulary&) = default;
|
28
|
+
|
30
29
|
/// <summary>
|
31
30
|
/// Constructs a new instance of <seealso cref="Vocabulary"/> from the specified
|
32
31
|
/// literal and symbolic token names.
|
@@ -38,7 +37,7 @@ namespace dfa {
|
|
38
37
|
/// </param>
|
39
38
|
/// <seealso cref= #getLiteralName(int) </seealso>
|
40
39
|
/// <seealso cref= #getSymbolicName(int) </seealso>
|
41
|
-
Vocabulary(
|
40
|
+
Vocabulary(std::vector<std::string> literalNames, std::vector<std::string> symbolicNames);
|
42
41
|
|
43
42
|
/// <summary>
|
44
43
|
/// Constructs a new instance of <seealso cref="Vocabulary"/> from the specified
|
@@ -56,29 +55,14 @@ namespace dfa {
|
|
56
55
|
/// <seealso cref= #getLiteralName(int) </seealso>
|
57
56
|
/// <seealso cref= #getSymbolicName(int) </seealso>
|
58
57
|
/// <seealso cref= #getDisplayName(int) </seealso>
|
59
|
-
Vocabulary(
|
60
|
-
|
61
|
-
|
62
|
-
/// <summary>
|
63
|
-
/// Returns a <seealso cref="Vocabulary"/> instance from the specified set of token
|
64
|
-
/// names. This method acts as a compatibility layer for the single
|
65
|
-
/// {@code tokenNames} array generated by previous releases of ANTLR.
|
66
|
-
///
|
67
|
-
/// <para>The resulting vocabulary instance returns {@code null} for
|
68
|
-
/// <seealso cref="#getLiteralName(int)"/> and <seealso cref="#getSymbolicName(int)"/>, and the
|
69
|
-
/// value from {@code tokenNames} for the display names.</para>
|
70
|
-
/// </summary>
|
71
|
-
/// <param name="tokenNames"> The token names, or {@code null} if no token names are
|
72
|
-
/// available. </param>
|
73
|
-
/// <returns> A <seealso cref="Vocabulary"/> instance which uses {@code tokenNames} for
|
74
|
-
/// the display names of tokens. </returns>
|
75
|
-
static Vocabulary fromTokenNames(const std::vector<std::string> &tokenNames);
|
58
|
+
Vocabulary(std::vector<std::string> literalNames, std::vector<std::string> symbolicNames,
|
59
|
+
std::vector<std::string> displayNames);
|
76
60
|
|
77
61
|
/// <summary>
|
78
62
|
/// Returns the highest token type value. It can be used to iterate from
|
79
63
|
/// zero to that number, inclusively, thus querying all stored entries. </summary>
|
80
64
|
/// <returns> the highest token type value </returns>
|
81
|
-
|
65
|
+
constexpr size_t getMaxTokenType() const { return _maxTokenType; }
|
82
66
|
|
83
67
|
/// <summary>
|
84
68
|
/// Gets the string literal associated with a token type. The string returned
|
@@ -115,7 +99,7 @@ namespace dfa {
|
|
115
99
|
/// </param>
|
116
100
|
/// <returns> The string literal associated with the specified token type, or
|
117
101
|
/// {@code null} if no string literal is associated with the type. </returns>
|
118
|
-
|
102
|
+
std::string_view getLiteralName(size_t tokenType) const;
|
119
103
|
|
120
104
|
/// <summary>
|
121
105
|
/// Gets the symbolic name associated with a token type. The string returned
|
@@ -159,7 +143,7 @@ namespace dfa {
|
|
159
143
|
/// </param>
|
160
144
|
/// <returns> The symbolic name associated with the specified token type, or
|
161
145
|
/// {@code null} if no symbolic name is associated with the type. </returns>
|
162
|
-
|
146
|
+
std::string_view getSymbolicName(size_t tokenType) const;
|
163
147
|
|
164
148
|
/// <summary>
|
165
149
|
/// Gets the display name of a token type.
|
@@ -180,7 +164,7 @@ namespace dfa {
|
|
180
164
|
/// </param>
|
181
165
|
/// <returns> The display name of the token type, for use in error reporting or
|
182
166
|
/// other user-visible messages which reference specific token types. </returns>
|
183
|
-
|
167
|
+
std::string getDisplayName(size_t tokenType) const;
|
184
168
|
|
185
169
|
private:
|
186
170
|
std::vector<std::string> const _literalNames;
|
@@ -6,36 +6,34 @@
|
|
6
6
|
#pragma once
|
7
7
|
|
8
8
|
#include <algorithm>
|
9
|
-
#include <
|
9
|
+
#include <any>
|
10
10
|
#include <atomic>
|
11
|
-
#include <
|
12
|
-
#include <
|
11
|
+
#include <bitset>
|
12
|
+
#include <cassert>
|
13
|
+
#include <climits>
|
14
|
+
#include <cstddef>
|
15
|
+
#include <cstdint>
|
16
|
+
#include <cstdlib>
|
17
|
+
#include <exception>
|
13
18
|
#include <fstream>
|
14
19
|
#include <iostream>
|
15
20
|
#include <iterator>
|
16
21
|
#include <limits>
|
17
|
-
#include <limits.h>
|
18
|
-
#include <list>
|
19
22
|
#include <map>
|
20
23
|
#include <memory>
|
24
|
+
#include <mutex>
|
21
25
|
#include <set>
|
22
|
-
#include <
|
23
|
-
#include <stdint.h>
|
24
|
-
#include <stdlib.h>
|
26
|
+
#include <shared_mutex>
|
25
27
|
#include <sstream>
|
26
28
|
#include <stack>
|
27
29
|
#include <string>
|
30
|
+
#include <string_view>
|
28
31
|
#include <typeinfo>
|
29
32
|
#include <type_traits>
|
30
33
|
#include <unordered_map>
|
31
34
|
#include <unordered_set>
|
32
35
|
#include <utility>
|
33
36
|
#include <vector>
|
34
|
-
#include <mutex>
|
35
|
-
#include <exception>
|
36
|
-
#include <bitset>
|
37
|
-
#include <condition_variable>
|
38
|
-
#include <functional>
|
39
37
|
|
40
38
|
// Defines for the Guid class and other platform dependent stuff.
|
41
39
|
#ifdef _WIN32
|
@@ -49,25 +47,12 @@
|
|
49
47
|
#endif
|
50
48
|
#endif
|
51
49
|
|
52
|
-
#define GUID_WINDOWS
|
53
|
-
|
54
50
|
#ifdef _WIN64
|
55
51
|
typedef __int64 ssize_t;
|
56
52
|
#else
|
57
53
|
typedef __int32 ssize_t;
|
58
54
|
#endif
|
59
55
|
|
60
|
-
#if _MSC_VER >= 1900 && _MSC_VER < 2000
|
61
|
-
// VS 2015 has a known bug when using std::codecvt_utf8<char32_t>
|
62
|
-
// so we have to temporarily use __int32 instead.
|
63
|
-
// https://connect.microsoft.com/VisualStudio/feedback/details/1403302/unresolved-external-when-using-codecvt-utf8
|
64
|
-
typedef std::basic_string<__int32> i32string;
|
65
|
-
|
66
|
-
typedef i32string UTF32String;
|
67
|
-
#else
|
68
|
-
typedef std::u32string UTF32String;
|
69
|
-
#endif
|
70
|
-
|
71
56
|
#ifdef ANTLR4CPP_EXPORTS
|
72
57
|
#define ANTLR4CPP_PUBLIC __declspec(dllexport)
|
73
58
|
#else
|
@@ -78,26 +63,13 @@
|
|
78
63
|
#endif
|
79
64
|
#endif
|
80
65
|
|
81
|
-
#if defined(_MSC_VER) && !defined(__clang__)
|
82
|
-
// clang-cl should escape this to prevent [ignored-attributes].
|
83
|
-
namespace std {
|
84
|
-
class ANTLR4CPP_PUBLIC exception; // Prevents warning C4275 from MSVC.
|
85
|
-
} // namespace std
|
86
|
-
#endif
|
87
|
-
|
88
66
|
#elif defined(__APPLE__)
|
89
|
-
typedef std::u32string UTF32String;
|
90
|
-
|
91
|
-
#define GUID_CFUUID
|
92
67
|
#if __GNUC__ >= 4
|
93
68
|
#define ANTLR4CPP_PUBLIC __attribute__ ((visibility ("default")))
|
94
69
|
#else
|
95
70
|
#define ANTLR4CPP_PUBLIC
|
96
71
|
#endif
|
97
72
|
#else
|
98
|
-
typedef std::u32string UTF32String;
|
99
|
-
|
100
|
-
#define GUID_LIBUUID
|
101
73
|
#if __GNUC__ >= 6
|
102
74
|
#define ANTLR4CPP_PUBLIC __attribute__ ((visibility ("default")))
|
103
75
|
#else
|
@@ -105,27 +77,16 @@
|
|
105
77
|
#endif
|
106
78
|
#endif
|
107
79
|
|
108
|
-
#
|
109
|
-
#
|
80
|
+
#ifdef __has_builtin
|
81
|
+
#define ANTLR4CPP_HAVE_BUILTIN(x) __has_builtin(x)
|
82
|
+
#else
|
83
|
+
#define ANTLR4CPP_HAVE_BUILTIN(x) 0
|
84
|
+
#endif
|
110
85
|
|
111
|
-
#
|
112
|
-
|
113
|
-
#if __has_feature(cxx_noexcept)
|
114
|
-
#define HAS_NOEXCEPT
|
115
|
-
#endif
|
116
|
-
#else
|
117
|
-
#if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ * 10 + __GNUC_MINOR__ >= 46 || \
|
118
|
-
defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026
|
119
|
-
#define HAS_NOEXCEPT
|
120
|
-
#endif
|
121
|
-
#endif
|
86
|
+
#define ANTLR4CPP_INTERNAL_STRINGIFY(x) #x
|
87
|
+
#define ANTLR4CPP_STRINGIFY(x) ANTLR4CPP_INTERNAL_STRINGIFY(x)
|
122
88
|
|
123
|
-
|
124
|
-
#define NOEXCEPT noexcept
|
125
|
-
#else
|
126
|
-
#define NOEXCEPT
|
127
|
-
#endif
|
128
|
-
#endif
|
89
|
+
#include "support/Declarations.h"
|
129
90
|
|
130
91
|
// We have to undefine this symbol as ANTLR will use this name for own members and even
|
131
92
|
// generated functions. Because EOF is a global macro we cannot use e.g. a namespace scope to disambiguate.
|