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,621 +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 "IntStream.h"
|
7
|
-
#include "atn/OrderedATNConfigSet.h"
|
8
|
-
#include "Token.h"
|
9
|
-
#include "LexerNoViableAltException.h"
|
10
|
-
#include "atn/RuleStopState.h"
|
11
|
-
#include "atn/RuleTransition.h"
|
12
|
-
#include "atn/SingletonPredictionContext.h"
|
13
|
-
#include "atn/PredicateTransition.h"
|
14
|
-
#include "atn/ActionTransition.h"
|
15
|
-
#include "atn/TokensStartState.h"
|
16
|
-
#include "misc/Interval.h"
|
17
|
-
#include "dfa/DFA.h"
|
18
|
-
#include "Lexer.h"
|
19
|
-
#include "internal/Synchronization.h"
|
20
|
-
|
21
|
-
#include "dfa/DFAState.h"
|
22
|
-
#include "atn/LexerATNConfig.h"
|
23
|
-
#include "atn/LexerActionExecutor.h"
|
24
|
-
|
25
|
-
#include "atn/LexerATNSimulator.h"
|
26
|
-
|
27
|
-
#ifndef LEXER_DEBUG_ATN
|
28
|
-
#define LEXER_DEBUG_ATN 0
|
29
|
-
#endif
|
30
|
-
#ifndef LEXER_DEBUG_DFA
|
31
|
-
#define LEXER_DEBUG_DFA 0
|
32
|
-
#endif
|
33
|
-
|
34
|
-
using namespace antlr4;
|
35
|
-
using namespace antlr4::atn;
|
36
|
-
using namespace antlr4::internal;
|
37
|
-
using namespace antlrcpp;
|
38
|
-
|
39
|
-
void LexerATNSimulator::SimState::reset() {
|
40
|
-
*this = SimState();
|
41
|
-
}
|
42
|
-
|
43
|
-
LexerATNSimulator::LexerATNSimulator(const ATN &atn, std::vector<dfa::DFA> &decisionToDFA,
|
44
|
-
PredictionContextCache &sharedContextCache)
|
45
|
-
: LexerATNSimulator(nullptr, atn, decisionToDFA, sharedContextCache) {
|
46
|
-
}
|
47
|
-
|
48
|
-
LexerATNSimulator::LexerATNSimulator(Lexer *recog, const ATN &atn, std::vector<dfa::DFA> &decisionToDFA,
|
49
|
-
PredictionContextCache &sharedContextCache)
|
50
|
-
: ATNSimulator(atn, sharedContextCache), _recog(recog), _decisionToDFA(decisionToDFA) {
|
51
|
-
InitializeInstanceFields();
|
52
|
-
}
|
53
|
-
|
54
|
-
void LexerATNSimulator::copyState(LexerATNSimulator *simulator) {
|
55
|
-
_charPositionInLine = simulator->_charPositionInLine;
|
56
|
-
_line = simulator->_line;
|
57
|
-
_mode = simulator->_mode;
|
58
|
-
_startIndex = simulator->_startIndex;
|
59
|
-
}
|
60
|
-
|
61
|
-
size_t LexerATNSimulator::match(CharStream *input, size_t mode) {
|
62
|
-
_mode = mode;
|
63
|
-
ssize_t mark = input->mark();
|
64
|
-
|
65
|
-
auto onExit = finally([input, mark] {
|
66
|
-
input->release(mark);
|
67
|
-
});
|
68
|
-
|
69
|
-
_startIndex = input->index();
|
70
|
-
_prevAccept.reset();
|
71
|
-
const dfa::DFA &dfa = _decisionToDFA[mode];
|
72
|
-
dfa::DFAState* s0;
|
73
|
-
{
|
74
|
-
SharedLock<SharedMutex> stateLock(atn._stateMutex);
|
75
|
-
s0 = dfa.s0;
|
76
|
-
}
|
77
|
-
if (s0 == nullptr) {
|
78
|
-
return matchATN(input);
|
79
|
-
} else {
|
80
|
-
return execATN(input, s0);
|
81
|
-
}
|
82
|
-
}
|
83
|
-
|
84
|
-
void LexerATNSimulator::reset() {
|
85
|
-
_prevAccept.reset();
|
86
|
-
_startIndex = 0;
|
87
|
-
_line = 1;
|
88
|
-
_charPositionInLine = 0;
|
89
|
-
_mode = Lexer::DEFAULT_MODE;
|
90
|
-
}
|
91
|
-
|
92
|
-
void LexerATNSimulator::clearDFA() {
|
93
|
-
size_t size = _decisionToDFA.size();
|
94
|
-
_decisionToDFA.clear();
|
95
|
-
for (size_t d = 0; d < size; ++d) {
|
96
|
-
_decisionToDFA.emplace_back(atn.getDecisionState(d), d);
|
97
|
-
}
|
98
|
-
}
|
99
|
-
|
100
|
-
size_t LexerATNSimulator::matchATN(CharStream *input) {
|
101
|
-
ATNState *startState = atn.modeToStartState[_mode];
|
102
|
-
|
103
|
-
std::unique_ptr<ATNConfigSet> s0_closure = computeStartState(input, startState);
|
104
|
-
|
105
|
-
bool suppressEdge = s0_closure->hasSemanticContext;
|
106
|
-
s0_closure->hasSemanticContext = false;
|
107
|
-
|
108
|
-
dfa::DFAState *next = addDFAState(s0_closure.release(), suppressEdge);
|
109
|
-
|
110
|
-
size_t predict = execATN(input, next);
|
111
|
-
|
112
|
-
return predict;
|
113
|
-
}
|
114
|
-
|
115
|
-
size_t LexerATNSimulator::execATN(CharStream *input, dfa::DFAState *ds0) {
|
116
|
-
if (ds0->isAcceptState) {
|
117
|
-
// allow zero-length tokens
|
118
|
-
// ml: in Java code this method uses 3 params. The first is a member var of the class anyway (_prevAccept), so why pass it here?
|
119
|
-
captureSimState(input, ds0);
|
120
|
-
}
|
121
|
-
|
122
|
-
size_t t = input->LA(1);
|
123
|
-
dfa::DFAState *s = ds0; // s is current/from DFA state
|
124
|
-
|
125
|
-
while (true) { // while more work
|
126
|
-
// As we move src->trg, src->trg, we keep track of the previous trg to
|
127
|
-
// avoid looking up the DFA state again, which is expensive.
|
128
|
-
// If the previous target was already part of the DFA, we might
|
129
|
-
// be able to avoid doing a reach operation upon t. If s!=null,
|
130
|
-
// it means that semantic predicates didn't prevent us from
|
131
|
-
// creating a DFA state. Once we know s!=null, we check to see if
|
132
|
-
// the DFA state has an edge already for t. If so, we can just reuse
|
133
|
-
// it's configuration set; there's no point in re-computing it.
|
134
|
-
// This is kind of like doing DFA simulation within the ATN
|
135
|
-
// simulation because DFA simulation is really just a way to avoid
|
136
|
-
// computing reach/closure sets. Technically, once we know that
|
137
|
-
// we have a previously added DFA state, we could jump over to
|
138
|
-
// the DFA simulator. But, that would mean popping back and forth
|
139
|
-
// a lot and making things more complicated algorithmically.
|
140
|
-
// This optimization makes a lot of sense for loops within DFA.
|
141
|
-
// A character will take us back to an existing DFA state
|
142
|
-
// that already has lots of edges out of it. e.g., .* in comments.
|
143
|
-
dfa::DFAState *target = getExistingTargetState(s, t);
|
144
|
-
if (target == nullptr) {
|
145
|
-
target = computeTargetState(input, s, t);
|
146
|
-
}
|
147
|
-
|
148
|
-
if (target == ERROR.get()) {
|
149
|
-
break;
|
150
|
-
}
|
151
|
-
|
152
|
-
// If this is a consumable input element, make sure to consume before
|
153
|
-
// capturing the accept state so the input index, line, and char
|
154
|
-
// position accurately reflect the state of the interpreter at the
|
155
|
-
// end of the token.
|
156
|
-
if (t != Token::EOF) {
|
157
|
-
consume(input);
|
158
|
-
}
|
159
|
-
|
160
|
-
if (target->isAcceptState) {
|
161
|
-
captureSimState(input, target);
|
162
|
-
if (t == Token::EOF) {
|
163
|
-
break;
|
164
|
-
}
|
165
|
-
}
|
166
|
-
|
167
|
-
t = input->LA(1);
|
168
|
-
s = target; // flip; current DFA target becomes new src/from state
|
169
|
-
}
|
170
|
-
|
171
|
-
return failOrAccept(input, s->configs.get(), t);
|
172
|
-
}
|
173
|
-
|
174
|
-
dfa::DFAState *LexerATNSimulator::getExistingTargetState(dfa::DFAState *s, size_t t) {
|
175
|
-
dfa::DFAState* retval = nullptr;
|
176
|
-
SharedLock<SharedMutex> edgeLock(atn._edgeMutex);
|
177
|
-
if (t <= MAX_DFA_EDGE) {
|
178
|
-
auto iterator = s->edges.find(t - MIN_DFA_EDGE);
|
179
|
-
#if LEXER_DEBUG_ATN == 1
|
180
|
-
if (iterator != s->edges.end()) {
|
181
|
-
std::cout << std::string("reuse state ") << s->stateNumber << std::string(" edge to ") << iterator->second->stateNumber << std::endl;
|
182
|
-
}
|
183
|
-
#endif
|
184
|
-
|
185
|
-
if (iterator != s->edges.end())
|
186
|
-
retval = iterator->second;
|
187
|
-
}
|
188
|
-
return retval;
|
189
|
-
}
|
190
|
-
|
191
|
-
dfa::DFAState *LexerATNSimulator::computeTargetState(CharStream *input, dfa::DFAState *s, size_t t) {
|
192
|
-
OrderedATNConfigSet *reach = new OrderedATNConfigSet(); /* mem-check: deleted on error or managed by new DFA state. */
|
193
|
-
|
194
|
-
// if we don't find an existing DFA state
|
195
|
-
// Fill reach starting from closure, following t transitions
|
196
|
-
getReachableConfigSet(input, s->configs.get(), reach, t);
|
197
|
-
|
198
|
-
if (reach->isEmpty()) { // we got nowhere on t from s
|
199
|
-
if (!reach->hasSemanticContext) {
|
200
|
-
// we got nowhere on t, don't throw out this knowledge; it'd
|
201
|
-
// cause a failover from DFA later.
|
202
|
-
addDFAEdge(s, t, ERROR.get());
|
203
|
-
}
|
204
|
-
delete reach;
|
205
|
-
|
206
|
-
// stop when we can't match any more char
|
207
|
-
return ERROR.get();
|
208
|
-
}
|
209
|
-
|
210
|
-
// Add an edge from s to target DFA found/created for reach
|
211
|
-
return addDFAEdge(s, t, reach);
|
212
|
-
}
|
213
|
-
|
214
|
-
size_t LexerATNSimulator::failOrAccept(CharStream *input, ATNConfigSet *reach, size_t t) {
|
215
|
-
if (_prevAccept.dfaState != nullptr) {
|
216
|
-
accept(input, _prevAccept.dfaState->lexerActionExecutor, _startIndex, _prevAccept.index, _prevAccept.line, _prevAccept.charPos);
|
217
|
-
return _prevAccept.dfaState->prediction;
|
218
|
-
} else {
|
219
|
-
// if no accept and EOF is first char, return EOF
|
220
|
-
if (t == Token::EOF && input->index() == _startIndex) {
|
221
|
-
return Token::EOF;
|
222
|
-
}
|
223
|
-
|
224
|
-
throw LexerNoViableAltException(_recog, input, _startIndex, reach);
|
225
|
-
}
|
226
|
-
}
|
227
|
-
|
228
|
-
void LexerATNSimulator::getReachableConfigSet(CharStream *input, ATNConfigSet *closure_, ATNConfigSet *reach, size_t t) {
|
229
|
-
// this is used to skip processing for configs which have a lower priority
|
230
|
-
// than a config that already reached an accept state for the same rule
|
231
|
-
size_t skipAlt = ATN::INVALID_ALT_NUMBER;
|
232
|
-
|
233
|
-
for (const auto &c : closure_->configs) {
|
234
|
-
bool currentAltReachedAcceptState = c->alt == skipAlt;
|
235
|
-
if (currentAltReachedAcceptState && (std::static_pointer_cast<LexerATNConfig>(c))->hasPassedThroughNonGreedyDecision()) {
|
236
|
-
continue;
|
237
|
-
}
|
238
|
-
|
239
|
-
#if LEXER_DEBUG_ATN == 1
|
240
|
-
std::cout << "testing " << getTokenName((int)t) << " at " << c->toString(true) << std::endl;
|
241
|
-
#endif
|
242
|
-
|
243
|
-
size_t n = c->state->transitions.size();
|
244
|
-
for (size_t ti = 0; ti < n; ti++) { // for each transition
|
245
|
-
const Transition *trans = c->state->transitions[ti].get();
|
246
|
-
ATNState *target = getReachableTarget(trans, (int)t);
|
247
|
-
if (target != nullptr) {
|
248
|
-
auto lexerActionExecutor = downCast<const LexerATNConfig&>(*c).getLexerActionExecutor();
|
249
|
-
if (lexerActionExecutor != nullptr) {
|
250
|
-
lexerActionExecutor = lexerActionExecutor->fixOffsetBeforeMatch((int)input->index() - (int)_startIndex);
|
251
|
-
}
|
252
|
-
|
253
|
-
bool treatEofAsEpsilon = t == Token::EOF;
|
254
|
-
Ref<LexerATNConfig> config = std::make_shared<LexerATNConfig>(downCast<const LexerATNConfig&>(*c),
|
255
|
-
target, std::move(lexerActionExecutor));
|
256
|
-
|
257
|
-
if (closure(input, config, reach, currentAltReachedAcceptState, true, treatEofAsEpsilon)) {
|
258
|
-
// any remaining configs for this alt have a lower priority than
|
259
|
-
// the one that just reached an accept state.
|
260
|
-
skipAlt = c->alt;
|
261
|
-
break;
|
262
|
-
}
|
263
|
-
}
|
264
|
-
}
|
265
|
-
}
|
266
|
-
}
|
267
|
-
|
268
|
-
void LexerATNSimulator::accept(CharStream *input, const Ref<const LexerActionExecutor> &lexerActionExecutor, size_t /*startIndex*/,
|
269
|
-
size_t index, size_t line, size_t charPos) {
|
270
|
-
#if LEXER_DEBUG_ATN == 1
|
271
|
-
std::cout << "ACTION ";
|
272
|
-
std::cout << toString(lexerActionExecutor) << std::endl;
|
273
|
-
#endif
|
274
|
-
|
275
|
-
// seek to after last char in token
|
276
|
-
input->seek(index);
|
277
|
-
_line = line;
|
278
|
-
_charPositionInLine = (int)charPos;
|
279
|
-
|
280
|
-
if (lexerActionExecutor != nullptr && _recog != nullptr) {
|
281
|
-
lexerActionExecutor->execute(_recog, input, _startIndex);
|
282
|
-
}
|
283
|
-
}
|
284
|
-
|
285
|
-
atn::ATNState *LexerATNSimulator::getReachableTarget(const Transition *trans, size_t t) {
|
286
|
-
if (trans->matches(t, Lexer::MIN_CHAR_VALUE, Lexer::MAX_CHAR_VALUE)) {
|
287
|
-
return trans->target;
|
288
|
-
}
|
289
|
-
|
290
|
-
return nullptr;
|
291
|
-
}
|
292
|
-
|
293
|
-
std::unique_ptr<ATNConfigSet> LexerATNSimulator::computeStartState(CharStream *input, ATNState *p) {
|
294
|
-
Ref<const PredictionContext> initialContext = PredictionContext::EMPTY; // ml: the purpose of this assignment is unclear
|
295
|
-
std::unique_ptr<ATNConfigSet> configs(new OrderedATNConfigSet());
|
296
|
-
for (size_t i = 0; i < p->transitions.size(); i++) {
|
297
|
-
ATNState *target = p->transitions[i]->target;
|
298
|
-
Ref<LexerATNConfig> c = std::make_shared<LexerATNConfig>(target, (int)(i + 1), initialContext);
|
299
|
-
closure(input, c, configs.get(), false, false, false);
|
300
|
-
}
|
301
|
-
|
302
|
-
return configs;
|
303
|
-
}
|
304
|
-
|
305
|
-
bool LexerATNSimulator::closure(CharStream *input, const Ref<LexerATNConfig> &config, ATNConfigSet *configs,
|
306
|
-
bool currentAltReachedAcceptState, bool speculative, bool treatEofAsEpsilon) {
|
307
|
-
#if LEXER_DEBUG_ATN == 1
|
308
|
-
std::cout << "closure(" << config->toString(true) << ")" << std::endl;
|
309
|
-
#endif
|
310
|
-
|
311
|
-
if (config->state != nullptr && config->state->getStateType() == ATNStateType::RULE_STOP) {
|
312
|
-
#if LEXER_DEBUG_ATN == 1
|
313
|
-
if (_recog != nullptr) {
|
314
|
-
std::cout << "closure at " << _recog->getRuleNames()[config->state->ruleIndex] << " rule stop " << config << std::endl;
|
315
|
-
} else {
|
316
|
-
std::cout << "closure at rule stop " << config << std::endl;
|
317
|
-
}
|
318
|
-
#endif
|
319
|
-
|
320
|
-
if (config->context == nullptr || config->context->hasEmptyPath()) {
|
321
|
-
if (config->context == nullptr || config->context->isEmpty()) {
|
322
|
-
configs->add(config);
|
323
|
-
return true;
|
324
|
-
} else {
|
325
|
-
configs->add(std::make_shared<LexerATNConfig>(*config, config->state, PredictionContext::EMPTY));
|
326
|
-
currentAltReachedAcceptState = true;
|
327
|
-
}
|
328
|
-
}
|
329
|
-
|
330
|
-
if (config->context != nullptr && !config->context->isEmpty()) {
|
331
|
-
for (size_t i = 0; i < config->context->size(); i++) {
|
332
|
-
if (config->context->getReturnState(i) != PredictionContext::EMPTY_RETURN_STATE) {
|
333
|
-
Ref<const PredictionContext> newContext = config->context->getParent(i); // "pop" return state
|
334
|
-
ATNState *returnState = atn.states[config->context->getReturnState(i)];
|
335
|
-
Ref<LexerATNConfig> c = std::make_shared<LexerATNConfig>(*config, returnState, newContext);
|
336
|
-
currentAltReachedAcceptState = closure(input, c, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
|
337
|
-
}
|
338
|
-
}
|
339
|
-
}
|
340
|
-
|
341
|
-
return currentAltReachedAcceptState;
|
342
|
-
}
|
343
|
-
|
344
|
-
// optimization
|
345
|
-
if (!config->state->epsilonOnlyTransitions) {
|
346
|
-
if (!currentAltReachedAcceptState || !config->hasPassedThroughNonGreedyDecision()) {
|
347
|
-
configs->add(config);
|
348
|
-
}
|
349
|
-
}
|
350
|
-
|
351
|
-
ATNState *p = config->state;
|
352
|
-
for (size_t i = 0; i < p->transitions.size(); i++) {
|
353
|
-
const Transition *t = p->transitions[i].get();
|
354
|
-
Ref<LexerATNConfig> c = getEpsilonTarget(input, config, t, configs, speculative, treatEofAsEpsilon);
|
355
|
-
if (c != nullptr) {
|
356
|
-
currentAltReachedAcceptState = closure(input, c, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
|
357
|
-
}
|
358
|
-
}
|
359
|
-
|
360
|
-
return currentAltReachedAcceptState;
|
361
|
-
}
|
362
|
-
|
363
|
-
Ref<LexerATNConfig> LexerATNSimulator::getEpsilonTarget(CharStream *input, const Ref<LexerATNConfig> &config, const Transition *t,
|
364
|
-
ATNConfigSet *configs, bool speculative, bool treatEofAsEpsilon) {
|
365
|
-
|
366
|
-
Ref<LexerATNConfig> c = nullptr;
|
367
|
-
switch (t->getTransitionType()) {
|
368
|
-
case TransitionType::RULE: {
|
369
|
-
const RuleTransition *ruleTransition = static_cast<const RuleTransition*>(t);
|
370
|
-
Ref<const PredictionContext> newContext = SingletonPredictionContext::create(config->context, ruleTransition->followState->stateNumber);
|
371
|
-
c = std::make_shared<LexerATNConfig>(*config, t->target, newContext);
|
372
|
-
break;
|
373
|
-
}
|
374
|
-
|
375
|
-
case TransitionType::PRECEDENCE:
|
376
|
-
throw UnsupportedOperationException("Precedence predicates are not supported in lexers.");
|
377
|
-
|
378
|
-
case TransitionType::PREDICATE: {
|
379
|
-
/* Track traversing semantic predicates. If we traverse,
|
380
|
-
we cannot add a DFA state for this "reach" computation
|
381
|
-
because the DFA would not test the predicate again in the
|
382
|
-
future. Rather than creating collections of semantic predicates
|
383
|
-
like v3 and testing them on prediction, v4 will test them on the
|
384
|
-
fly all the time using the ATN not the DFA. This is slower but
|
385
|
-
semantically it's not used that often. One of the key elements to
|
386
|
-
this predicate mechanism is not adding DFA states that see
|
387
|
-
predicates immediately afterwards in the ATN. For example,
|
388
|
-
|
389
|
-
a : ID {p1}? | ID {p2}? ;
|
390
|
-
|
391
|
-
should create the start state for rule 'a' (to save start state
|
392
|
-
competition), but should not create target of ID state. The
|
393
|
-
collection of ATN states the following ID references includes
|
394
|
-
states reached by traversing predicates. Since this is when we
|
395
|
-
test them, we cannot cash the DFA state target of ID.
|
396
|
-
*/
|
397
|
-
const PredicateTransition *pt = static_cast<const PredicateTransition*>(t);
|
398
|
-
|
399
|
-
#if LEXER_DEBUG_ATN == 1
|
400
|
-
std::cout << "EVAL rule " << pt->getRuleIndex() << ":" << pt->getPredIndex() << std::endl;
|
401
|
-
#endif
|
402
|
-
|
403
|
-
configs->hasSemanticContext = true;
|
404
|
-
if (evaluatePredicate(input, pt->getRuleIndex(), pt->getPredIndex(), speculative)) {
|
405
|
-
c = std::make_shared<LexerATNConfig>(*config, t->target);
|
406
|
-
}
|
407
|
-
break;
|
408
|
-
}
|
409
|
-
|
410
|
-
case TransitionType::ACTION:
|
411
|
-
if (config->context == nullptr|| config->context->hasEmptyPath()) {
|
412
|
-
// execute actions anywhere in the start rule for a token.
|
413
|
-
//
|
414
|
-
// TODO: if the entry rule is invoked recursively, some
|
415
|
-
// actions may be executed during the recursive call. The
|
416
|
-
// problem can appear when hasEmptyPath() is true but
|
417
|
-
// isEmpty() is false. In this case, the config needs to be
|
418
|
-
// split into two contexts - one with just the empty path
|
419
|
-
// and another with everything but the empty path.
|
420
|
-
// Unfortunately, the current algorithm does not allow
|
421
|
-
// getEpsilonTarget to return two configurations, so
|
422
|
-
// additional modifications are needed before we can support
|
423
|
-
// the split operation.
|
424
|
-
auto lexerActionExecutor = LexerActionExecutor::append(config->getLexerActionExecutor(),
|
425
|
-
atn.lexerActions[static_cast<const ActionTransition *>(t)->actionIndex]);
|
426
|
-
c = std::make_shared<LexerATNConfig>(*config, t->target, std::move(lexerActionExecutor));
|
427
|
-
break;
|
428
|
-
}
|
429
|
-
else {
|
430
|
-
// ignore actions in referenced rules
|
431
|
-
c = std::make_shared<LexerATNConfig>(*config, t->target);
|
432
|
-
break;
|
433
|
-
}
|
434
|
-
|
435
|
-
case TransitionType::EPSILON:
|
436
|
-
c = std::make_shared<LexerATNConfig>(*config, t->target);
|
437
|
-
break;
|
438
|
-
|
439
|
-
case TransitionType::ATOM:
|
440
|
-
case TransitionType::RANGE:
|
441
|
-
case TransitionType::SET:
|
442
|
-
if (treatEofAsEpsilon) {
|
443
|
-
if (t->matches(Token::EOF, Lexer::MIN_CHAR_VALUE, Lexer::MAX_CHAR_VALUE)) {
|
444
|
-
c = std::make_shared<LexerATNConfig>(*config, t->target);
|
445
|
-
break;
|
446
|
-
}
|
447
|
-
}
|
448
|
-
|
449
|
-
break;
|
450
|
-
|
451
|
-
default: // To silence the compiler. Other transition types are not used here.
|
452
|
-
break;
|
453
|
-
}
|
454
|
-
|
455
|
-
return c;
|
456
|
-
}
|
457
|
-
|
458
|
-
bool LexerATNSimulator::evaluatePredicate(CharStream *input, size_t ruleIndex, size_t predIndex, bool speculative) {
|
459
|
-
// assume true if no recognizer was provided
|
460
|
-
if (_recog == nullptr) {
|
461
|
-
return true;
|
462
|
-
}
|
463
|
-
|
464
|
-
if (!speculative) {
|
465
|
-
return _recog->sempred(nullptr, ruleIndex, predIndex);
|
466
|
-
}
|
467
|
-
|
468
|
-
size_t savedCharPositionInLine = _charPositionInLine;
|
469
|
-
size_t savedLine = _line;
|
470
|
-
size_t index = input->index();
|
471
|
-
ssize_t marker = input->mark();
|
472
|
-
|
473
|
-
auto onExit = finally([this, input, savedCharPositionInLine, savedLine, index, marker] {
|
474
|
-
_charPositionInLine = savedCharPositionInLine;
|
475
|
-
_line = savedLine;
|
476
|
-
input->seek(index);
|
477
|
-
input->release(marker);
|
478
|
-
});
|
479
|
-
|
480
|
-
consume(input);
|
481
|
-
return _recog->sempred(nullptr, ruleIndex, predIndex);
|
482
|
-
}
|
483
|
-
|
484
|
-
void LexerATNSimulator::captureSimState(CharStream *input, dfa::DFAState *dfaState) {
|
485
|
-
_prevAccept.index = input->index();
|
486
|
-
_prevAccept.line = _line;
|
487
|
-
_prevAccept.charPos = _charPositionInLine;
|
488
|
-
_prevAccept.dfaState = dfaState;
|
489
|
-
}
|
490
|
-
|
491
|
-
dfa::DFAState *LexerATNSimulator::addDFAEdge(dfa::DFAState *from, size_t t, ATNConfigSet *q) {
|
492
|
-
/* leading to this call, ATNConfigSet.hasSemanticContext is used as a
|
493
|
-
* marker indicating dynamic predicate evaluation makes this edge
|
494
|
-
* dependent on the specific input sequence, so the static edge in the
|
495
|
-
* DFA should be omitted. The target DFAState is still created since
|
496
|
-
* execATN has the ability to resynchronize with the DFA state cache
|
497
|
-
* following the predicate evaluation step.
|
498
|
-
*
|
499
|
-
* TJP notes: next time through the DFA, we see a pred again and eval.
|
500
|
-
* If that gets us to a previously created (but dangling) DFA
|
501
|
-
* state, we can continue in pure DFA mode from there.
|
502
|
-
*/
|
503
|
-
bool suppressEdge = q->hasSemanticContext;
|
504
|
-
q->hasSemanticContext = false;
|
505
|
-
|
506
|
-
dfa::DFAState *to = addDFAState(q);
|
507
|
-
|
508
|
-
if (suppressEdge) {
|
509
|
-
return to;
|
510
|
-
}
|
511
|
-
|
512
|
-
addDFAEdge(from, t, to);
|
513
|
-
return to;
|
514
|
-
}
|
515
|
-
|
516
|
-
void LexerATNSimulator::addDFAEdge(dfa::DFAState *p, size_t t, dfa::DFAState *q) {
|
517
|
-
if (/*t < MIN_DFA_EDGE ||*/ t > MAX_DFA_EDGE) { // MIN_DFA_EDGE is 0
|
518
|
-
// Only track edges within the DFA bounds
|
519
|
-
return;
|
520
|
-
}
|
521
|
-
|
522
|
-
UniqueLock<SharedMutex> edgeLock(atn._edgeMutex);
|
523
|
-
p->edges[t - MIN_DFA_EDGE] = q; // connect
|
524
|
-
}
|
525
|
-
|
526
|
-
dfa::DFAState *LexerATNSimulator::addDFAState(ATNConfigSet *configs) {
|
527
|
-
return addDFAState(configs, true);
|
528
|
-
}
|
529
|
-
|
530
|
-
dfa::DFAState *LexerATNSimulator::addDFAState(ATNConfigSet *configs, bool suppressEdge) {
|
531
|
-
/* the lexer evaluates predicates on-the-fly; by this point configs
|
532
|
-
* should not contain any configurations with unevaluated predicates.
|
533
|
-
*/
|
534
|
-
assert(!configs->hasSemanticContext);
|
535
|
-
|
536
|
-
dfa::DFAState *proposed = new dfa::DFAState(std::unique_ptr<ATNConfigSet>(configs)); /* mem-check: managed by the DFA or deleted below */
|
537
|
-
Ref<ATNConfig> firstConfigWithRuleStopState = nullptr;
|
538
|
-
for (const auto &c : configs->configs) {
|
539
|
-
if (RuleStopState::is(c->state)) {
|
540
|
-
firstConfigWithRuleStopState = c;
|
541
|
-
break;
|
542
|
-
}
|
543
|
-
}
|
544
|
-
|
545
|
-
if (firstConfigWithRuleStopState != nullptr) {
|
546
|
-
proposed->isAcceptState = true;
|
547
|
-
proposed->lexerActionExecutor = downCast<const LexerATNConfig&>(*firstConfigWithRuleStopState).getLexerActionExecutor();
|
548
|
-
proposed->prediction = atn.ruleToTokenType[firstConfigWithRuleStopState->state->ruleIndex];
|
549
|
-
}
|
550
|
-
|
551
|
-
dfa::DFA &dfa = _decisionToDFA[_mode];
|
552
|
-
|
553
|
-
{
|
554
|
-
UniqueLock<SharedMutex> stateLock(atn._stateMutex);
|
555
|
-
auto [existing, inserted] = dfa.states.insert(proposed);
|
556
|
-
if (!inserted) {
|
557
|
-
delete proposed;
|
558
|
-
proposed = *existing;
|
559
|
-
} else {
|
560
|
-
// Previously we did a lookup, then set fields, then inserted. It was `dfa.states.size()`,
|
561
|
-
// since we already inserted we need to subtract one.
|
562
|
-
proposed->stateNumber = static_cast<int>(dfa.states.size() - 1);
|
563
|
-
proposed->configs->setReadonly(true);
|
564
|
-
}
|
565
|
-
if (!suppressEdge) {
|
566
|
-
dfa.s0 = proposed;
|
567
|
-
}
|
568
|
-
}
|
569
|
-
|
570
|
-
return proposed;
|
571
|
-
}
|
572
|
-
|
573
|
-
dfa::DFA& LexerATNSimulator::getDFA(size_t mode) {
|
574
|
-
return _decisionToDFA[mode];
|
575
|
-
}
|
576
|
-
|
577
|
-
std::string LexerATNSimulator::getText(CharStream *input) {
|
578
|
-
// index is first lookahead char, don't include.
|
579
|
-
return input->getText(misc::Interval(_startIndex, input->index() - 1));
|
580
|
-
}
|
581
|
-
|
582
|
-
size_t LexerATNSimulator::getLine() const {
|
583
|
-
return _line;
|
584
|
-
}
|
585
|
-
|
586
|
-
void LexerATNSimulator::setLine(size_t line) {
|
587
|
-
_line = line;
|
588
|
-
}
|
589
|
-
|
590
|
-
size_t LexerATNSimulator::getCharPositionInLine() {
|
591
|
-
return _charPositionInLine;
|
592
|
-
}
|
593
|
-
|
594
|
-
void LexerATNSimulator::setCharPositionInLine(size_t charPositionInLine) {
|
595
|
-
_charPositionInLine = charPositionInLine;
|
596
|
-
}
|
597
|
-
|
598
|
-
void LexerATNSimulator::consume(CharStream *input) {
|
599
|
-
size_t curChar = input->LA(1);
|
600
|
-
if (curChar == '\n') {
|
601
|
-
_line++;
|
602
|
-
_charPositionInLine = 0;
|
603
|
-
} else {
|
604
|
-
_charPositionInLine++;
|
605
|
-
}
|
606
|
-
input->consume();
|
607
|
-
}
|
608
|
-
|
609
|
-
std::string LexerATNSimulator::getTokenName(size_t t) {
|
610
|
-
if (t == Token::EOF) {
|
611
|
-
return "EOF";
|
612
|
-
}
|
613
|
-
return std::string("'") + static_cast<char>(t) + std::string("'");
|
614
|
-
}
|
615
|
-
|
616
|
-
void LexerATNSimulator::InitializeInstanceFields() {
|
617
|
-
_startIndex = 0;
|
618
|
-
_line = 1;
|
619
|
-
_charPositionInLine = 0;
|
620
|
-
_mode = antlr4::Lexer::DEFAULT_MODE;
|
621
|
-
}
|