expressir 1.4.2 → 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 +3 -2
- 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,466 +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 "ANTLRErrorStrategy.h"
|
9
|
-
#include "misc/IntervalSet.h"
|
10
|
-
|
11
|
-
namespace antlr4 {
|
12
|
-
|
13
|
-
/**
|
14
|
-
* This is the default implementation of {@link ANTLRErrorStrategy} used for
|
15
|
-
* error reporting and recovery in ANTLR parsers.
|
16
|
-
*/
|
17
|
-
class ANTLR4CPP_PUBLIC DefaultErrorStrategy : public ANTLRErrorStrategy {
|
18
|
-
public:
|
19
|
-
DefaultErrorStrategy();
|
20
|
-
DefaultErrorStrategy(DefaultErrorStrategy const& other) = delete;
|
21
|
-
virtual ~DefaultErrorStrategy();
|
22
|
-
|
23
|
-
DefaultErrorStrategy& operator = (DefaultErrorStrategy const& other) = delete;
|
24
|
-
|
25
|
-
protected:
|
26
|
-
/**
|
27
|
-
* Indicates whether the error strategy is currently "recovering from an
|
28
|
-
* error". This is used to suppress reporting multiple error messages while
|
29
|
-
* attempting to recover from a detected syntax error.
|
30
|
-
*
|
31
|
-
* @see #inErrorRecoveryMode
|
32
|
-
*/
|
33
|
-
bool errorRecoveryMode;
|
34
|
-
|
35
|
-
/** The index into the input stream where the last error occurred.
|
36
|
-
* This is used to prevent infinite loops where an error is found
|
37
|
-
* but no token is consumed during recovery...another error is found,
|
38
|
-
* ad nauseum. This is a failsafe mechanism to guarantee that at least
|
39
|
-
* one token/tree node is consumed for two errors.
|
40
|
-
*/
|
41
|
-
int lastErrorIndex;
|
42
|
-
|
43
|
-
misc::IntervalSet lastErrorStates;
|
44
|
-
|
45
|
-
/// <summary>
|
46
|
-
/// {@inheritDoc}
|
47
|
-
/// <p/>
|
48
|
-
/// The default implementation simply calls <seealso cref="#endErrorCondition"/> to
|
49
|
-
/// ensure that the handler is not in error recovery mode.
|
50
|
-
/// </summary>
|
51
|
-
public:
|
52
|
-
virtual void reset(Parser *recognizer) override;
|
53
|
-
|
54
|
-
/// <summary>
|
55
|
-
/// This method is called to enter error recovery mode when a recognition
|
56
|
-
/// exception is reported.
|
57
|
-
/// </summary>
|
58
|
-
/// <param name="recognizer"> the parser instance </param>
|
59
|
-
protected:
|
60
|
-
virtual void beginErrorCondition(Parser *recognizer);
|
61
|
-
|
62
|
-
/// <summary>
|
63
|
-
/// {@inheritDoc}
|
64
|
-
/// </summary>
|
65
|
-
public:
|
66
|
-
virtual bool inErrorRecoveryMode(Parser *recognizer) override;
|
67
|
-
|
68
|
-
/// <summary>
|
69
|
-
/// This method is called to leave error recovery mode after recovering from
|
70
|
-
/// a recognition exception.
|
71
|
-
/// </summary>
|
72
|
-
/// <param name="recognizer"> </param>
|
73
|
-
protected:
|
74
|
-
virtual void endErrorCondition(Parser *recognizer);
|
75
|
-
|
76
|
-
/// <summary>
|
77
|
-
/// {@inheritDoc}
|
78
|
-
/// <p/>
|
79
|
-
/// The default implementation simply calls <seealso cref="#endErrorCondition"/>.
|
80
|
-
/// </summary>
|
81
|
-
public:
|
82
|
-
virtual void reportMatch(Parser *recognizer) override;
|
83
|
-
|
84
|
-
/// {@inheritDoc}
|
85
|
-
/// <p/>
|
86
|
-
/// The default implementation returns immediately if the handler is already
|
87
|
-
/// in error recovery mode. Otherwise, it calls <seealso cref="#beginErrorCondition"/>
|
88
|
-
/// and dispatches the reporting task based on the runtime type of {@code e}
|
89
|
-
/// according to the following table.
|
90
|
-
///
|
91
|
-
/// <ul>
|
92
|
-
/// <li><seealso cref="NoViableAltException"/>: Dispatches the call to
|
93
|
-
/// <seealso cref="#reportNoViableAlternative"/></li>
|
94
|
-
/// <li><seealso cref="InputMismatchException"/>: Dispatches the call to
|
95
|
-
/// <seealso cref="#reportInputMismatch"/></li>
|
96
|
-
/// <li><seealso cref="FailedPredicateException"/>: Dispatches the call to
|
97
|
-
/// <seealso cref="#reportFailedPredicate"/></li>
|
98
|
-
/// <li>All other types: calls <seealso cref="Parser#notifyErrorListeners"/> to report
|
99
|
-
/// the exception</li>
|
100
|
-
/// </ul>
|
101
|
-
virtual void reportError(Parser *recognizer, const RecognitionException &e) override;
|
102
|
-
|
103
|
-
/// <summary>
|
104
|
-
/// {@inheritDoc}
|
105
|
-
/// <p/>
|
106
|
-
/// The default implementation resynchronizes the parser by consuming tokens
|
107
|
-
/// until we find one in the resynchronization set--loosely the set of tokens
|
108
|
-
/// that can follow the current rule.
|
109
|
-
/// </summary>
|
110
|
-
virtual void recover(Parser *recognizer, std::exception_ptr e) override;
|
111
|
-
|
112
|
-
/**
|
113
|
-
* The default implementation of {@link ANTLRErrorStrategy#sync} makes sure
|
114
|
-
* that the current lookahead symbol is consistent with what were expecting
|
115
|
-
* at this point in the ATN. You can call this anytime but ANTLR only
|
116
|
-
* generates code to check before subrules/loops and each iteration.
|
117
|
-
*
|
118
|
-
* <p>Implements Jim Idle's magic sync mechanism in closures and optional
|
119
|
-
* subrules. E.g.,</p>
|
120
|
-
*
|
121
|
-
* <pre>
|
122
|
-
* a : sync ( stuff sync )* ;
|
123
|
-
* sync : {consume to what can follow sync} ;
|
124
|
-
* </pre>
|
125
|
-
*
|
126
|
-
* At the start of a sub rule upon error, {@link #sync} performs single
|
127
|
-
* token deletion, if possible. If it can't do that, it bails on the current
|
128
|
-
* rule and uses the default error recovery, which consumes until the
|
129
|
-
* resynchronization set of the current rule.
|
130
|
-
*
|
131
|
-
* <p>If the sub rule is optional ({@code (...)?}, {@code (...)*}, or block
|
132
|
-
* with an empty alternative), then the expected set includes what follows
|
133
|
-
* the subrule.</p>
|
134
|
-
*
|
135
|
-
* <p>During loop iteration, it consumes until it sees a token that can start a
|
136
|
-
* sub rule or what follows loop. Yes, that is pretty aggressive. We opt to
|
137
|
-
* stay in the loop as long as possible.</p>
|
138
|
-
*
|
139
|
-
* <p><strong>ORIGINS</strong></p>
|
140
|
-
*
|
141
|
-
* <p>Previous versions of ANTLR did a poor job of their recovery within loops.
|
142
|
-
* A single mismatch token or missing token would force the parser to bail
|
143
|
-
* out of the entire rules surrounding the loop. So, for rule</p>
|
144
|
-
*
|
145
|
-
* <pre>
|
146
|
-
* classDef : 'class' ID '{' member* '}'
|
147
|
-
* </pre>
|
148
|
-
*
|
149
|
-
* input with an extra token between members would force the parser to
|
150
|
-
* consume until it found the next class definition rather than the next
|
151
|
-
* member definition of the current class.
|
152
|
-
*
|
153
|
-
* <p>This functionality cost a little bit of effort because the parser has to
|
154
|
-
* compare token set at the start of the loop and at each iteration. If for
|
155
|
-
* some reason speed is suffering for you, you can turn off this
|
156
|
-
* functionality by simply overriding this method as a blank { }.</p>
|
157
|
-
*/
|
158
|
-
virtual void sync(Parser *recognizer) override;
|
159
|
-
|
160
|
-
/// <summary>
|
161
|
-
/// This is called by <seealso cref="#reportError"/> when the exception is a
|
162
|
-
/// <seealso cref="NoViableAltException"/>.
|
163
|
-
/// </summary>
|
164
|
-
/// <seealso cref= #reportError
|
165
|
-
/// </seealso>
|
166
|
-
/// <param name="recognizer"> the parser instance </param>
|
167
|
-
/// <param name="e"> the recognition exception </param>
|
168
|
-
protected:
|
169
|
-
virtual void reportNoViableAlternative(Parser *recognizer, const NoViableAltException &e);
|
170
|
-
|
171
|
-
/// <summary>
|
172
|
-
/// This is called by <seealso cref="#reportError"/> when the exception is an
|
173
|
-
/// <seealso cref="InputMismatchException"/>.
|
174
|
-
/// </summary>
|
175
|
-
/// <seealso cref= #reportError
|
176
|
-
/// </seealso>
|
177
|
-
/// <param name="recognizer"> the parser instance </param>
|
178
|
-
/// <param name="e"> the recognition exception </param>
|
179
|
-
virtual void reportInputMismatch(Parser *recognizer, const InputMismatchException &e);
|
180
|
-
|
181
|
-
/// <summary>
|
182
|
-
/// This is called by <seealso cref="#reportError"/> when the exception is a
|
183
|
-
/// <seealso cref="FailedPredicateException"/>.
|
184
|
-
/// </summary>
|
185
|
-
/// <seealso cref= #reportError
|
186
|
-
/// </seealso>
|
187
|
-
/// <param name="recognizer"> the parser instance </param>
|
188
|
-
/// <param name="e"> the recognition exception </param>
|
189
|
-
virtual void reportFailedPredicate(Parser *recognizer, const FailedPredicateException &e);
|
190
|
-
|
191
|
-
/**
|
192
|
-
* This method is called to report a syntax error which requires the removal
|
193
|
-
* of a token from the input stream. At the time this method is called, the
|
194
|
-
* erroneous symbol is current {@code LT(1)} symbol and has not yet been
|
195
|
-
* removed from the input stream. When this method returns,
|
196
|
-
* {@code recognizer} is in error recovery mode.
|
197
|
-
*
|
198
|
-
* <p>This method is called when {@link #singleTokenDeletion} identifies
|
199
|
-
* single-token deletion as a viable recovery strategy for a mismatched
|
200
|
-
* input error.</p>
|
201
|
-
*
|
202
|
-
* <p>The default implementation simply returns if the handler is already in
|
203
|
-
* error recovery mode. Otherwise, it calls {@link #beginErrorCondition} to
|
204
|
-
* enter error recovery mode, followed by calling
|
205
|
-
* {@link Parser#notifyErrorListeners}.</p>
|
206
|
-
*
|
207
|
-
* @param recognizer the parser instance
|
208
|
-
*/
|
209
|
-
virtual void reportUnwantedToken(Parser *recognizer);
|
210
|
-
|
211
|
-
/**
|
212
|
-
* This method is called to report a syntax error which requires the
|
213
|
-
* insertion of a missing token into the input stream. At the time this
|
214
|
-
* method is called, the missing token has not yet been inserted. When this
|
215
|
-
* method returns, {@code recognizer} is in error recovery mode.
|
216
|
-
*
|
217
|
-
* <p>This method is called when {@link #singleTokenInsertion} identifies
|
218
|
-
* single-token insertion as a viable recovery strategy for a mismatched
|
219
|
-
* input error.</p>
|
220
|
-
*
|
221
|
-
* <p>The default implementation simply returns if the handler is already in
|
222
|
-
* error recovery mode. Otherwise, it calls {@link #beginErrorCondition} to
|
223
|
-
* enter error recovery mode, followed by calling
|
224
|
-
* {@link Parser#notifyErrorListeners}.</p>
|
225
|
-
*
|
226
|
-
* @param recognizer the parser instance
|
227
|
-
*/
|
228
|
-
virtual void reportMissingToken(Parser *recognizer);
|
229
|
-
|
230
|
-
public:
|
231
|
-
/**
|
232
|
-
* {@inheritDoc}
|
233
|
-
*
|
234
|
-
* <p>The default implementation attempts to recover from the mismatched input
|
235
|
-
* by using single token insertion and deletion as described below. If the
|
236
|
-
* recovery attempt fails, this method throws an
|
237
|
-
* {@link InputMismatchException}.</p>
|
238
|
-
*
|
239
|
-
* <p><strong>EXTRA TOKEN</strong> (single token deletion)</p>
|
240
|
-
*
|
241
|
-
* <p>{@code LA(1)} is not what we are looking for. If {@code LA(2)} has the
|
242
|
-
* right token, however, then assume {@code LA(1)} is some extra spurious
|
243
|
-
* token and delete it. Then consume and return the next token (which was
|
244
|
-
* the {@code LA(2)} token) as the successful result of the match operation.</p>
|
245
|
-
*
|
246
|
-
* <p>This recovery strategy is implemented by {@link #singleTokenDeletion}.</p>
|
247
|
-
*
|
248
|
-
* <p><strong>MISSING TOKEN</strong> (single token insertion)</p>
|
249
|
-
*
|
250
|
-
* <p>If current token (at {@code LA(1)}) is consistent with what could come
|
251
|
-
* after the expected {@code LA(1)} token, then assume the token is missing
|
252
|
-
* and use the parser's {@link TokenFactory} to create it on the fly. The
|
253
|
-
* "insertion" is performed by returning the created token as the successful
|
254
|
-
* result of the match operation.</p>
|
255
|
-
*
|
256
|
-
* <p>This recovery strategy is implemented by {@link #singleTokenInsertion}.</p>
|
257
|
-
*
|
258
|
-
* <p><strong>EXAMPLE</strong></p>
|
259
|
-
*
|
260
|
-
* <p>For example, Input {@code i=(3;} is clearly missing the {@code ')'}. When
|
261
|
-
* the parser returns from the nested call to {@code expr}, it will have
|
262
|
-
* call chain:</p>
|
263
|
-
*
|
264
|
-
* <pre>
|
265
|
-
* stat → expr → atom
|
266
|
-
* </pre>
|
267
|
-
*
|
268
|
-
* and it will be trying to match the {@code ')'} at this point in the
|
269
|
-
* derivation:
|
270
|
-
*
|
271
|
-
* <pre>
|
272
|
-
* => ID '=' '(' INT ')' ('+' atom)* ';'
|
273
|
-
* ^
|
274
|
-
* </pre>
|
275
|
-
*
|
276
|
-
* The attempt to match {@code ')'} will fail when it sees {@code ';'} and
|
277
|
-
* call {@link #recoverInline}. To recover, it sees that {@code LA(1)==';'}
|
278
|
-
* is in the set of tokens that can follow the {@code ')'} token reference
|
279
|
-
* in rule {@code atom}. It can assume that you forgot the {@code ')'}.
|
280
|
-
*/
|
281
|
-
virtual Token* recoverInline(Parser *recognizer) override;
|
282
|
-
|
283
|
-
/// <summary>
|
284
|
-
/// This method implements the single-token insertion inline error recovery
|
285
|
-
/// strategy. It is called by <seealso cref="#recoverInline"/> if the single-token
|
286
|
-
/// deletion strategy fails to recover from the mismatched input. If this
|
287
|
-
/// method returns {@code true}, {@code recognizer} will be in error recovery
|
288
|
-
/// mode.
|
289
|
-
/// <p/>
|
290
|
-
/// This method determines whether or not single-token insertion is viable by
|
291
|
-
/// checking if the {@code LA(1)} input symbol could be successfully matched
|
292
|
-
/// if it were instead the {@code LA(2)} symbol. If this method returns
|
293
|
-
/// {@code true}, the caller is responsible for creating and inserting a
|
294
|
-
/// token with the correct type to produce this behavior.
|
295
|
-
/// </summary>
|
296
|
-
/// <param name="recognizer"> the parser instance </param>
|
297
|
-
/// <returns> {@code true} if single-token insertion is a viable recovery
|
298
|
-
/// strategy for the current mismatched input, otherwise {@code false} </returns>
|
299
|
-
protected:
|
300
|
-
virtual bool singleTokenInsertion(Parser *recognizer);
|
301
|
-
|
302
|
-
/// <summary>
|
303
|
-
/// This method implements the single-token deletion inline error recovery
|
304
|
-
/// strategy. It is called by <seealso cref="#recoverInline"/> to attempt to recover
|
305
|
-
/// from mismatched input. If this method returns null, the parser and error
|
306
|
-
/// handler state will not have changed. If this method returns non-null,
|
307
|
-
/// {@code recognizer} will <em>not</em> be in error recovery mode since the
|
308
|
-
/// returned token was a successful match.
|
309
|
-
/// <p/>
|
310
|
-
/// If the single-token deletion is successful, this method calls
|
311
|
-
/// <seealso cref="#reportUnwantedToken"/> to report the error, followed by
|
312
|
-
/// <seealso cref="Parser#consume"/> to actually "delete" the extraneous token. Then,
|
313
|
-
/// before returning <seealso cref="#reportMatch"/> is called to signal a successful
|
314
|
-
/// match.
|
315
|
-
/// </summary>
|
316
|
-
/// <param name="recognizer"> the parser instance </param>
|
317
|
-
/// <returns> the successfully matched <seealso cref="Token"/> instance if single-token
|
318
|
-
/// deletion successfully recovers from the mismatched input, otherwise
|
319
|
-
/// {@code null} </returns>
|
320
|
-
virtual Token* singleTokenDeletion(Parser *recognizer);
|
321
|
-
|
322
|
-
/// <summary>
|
323
|
-
/// Conjure up a missing token during error recovery.
|
324
|
-
///
|
325
|
-
/// The recognizer attempts to recover from single missing
|
326
|
-
/// symbols. But, actions might refer to that missing symbol.
|
327
|
-
/// For example, x=ID {f($x);}. The action clearly assumes
|
328
|
-
/// that there has been an identifier matched previously and that
|
329
|
-
/// $x points at that token. If that token is missing, but
|
330
|
-
/// the next token in the stream is what we want we assume that
|
331
|
-
/// this token is missing and we keep going. Because we
|
332
|
-
/// have to return some token to replace the missing token,
|
333
|
-
/// we have to conjure one up. This method gives the user control
|
334
|
-
/// over the tokens returned for missing tokens. Mostly,
|
335
|
-
/// you will want to create something special for identifier
|
336
|
-
/// tokens. For literals such as '{' and ',', the default
|
337
|
-
/// action in the parser or tree parser works. It simply creates
|
338
|
-
/// a CommonToken of the appropriate type. The text will be the token.
|
339
|
-
/// If you change what tokens must be created by the lexer,
|
340
|
-
/// override this method to create the appropriate tokens.
|
341
|
-
/// </summary>
|
342
|
-
virtual Token* getMissingSymbol(Parser *recognizer);
|
343
|
-
|
344
|
-
virtual misc::IntervalSet getExpectedTokens(Parser *recognizer);
|
345
|
-
|
346
|
-
/// <summary>
|
347
|
-
/// How should a token be displayed in an error message? The default
|
348
|
-
/// is to display just the text, but during development you might
|
349
|
-
/// want to have a lot of information spit out. Override in that case
|
350
|
-
/// to use t.toString() (which, for CommonToken, dumps everything about
|
351
|
-
/// the token). This is better than forcing you to override a method in
|
352
|
-
/// your token objects because you don't have to go modify your lexer
|
353
|
-
/// so that it creates a new class.
|
354
|
-
/// </summary>
|
355
|
-
virtual std::string getTokenErrorDisplay(Token *t);
|
356
|
-
|
357
|
-
virtual std::string getSymbolText(Token *symbol);
|
358
|
-
|
359
|
-
virtual size_t getSymbolType(Token *symbol);
|
360
|
-
|
361
|
-
virtual std::string escapeWSAndQuote(const std::string &s) const;
|
362
|
-
|
363
|
-
/* Compute the error recovery set for the current rule. During
|
364
|
-
* rule invocation, the parser pushes the set of tokens that can
|
365
|
-
* follow that rule reference on the stack; this amounts to
|
366
|
-
* computing FIRST of what follows the rule reference in the
|
367
|
-
* enclosing rule. See LinearApproximator.FIRST().
|
368
|
-
* This local follow set only includes tokens
|
369
|
-
* from within the rule; i.e., the FIRST computation done by
|
370
|
-
* ANTLR stops at the end of a rule.
|
371
|
-
*
|
372
|
-
* EXAMPLE
|
373
|
-
*
|
374
|
-
* When you find a "no viable alt exception", the input is not
|
375
|
-
* consistent with any of the alternatives for rule r. The best
|
376
|
-
* thing to do is to consume tokens until you see something that
|
377
|
-
* can legally follow a call to r *or* any rule that called r.
|
378
|
-
* You don't want the exact set of viable next tokens because the
|
379
|
-
* input might just be missing a token--you might consume the
|
380
|
-
* rest of the input looking for one of the missing tokens.
|
381
|
-
*
|
382
|
-
* Consider grammar:
|
383
|
-
*
|
384
|
-
* a : '[' b ']'
|
385
|
-
* | '(' b ')'
|
386
|
-
* ;
|
387
|
-
* b : c '^' INT ;
|
388
|
-
* c : ID
|
389
|
-
* | INT
|
390
|
-
* ;
|
391
|
-
*
|
392
|
-
* At each rule invocation, the set of tokens that could follow
|
393
|
-
* that rule is pushed on a stack. Here are the various
|
394
|
-
* context-sensitive follow sets:
|
395
|
-
*
|
396
|
-
* FOLLOW(b1_in_a) = FIRST(']') = ']'
|
397
|
-
* FOLLOW(b2_in_a) = FIRST(')') = ')'
|
398
|
-
* FOLLOW(c_in_b) = FIRST('^') = '^'
|
399
|
-
*
|
400
|
-
* Upon erroneous input "[]", the call chain is
|
401
|
-
*
|
402
|
-
* a -> b -> c
|
403
|
-
*
|
404
|
-
* and, hence, the follow context stack is:
|
405
|
-
*
|
406
|
-
* depth follow set start of rule execution
|
407
|
-
* 0 <EOF> a (from main())
|
408
|
-
* 1 ']' b
|
409
|
-
* 2 '^' c
|
410
|
-
*
|
411
|
-
* Notice that ')' is not included, because b would have to have
|
412
|
-
* been called from a different context in rule a for ')' to be
|
413
|
-
* included.
|
414
|
-
*
|
415
|
-
* For error recovery, we cannot consider FOLLOW(c)
|
416
|
-
* (context-sensitive or otherwise). We need the combined set of
|
417
|
-
* all context-sensitive FOLLOW sets--the set of all tokens that
|
418
|
-
* could follow any reference in the call chain. We need to
|
419
|
-
* resync to one of those tokens. Note that FOLLOW(c)='^' and if
|
420
|
-
* we resync'd to that token, we'd consume until EOF. We need to
|
421
|
-
* sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
|
422
|
-
* In this case, for input "[]", LA(1) is ']' and in the set, so we would
|
423
|
-
* not consume anything. After printing an error, rule c would
|
424
|
-
* return normally. Rule b would not find the required '^' though.
|
425
|
-
* At this point, it gets a mismatched token error and throws an
|
426
|
-
* exception (since LA(1) is not in the viable following token
|
427
|
-
* set). The rule exception handler tries to recover, but finds
|
428
|
-
* the same recovery set and doesn't consume anything. Rule b
|
429
|
-
* exits normally returning to rule a. Now it finds the ']' (and
|
430
|
-
* with the successful match exits errorRecovery mode).
|
431
|
-
*
|
432
|
-
* So, you can see that the parser walks up the call chain looking
|
433
|
-
* for the token that was a member of the recovery set.
|
434
|
-
*
|
435
|
-
* Errors are not generated in errorRecovery mode.
|
436
|
-
*
|
437
|
-
* ANTLR's error recovery mechanism is based upon original ideas:
|
438
|
-
*
|
439
|
-
* "Algorithms + Data Structures = Programs" by Niklaus Wirth
|
440
|
-
*
|
441
|
-
* and
|
442
|
-
*
|
443
|
-
* "A note on error recovery in recursive descent parsers":
|
444
|
-
* http://portal.acm.org/citation.cfm?id=947902.947905
|
445
|
-
*
|
446
|
-
* Later, Josef Grosch had some good ideas:
|
447
|
-
*
|
448
|
-
* "Efficient and Comfortable Error Recovery in Recursive Descent
|
449
|
-
* Parsers":
|
450
|
-
* ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
|
451
|
-
*
|
452
|
-
* Like Grosch I implement context-sensitive FOLLOW sets that are combined
|
453
|
-
* at run-time upon error to avoid overhead during parsing.
|
454
|
-
*/
|
455
|
-
virtual misc::IntervalSet getErrorRecoverySet(Parser *recognizer);
|
456
|
-
|
457
|
-
/// <summary>
|
458
|
-
/// Consume tokens until one matches the given token set. </summary>
|
459
|
-
virtual void consumeUntil(Parser *recognizer, const misc::IntervalSet &set);
|
460
|
-
|
461
|
-
private:
|
462
|
-
std::vector<std::unique_ptr<Token>> _errorSymbols; // Temporarily created token.
|
463
|
-
void InitializeInstanceFields();
|
464
|
-
};
|
465
|
-
|
466
|
-
} // namespace antlr4
|
@@ -1,84 +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/PredictionContext.h"
|
7
|
-
#include "atn/ATNConfig.h"
|
8
|
-
#include "atn/ATNConfigSet.h"
|
9
|
-
#include "Parser.h"
|
10
|
-
#include "misc/Interval.h"
|
11
|
-
#include "dfa/DFA.h"
|
12
|
-
|
13
|
-
#include "DiagnosticErrorListener.h"
|
14
|
-
|
15
|
-
using namespace antlr4;
|
16
|
-
|
17
|
-
DiagnosticErrorListener::DiagnosticErrorListener() : DiagnosticErrorListener(true) {
|
18
|
-
}
|
19
|
-
|
20
|
-
DiagnosticErrorListener::DiagnosticErrorListener(bool exactOnly_) : exactOnly(exactOnly_) {
|
21
|
-
}
|
22
|
-
|
23
|
-
void DiagnosticErrorListener::reportAmbiguity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex,
|
24
|
-
bool exact, const antlrcpp::BitSet &ambigAlts, atn::ATNConfigSet *configs) {
|
25
|
-
if (exactOnly && !exact) {
|
26
|
-
return;
|
27
|
-
}
|
28
|
-
|
29
|
-
std::string decision = getDecisionDescription(recognizer, dfa);
|
30
|
-
antlrcpp::BitSet conflictingAlts = getConflictingAlts(ambigAlts, configs);
|
31
|
-
std::string text = recognizer->getTokenStream()->getText(misc::Interval(startIndex, stopIndex));
|
32
|
-
std::string message = "reportAmbiguity d=" + decision + ": ambigAlts=" + conflictingAlts.toString() +
|
33
|
-
", input='" + text + "'";
|
34
|
-
|
35
|
-
recognizer->notifyErrorListeners(message);
|
36
|
-
}
|
37
|
-
|
38
|
-
void DiagnosticErrorListener::reportAttemptingFullContext(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex,
|
39
|
-
size_t stopIndex, const antlrcpp::BitSet &/*conflictingAlts*/, atn::ATNConfigSet * /*configs*/) {
|
40
|
-
std::string decision = getDecisionDescription(recognizer, dfa);
|
41
|
-
std::string text = recognizer->getTokenStream()->getText(misc::Interval(startIndex, stopIndex));
|
42
|
-
std::string message = "reportAttemptingFullContext d=" + decision + ", input='" + text + "'";
|
43
|
-
recognizer->notifyErrorListeners(message);
|
44
|
-
}
|
45
|
-
|
46
|
-
void DiagnosticErrorListener::reportContextSensitivity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex,
|
47
|
-
size_t stopIndex, size_t /*prediction*/, atn::ATNConfigSet * /*configs*/) {
|
48
|
-
std::string decision = getDecisionDescription(recognizer, dfa);
|
49
|
-
std::string text = recognizer->getTokenStream()->getText(misc::Interval(startIndex, stopIndex));
|
50
|
-
std::string message = "reportContextSensitivity d=" + decision + ", input='" + text + "'";
|
51
|
-
recognizer->notifyErrorListeners(message);
|
52
|
-
}
|
53
|
-
|
54
|
-
std::string DiagnosticErrorListener::getDecisionDescription(Parser *recognizer, const dfa::DFA &dfa) {
|
55
|
-
size_t decision = dfa.decision;
|
56
|
-
size_t ruleIndex = (reinterpret_cast<atn::ATNState*>(dfa.atnStartState))->ruleIndex;
|
57
|
-
|
58
|
-
const std::vector<std::string>& ruleNames = recognizer->getRuleNames();
|
59
|
-
if (ruleIndex == INVALID_INDEX || ruleIndex >= ruleNames.size()) {
|
60
|
-
return std::to_string(decision);
|
61
|
-
}
|
62
|
-
|
63
|
-
std::string ruleName = ruleNames[ruleIndex];
|
64
|
-
if (ruleName == "" || ruleName.empty()) {
|
65
|
-
return std::to_string(decision);
|
66
|
-
}
|
67
|
-
|
68
|
-
return std::to_string(decision) + " (" + ruleName + ")";
|
69
|
-
}
|
70
|
-
|
71
|
-
antlrcpp::BitSet DiagnosticErrorListener::getConflictingAlts(const antlrcpp::BitSet &reportedAlts,
|
72
|
-
atn::ATNConfigSet *configs) {
|
73
|
-
if (reportedAlts.count() > 0) { // Not exactly like the original Java code, but this listener is only used
|
74
|
-
// in the TestRig (where it never provides a good alt set), so it's probably ok so.
|
75
|
-
return reportedAlts;
|
76
|
-
}
|
77
|
-
|
78
|
-
antlrcpp::BitSet result;
|
79
|
-
for (auto &config : configs->configs) {
|
80
|
-
result.set(config->alt);
|
81
|
-
}
|
82
|
-
|
83
|
-
return result;
|
84
|
-
}
|
@@ -1,80 +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 "BaseErrorListener.h"
|
9
|
-
|
10
|
-
namespace antlr4 {
|
11
|
-
|
12
|
-
/// <summary>
|
13
|
-
/// This implementation of <seealso cref="ANTLRErrorListener"/> can be used to identify
|
14
|
-
/// certain potential correctness and performance problems in grammars. "Reports"
|
15
|
-
/// are made by calling <seealso cref="Parser#notifyErrorListeners"/> with the appropriate
|
16
|
-
/// message.
|
17
|
-
///
|
18
|
-
/// <ul>
|
19
|
-
/// <li><b>Ambiguities</b>: These are cases where more than one path through the
|
20
|
-
/// grammar can match the input.</li>
|
21
|
-
/// <li><b>Weak context sensitivity</b>: These are cases where full-context
|
22
|
-
/// prediction resolved an SLL conflict to a unique alternative which equaled the
|
23
|
-
/// minimum alternative of the SLL conflict.</li>
|
24
|
-
/// <li><b>Strong (forced) context sensitivity</b>: These are cases where the
|
25
|
-
/// full-context prediction resolved an SLL conflict to a unique alternative,
|
26
|
-
/// <em>and</em> the minimum alternative of the SLL conflict was found to not be
|
27
|
-
/// a truly viable alternative. Two-stage parsing cannot be used for inputs where
|
28
|
-
/// this situation occurs.</li>
|
29
|
-
/// </ul>
|
30
|
-
///
|
31
|
-
/// @author Sam Harwell
|
32
|
-
/// </summary>
|
33
|
-
class ANTLR4CPP_PUBLIC DiagnosticErrorListener : public BaseErrorListener {
|
34
|
-
/// <summary>
|
35
|
-
/// When {@code true}, only exactly known ambiguities are reported.
|
36
|
-
/// </summary>
|
37
|
-
protected:
|
38
|
-
const bool exactOnly;
|
39
|
-
|
40
|
-
/// <summary>
|
41
|
-
/// Initializes a new instance of <seealso cref="DiagnosticErrorListener"/> which only
|
42
|
-
/// reports exact ambiguities.
|
43
|
-
/// </summary>
|
44
|
-
public:
|
45
|
-
DiagnosticErrorListener();
|
46
|
-
|
47
|
-
/// <summary>
|
48
|
-
/// Initializes a new instance of <seealso cref="DiagnosticErrorListener"/>, specifying
|
49
|
-
/// whether all ambiguities or only exact ambiguities are reported.
|
50
|
-
/// </summary>
|
51
|
-
/// <param name="exactOnly"> {@code true} to report only exact ambiguities, otherwise
|
52
|
-
/// {@code false} to report all ambiguities. </param>
|
53
|
-
DiagnosticErrorListener(bool exactOnly);
|
54
|
-
|
55
|
-
virtual void reportAmbiguity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex, bool exact,
|
56
|
-
const antlrcpp::BitSet &ambigAlts, atn::ATNConfigSet *configs) override;
|
57
|
-
|
58
|
-
virtual void reportAttemptingFullContext(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex,
|
59
|
-
const antlrcpp::BitSet &conflictingAlts, atn::ATNConfigSet *configs) override;
|
60
|
-
|
61
|
-
virtual void reportContextSensitivity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex,
|
62
|
-
size_t prediction, atn::ATNConfigSet *configs) override;
|
63
|
-
|
64
|
-
protected:
|
65
|
-
virtual std::string getDecisionDescription(Parser *recognizer, const dfa::DFA &dfa);
|
66
|
-
|
67
|
-
/// <summary>
|
68
|
-
/// Computes the set of conflicting or ambiguous alternatives from a
|
69
|
-
/// configuration set, if that information was not already provided by the
|
70
|
-
/// parser.
|
71
|
-
/// </summary>
|
72
|
-
/// <param name="reportedAlts"> The set of conflicting or ambiguous alternatives, as
|
73
|
-
/// reported by the parser. </param>
|
74
|
-
/// <param name="configs"> The conflicting or ambiguous configuration set. </param>
|
75
|
-
/// <returns> Returns {@code reportedAlts} if it is not {@code null}, otherwise
|
76
|
-
/// returns the set of alternatives represented in {@code configs}. </returns>
|
77
|
-
virtual antlrcpp::BitSet getConflictingAlts(const antlrcpp::BitSet &reportedAlts, atn::ATNConfigSet *configs);
|
78
|
-
};
|
79
|
-
|
80
|
-
} // namespace antlr4
|