expressir 1.4.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/codeql.yml +2 -14
- data/.github/workflows/rake.yml +6 -364
- data/.github/workflows/release.yml +15 -178
- data/.github/workflows/stress.yml +1 -18
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +7 -0
- data/Gemfile +13 -0
- data/README.adoc +6 -19
- data/Rakefile +6 -7
- data/expressir.gemspec +23 -32
- data/expressir_wrapped.txt +23068 -0
- data/lib/expressir/cli.rb +1 -1
- data/lib/expressir/express/formatter.rb +661 -661
- data/lib/expressir/express/parser.rb +299 -33
- data/lib/expressir/express/visitor.rb +238 -133
- data/lib/expressir/model/declarations/interface_item.rb +1 -1
- data/lib/expressir/version.rb +1 -1
- metadata +15 -573
- data/.cross_rubies +0 -28
- data/.gitmodules +0 -6
- data/.yardopts +0 -11
- data/exe/generate-parser +0 -51
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/CMakeLists.txt +0 -191
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj +0 -652
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj.filters +0 -948
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2022.vcxproj +0 -652
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2022.vcxproj.filters +0 -948
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp-ios/Info.plist +0 -26
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp-ios/antlrcpp_ios.h +0 -17
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj +0 -3040
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4.xcscheme +0 -76
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_ios.xcscheme +0 -76
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_static.xcscheme +0 -76
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/nuget/ANTLR4.Runtime.cpp.noarch.nuspec +0 -23
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/nuget/ANTLR4.Runtime.cpp.noarch.targets +0 -8
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/nuget/ANTLR4.Runtime.cpp.shared.nuspec +0 -30
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/nuget/ANTLR4.Runtime.cpp.shared.props +0 -21
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/nuget/ANTLR4.Runtime.cpp.shared.targets +0 -44
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/nuget/ANTLR4.Runtime.cpp.static.nuspec +0 -29
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/nuget/ANTLR4.Runtime.cpp.static.targets +0 -44
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/nuget/antlr4.jpg +0 -0
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/nuget/pack.cmd +0 -93
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorListener.cpp +0 -10
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorListener.h +0 -167
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorStrategy.cpp +0 -10
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRErrorStrategy.h +0 -121
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.cpp +0 -23
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.h +0 -30
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +0 -180
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.h +0 -79
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/BailErrorStrategy.cpp +0 -61
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/BailErrorStrategy.h +0 -59
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/BaseErrorListener.cpp +0 -25
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/BaseErrorListener.h +0 -36
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/BufferedTokenStream.cpp +0 -414
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/BufferedTokenStream.h +0 -200
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/CharStream.cpp +0 -11
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/CharStream.h +0 -37
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.cpp +0 -193
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonToken.h +0 -158
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.cpp +0 -39
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.h +0 -74
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenStream.cpp +0 -78
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenStream.h +0 -79
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ConsoleErrorListener.cpp +0 -15
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ConsoleErrorListener.h +0 -35
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp +0 -336
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/DefaultErrorStrategy.h +0 -466
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/DiagnosticErrorListener.cpp +0 -84
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/DiagnosticErrorListener.h +0 -80
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.cpp +0 -64
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Exceptions.h +0 -99
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.cpp +0 -52
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/FailedPredicateException.h +0 -32
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/FlatHashMap.h +0 -57
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/FlatHashSet.h +0 -57
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/InputMismatchException.cpp +0 -18
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/InputMismatchException.h +0 -24
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.cpp +0 -12
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.h +0 -218
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/InterpreterRuleContext.cpp +0 -19
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/InterpreterRuleContext.h +0 -45
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.cpp +0 -294
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.h +0 -196
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.cpp +0 -60
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerInterpreter.h +0 -46
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerNoViableAltException.cpp +0 -36
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/LexerNoViableAltException.h +0 -31
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.cpp +0 -92
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.h +0 -88
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/NoViableAltException.cpp +0 -46
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/NoViableAltException.h +0 -42
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.cpp +0 -670
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.h +0 -461
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.cpp +0 -294
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserInterpreter.h +0 -173
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.cpp +0 -138
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.h +0 -147
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.cpp +0 -53
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.h +0 -38
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.cpp +0 -65
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/RecognitionException.h +0 -98
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.cpp +0 -157
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.h +0 -160
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.cpp +0 -144
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContext.h +0 -141
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContextWithAltNum.cpp +0 -27
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuleContextWithAltNum.h +0 -32
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.cpp +0 -54
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.h +0 -155
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.cpp +0 -9
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.h +0 -92
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenFactory.h +0 -30
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.cpp +0 -9
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.h +0 -85
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStream.cpp +0 -11
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStream.h +0 -137
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp +0 -425
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.h +0 -295
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp +0 -208
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedCharStream.h +0 -117
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedTokenStream.cpp +0 -270
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/UnbufferedTokenStream.h +0 -115
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Version.h +0 -42
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.cpp +0 -64
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.h +0 -177
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/WritableToken.cpp +0 -9
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/WritableToken.h +0 -23
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-common.h +0 -101
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-runtime.h +0 -168
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.cpp +0 -159
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.h +0 -133
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.cpp +0 -106
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.h +0 -157
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp +0 -233
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfigSet.h +0 -157
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.cpp +0 -39
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializationOptions.h +0 -48
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp +0 -628
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.h +0 -32
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.cpp +0 -33
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSimulator.h +0 -71
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.cpp +0 -56
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.h +0 -139
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.cpp +0 -33
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNStateType.h +0 -36
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNType.h +0 -20
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.cpp +0 -29
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ActionTransition.h +0 -35
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AmbiguityInfo.cpp +0 -16
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AmbiguityInfo.h +0 -68
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.cpp +0 -129
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ArrayPredictionContext.h +0 -51
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.cpp +0 -27
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/AtomTransition.h +0 -33
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicBlockStartState.h +0 -24
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BasicState.h +0 -23
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockEndState.h +0 -26
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/BlockStartState.h +0 -30
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.cpp +0 -14
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ContextSensitivityInfo.h +0 -47
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionEventInfo.cpp +0 -14
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionEventInfo.h +0 -70
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.cpp +0 -25
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionInfo.h +0 -227
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.cpp +0 -12
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/DecisionState.h +0 -34
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.cpp +0 -31
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/EpsilonTransition.h +0 -42
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ErrorInfo.cpp +0 -15
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ErrorInfo.h +0 -43
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/HashUtils.h +0 -18
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp +0 -189
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.h +0 -76
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.cpp +0 -67
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNConfig.h +0 -44
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp +0 -621
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.h +0 -199
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.cpp +0 -15
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerAction.h +0 -100
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.cpp +0 -108
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionExecutor.h +0 -128
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerActionType.h +0 -57
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.cpp +0 -43
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerChannelAction.h +0 -59
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.cpp +0 -45
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerCustomAction.h +0 -75
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.cpp +0 -50
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerIndexedCustomAction.h +0 -76
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp +0 -43
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerModeAction.h +0 -57
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.cpp +0 -36
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerMoreAction.h +0 -53
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.cpp +0 -36
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPopModeAction.h +0 -53
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.cpp +0 -43
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerPushModeAction.h +0 -57
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.cpp +0 -36
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerSkipAction.h +0 -51
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.cpp +0 -43
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerTypeAction.h +0 -51
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.cpp +0 -16
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LookaheadEventInfo.h +0 -42
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LoopEndState.h +0 -26
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.cpp +0 -22
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/NotSetTransition.h +0 -27
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.cpp +0 -16
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/OrderedATNConfigSet.h +0 -25
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParseInfo.cpp +0 -102
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParseInfo.h +0 -102
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp +0 -1413
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.h +0 -911
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulatorOptions.h +0 -50
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusBlockStartState.h +0 -29
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PlusLoopbackState.h +0 -25
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.cpp +0 -23
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PrecedencePredicateTransition.h +0 -35
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.cpp +0 -17
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateEvalInfo.h +0 -62
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.cpp +0 -24
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredicateTransition.h +0 -50
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.cpp +0 -601
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.h +0 -225
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.cpp +0 -56
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextCache.h +0 -63
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.cpp +0 -167
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCache.h +0 -101
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextMergeCacheOptions.h +0 -71
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContextType.h +0 -21
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.cpp +0 -202
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionMode.h +0 -436
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.cpp +0 -179
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ProfilingATNSimulator.h +0 -60
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.cpp +0 -26
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RangeTransition.h +0 -31
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStartState.h +0 -26
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleStopState.h +0 -27
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.cpp +0 -33
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/RuleTransition.h +0 -42
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.cpp +0 -418
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContext.h +0 -237
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SemanticContextType.h +0 -23
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SerializedATNView.h +0 -101
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.cpp +0 -28
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SetTransition.h +0 -38
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp +0 -79
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.h +0 -43
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarBlockStartState.h +0 -24
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopEntryState.h +0 -37
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.cpp +0 -19
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/StarLoopbackState.h +0 -25
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TokensStartState.h +0 -24
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.cpp +0 -36
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/Transition.h +0 -65
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.cpp +0 -27
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/TransitionType.h +0 -33
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.cpp +0 -21
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/WildcardTransition.h +0 -27
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.cpp +0 -115
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.h +0 -96
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.cpp +0 -60
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.h +0 -32
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.cpp +0 -59
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.h +0 -154
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.cpp +0 -17
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/LexerDFASerializer.h +0 -22
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/internal/Synchronization.cpp +0 -100
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/internal/Synchronization.h +0 -154
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.cpp +0 -124
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/InterpreterDataReader.h +0 -33
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.cpp +0 -61
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Interval.h +0 -84
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.cpp +0 -508
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.h +0 -190
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.cpp +0 -120
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.h +0 -102
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Predicate.cpp +0 -4
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/Predicate.h +0 -21
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.cpp +0 -8
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.h +0 -16
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.cpp +0 -43
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.h +0 -149
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/BitSet.h +0 -76
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.cpp +0 -207
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.h +0 -65
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Casts.h +0 -34
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Declarations.h +0 -161
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.cpp +0 -38
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.h +0 -16
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Unicode.h +0 -28
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.cpp +0 -242
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Utf8.h +0 -54
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h +0 -129
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNode.h +0 -24
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.cpp +0 -54
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ErrorNodeImpl.h +0 -43
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.cpp +0 -66
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/IterativeParseTreeWalker.h +0 -53
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.cpp +0 -12
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.h +0 -111
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeListener.cpp +0 -9
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeListener.h +0 -39
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeProperty.h +0 -50
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeType.h +0 -22
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.cpp +0 -9
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeVisitor.h +0 -57
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.cpp +0 -48
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.h +0 -55
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNode.h +0 -40
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp +0 -54
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.h +0 -32
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.cpp +0 -241
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.h +0 -78
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/Chunk.cpp +0 -9
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/Chunk.h +0 -44
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.cpp +0 -69
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreeMatch.h +0 -132
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp +0 -64
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.h +0 -105
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp +0 -370
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.h +0 -185
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.cpp +0 -77
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/RuleTagToken.h +0 -117
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TagChunk.cpp +0 -39
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TagChunk.h +0 -86
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TextChunk.cpp +0 -28
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TextChunk.h +0 -51
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.cpp +0 -36
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/TokenTagToken.h +0 -80
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp +0 -154
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.h +0 -86
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathElement.cpp +0 -31
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathElement.h +0 -40
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.cpp +0 -180
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.g4 +0 -64
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.h +0 -53
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexer.tokens +0 -12
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.cpp +0 -13
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.h +0 -22
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.cpp +0 -20
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.h +0 -27
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp +0 -30
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.h +0 -26
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.cpp +0 -20
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.h +0 -25
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp +0 -33
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.h +0 -26
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.cpp +0 -23
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.h +0 -23
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.cpp +0 -24
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.h +0 -23
- data/ext/express_parser/antlr4-upstream/runtime/Cpp/runtime/tests/Utf8Test.cpp +0 -110
- data/ext/express_parser/antlrgen/Express.interp +0 -532
- data/ext/express_parser/antlrgen/Express.tokens +0 -190
- data/ext/express_parser/antlrgen/ExpressBaseListener.cpp +0 -7
- data/ext/express_parser/antlrgen/ExpressBaseListener.h +0 -623
- data/ext/express_parser/antlrgen/ExpressBaseVisitor.cpp +0 -7
- data/ext/express_parser/antlrgen/ExpressBaseVisitor.h +0 -816
- data/ext/express_parser/antlrgen/ExpressLexer.cpp +0 -685
- data/ext/express_parser/antlrgen/ExpressLexer.h +0 -78
- data/ext/express_parser/antlrgen/ExpressLexer.interp +0 -534
- data/ext/express_parser/antlrgen/ExpressLexer.tokens +0 -190
- data/ext/express_parser/antlrgen/ExpressListener.cpp +0 -7
- data/ext/express_parser/antlrgen/ExpressListener.h +0 -616
- data/ext/express_parser/antlrgen/ExpressParser.cpp +0 -17591
- data/ext/express_parser/antlrgen/ExpressParser.h +0 -3692
- data/ext/express_parser/antlrgen/ExpressVisitor.cpp +0 -7
- data/ext/express_parser/antlrgen/ExpressVisitor.h +0 -422
- data/ext/express_parser/express_parser.cpp +0 -19405
- data/ext/express_parser/extconf.rb +0 -63
- data/rakelib/antlr4-native.rake +0 -173
- data/rakelib/cross-ruby.rake +0 -403
- data/spec/acceptance/version_spec.rb +0 -30
- data/spec/expressir/express/cache_spec.rb +0 -89
- data/spec/expressir/express/formatter_spec.rb +0 -171
- data/spec/expressir/express/parser_spec.rb +0 -141
- data/spec/expressir/model/model_element_spec.rb +0 -343
- data/spec/spec_helper.rb +0 -24
- data/spec/support/console_helper.rb +0 -29
- data/spec/syntax/multiple.exp +0 -23
- data/spec/syntax/multiple.yaml +0 -198
- data/spec/syntax/multiple_formatted.exp +0 -71
- data/spec/syntax/multiple_hyperlink_formatted.exp +0 -71
- data/spec/syntax/multiple_schema_head_hyperlink_formatted.exp +0 -13
- data/spec/syntax/remark.exp +0 -193
- data/spec/syntax/remark.yaml +0 -471
- data/spec/syntax/remark_formatted.exp +0 -228
- data/spec/syntax/single.exp +0 -4
- data/spec/syntax/single.yaml +0 -18
- data/spec/syntax/single_formatted.exp +0 -10
- data/spec/syntax/single_formatted.yaml +0 -36
- data/spec/syntax/syntax.exp +0 -333
- data/spec/syntax/syntax.yaml +0 -3509
- data/spec/syntax/syntax_formatted.exp +0 -902
- data/spec/syntax/syntax_hyperlink_formatted.exp +0 -902
- data/spec/syntax/syntax_schema_head_formatted.exp +0 -18
@@ -1,628 +0,0 @@
|
|
1
|
-
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
2
|
-
* Use of this file is governed by the BSD 3-clause license that
|
3
|
-
* can be found in the LICENSE.txt file in the project root.
|
4
|
-
*/
|
5
|
-
|
6
|
-
#include "atn/ATNDeserializationOptions.h"
|
7
|
-
|
8
|
-
#include "atn/ATNType.h"
|
9
|
-
#include "atn/ATNState.h"
|
10
|
-
#include "atn/ATN.h"
|
11
|
-
|
12
|
-
#include "atn/LoopEndState.h"
|
13
|
-
#include "atn/DecisionState.h"
|
14
|
-
#include "atn/RuleStartState.h"
|
15
|
-
#include "atn/RuleStopState.h"
|
16
|
-
#include "atn/TokensStartState.h"
|
17
|
-
#include "atn/RuleTransition.h"
|
18
|
-
#include "atn/EpsilonTransition.h"
|
19
|
-
#include "atn/PlusLoopbackState.h"
|
20
|
-
#include "atn/PlusBlockStartState.h"
|
21
|
-
#include "atn/StarLoopbackState.h"
|
22
|
-
#include "atn/BasicBlockStartState.h"
|
23
|
-
#include "atn/BasicState.h"
|
24
|
-
#include "atn/BlockEndState.h"
|
25
|
-
#include "atn/StarLoopEntryState.h"
|
26
|
-
|
27
|
-
#include "atn/AtomTransition.h"
|
28
|
-
#include "atn/StarBlockStartState.h"
|
29
|
-
#include "atn/RangeTransition.h"
|
30
|
-
#include "atn/PredicateTransition.h"
|
31
|
-
#include "atn/PrecedencePredicateTransition.h"
|
32
|
-
#include "atn/ActionTransition.h"
|
33
|
-
#include "atn/SetTransition.h"
|
34
|
-
#include "atn/NotSetTransition.h"
|
35
|
-
#include "atn/WildcardTransition.h"
|
36
|
-
#include "atn/TransitionType.h"
|
37
|
-
#include "Token.h"
|
38
|
-
|
39
|
-
#include "misc/IntervalSet.h"
|
40
|
-
#include "Exceptions.h"
|
41
|
-
#include "support/CPPUtils.h"
|
42
|
-
#include "support/Casts.h"
|
43
|
-
|
44
|
-
#include "atn/LexerCustomAction.h"
|
45
|
-
#include "atn/LexerChannelAction.h"
|
46
|
-
#include "atn/LexerModeAction.h"
|
47
|
-
#include "atn/LexerMoreAction.h"
|
48
|
-
#include "atn/LexerPopModeAction.h"
|
49
|
-
#include "atn/LexerPushModeAction.h"
|
50
|
-
#include "atn/LexerSkipAction.h"
|
51
|
-
#include "atn/LexerTypeAction.h"
|
52
|
-
|
53
|
-
#include "atn/ATNDeserializer.h"
|
54
|
-
|
55
|
-
#include <cassert>
|
56
|
-
#include <string>
|
57
|
-
#include <vector>
|
58
|
-
|
59
|
-
using namespace antlr4;
|
60
|
-
using namespace antlr4::atn;
|
61
|
-
using namespace antlrcpp;
|
62
|
-
|
63
|
-
namespace {
|
64
|
-
|
65
|
-
void checkCondition(bool condition, std::string_view message) {
|
66
|
-
if (!condition) {
|
67
|
-
throw IllegalStateException(std::string(message));
|
68
|
-
}
|
69
|
-
}
|
70
|
-
|
71
|
-
void checkCondition(bool condition) {
|
72
|
-
checkCondition(condition, "");
|
73
|
-
}
|
74
|
-
|
75
|
-
/**
|
76
|
-
* Analyze the {@link StarLoopEntryState} states in the specified ATN to set
|
77
|
-
* the {@link StarLoopEntryState#isPrecedenceDecision} field to the
|
78
|
-
* correct value.
|
79
|
-
*
|
80
|
-
* @param atn The ATN.
|
81
|
-
*/
|
82
|
-
void markPrecedenceDecisions(const ATN &atn) {
|
83
|
-
for (ATNState *state : atn.states) {
|
84
|
-
if (!StarLoopEntryState::is(state)) {
|
85
|
-
continue;
|
86
|
-
}
|
87
|
-
|
88
|
-
/* We analyze the ATN to determine if this ATN decision state is the
|
89
|
-
* decision for the closure block that determines whether a
|
90
|
-
* precedence rule should continue or complete.
|
91
|
-
*/
|
92
|
-
if (atn.ruleToStartState[state->ruleIndex]->isLeftRecursiveRule) {
|
93
|
-
ATNState *maybeLoopEndState = state->transitions[state->transitions.size() - 1]->target;
|
94
|
-
if (LoopEndState::is(maybeLoopEndState)) {
|
95
|
-
if (maybeLoopEndState->epsilonOnlyTransitions && RuleStopState::is(maybeLoopEndState->transitions[0]->target)) {
|
96
|
-
downCast<StarLoopEntryState*>(state)->isPrecedenceDecision = true;
|
97
|
-
}
|
98
|
-
}
|
99
|
-
}
|
100
|
-
}
|
101
|
-
}
|
102
|
-
|
103
|
-
Ref<const LexerAction> lexerActionFactory(LexerActionType type, int data1, int data2) {
|
104
|
-
switch (type) {
|
105
|
-
case LexerActionType::CHANNEL:
|
106
|
-
return std::make_shared<LexerChannelAction>(data1);
|
107
|
-
|
108
|
-
case LexerActionType::CUSTOM:
|
109
|
-
return std::make_shared<LexerCustomAction>(data1, data2);
|
110
|
-
|
111
|
-
case LexerActionType::MODE:
|
112
|
-
return std::make_shared< LexerModeAction>(data1);
|
113
|
-
|
114
|
-
case LexerActionType::MORE:
|
115
|
-
return LexerMoreAction::getInstance();
|
116
|
-
|
117
|
-
case LexerActionType::POP_MODE:
|
118
|
-
return LexerPopModeAction::getInstance();
|
119
|
-
|
120
|
-
case LexerActionType::PUSH_MODE:
|
121
|
-
return std::make_shared<LexerPushModeAction>(data1);
|
122
|
-
|
123
|
-
case LexerActionType::SKIP:
|
124
|
-
return LexerSkipAction::getInstance();
|
125
|
-
|
126
|
-
case LexerActionType::TYPE:
|
127
|
-
return std::make_shared<LexerTypeAction>(data1);
|
128
|
-
|
129
|
-
default:
|
130
|
-
throw IllegalArgumentException("The specified lexer action type " + std::to_string(static_cast<size_t>(type)) +
|
131
|
-
" is not valid.");
|
132
|
-
}
|
133
|
-
}
|
134
|
-
|
135
|
-
ConstTransitionPtr edgeFactory(const ATN &atn, TransitionType type, size_t trg, size_t arg1, size_t arg2,
|
136
|
-
size_t arg3, const std::vector<misc::IntervalSet> &sets) {
|
137
|
-
ATNState *target = atn.states[trg];
|
138
|
-
switch (type) {
|
139
|
-
case TransitionType::EPSILON:
|
140
|
-
return std::make_unique<EpsilonTransition>(target);
|
141
|
-
case TransitionType::RANGE:
|
142
|
-
if (arg3 != 0) {
|
143
|
-
return std::make_unique<RangeTransition>(target, Token::EOF, arg2);
|
144
|
-
} else {
|
145
|
-
return std::make_unique<RangeTransition>(target, arg1, arg2);
|
146
|
-
}
|
147
|
-
case TransitionType::RULE:
|
148
|
-
return std::make_unique<RuleTransition>(downCast<RuleStartState*>(atn.states[arg1]), arg2, (int)arg3, target);
|
149
|
-
case TransitionType::PREDICATE:
|
150
|
-
return std::make_unique<PredicateTransition>(target, arg1, arg2, arg3 != 0);
|
151
|
-
case TransitionType::PRECEDENCE:
|
152
|
-
return std::make_unique<PrecedencePredicateTransition>(target, (int)arg1);
|
153
|
-
case TransitionType::ATOM:
|
154
|
-
if (arg3 != 0) {
|
155
|
-
return std::make_unique<AtomTransition>(target, Token::EOF);
|
156
|
-
} else {
|
157
|
-
return std::make_unique<AtomTransition>(target, arg1);
|
158
|
-
}
|
159
|
-
case TransitionType::ACTION:
|
160
|
-
return std::make_unique<ActionTransition>(target, arg1, arg2, arg3 != 0);
|
161
|
-
case TransitionType::SET:
|
162
|
-
return std::make_unique<SetTransition>(target, sets[arg1]);
|
163
|
-
case TransitionType::NOT_SET:
|
164
|
-
return std::make_unique<NotSetTransition>(target, sets[arg1]);
|
165
|
-
case TransitionType::WILDCARD:
|
166
|
-
return std::make_unique<WildcardTransition>(target);
|
167
|
-
}
|
168
|
-
|
169
|
-
throw IllegalArgumentException("The specified transition type is not valid.");
|
170
|
-
}
|
171
|
-
|
172
|
-
/* mem check: all created instances are freed in the d-tor of the ATN. */
|
173
|
-
ATNState* stateFactory(ATNStateType type, size_t ruleIndex) {
|
174
|
-
ATNState *s;
|
175
|
-
switch (type) {
|
176
|
-
case ATNStateType::INVALID:
|
177
|
-
return nullptr;
|
178
|
-
case ATNStateType::BASIC :
|
179
|
-
s = new BasicState();
|
180
|
-
break;
|
181
|
-
case ATNStateType::RULE_START :
|
182
|
-
s = new RuleStartState();
|
183
|
-
break;
|
184
|
-
case ATNStateType::BLOCK_START :
|
185
|
-
s = new BasicBlockStartState();
|
186
|
-
break;
|
187
|
-
case ATNStateType::PLUS_BLOCK_START :
|
188
|
-
s = new PlusBlockStartState();
|
189
|
-
break;
|
190
|
-
case ATNStateType::STAR_BLOCK_START :
|
191
|
-
s = new StarBlockStartState();
|
192
|
-
break;
|
193
|
-
case ATNStateType::TOKEN_START :
|
194
|
-
s = new TokensStartState();
|
195
|
-
break;
|
196
|
-
case ATNStateType::RULE_STOP :
|
197
|
-
s = new RuleStopState();
|
198
|
-
break;
|
199
|
-
case ATNStateType::BLOCK_END :
|
200
|
-
s = new BlockEndState();
|
201
|
-
break;
|
202
|
-
case ATNStateType::STAR_LOOP_BACK :
|
203
|
-
s = new StarLoopbackState();
|
204
|
-
break;
|
205
|
-
case ATNStateType::STAR_LOOP_ENTRY :
|
206
|
-
s = new StarLoopEntryState();
|
207
|
-
break;
|
208
|
-
case ATNStateType::PLUS_LOOP_BACK :
|
209
|
-
s = new PlusLoopbackState();
|
210
|
-
break;
|
211
|
-
case ATNStateType::LOOP_END :
|
212
|
-
s = new LoopEndState();
|
213
|
-
break;
|
214
|
-
default :
|
215
|
-
std::string message = "The specified state type " + std::to_string(static_cast<size_t>(type)) + " is not valid.";
|
216
|
-
throw IllegalArgumentException(message);
|
217
|
-
}
|
218
|
-
assert(s->getStateType() == type);
|
219
|
-
s->ruleIndex = ruleIndex;
|
220
|
-
return s;
|
221
|
-
}
|
222
|
-
|
223
|
-
ssize_t readUnicodeInt32(SerializedATNView data, int& p) {
|
224
|
-
return static_cast<ssize_t>(data[p++]);
|
225
|
-
}
|
226
|
-
|
227
|
-
void deserializeSets(
|
228
|
-
SerializedATNView data,
|
229
|
-
int& p,
|
230
|
-
std::vector<misc::IntervalSet>& sets) {
|
231
|
-
size_t nsets = data[p++];
|
232
|
-
sets.reserve(sets.size() + nsets);
|
233
|
-
for (size_t i = 0; i < nsets; i++) {
|
234
|
-
size_t nintervals = data[p++];
|
235
|
-
misc::IntervalSet set;
|
236
|
-
|
237
|
-
bool containsEof = data[p++] != 0;
|
238
|
-
if (containsEof) {
|
239
|
-
set.add(-1);
|
240
|
-
}
|
241
|
-
|
242
|
-
for (size_t j = 0; j < nintervals; j++) {
|
243
|
-
auto a = readUnicodeInt32(data, p);
|
244
|
-
auto b = readUnicodeInt32(data, p);
|
245
|
-
set.add(a, b);
|
246
|
-
}
|
247
|
-
sets.push_back(set);
|
248
|
-
}
|
249
|
-
}
|
250
|
-
|
251
|
-
}
|
252
|
-
|
253
|
-
ATNDeserializer::ATNDeserializer() : ATNDeserializer(ATNDeserializationOptions::getDefaultOptions()) {}
|
254
|
-
|
255
|
-
ATNDeserializer::ATNDeserializer(ATNDeserializationOptions deserializationOptions) : _deserializationOptions(std::move(deserializationOptions)) {}
|
256
|
-
|
257
|
-
std::unique_ptr<ATN> ATNDeserializer::deserialize(SerializedATNView data) const {
|
258
|
-
int p = 0;
|
259
|
-
int version = data[p++];
|
260
|
-
if (version != SERIALIZED_VERSION) {
|
261
|
-
std::string reason = "Could not deserialize ATN with version" + std::to_string(version) + "(expected " + std::to_string(SERIALIZED_VERSION) + ").";
|
262
|
-
|
263
|
-
throw UnsupportedOperationException(reason);
|
264
|
-
}
|
265
|
-
|
266
|
-
ATNType grammarType = (ATNType)data[p++];
|
267
|
-
size_t maxTokenType = data[p++];
|
268
|
-
auto atn = std::make_unique<ATN>(grammarType, maxTokenType);
|
269
|
-
|
270
|
-
//
|
271
|
-
// STATES
|
272
|
-
//
|
273
|
-
{
|
274
|
-
std::vector<std::pair<LoopEndState*, size_t>> loopBackStateNumbers;
|
275
|
-
std::vector<std::pair<BlockStartState*, size_t>> endStateNumbers;
|
276
|
-
size_t nstates = data[p++];
|
277
|
-
atn->states.reserve(nstates);
|
278
|
-
loopBackStateNumbers.reserve(nstates); // Reserve worst case size, its short lived.
|
279
|
-
endStateNumbers.reserve(nstates); // Reserve worst case size, its short lived.
|
280
|
-
for (size_t i = 0; i < nstates; i++) {
|
281
|
-
ATNStateType stype = static_cast<ATNStateType>(data[p++]);
|
282
|
-
// ignore bad type of states
|
283
|
-
if (stype == ATNStateType::INVALID) {
|
284
|
-
atn->addState(nullptr);
|
285
|
-
continue;
|
286
|
-
}
|
287
|
-
|
288
|
-
size_t ruleIndex = data[p++];
|
289
|
-
ATNState *s = stateFactory(stype, ruleIndex);
|
290
|
-
if (stype == ATNStateType::LOOP_END) { // special case
|
291
|
-
int loopBackStateNumber = data[p++];
|
292
|
-
loopBackStateNumbers.push_back({ downCast<LoopEndState*>(s), loopBackStateNumber });
|
293
|
-
} else if (BlockStartState::is(s)) {
|
294
|
-
int endStateNumber = data[p++];
|
295
|
-
endStateNumbers.push_back({ downCast<BlockStartState*>(s), endStateNumber });
|
296
|
-
}
|
297
|
-
atn->addState(s);
|
298
|
-
}
|
299
|
-
|
300
|
-
// delay the assignment of loop back and end states until we know all the state instances have been initialized
|
301
|
-
for (auto &pair : loopBackStateNumbers) {
|
302
|
-
pair.first->loopBackState = atn->states[pair.second];
|
303
|
-
}
|
304
|
-
|
305
|
-
for (auto &pair : endStateNumbers) {
|
306
|
-
pair.first->endState = downCast<BlockEndState*>(atn->states[pair.second]);
|
307
|
-
}
|
308
|
-
}
|
309
|
-
|
310
|
-
size_t numNonGreedyStates = data[p++];
|
311
|
-
for (size_t i = 0; i < numNonGreedyStates; i++) {
|
312
|
-
size_t stateNumber = data[p++];
|
313
|
-
// The serialized ATN must be specifying the right states, so that the
|
314
|
-
// cast below is correct.
|
315
|
-
downCast<DecisionState*>(atn->states[stateNumber])->nonGreedy = true;
|
316
|
-
}
|
317
|
-
|
318
|
-
size_t numPrecedenceStates = data[p++];
|
319
|
-
for (size_t i = 0; i < numPrecedenceStates; i++) {
|
320
|
-
size_t stateNumber = data[p++];
|
321
|
-
downCast<RuleStartState*>(atn->states[stateNumber])->isLeftRecursiveRule = true;
|
322
|
-
}
|
323
|
-
|
324
|
-
//
|
325
|
-
// RULES
|
326
|
-
//
|
327
|
-
size_t nrules = data[p++];
|
328
|
-
atn->ruleToStartState.reserve(nrules);
|
329
|
-
for (size_t i = 0; i < nrules; i++) {
|
330
|
-
size_t s = data[p++];
|
331
|
-
// Also here, the serialized atn must ensure to point to the correct class type.
|
332
|
-
RuleStartState *startState = downCast<RuleStartState*>(atn->states[s]);
|
333
|
-
atn->ruleToStartState.push_back(startState);
|
334
|
-
if (atn->grammarType == ATNType::LEXER) {
|
335
|
-
size_t tokenType = data[p++];
|
336
|
-
atn->ruleToTokenType.push_back(tokenType);
|
337
|
-
}
|
338
|
-
}
|
339
|
-
|
340
|
-
atn->ruleToStopState.resize(nrules);
|
341
|
-
for (ATNState *state : atn->states) {
|
342
|
-
if (!RuleStopState::is(state)) {
|
343
|
-
continue;
|
344
|
-
}
|
345
|
-
|
346
|
-
RuleStopState *stopState = downCast<RuleStopState*>(state);
|
347
|
-
atn->ruleToStopState[state->ruleIndex] = stopState;
|
348
|
-
atn->ruleToStartState[state->ruleIndex]->stopState = stopState;
|
349
|
-
}
|
350
|
-
|
351
|
-
//
|
352
|
-
// MODES
|
353
|
-
//
|
354
|
-
size_t nmodes = data[p++];
|
355
|
-
atn->modeToStartState.reserve(nmodes);
|
356
|
-
for (size_t i = 0; i < nmodes; i++) {
|
357
|
-
size_t s = data[p++];
|
358
|
-
atn->modeToStartState.push_back(downCast<TokensStartState*>(atn->states[s]));
|
359
|
-
}
|
360
|
-
|
361
|
-
//
|
362
|
-
// SETS
|
363
|
-
//
|
364
|
-
{
|
365
|
-
std::vector<misc::IntervalSet> sets;
|
366
|
-
|
367
|
-
deserializeSets(data, p, sets);
|
368
|
-
sets.shrink_to_fit();
|
369
|
-
|
370
|
-
//
|
371
|
-
// EDGES
|
372
|
-
//
|
373
|
-
int nedges = data[p++];
|
374
|
-
for (int i = 0; i < nedges; i++) {
|
375
|
-
size_t src = data[p];
|
376
|
-
size_t trg = data[p + 1];
|
377
|
-
TransitionType ttype = static_cast<TransitionType>(data[p + 2]);
|
378
|
-
size_t arg1 = data[p + 3];
|
379
|
-
size_t arg2 = data[p + 4];
|
380
|
-
size_t arg3 = data[p + 5];
|
381
|
-
ConstTransitionPtr trans = edgeFactory(*atn, ttype, trg, arg1, arg2, arg3, sets);
|
382
|
-
ATNState *srcState = atn->states[src];
|
383
|
-
srcState->addTransition(std::move(trans));
|
384
|
-
p += 6;
|
385
|
-
}
|
386
|
-
}
|
387
|
-
// edges for rule stop states can be derived, so they aren't serialized
|
388
|
-
for (ATNState *state : atn->states) {
|
389
|
-
for (size_t i = 0; i < state->transitions.size(); i++) {
|
390
|
-
const Transition *t = state->transitions[i].get();
|
391
|
-
if (!RuleTransition::is(t)) {
|
392
|
-
continue;
|
393
|
-
}
|
394
|
-
|
395
|
-
const RuleTransition *ruleTransition = downCast<const RuleTransition*>(t);
|
396
|
-
size_t outermostPrecedenceReturn = INVALID_INDEX;
|
397
|
-
if (atn->ruleToStartState[ruleTransition->target->ruleIndex]->isLeftRecursiveRule) {
|
398
|
-
if (ruleTransition->precedence == 0) {
|
399
|
-
outermostPrecedenceReturn = ruleTransition->target->ruleIndex;
|
400
|
-
}
|
401
|
-
}
|
402
|
-
|
403
|
-
ConstTransitionPtr returnTransition = std::make_unique<EpsilonTransition>(ruleTransition->followState, outermostPrecedenceReturn);
|
404
|
-
atn->ruleToStopState[ruleTransition->target->ruleIndex]->addTransition(std::move(returnTransition));
|
405
|
-
}
|
406
|
-
}
|
407
|
-
|
408
|
-
for (ATNState *state : atn->states) {
|
409
|
-
if (BlockStartState::is(state)) {
|
410
|
-
BlockStartState *startState = downCast<BlockStartState*>(state);
|
411
|
-
|
412
|
-
// we need to know the end state to set its start state
|
413
|
-
if (startState->endState == nullptr) {
|
414
|
-
throw IllegalStateException();
|
415
|
-
}
|
416
|
-
|
417
|
-
// block end states can only be associated to a single block start state
|
418
|
-
if (startState->endState->startState != nullptr) {
|
419
|
-
throw IllegalStateException();
|
420
|
-
}
|
421
|
-
|
422
|
-
startState->endState->startState = downCast<BlockStartState*>(state);
|
423
|
-
}
|
424
|
-
|
425
|
-
if (PlusLoopbackState::is(state)) {
|
426
|
-
PlusLoopbackState *loopbackState = downCast<PlusLoopbackState*>(state);
|
427
|
-
for (size_t i = 0; i < loopbackState->transitions.size(); i++) {
|
428
|
-
ATNState *target = loopbackState->transitions[i]->target;
|
429
|
-
if (PlusBlockStartState::is(target)) {
|
430
|
-
(downCast<PlusBlockStartState*>(target))->loopBackState = loopbackState;
|
431
|
-
}
|
432
|
-
}
|
433
|
-
} else if (StarLoopbackState::is(state)) {
|
434
|
-
StarLoopbackState *loopbackState = downCast<StarLoopbackState*>(state);
|
435
|
-
for (size_t i = 0; i < loopbackState->transitions.size(); i++) {
|
436
|
-
ATNState *target = loopbackState->transitions[i]->target;
|
437
|
-
if (StarLoopEntryState::is(target)) {
|
438
|
-
downCast<StarLoopEntryState*>(target)->loopBackState = loopbackState;
|
439
|
-
}
|
440
|
-
}
|
441
|
-
}
|
442
|
-
}
|
443
|
-
|
444
|
-
//
|
445
|
-
// DECISIONS
|
446
|
-
//
|
447
|
-
size_t ndecisions = data[p++];
|
448
|
-
atn->decisionToState.reserve(ndecisions);
|
449
|
-
for (size_t i = 0; i < ndecisions; i++) {
|
450
|
-
size_t s = data[p++];
|
451
|
-
DecisionState *decState = downCast<DecisionState*>(atn->states[s]);
|
452
|
-
if (decState == nullptr)
|
453
|
-
throw IllegalStateException();
|
454
|
-
|
455
|
-
atn->decisionToState.push_back(decState);
|
456
|
-
decState->decision = static_cast<int>(i);
|
457
|
-
}
|
458
|
-
|
459
|
-
//
|
460
|
-
// LEXER ACTIONS
|
461
|
-
//
|
462
|
-
if (atn->grammarType == ATNType::LEXER) {
|
463
|
-
atn->lexerActions.resize(data[p++]);
|
464
|
-
for (size_t i = 0; i < atn->lexerActions.size(); i++) {
|
465
|
-
LexerActionType actionType = static_cast<LexerActionType>(data[p++]);
|
466
|
-
int data1 = data[p++];
|
467
|
-
int data2 = data[p++];
|
468
|
-
atn->lexerActions[i] = lexerActionFactory(actionType, data1, data2);
|
469
|
-
}
|
470
|
-
}
|
471
|
-
|
472
|
-
markPrecedenceDecisions(*atn);
|
473
|
-
|
474
|
-
if (_deserializationOptions.isVerifyATN()) {
|
475
|
-
verifyATN(*atn);
|
476
|
-
}
|
477
|
-
|
478
|
-
if (_deserializationOptions.isGenerateRuleBypassTransitions() && atn->grammarType == ATNType::PARSER) {
|
479
|
-
atn->ruleToTokenType.resize(atn->ruleToStartState.size());
|
480
|
-
for (size_t i = 0; i < atn->ruleToStartState.size(); i++) {
|
481
|
-
atn->ruleToTokenType[i] = static_cast<int>(atn->maxTokenType + i + 1);
|
482
|
-
}
|
483
|
-
|
484
|
-
for (std::vector<RuleStartState*>::size_type i = 0; i < atn->ruleToStartState.size(); i++) {
|
485
|
-
BasicBlockStartState *bypassStart = new BasicBlockStartState(); /* mem check: freed in ATN d-tor */
|
486
|
-
bypassStart->ruleIndex = static_cast<int>(i);
|
487
|
-
atn->addState(bypassStart);
|
488
|
-
|
489
|
-
BlockEndState *bypassStop = new BlockEndState(); /* mem check: freed in ATN d-tor */
|
490
|
-
bypassStop->ruleIndex = static_cast<int>(i);
|
491
|
-
atn->addState(bypassStop);
|
492
|
-
|
493
|
-
bypassStart->endState = bypassStop;
|
494
|
-
atn->defineDecisionState(bypassStart);
|
495
|
-
|
496
|
-
bypassStop->startState = bypassStart;
|
497
|
-
|
498
|
-
ATNState *endState;
|
499
|
-
const Transition *excludeTransition = nullptr;
|
500
|
-
if (atn->ruleToStartState[i]->isLeftRecursiveRule) {
|
501
|
-
// wrap from the beginning of the rule to the StarLoopEntryState
|
502
|
-
endState = nullptr;
|
503
|
-
for (ATNState *state : atn->states) {
|
504
|
-
if (state->ruleIndex != i) {
|
505
|
-
continue;
|
506
|
-
}
|
507
|
-
|
508
|
-
if (!StarLoopEntryState::is(state)) {
|
509
|
-
continue;
|
510
|
-
}
|
511
|
-
|
512
|
-
ATNState *maybeLoopEndState = state->transitions[state->transitions.size() - 1]->target;
|
513
|
-
if (!LoopEndState::is(maybeLoopEndState)) {
|
514
|
-
continue;
|
515
|
-
}
|
516
|
-
|
517
|
-
if (maybeLoopEndState->epsilonOnlyTransitions && RuleStopState::is(maybeLoopEndState->transitions[0]->target)) {
|
518
|
-
endState = state;
|
519
|
-
break;
|
520
|
-
}
|
521
|
-
}
|
522
|
-
|
523
|
-
if (endState == nullptr) {
|
524
|
-
throw UnsupportedOperationException("Couldn't identify final state of the precedence rule prefix section.");
|
525
|
-
|
526
|
-
}
|
527
|
-
|
528
|
-
excludeTransition = (static_cast<StarLoopEntryState*>(endState))->loopBackState->transitions[0].get();
|
529
|
-
} else {
|
530
|
-
endState = atn->ruleToStopState[i];
|
531
|
-
}
|
532
|
-
|
533
|
-
// all non-excluded transitions that currently target end state need to target blockEnd instead
|
534
|
-
for (ATNState *state : atn->states) {
|
535
|
-
for (auto &transition : state->transitions) {
|
536
|
-
if (transition.get() == excludeTransition) {
|
537
|
-
continue;
|
538
|
-
}
|
539
|
-
|
540
|
-
if (transition->target == endState) {
|
541
|
-
const_cast<Transition*>(transition.get())->target = bypassStop;
|
542
|
-
}
|
543
|
-
}
|
544
|
-
}
|
545
|
-
|
546
|
-
// all transitions leaving the rule start state need to leave blockStart instead
|
547
|
-
while (atn->ruleToStartState[i]->transitions.size() > 0) {
|
548
|
-
ConstTransitionPtr transition = atn->ruleToStartState[i]->removeTransition(atn->ruleToStartState[i]->transitions.size() - 1);
|
549
|
-
bypassStart->addTransition(std::move(transition));
|
550
|
-
}
|
551
|
-
|
552
|
-
// link the new states
|
553
|
-
atn->ruleToStartState[i]->addTransition(std::make_unique<EpsilonTransition>(bypassStart));
|
554
|
-
bypassStop->addTransition(std::make_unique<EpsilonTransition>(endState));
|
555
|
-
|
556
|
-
ATNState *matchState = new BasicState(); /* mem check: freed in ATN d-tor */
|
557
|
-
atn->addState(matchState);
|
558
|
-
matchState->addTransition(std::make_unique<AtomTransition>(bypassStop, atn->ruleToTokenType[i]));
|
559
|
-
bypassStart->addTransition(std::make_unique<EpsilonTransition>(matchState));
|
560
|
-
}
|
561
|
-
|
562
|
-
if (_deserializationOptions.isVerifyATN()) {
|
563
|
-
// reverify after modification
|
564
|
-
verifyATN(*atn);
|
565
|
-
}
|
566
|
-
}
|
567
|
-
|
568
|
-
return atn;
|
569
|
-
}
|
570
|
-
|
571
|
-
void ATNDeserializer::verifyATN(const ATN &atn) const {
|
572
|
-
// verify assumptions
|
573
|
-
for (ATNState *state : atn.states) {
|
574
|
-
if (state == nullptr) {
|
575
|
-
continue;
|
576
|
-
}
|
577
|
-
|
578
|
-
checkCondition(state->epsilonOnlyTransitions || state->transitions.size() <= 1);
|
579
|
-
|
580
|
-
if (PlusBlockStartState::is(state)) {
|
581
|
-
checkCondition((downCast<PlusBlockStartState*>(state))->loopBackState != nullptr);
|
582
|
-
}
|
583
|
-
|
584
|
-
if (StarLoopEntryState::is(state)) {
|
585
|
-
StarLoopEntryState *starLoopEntryState = downCast<StarLoopEntryState*>(state);
|
586
|
-
checkCondition(starLoopEntryState->loopBackState != nullptr);
|
587
|
-
checkCondition(starLoopEntryState->transitions.size() == 2);
|
588
|
-
|
589
|
-
if (StarBlockStartState::is(starLoopEntryState->transitions[0]->target)) {
|
590
|
-
checkCondition(downCast<LoopEndState*>(starLoopEntryState->transitions[1]->target) != nullptr);
|
591
|
-
checkCondition(!starLoopEntryState->nonGreedy);
|
592
|
-
} else if (LoopEndState::is(starLoopEntryState->transitions[0]->target)) {
|
593
|
-
checkCondition(StarBlockStartState::is(starLoopEntryState->transitions[1]->target));
|
594
|
-
checkCondition(starLoopEntryState->nonGreedy);
|
595
|
-
} else {
|
596
|
-
throw IllegalStateException();
|
597
|
-
}
|
598
|
-
}
|
599
|
-
|
600
|
-
if (StarLoopbackState::is(state)) {
|
601
|
-
checkCondition(state->transitions.size() == 1);
|
602
|
-
checkCondition(StarLoopEntryState::is(state->transitions[0]->target));
|
603
|
-
}
|
604
|
-
|
605
|
-
if (LoopEndState::is(state)) {
|
606
|
-
checkCondition((downCast<LoopEndState*>(state))->loopBackState != nullptr);
|
607
|
-
}
|
608
|
-
|
609
|
-
if (RuleStartState::is(state)) {
|
610
|
-
checkCondition((downCast<RuleStartState*>(state))->stopState != nullptr);
|
611
|
-
}
|
612
|
-
|
613
|
-
if (BlockStartState::is(state)) {
|
614
|
-
checkCondition((downCast<BlockStartState*>(state))->endState != nullptr);
|
615
|
-
}
|
616
|
-
|
617
|
-
if (BlockEndState::is(state)) {
|
618
|
-
checkCondition((downCast<BlockEndState*>(state))->startState != nullptr);
|
619
|
-
}
|
620
|
-
|
621
|
-
if (DecisionState::is(state)) {
|
622
|
-
DecisionState *decisionState = downCast<DecisionState*>(state);
|
623
|
-
checkCondition(decisionState->transitions.size() <= 1 || decisionState->decision >= 0);
|
624
|
-
} else {
|
625
|
-
checkCondition(state->transitions.size() <= 1 || RuleStopState::is(state));
|
626
|
-
}
|
627
|
-
}
|
628
|
-
}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
2
|
-
* Use of this file is governed by the BSD 3-clause license that
|
3
|
-
* can be found in the LICENSE.txt file in the project root.
|
4
|
-
*/
|
5
|
-
|
6
|
-
#pragma once
|
7
|
-
|
8
|
-
#include "atn/ATNDeserializationOptions.h"
|
9
|
-
#include "atn/SerializedATNView.h"
|
10
|
-
#include "atn/LexerAction.h"
|
11
|
-
#include "atn/Transition.h"
|
12
|
-
|
13
|
-
namespace antlr4 {
|
14
|
-
namespace atn {
|
15
|
-
|
16
|
-
class ANTLR4CPP_PUBLIC ATNDeserializer final {
|
17
|
-
public:
|
18
|
-
static constexpr size_t SERIALIZED_VERSION = 4;
|
19
|
-
|
20
|
-
ATNDeserializer();
|
21
|
-
|
22
|
-
explicit ATNDeserializer(ATNDeserializationOptions deserializationOptions);
|
23
|
-
|
24
|
-
std::unique_ptr<ATN> deserialize(SerializedATNView input) const;
|
25
|
-
void verifyATN(const ATN &atn) const;
|
26
|
-
|
27
|
-
private:
|
28
|
-
const ATNDeserializationOptions _deserializationOptions;
|
29
|
-
};
|
30
|
-
|
31
|
-
} // namespace atn
|
32
|
-
} // namespace antlr4
|
@@ -1,33 +0,0 @@
|
|
1
|
-
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
2
|
-
* Use of this file is governed by the BSD 3-clause license that
|
3
|
-
* can be found in the LICENSE.txt file in the project root.
|
4
|
-
*/
|
5
|
-
|
6
|
-
#include "atn/ATNSimulator.h"
|
7
|
-
|
8
|
-
#include "atn/ATNConfigSet.h"
|
9
|
-
#include "atn/ATNDeserializer.h"
|
10
|
-
#include "atn/ATNType.h"
|
11
|
-
#include "dfa/DFAState.h"
|
12
|
-
|
13
|
-
using namespace antlr4;
|
14
|
-
using namespace antlr4::dfa;
|
15
|
-
using namespace antlr4::atn;
|
16
|
-
|
17
|
-
const Ref<DFAState> ATNSimulator::ERROR = std::make_shared<DFAState>(std::numeric_limits<int>::max());
|
18
|
-
|
19
|
-
ATNSimulator::ATNSimulator(const ATN &atn, PredictionContextCache &sharedContextCache)
|
20
|
-
: atn(atn), _sharedContextCache(sharedContextCache) {}
|
21
|
-
|
22
|
-
void ATNSimulator::clearDFA() {
|
23
|
-
throw UnsupportedOperationException("This ATN simulator does not support clearing the DFA.");
|
24
|
-
}
|
25
|
-
|
26
|
-
PredictionContextCache& ATNSimulator::getSharedContextCache() const {
|
27
|
-
return _sharedContextCache;
|
28
|
-
}
|
29
|
-
|
30
|
-
Ref<const PredictionContext> ATNSimulator::getCachedContext(const Ref<const PredictionContext> &context) {
|
31
|
-
// This function must only be called with an active state lock, as we are going to change a shared structure.
|
32
|
-
return PredictionContext::getCachedContext(context, getSharedContextCache());
|
33
|
-
}
|