expressir 1.4.3 → 2.1.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 +21 -0
- data/Gemfile +12 -0
- data/README.adoc +6 -19
- data/Rakefile +6 -7
- data/exe/{format-test → expressir-format-test} +1 -1
- 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/liquid/cache_drop.rb +20 -0
- data/lib/expressir/liquid/data_type_drop.rb +8 -0
- data/lib/expressir/liquid/data_types/aggregate_drop.rb +21 -0
- data/lib/expressir/liquid/data_types/array_drop.rb +34 -0
- data/lib/expressir/liquid/data_types/bag_drop.rb +26 -0
- data/lib/expressir/liquid/data_types/binary_drop.rb +22 -0
- data/lib/expressir/liquid/data_types/boolean_drop.rb +10 -0
- data/lib/expressir/liquid/data_types/enumeration_drop.rb +30 -0
- data/lib/expressir/liquid/data_types/enumeration_item_drop.rb +17 -0
- data/lib/expressir/liquid/data_types/generic_drop.rb +17 -0
- data/lib/expressir/liquid/data_types/generic_entity_drop.rb +17 -0
- data/lib/expressir/liquid/data_types/integer_drop.rb +10 -0
- data/lib/expressir/liquid/data_types/list_drop.rb +30 -0
- data/lib/expressir/liquid/data_types/logical_drop.rb +10 -0
- data/lib/expressir/liquid/data_types/number_drop.rb +10 -0
- data/lib/expressir/liquid/data_types/real_drop.rb +18 -0
- data/lib/expressir/liquid/data_types/select_drop.rb +34 -0
- data/lib/expressir/liquid/data_types/set_drop.rb +26 -0
- data/lib/expressir/liquid/data_types/string_drop.rb +22 -0
- data/lib/expressir/liquid/declaration_drop.rb +8 -0
- data/lib/expressir/liquid/declarations/attribute_drop.rb +37 -0
- data/lib/expressir/liquid/declarations/constant_drop.rb +25 -0
- data/lib/expressir/liquid/declarations/entity_drop.rb +65 -0
- data/lib/expressir/liquid/declarations/function_drop.rb +93 -0
- data/lib/expressir/liquid/declarations/interface_drop.rb +30 -0
- data/lib/expressir/liquid/declarations/interface_item_drop.rb +22 -0
- data/lib/expressir/liquid/declarations/interfaced_item_drop.rb +34 -0
- data/lib/expressir/liquid/declarations/parameter_drop.rb +25 -0
- data/lib/expressir/liquid/declarations/procedure_drop.rb +89 -0
- data/lib/expressir/liquid/declarations/remark_item_drop.rb +22 -0
- data/lib/expressir/liquid/declarations/rule_drop.rb +105 -0
- data/lib/expressir/liquid/declarations/schema_drop.rb +91 -0
- data/lib/expressir/liquid/declarations/schema_version_drop.rb +26 -0
- data/lib/expressir/liquid/declarations/schema_version_item_drop.rb +22 -0
- data/lib/expressir/liquid/declarations/subtype_constraint_drop.rb +37 -0
- data/lib/expressir/liquid/declarations/type_drop.rb +37 -0
- data/lib/expressir/liquid/declarations/unique_rule_drop.rb +21 -0
- data/lib/expressir/liquid/declarations/variable_drop.rb +25 -0
- data/lib/expressir/liquid/declarations/where_rule_drop.rb +21 -0
- data/lib/expressir/liquid/expression_drop.rb +8 -0
- data/lib/expressir/liquid/expressions/aggregate_initializer_drop.rb +24 -0
- data/lib/expressir/liquid/expressions/aggregate_initializer_item_drop.rb +22 -0
- data/lib/expressir/liquid/expressions/binary_expression_drop.rb +26 -0
- data/lib/expressir/liquid/expressions/entity_constructor_drop.rb +26 -0
- data/lib/expressir/liquid/expressions/function_call_drop.rb +26 -0
- data/lib/expressir/liquid/expressions/interval_drop.rb +34 -0
- data/lib/expressir/liquid/expressions/query_expression_drop.rb +25 -0
- data/lib/expressir/liquid/expressions/unary_expression_drop.rb +22 -0
- data/lib/expressir/liquid/identifier_drop.rb +33 -0
- data/lib/expressir/liquid/literal_drop.rb +8 -0
- data/lib/expressir/liquid/literals/binary_drop.rb +18 -0
- data/lib/expressir/liquid/literals/integer_drop.rb +18 -0
- data/lib/expressir/liquid/literals/logical_drop.rb +18 -0
- data/lib/expressir/liquid/literals/real_drop.rb +18 -0
- data/lib/expressir/liquid/literals/string_drop.rb +22 -0
- data/lib/expressir/liquid/model_element_drop.rb +33 -0
- data/lib/expressir/liquid/reference_drop.rb +8 -0
- data/lib/expressir/liquid/references/attribute_reference_drop.rb +22 -0
- data/lib/expressir/liquid/references/group_reference_drop.rb +22 -0
- data/lib/expressir/liquid/references/index_reference_drop.rb +26 -0
- data/lib/expressir/liquid/references/simple_reference_drop.rb +22 -0
- data/lib/expressir/liquid/repository_drop.rb +22 -0
- data/lib/expressir/liquid/statement_drop.rb +8 -0
- data/lib/expressir/liquid/statements/alias_drop.rb +29 -0
- data/lib/expressir/liquid/statements/assignment_drop.rb +22 -0
- data/lib/expressir/liquid/statements/case_action_drop.rb +26 -0
- data/lib/expressir/liquid/statements/case_drop.rb +30 -0
- data/lib/expressir/liquid/statements/compound_drop.rb +22 -0
- data/lib/expressir/liquid/statements/escape_drop.rb +10 -0
- data/lib/expressir/liquid/statements/if_drop.rb +34 -0
- data/lib/expressir/liquid/statements/null_drop.rb +10 -0
- data/lib/expressir/liquid/statements/procedure_call_drop.rb +26 -0
- data/lib/expressir/liquid/statements/repeat_drop.rb +45 -0
- data/lib/expressir/liquid/statements/return_drop.rb +18 -0
- data/lib/expressir/liquid/statements/skip_drop.rb +10 -0
- data/lib/expressir/liquid/supertype_expression_drop.rb +8 -0
- data/lib/expressir/liquid/supertype_expressions/binary_supertype_expression_drop.rb +26 -0
- data/lib/expressir/liquid/supertype_expressions/oneof_supertype_expression_drop.rb +22 -0
- data/lib/expressir/liquid.rb +18 -0
- data/lib/expressir/model/declarations/interface_item.rb +1 -1
- data/lib/expressir/model/model_element.rb +7 -0
- data/lib/expressir/version.rb +1 -1
- data/lib/expressir.rb +2 -0
- metadata +101 -569
- 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
- /data/exe/{format → expressir-format} +0 -0
@@ -1,911 +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 "PredictionMode.h"
|
9
|
-
#include "dfa/DFAState.h"
|
10
|
-
#include "atn/ATNSimulator.h"
|
11
|
-
#include "atn/PredictionContext.h"
|
12
|
-
#include "atn/PredictionContextMergeCache.h"
|
13
|
-
#include "atn/ParserATNSimulatorOptions.h"
|
14
|
-
#include "SemanticContext.h"
|
15
|
-
#include "atn/ATNConfig.h"
|
16
|
-
|
17
|
-
namespace antlr4 {
|
18
|
-
namespace atn {
|
19
|
-
|
20
|
-
/**
|
21
|
-
* The embodiment of the adaptive LL(*), ALL(*), parsing strategy.
|
22
|
-
*
|
23
|
-
* <p>
|
24
|
-
* The basic complexity of the adaptive strategy makes it harder to understand.
|
25
|
-
* We begin with ATN simulation to build paths in a DFA. Subsequent prediction
|
26
|
-
* requests go through the DFA first. If they reach a state without an edge for
|
27
|
-
* the current symbol, the algorithm fails over to the ATN simulation to
|
28
|
-
* complete the DFA path for the current input (until it finds a conflict state
|
29
|
-
* or uniquely predicting state).</p>
|
30
|
-
*
|
31
|
-
* <p>
|
32
|
-
* All of that is done without using the outer context because we want to create
|
33
|
-
* a DFA that is not dependent upon the rule invocation stack when we do a
|
34
|
-
* prediction. One DFA works in all contexts. We avoid using context not
|
35
|
-
* necessarily because it's slower, although it can be, but because of the DFA
|
36
|
-
* caching problem. The closure routine only considers the rule invocation stack
|
37
|
-
* created during prediction beginning in the decision rule. For example, if
|
38
|
-
* prediction occurs without invoking another rule's ATN, there are no context
|
39
|
-
* stacks in the configurations. When lack of context leads to a conflict, we
|
40
|
-
* don't know if it's an ambiguity or a weakness in the strong LL(*) parsing
|
41
|
-
* strategy (versus full LL(*)).</p>
|
42
|
-
*
|
43
|
-
* <p>
|
44
|
-
* When SLL yields a configuration set with conflict, we rewind the input and
|
45
|
-
* retry the ATN simulation, this time using full outer context without adding
|
46
|
-
* to the DFA. Configuration context stacks will be the full invocation stacks
|
47
|
-
* from the start rule. If we get a conflict using full context, then we can
|
48
|
-
* definitively say we have a true ambiguity for that input sequence. If we
|
49
|
-
* don't get a conflict, it implies that the decision is sensitive to the outer
|
50
|
-
* context. (It is not context-sensitive in the sense of context-sensitive
|
51
|
-
* grammars.)</p>
|
52
|
-
*
|
53
|
-
* <p>
|
54
|
-
* The next time we reach this DFA state with an SLL conflict, through DFA
|
55
|
-
* simulation, we will again retry the ATN simulation using full context mode.
|
56
|
-
* This is slow because we can't save the results and have to "interpret" the
|
57
|
-
* ATN each time we get that input.</p>
|
58
|
-
*
|
59
|
-
* <p>
|
60
|
-
* <strong>CACHING FULL CONTEXT PREDICTIONS</strong></p>
|
61
|
-
*
|
62
|
-
* <p>
|
63
|
-
* We could cache results from full context to predicted alternative easily and
|
64
|
-
* that saves a lot of time but doesn't work in presence of predicates. The set
|
65
|
-
* of visible predicates from the ATN start state changes depending on the
|
66
|
-
* context, because closure can fall off the end of a rule. I tried to cache
|
67
|
-
* tuples (stack context, semantic context, predicted alt) but it was slower
|
68
|
-
* than interpreting and much more complicated. Also required a huge amount of
|
69
|
-
* memory. The goal is not to create the world's fastest parser anyway. I'd like
|
70
|
-
* to keep this algorithm simple. By launching multiple threads, we can improve
|
71
|
-
* the speed of parsing across a large number of files.</p>
|
72
|
-
*
|
73
|
-
* <p>
|
74
|
-
* There is no strict ordering between the amount of input used by SLL vs LL,
|
75
|
-
* which makes it really hard to build a cache for full context. Let's say that
|
76
|
-
* we have input A B C that leads to an SLL conflict with full context X. That
|
77
|
-
* implies that using X we might only use A B but we could also use A B C D to
|
78
|
-
* resolve conflict. Input A B C D could predict alternative 1 in one position
|
79
|
-
* in the input and A B C E could predict alternative 2 in another position in
|
80
|
-
* input. The conflicting SLL configurations could still be non-unique in the
|
81
|
-
* full context prediction, which would lead us to requiring more input than the
|
82
|
-
* original A B C. To make a prediction cache work, we have to track the exact
|
83
|
-
* input used during the previous prediction. That amounts to a cache that maps
|
84
|
-
* X to a specific DFA for that context.</p>
|
85
|
-
*
|
86
|
-
* <p>
|
87
|
-
* Something should be done for left-recursive expression predictions. They are
|
88
|
-
* likely LL(1) + pred eval. Easier to do the whole SLL unless error and retry
|
89
|
-
* with full LL thing Sam does.</p>
|
90
|
-
*
|
91
|
-
* <p>
|
92
|
-
* <strong>AVOIDING FULL CONTEXT PREDICTION</strong></p>
|
93
|
-
*
|
94
|
-
* <p>
|
95
|
-
* We avoid doing full context retry when the outer context is empty, we did not
|
96
|
-
* dip into the outer context by falling off the end of the decision state rule,
|
97
|
-
* or when we force SLL mode.</p>
|
98
|
-
*
|
99
|
-
* <p>
|
100
|
-
* As an example of the not dip into outer context case, consider as super
|
101
|
-
* constructor calls versus function calls. One grammar might look like
|
102
|
-
* this:</p>
|
103
|
-
*
|
104
|
-
* <pre>
|
105
|
-
* ctorBody
|
106
|
-
* : '{' superCall? stat* '}'
|
107
|
-
* ;
|
108
|
-
* </pre>
|
109
|
-
*
|
110
|
-
* <p>
|
111
|
-
* Or, you might see something like</p>
|
112
|
-
*
|
113
|
-
* <pre>
|
114
|
-
* stat
|
115
|
-
* : superCall ';'
|
116
|
-
* | expression ';'
|
117
|
-
* | ...
|
118
|
-
* ;
|
119
|
-
* </pre>
|
120
|
-
*
|
121
|
-
* <p>
|
122
|
-
* In both cases I believe that no closure operations will dip into the outer
|
123
|
-
* context. In the first case ctorBody in the worst case will stop at the '}'.
|
124
|
-
* In the 2nd case it should stop at the ';'. Both cases should stay within the
|
125
|
-
* entry rule and not dip into the outer context.</p>
|
126
|
-
*
|
127
|
-
* <p>
|
128
|
-
* <strong>PREDICATES</strong></p>
|
129
|
-
*
|
130
|
-
* <p>
|
131
|
-
* Predicates are always evaluated if present in either SLL or LL both. SLL and
|
132
|
-
* LL simulation deals with predicates differently. SLL collects predicates as
|
133
|
-
* it performs closure operations like ANTLR v3 did. It delays predicate
|
134
|
-
* evaluation until it reaches and accept state. This allows us to cache the SLL
|
135
|
-
* ATN simulation whereas, if we had evaluated predicates on-the-fly during
|
136
|
-
* closure, the DFA state configuration sets would be different and we couldn't
|
137
|
-
* build up a suitable DFA.</p>
|
138
|
-
*
|
139
|
-
* <p>
|
140
|
-
* When building a DFA accept state during ATN simulation, we evaluate any
|
141
|
-
* predicates and return the sole semantically valid alternative. If there is
|
142
|
-
* more than 1 alternative, we report an ambiguity. If there are 0 alternatives,
|
143
|
-
* we throw an exception. Alternatives without predicates act like they have
|
144
|
-
* true predicates. The simple way to think about it is to strip away all
|
145
|
-
* alternatives with false predicates and choose the minimum alternative that
|
146
|
-
* remains.</p>
|
147
|
-
*
|
148
|
-
* <p>
|
149
|
-
* When we start in the DFA and reach an accept state that's predicated, we test
|
150
|
-
* those and return the minimum semantically viable alternative. If no
|
151
|
-
* alternatives are viable, we throw an exception.</p>
|
152
|
-
*
|
153
|
-
* <p>
|
154
|
-
* During full LL ATN simulation, closure always evaluates predicates and
|
155
|
-
* on-the-fly. This is crucial to reducing the configuration set size during
|
156
|
-
* closure. It hits a landmine when parsing with the Java grammar, for example,
|
157
|
-
* without this on-the-fly evaluation.</p>
|
158
|
-
*
|
159
|
-
* <p>
|
160
|
-
* <strong>SHARING DFA</strong></p>
|
161
|
-
*
|
162
|
-
* <p>
|
163
|
-
* All instances of the same parser share the same decision DFAs through a
|
164
|
-
* static field. Each instance gets its own ATN simulator but they share the
|
165
|
-
* same {@link #decisionToDFA} field. They also share a
|
166
|
-
* {@link PredictionContextCache} object that makes sure that all
|
167
|
-
* {@link PredictionContext} objects are shared among the DFA states. This makes
|
168
|
-
* a big size difference.</p>
|
169
|
-
*
|
170
|
-
* <p>
|
171
|
-
* <strong>THREAD SAFETY</strong></p>
|
172
|
-
*
|
173
|
-
* <p>
|
174
|
-
* The {@link ParserATNSimulator} locks on the {@link #decisionToDFA} field when
|
175
|
-
* it adds a new DFA object to that array. {@link #addDFAEdge}
|
176
|
-
* locks on the DFA for the current decision when setting the
|
177
|
-
* {@link DFAState#edges} field. {@link #addDFAState} locks on
|
178
|
-
* the DFA for the current decision when looking up a DFA state to see if it
|
179
|
-
* already exists. We must make sure that all requests to add DFA states that
|
180
|
-
* are equivalent result in the same shared DFA object. This is because lots of
|
181
|
-
* threads will be trying to update the DFA at once. The
|
182
|
-
* {@link #addDFAState} method also locks inside the DFA lock
|
183
|
-
* but this time on the shared context cache when it rebuilds the
|
184
|
-
* configurations' {@link PredictionContext} objects using cached
|
185
|
-
* subgraphs/nodes. No other locking occurs, even during DFA simulation. This is
|
186
|
-
* safe as long as we can guarantee that all threads referencing
|
187
|
-
* {@code s.edge[t]} get the same physical target {@link DFAState}, or
|
188
|
-
* {@code null}. Once into the DFA, the DFA simulation does not reference the
|
189
|
-
* {@link DFA#states} map. It follows the {@link DFAState#edges} field to new
|
190
|
-
* targets. The DFA simulator will either find {@link DFAState#edges} to be
|
191
|
-
* {@code null}, to be non-{@code null} and {@code dfa.edges[t]} null, or
|
192
|
-
* {@code dfa.edges[t]} to be non-null. The
|
193
|
-
* {@link #addDFAEdge} method could be racing to set the field
|
194
|
-
* but in either case the DFA simulator works; if {@code null}, and requests ATN
|
195
|
-
* simulation. It could also race trying to get {@code dfa.edges[t]}, but either
|
196
|
-
* way it will work because it's not doing a test and set operation.</p>
|
197
|
-
*
|
198
|
-
* <p>
|
199
|
-
* <strong>Starting with SLL then failing to combined SLL/LL (Two-Stage
|
200
|
-
* Parsing)</strong></p>
|
201
|
-
*
|
202
|
-
* <p>
|
203
|
-
* Sam pointed out that if SLL does not give a syntax error, then there is no
|
204
|
-
* point in doing full LL, which is slower. We only have to try LL if we get a
|
205
|
-
* syntax error. For maximum speed, Sam starts the parser set to pure SLL
|
206
|
-
* mode with the {@link BailErrorStrategy}:</p>
|
207
|
-
*
|
208
|
-
* <pre>
|
209
|
-
* parser.{@link Parser#getInterpreter() getInterpreter()}.{@link #setPredictionMode setPredictionMode}{@code (}{@link PredictionMode#SLL}{@code )};
|
210
|
-
* parser.{@link Parser#setErrorHandler setErrorHandler}(new {@link BailErrorStrategy}());
|
211
|
-
* </pre>
|
212
|
-
*
|
213
|
-
* <p>
|
214
|
-
* If it does not get a syntax error, then we're done. If it does get a syntax
|
215
|
-
* error, we need to retry with the combined SLL/LL strategy.</p>
|
216
|
-
*
|
217
|
-
* <p>
|
218
|
-
* The reason this works is as follows. If there are no SLL conflicts, then the
|
219
|
-
* grammar is SLL (at least for that input set). If there is an SLL conflict,
|
220
|
-
* the full LL analysis must yield a set of viable alternatives which is a
|
221
|
-
* subset of the alternatives reported by SLL. If the LL set is a singleton,
|
222
|
-
* then the grammar is LL but not SLL. If the LL set is the same size as the SLL
|
223
|
-
* set, the decision is SLL. If the LL set has size > 1, then that decision
|
224
|
-
* is truly ambiguous on the current input. If the LL set is smaller, then the
|
225
|
-
* SLL conflict resolution might choose an alternative that the full LL would
|
226
|
-
* rule out as a possibility based upon better context information. If that's
|
227
|
-
* the case, then the SLL parse will definitely get an error because the full LL
|
228
|
-
* analysis says it's not viable. If SLL conflict resolution chooses an
|
229
|
-
* alternative within the LL set, them both SLL and LL would choose the same
|
230
|
-
* alternative because they both choose the minimum of multiple conflicting
|
231
|
-
* alternatives.</p>
|
232
|
-
*
|
233
|
-
* <p>
|
234
|
-
* Let's say we have a set of SLL conflicting alternatives {@code {1, 2, 3}} and
|
235
|
-
* a smaller LL set called <em>s</em>. If <em>s</em> is {@code {2, 3}}, then SLL
|
236
|
-
* parsing will get an error because SLL will pursue alternative 1. If
|
237
|
-
* <em>s</em> is {@code {1, 2}} or {@code {1, 3}} then both SLL and LL will
|
238
|
-
* choose the same alternative because alternative one is the minimum of either
|
239
|
-
* set. If <em>s</em> is {@code {2}} or {@code {3}} then SLL will get a syntax
|
240
|
-
* error. If <em>s</em> is {@code {1}} then SLL will succeed.</p>
|
241
|
-
*
|
242
|
-
* <p>
|
243
|
-
* Of course, if the input is invalid, then we will get an error for sure in
|
244
|
-
* both SLL and LL parsing. Erroneous input will therefore require 2 passes over
|
245
|
-
* the input.</p>
|
246
|
-
*/
|
247
|
-
class ANTLR4CPP_PUBLIC ParserATNSimulator : public ATNSimulator {
|
248
|
-
public:
|
249
|
-
/// Testing only!
|
250
|
-
ParserATNSimulator(const ATN &atn, std::vector<dfa::DFA> &decisionToDFA,
|
251
|
-
PredictionContextCache &sharedContextCache);
|
252
|
-
|
253
|
-
ParserATNSimulator(Parser *parser, const ATN &atn, std::vector<dfa::DFA> &decisionToDFA,
|
254
|
-
PredictionContextCache &sharedContextCache);
|
255
|
-
|
256
|
-
ParserATNSimulator(Parser *parser, const ATN &atn, std::vector<dfa::DFA> &decisionToDFA,
|
257
|
-
PredictionContextCache &sharedContextCache,
|
258
|
-
const ParserATNSimulatorOptions &options);
|
259
|
-
|
260
|
-
virtual void reset() override;
|
261
|
-
virtual void clearDFA() override;
|
262
|
-
virtual size_t adaptivePredict(TokenStream *input, size_t decision, ParserRuleContext *outerContext);
|
263
|
-
|
264
|
-
static const bool TURN_OFF_LR_LOOP_ENTRY_BRANCH_OPT;
|
265
|
-
|
266
|
-
std::vector<dfa::DFA> &decisionToDFA;
|
267
|
-
|
268
|
-
/** Implements first-edge (loop entry) elimination as an optimization
|
269
|
-
* during closure operations. See antlr/antlr4#1398.
|
270
|
-
*
|
271
|
-
* The optimization is to avoid adding the loop entry config when
|
272
|
-
* the exit path can only lead back to the same
|
273
|
-
* StarLoopEntryState after popping context at the rule end state
|
274
|
-
* (traversing only epsilon edges, so we're still in closure, in
|
275
|
-
* this same rule).
|
276
|
-
*
|
277
|
-
* We need to detect any state that can reach loop entry on
|
278
|
-
* epsilon w/o exiting rule. We don't have to look at FOLLOW
|
279
|
-
* links, just ensure that all stack tops for config refer to key
|
280
|
-
* states in LR rule.
|
281
|
-
*
|
282
|
-
* To verify we are in the right situation we must first check
|
283
|
-
* closure is at a StarLoopEntryState generated during LR removal.
|
284
|
-
* Then we check that each stack top of context is a return state
|
285
|
-
* from one of these cases:
|
286
|
-
*
|
287
|
-
* 1. 'not' expr, '(' type ')' expr. The return state points at loop entry state
|
288
|
-
* 2. expr op expr. The return state is the block end of internal block of (...)*
|
289
|
-
* 3. 'between' expr 'and' expr. The return state of 2nd expr reference.
|
290
|
-
* That state points at block end of internal block of (...)*.
|
291
|
-
* 4. expr '?' expr ':' expr. The return state points at block end,
|
292
|
-
* which points at loop entry state.
|
293
|
-
*
|
294
|
-
* If any is true for each stack top, then closure does not add a
|
295
|
-
* config to the current config set for edge[0], the loop entry branch.
|
296
|
-
*
|
297
|
-
* Conditions fail if any context for the current config is:
|
298
|
-
*
|
299
|
-
* a. empty (we'd fall out of expr to do a global FOLLOW which could
|
300
|
-
* even be to some weird spot in expr) or,
|
301
|
-
* b. lies outside of expr or,
|
302
|
-
* c. lies within expr but at a state not the BlockEndState
|
303
|
-
* generated during LR removal
|
304
|
-
*
|
305
|
-
* Do we need to evaluate predicates ever in closure for this case?
|
306
|
-
*
|
307
|
-
* No. Predicates, including precedence predicates, are only
|
308
|
-
* evaluated when computing a DFA start state. I.e., only before
|
309
|
-
* the lookahead (but not parser) consumes a token.
|
310
|
-
*
|
311
|
-
* There are no epsilon edges allowed in LR rule alt blocks or in
|
312
|
-
* the "primary" part (ID here). If closure is in
|
313
|
-
* StarLoopEntryState any lookahead operation will have consumed a
|
314
|
-
* token as there are no epsilon-paths that lead to
|
315
|
-
* StarLoopEntryState. We do not have to evaluate predicates
|
316
|
-
* therefore if we are in the generated StarLoopEntryState of a LR
|
317
|
-
* rule. Note that when making a prediction starting at that
|
318
|
-
* decision point, decision d=2, compute-start-state performs
|
319
|
-
* closure starting at edges[0], edges[1] emanating from
|
320
|
-
* StarLoopEntryState. That means it is not performing closure on
|
321
|
-
* StarLoopEntryState during compute-start-state.
|
322
|
-
*
|
323
|
-
* How do we know this always gives same prediction answer?
|
324
|
-
*
|
325
|
-
* Without predicates, loop entry and exit paths are ambiguous
|
326
|
-
* upon remaining input +b (in, say, a+b). Either paths lead to
|
327
|
-
* valid parses. Closure can lead to consuming + immediately or by
|
328
|
-
* falling out of this call to expr back into expr and loop back
|
329
|
-
* again to StarLoopEntryState to match +b. In this special case,
|
330
|
-
* we choose the more efficient path, which is to take the bypass
|
331
|
-
* path.
|
332
|
-
*
|
333
|
-
* The lookahead language has not changed because closure chooses
|
334
|
-
* one path over the other. Both paths lead to consuming the same
|
335
|
-
* remaining input during a lookahead operation. If the next token
|
336
|
-
* is an operator, lookahead will enter the choice block with
|
337
|
-
* operators. If it is not, lookahead will exit expr. Same as if
|
338
|
-
* closure had chosen to enter the choice block immediately.
|
339
|
-
*
|
340
|
-
* Closure is examining one config (some loopentrystate, some alt,
|
341
|
-
* context) which means it is considering exactly one alt. Closure
|
342
|
-
* always copies the same alt to any derived configs.
|
343
|
-
*
|
344
|
-
* How do we know this optimization doesn't mess up precedence in
|
345
|
-
* our parse trees?
|
346
|
-
*
|
347
|
-
* Looking through expr from left edge of stat only has to confirm
|
348
|
-
* that an input, say, a+b+c; begins with any valid interpretation
|
349
|
-
* of an expression. The precedence actually doesn't matter when
|
350
|
-
* making a decision in stat seeing through expr. It is only when
|
351
|
-
* parsing rule expr that we must use the precedence to get the
|
352
|
-
* right interpretation and, hence, parse tree.
|
353
|
-
*/
|
354
|
-
bool canDropLoopEntryEdgeInLeftRecursiveRule(ATNConfig *config) const;
|
355
|
-
virtual std::string getRuleName(size_t index);
|
356
|
-
|
357
|
-
virtual Ref<ATNConfig> precedenceTransition(Ref<ATNConfig> const& config, const PrecedencePredicateTransition *pt,
|
358
|
-
bool collectPredicates, bool inContext, bool fullCtx);
|
359
|
-
|
360
|
-
void setPredictionMode(PredictionMode newMode);
|
361
|
-
PredictionMode getPredictionMode();
|
362
|
-
|
363
|
-
Parser* getParser();
|
364
|
-
|
365
|
-
virtual std::string getTokenName(size_t t);
|
366
|
-
|
367
|
-
virtual std::string getLookaheadName(TokenStream *input);
|
368
|
-
|
369
|
-
/// <summary>
|
370
|
-
/// Used for debugging in adaptivePredict around execATN but I cut
|
371
|
-
/// it out for clarity now that alg. works well. We can leave this
|
372
|
-
/// "dead" code for a bit.
|
373
|
-
/// </summary>
|
374
|
-
virtual void dumpDeadEndConfigs(NoViableAltException &nvae);
|
375
|
-
|
376
|
-
protected:
|
377
|
-
Parser *const parser;
|
378
|
-
|
379
|
-
/// <summary>
|
380
|
-
/// Each prediction operation uses a cache for merge of prediction contexts.
|
381
|
-
/// Don't keep around as it wastes huge amounts of memory. The merge cache
|
382
|
-
/// isn't synchronized but we're ok since two threads shouldn't reuse same
|
383
|
-
/// parser/atnsim object because it can only handle one input at a time.
|
384
|
-
/// This maps graphs a and b to merged result c. (a,b)->c. We can avoid
|
385
|
-
/// the merge if we ever see a and b again. Note that (b,a)->c should
|
386
|
-
/// also be examined during cache lookup.
|
387
|
-
/// </summary>
|
388
|
-
PredictionContextMergeCache mergeCache;
|
389
|
-
size_t _mergeCacheCounter = 0;
|
390
|
-
|
391
|
-
// LAME globals to avoid parameters!!!!! I need these down deep in predTransition
|
392
|
-
TokenStream *_input;
|
393
|
-
size_t _startIndex;
|
394
|
-
ParserRuleContext *_outerContext;
|
395
|
-
dfa::DFA *_dfa; // Reference into the decisionToDFA vector.
|
396
|
-
|
397
|
-
/// <summary>
|
398
|
-
/// Performs ATN simulation to compute a predicted alternative based
|
399
|
-
/// upon the remaining input, but also updates the DFA cache to avoid
|
400
|
-
/// having to traverse the ATN again for the same input sequence.
|
401
|
-
///
|
402
|
-
/// There are some key conditions we're looking for after computing a new
|
403
|
-
/// set of ATN configs (proposed DFA state):
|
404
|
-
/// if the set is empty, there is no viable alternative for current symbol
|
405
|
-
/// does the state uniquely predict an alternative?
|
406
|
-
/// does the state have a conflict that would prevent us from
|
407
|
-
/// putting it on the work list?
|
408
|
-
///
|
409
|
-
/// We also have some key operations to do:
|
410
|
-
/// add an edge from previous DFA state to potentially new DFA state, D,
|
411
|
-
/// upon current symbol but only if adding to work list, which means in all
|
412
|
-
/// cases except no viable alternative (and possibly non-greedy decisions?)
|
413
|
-
/// collecting predicates and adding semantic context to DFA accept states
|
414
|
-
/// adding rule context to context-sensitive DFA accept states
|
415
|
-
/// consuming an input symbol
|
416
|
-
/// reporting a conflict
|
417
|
-
/// reporting an ambiguity
|
418
|
-
/// reporting a context sensitivity
|
419
|
-
/// reporting insufficient predicates
|
420
|
-
///
|
421
|
-
/// cover these cases:
|
422
|
-
/// dead end
|
423
|
-
/// single alt
|
424
|
-
/// single alt + preds
|
425
|
-
/// conflict
|
426
|
-
/// conflict + preds
|
427
|
-
/// </summary>
|
428
|
-
virtual size_t execATN(dfa::DFA &dfa, dfa::DFAState *s0, TokenStream *input, size_t startIndex,
|
429
|
-
ParserRuleContext *outerContext);
|
430
|
-
|
431
|
-
/// <summary>
|
432
|
-
/// Get an existing target state for an edge in the DFA. If the target state
|
433
|
-
/// for the edge has not yet been computed or is otherwise not available,
|
434
|
-
/// this method returns {@code null}.
|
435
|
-
/// </summary>
|
436
|
-
/// <param name="previousD"> The current DFA state </param>
|
437
|
-
/// <param name="t"> The next input symbol </param>
|
438
|
-
/// <returns> The existing target DFA state for the given input symbol
|
439
|
-
/// {@code t}, or {@code null} if the target state for this edge is not
|
440
|
-
/// already cached </returns>
|
441
|
-
virtual dfa::DFAState* getExistingTargetState(dfa::DFAState *previousD, size_t t);
|
442
|
-
|
443
|
-
/// <summary>
|
444
|
-
/// Compute a target state for an edge in the DFA, and attempt to add the
|
445
|
-
/// computed state and corresponding edge to the DFA.
|
446
|
-
/// </summary>
|
447
|
-
/// <param name="dfa"> The DFA </param>
|
448
|
-
/// <param name="previousD"> The current DFA state </param>
|
449
|
-
/// <param name="t"> The next input symbol
|
450
|
-
/// </param>
|
451
|
-
/// <returns> The computed target DFA state for the given input symbol
|
452
|
-
/// {@code t}. If {@code t} does not lead to a valid DFA state, this method
|
453
|
-
/// returns <seealso cref="#ERROR"/>. </returns>
|
454
|
-
virtual dfa::DFAState *computeTargetState(dfa::DFA &dfa, dfa::DFAState *previousD, size_t t);
|
455
|
-
|
456
|
-
virtual void predicateDFAState(dfa::DFAState *dfaState, DecisionState *decisionState);
|
457
|
-
|
458
|
-
// comes back with reach.uniqueAlt set to a valid alt
|
459
|
-
virtual size_t execATNWithFullContext(dfa::DFA &dfa, dfa::DFAState *D, ATNConfigSet *s0,
|
460
|
-
TokenStream *input, size_t startIndex, ParserRuleContext *outerContext); // how far we got before failing over
|
461
|
-
|
462
|
-
virtual std::unique_ptr<ATNConfigSet> computeReachSet(ATNConfigSet *closure, size_t t, bool fullCtx);
|
463
|
-
|
464
|
-
/// <summary>
|
465
|
-
/// Return a configuration set containing only the configurations from
|
466
|
-
/// {@code configs} which are in a <seealso cref="RuleStopState"/>. If all
|
467
|
-
/// configurations in {@code configs} are already in a rule stop state, this
|
468
|
-
/// method simply returns {@code configs}.
|
469
|
-
/// <p/>
|
470
|
-
/// When {@code lookToEndOfRule} is true, this method uses
|
471
|
-
/// <seealso cref="ATN#nextTokens"/> for each configuration in {@code configs} which is
|
472
|
-
/// not already in a rule stop state to see if a rule stop state is reachable
|
473
|
-
/// from the configuration via epsilon-only transitions.
|
474
|
-
/// </summary>
|
475
|
-
/// <param name="configs"> the configuration set to update </param>
|
476
|
-
/// <param name="lookToEndOfRule"> when true, this method checks for rule stop states
|
477
|
-
/// reachable by epsilon-only transitions from each configuration in
|
478
|
-
/// {@code configs}.
|
479
|
-
/// </param>
|
480
|
-
/// <returns> {@code configs} if all configurations in {@code configs} are in a
|
481
|
-
/// rule stop state, otherwise return a new configuration set containing only
|
482
|
-
/// the configurations from {@code configs} which are in a rule stop state </returns>
|
483
|
-
virtual ATNConfigSet* removeAllConfigsNotInRuleStopState(ATNConfigSet *configs, bool lookToEndOfRule);
|
484
|
-
|
485
|
-
virtual std::unique_ptr<ATNConfigSet> computeStartState(ATNState *p, RuleContext *ctx, bool fullCtx);
|
486
|
-
|
487
|
-
/* parrt internal source braindump that doesn't mess up
|
488
|
-
* external API spec.
|
489
|
-
|
490
|
-
applyPrecedenceFilter is an optimization to avoid highly
|
491
|
-
nonlinear prediction of expressions and other left recursive
|
492
|
-
rules. The precedence predicates such as {3>=prec}? Are highly
|
493
|
-
context-sensitive in that they can only be properly evaluated
|
494
|
-
in the context of the proper prec argument. Without pruning,
|
495
|
-
these predicates are normal predicates evaluated when we reach
|
496
|
-
conflict state (or unique prediction). As we cannot evaluate
|
497
|
-
these predicates out of context, the resulting conflict leads
|
498
|
-
to full LL evaluation and nonlinear prediction which shows up
|
499
|
-
very clearly with fairly large expressions.
|
500
|
-
|
501
|
-
Example grammar:
|
502
|
-
|
503
|
-
e : e '*' e
|
504
|
-
| e '+' e
|
505
|
-
| INT
|
506
|
-
;
|
507
|
-
|
508
|
-
We convert that to the following:
|
509
|
-
|
510
|
-
e[int prec]
|
511
|
-
: INT
|
512
|
-
( {3>=prec}? '*' e[4]
|
513
|
-
| {2>=prec}? '+' e[3]
|
514
|
-
)*
|
515
|
-
;
|
516
|
-
|
517
|
-
The (..)* loop has a decision for the inner block as well as
|
518
|
-
an enter or exit decision, which is what concerns us here. At
|
519
|
-
the 1st + of input 1+2+3, the loop entry sees both predicates
|
520
|
-
and the loop exit also sees both predicates by falling off the
|
521
|
-
edge of e. This is because we have no stack information with
|
522
|
-
SLL and find the follow of e, which will hit the return states
|
523
|
-
inside the loop after e[4] and e[3], which brings it back to
|
524
|
-
the enter or exit decision. In this case, we know that we
|
525
|
-
cannot evaluate those predicates because we have fallen off
|
526
|
-
the edge of the stack and will in general not know which prec
|
527
|
-
parameter is the right one to use in the predicate.
|
528
|
-
|
529
|
-
Because we have special information, that these are precedence
|
530
|
-
predicates, we can resolve them without failing over to full
|
531
|
-
LL despite their context sensitive nature. We make an
|
532
|
-
assumption that prec[-1] <= prec[0], meaning that the current
|
533
|
-
precedence level is greater than or equal to the precedence
|
534
|
-
level of recursive invocations above us in the stack. For
|
535
|
-
example, if predicate {3>=prec}? is true of the current prec,
|
536
|
-
then one option is to enter the loop to match it now. The
|
537
|
-
other option is to exit the loop and the left recursive rule
|
538
|
-
to match the current operator in rule invocation further up
|
539
|
-
the stack. But, we know that all of those prec are lower or
|
540
|
-
the same value and so we can decide to enter the loop instead
|
541
|
-
of matching it later. That means we can strip out the other
|
542
|
-
configuration for the exit branch.
|
543
|
-
|
544
|
-
So imagine we have (14,1,$,{2>=prec}?) and then
|
545
|
-
(14,2,$-dipsIntoOuterContext,{2>=prec}?). The optimization
|
546
|
-
allows us to collapse these two configurations. We know that
|
547
|
-
if {2>=prec}? is true for the current prec parameter, it will
|
548
|
-
also be true for any prec from an invoking e call, indicated
|
549
|
-
by dipsIntoOuterContext. As the predicates are both true, we
|
550
|
-
have the option to evaluate them early in the decision start
|
551
|
-
state. We do this by stripping both predicates and choosing to
|
552
|
-
enter the loop as it is consistent with the notion of operator
|
553
|
-
precedence. It's also how the full LL conflict resolution
|
554
|
-
would work.
|
555
|
-
|
556
|
-
The solution requires a different DFA start state for each
|
557
|
-
precedence level.
|
558
|
-
|
559
|
-
The basic filter mechanism is to remove configurations of the
|
560
|
-
form (p, 2, pi) if (p, 1, pi) exists for the same p and pi. In
|
561
|
-
other words, for the same ATN state and predicate context,
|
562
|
-
remove any configuration associated with an exit branch if
|
563
|
-
there is a configuration associated with the enter branch.
|
564
|
-
|
565
|
-
It's also the case that the filter evaluates precedence
|
566
|
-
predicates and resolves conflicts according to precedence
|
567
|
-
levels. For example, for input 1+2+3 at the first +, we see
|
568
|
-
prediction filtering
|
569
|
-
|
570
|
-
[(11,1,[$],{3>=prec}?), (14,1,[$],{2>=prec}?), (5,2,[$],up=1),
|
571
|
-
(11,2,[$],up=1), (14,2,[$],up=1)],hasSemanticContext=true,dipsIntoOuterContext
|
572
|
-
|
573
|
-
to
|
574
|
-
|
575
|
-
[(11,1,[$]), (14,1,[$]), (5,2,[$],up=1)],dipsIntoOuterContext
|
576
|
-
|
577
|
-
This filters because {3>=prec}? evals to true and collapses
|
578
|
-
(11,1,[$],{3>=prec}?) and (11,2,[$],up=1) since early conflict
|
579
|
-
resolution based upon rules of operator precedence fits with
|
580
|
-
our usual match first alt upon conflict.
|
581
|
-
|
582
|
-
We noticed a problem where a recursive call resets precedence
|
583
|
-
to 0. Sam's fix: each config has flag indicating if it has
|
584
|
-
returned from an expr[0] call. then just don't filter any
|
585
|
-
config with that flag set. flag is carried along in
|
586
|
-
closure(). so to avoid adding field, set bit just under sign
|
587
|
-
bit of dipsIntoOuterContext (SUPPRESS_PRECEDENCE_FILTER).
|
588
|
-
With the change you filter "unless (p, 2, pi) was reached
|
589
|
-
after leaving the rule stop state of the LR rule containing
|
590
|
-
state p, corresponding to a rule invocation with precedence
|
591
|
-
level 0"
|
592
|
-
*/
|
593
|
-
|
594
|
-
/**
|
595
|
-
* This method transforms the start state computed by
|
596
|
-
* {@link #computeStartState} to the special start state used by a
|
597
|
-
* precedence DFA for a particular precedence value. The transformation
|
598
|
-
* process applies the following changes to the start state's configuration
|
599
|
-
* set.
|
600
|
-
*
|
601
|
-
* <ol>
|
602
|
-
* <li>Evaluate the precedence predicates for each configuration using
|
603
|
-
* {@link SemanticContext#evalPrecedence}.</li>
|
604
|
-
* <li>When {@link ATNConfig#isPrecedenceFilterSuppressed} is {@code false},
|
605
|
-
* remove all configurations which predict an alternative greater than 1,
|
606
|
-
* for which another configuration that predicts alternative 1 is in the
|
607
|
-
* same ATN state with the same prediction context. This transformation is
|
608
|
-
* valid for the following reasons:
|
609
|
-
* <ul>
|
610
|
-
* <li>The closure block cannot contain any epsilon transitions which bypass
|
611
|
-
* the body of the closure, so all states reachable via alternative 1 are
|
612
|
-
* part of the precedence alternatives of the transformed left-recursive
|
613
|
-
* rule.</li>
|
614
|
-
* <li>The "primary" portion of a left recursive rule cannot contain an
|
615
|
-
* epsilon transition, so the only way an alternative other than 1 can exist
|
616
|
-
* in a state that is also reachable via alternative 1 is by nesting calls
|
617
|
-
* to the left-recursive rule, with the outer calls not being at the
|
618
|
-
* preferred precedence level. The
|
619
|
-
* {@link ATNConfig#isPrecedenceFilterSuppressed} property marks ATN
|
620
|
-
* configurations which do not meet this condition, and therefore are not
|
621
|
-
* eligible for elimination during the filtering process.</li>
|
622
|
-
* </ul>
|
623
|
-
* </li>
|
624
|
-
* </ol>
|
625
|
-
*
|
626
|
-
* <p>
|
627
|
-
* The prediction context must be considered by this filter to address
|
628
|
-
* situations like the following.
|
629
|
-
* </p>
|
630
|
-
* <code>
|
631
|
-
* <pre>
|
632
|
-
* grammar TA;
|
633
|
-
* prog: statement* EOF;
|
634
|
-
* statement: letterA | statement letterA 'b' ;
|
635
|
-
* letterA: 'a';
|
636
|
-
* </pre>
|
637
|
-
* </code>
|
638
|
-
* <p>
|
639
|
-
* If the above grammar, the ATN state immediately before the token
|
640
|
-
* reference {@code 'a'} in {@code letterA} is reachable from the left edge
|
641
|
-
* of both the primary and closure blocks of the left-recursive rule
|
642
|
-
* {@code statement}. The prediction context associated with each of these
|
643
|
-
* configurations distinguishes between them, and prevents the alternative
|
644
|
-
* which stepped out to {@code prog} (and then back in to {@code statement}
|
645
|
-
* from being eliminated by the filter.
|
646
|
-
* </p>
|
647
|
-
*
|
648
|
-
* @param configs The configuration set computed by
|
649
|
-
* {@link #computeStartState} as the start state for the DFA.
|
650
|
-
* @return The transformed configuration set representing the start state
|
651
|
-
* for a precedence DFA at a particular precedence level (determined by
|
652
|
-
* calling {@link Parser#getPrecedence}).
|
653
|
-
*/
|
654
|
-
std::unique_ptr<ATNConfigSet> applyPrecedenceFilter(ATNConfigSet *configs);
|
655
|
-
|
656
|
-
virtual ATNState *getReachableTarget(const Transition *trans, size_t ttype);
|
657
|
-
|
658
|
-
virtual std::vector<Ref<const SemanticContext>> getPredsForAmbigAlts(const antlrcpp::BitSet &ambigAlts,
|
659
|
-
ATNConfigSet *configs, size_t nalts);
|
660
|
-
|
661
|
-
std::vector<dfa::DFAState::PredPrediction> getPredicatePredictions(const antlrcpp::BitSet &ambigAlts,
|
662
|
-
const std::vector<Ref<const SemanticContext>> &altToPred);
|
663
|
-
|
664
|
-
/**
|
665
|
-
* This method is used to improve the localization of error messages by
|
666
|
-
* choosing an alternative rather than throwing a
|
667
|
-
* {@link NoViableAltException} in particular prediction scenarios where the
|
668
|
-
* {@link #ERROR} state was reached during ATN simulation.
|
669
|
-
*
|
670
|
-
* <p>
|
671
|
-
* The default implementation of this method uses the following
|
672
|
-
* algorithm to identify an ATN configuration which successfully parsed the
|
673
|
-
* decision entry rule. Choosing such an alternative ensures that the
|
674
|
-
* {@link ParserRuleContext} returned by the calling rule will be complete
|
675
|
-
* and valid, and the syntax error will be reported later at a more
|
676
|
-
* localized location.</p>
|
677
|
-
*
|
678
|
-
* <ul>
|
679
|
-
* <li>If a syntactically valid path or paths reach the end of the decision rule and
|
680
|
-
* they are semantically valid if predicated, return the min associated alt.</li>
|
681
|
-
* <li>Else, if a semantically invalid but syntactically valid path exist
|
682
|
-
* or paths exist, return the minimum associated alt.
|
683
|
-
* </li>
|
684
|
-
* <li>Otherwise, return {@link ATN#INVALID_ALT_NUMBER}.</li>
|
685
|
-
* </ul>
|
686
|
-
*
|
687
|
-
* <p>
|
688
|
-
* In some scenarios, the algorithm described above could predict an
|
689
|
-
* alternative which will result in a {@link FailedPredicateException} in
|
690
|
-
* the parser. Specifically, this could occur if the <em>only</em> configuration
|
691
|
-
* capable of successfully parsing to the end of the decision rule is
|
692
|
-
* blocked by a semantic predicate. By choosing this alternative within
|
693
|
-
* {@link #adaptivePredict} instead of throwing a
|
694
|
-
* {@link NoViableAltException}, the resulting
|
695
|
-
* {@link FailedPredicateException} in the parser will identify the specific
|
696
|
-
* predicate which is preventing the parser from successfully parsing the
|
697
|
-
* decision rule, which helps developers identify and correct logic errors
|
698
|
-
* in semantic predicates.
|
699
|
-
* </p>
|
700
|
-
*
|
701
|
-
* @param configs The ATN configurations which were valid immediately before
|
702
|
-
* the {@link #ERROR} state was reached
|
703
|
-
* @param outerContext The is the \gamma_0 initial parser context from the paper
|
704
|
-
* or the parser stack at the instant before prediction commences.
|
705
|
-
*
|
706
|
-
* @return The value to return from {@link #adaptivePredict}, or
|
707
|
-
* {@link ATN#INVALID_ALT_NUMBER} if a suitable alternative was not
|
708
|
-
* identified and {@link #adaptivePredict} should report an error instead.
|
709
|
-
*/
|
710
|
-
size_t getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(ATNConfigSet *configs,
|
711
|
-
ParserRuleContext *outerContext);
|
712
|
-
|
713
|
-
virtual size_t getAltThatFinishedDecisionEntryRule(ATNConfigSet *configs);
|
714
|
-
|
715
|
-
/** Walk the list of configurations and split them according to
|
716
|
-
* those that have preds evaluating to true/false. If no pred, assume
|
717
|
-
* true pred and include in succeeded set. Returns Pair of sets.
|
718
|
-
*
|
719
|
-
* Create a new set so as not to alter the incoming parameter.
|
720
|
-
*
|
721
|
-
* Assumption: the input stream has been restored to the starting point
|
722
|
-
* prediction, which is where predicates need to evaluate.
|
723
|
-
*/
|
724
|
-
std::pair<ATNConfigSet *, ATNConfigSet *> splitAccordingToSemanticValidity(ATNConfigSet *configs,
|
725
|
-
ParserRuleContext *outerContext);
|
726
|
-
|
727
|
-
/// <summary>
|
728
|
-
/// Look through a list of predicate/alt pairs, returning alts for the
|
729
|
-
/// pairs that win. A {@code NONE} predicate indicates an alt containing an
|
730
|
-
/// unpredicated config which behaves as "always true." If !complete
|
731
|
-
/// then we stop at the first predicate that evaluates to true. This
|
732
|
-
/// includes pairs with null predicates.
|
733
|
-
/// </summary>
|
734
|
-
antlrcpp::BitSet evalSemanticContext(const std::vector<dfa::DFAState::PredPrediction> &predPredictions,
|
735
|
-
ParserRuleContext *outerContext, bool complete);
|
736
|
-
|
737
|
-
/**
|
738
|
-
* Evaluate a semantic context within a specific parser context.
|
739
|
-
*
|
740
|
-
* <p>
|
741
|
-
* This method might not be called for every semantic context evaluated
|
742
|
-
* during the prediction process. In particular, we currently do not
|
743
|
-
* evaluate the following but it may change in the future:</p>
|
744
|
-
*
|
745
|
-
* <ul>
|
746
|
-
* <li>Precedence predicates (represented by
|
747
|
-
* {@link SemanticContext.PrecedencePredicate}) are not currently evaluated
|
748
|
-
* through this method.</li>
|
749
|
-
* <li>Operator predicates (represented by {@link SemanticContext.AND} and
|
750
|
-
* {@link SemanticContext.OR}) are evaluated as a single semantic
|
751
|
-
* context, rather than evaluating the operands individually.
|
752
|
-
* Implementations which require evaluation results from individual
|
753
|
-
* predicates should override this method to explicitly handle evaluation of
|
754
|
-
* the operands within operator predicates.</li>
|
755
|
-
* </ul>
|
756
|
-
*
|
757
|
-
* @param pred The semantic context to evaluate
|
758
|
-
* @param parserCallStack The parser context in which to evaluate the
|
759
|
-
* semantic context
|
760
|
-
* @param alt The alternative which is guarded by {@code pred}
|
761
|
-
* @param fullCtx {@code true} if the evaluation is occurring during LL
|
762
|
-
* prediction; otherwise, {@code false} if the evaluation is occurring
|
763
|
-
* during SLL prediction
|
764
|
-
*
|
765
|
-
* @since 4.3
|
766
|
-
*/
|
767
|
-
virtual bool evalSemanticContext(Ref<const SemanticContext> const& pred, ParserRuleContext *parserCallStack,
|
768
|
-
size_t alt, bool fullCtx);
|
769
|
-
|
770
|
-
/* TODO: If we are doing predicates, there is no point in pursuing
|
771
|
-
closure operations if we reach a DFA state that uniquely predicts
|
772
|
-
alternative. We will not be caching that DFA state and it is a
|
773
|
-
waste to pursue the closure. Might have to advance when we do
|
774
|
-
ambig detection thought :(
|
775
|
-
*/
|
776
|
-
virtual void closure(Ref<ATNConfig> const& config, ATNConfigSet *configs, ATNConfig::Set &closureBusy,
|
777
|
-
bool collectPredicates, bool fullCtx, bool treatEofAsEpsilon);
|
778
|
-
|
779
|
-
virtual void closureCheckingStopState(Ref<ATNConfig> const& config, ATNConfigSet *configs, ATNConfig::Set &closureBusy,
|
780
|
-
bool collectPredicates, bool fullCtx, int depth, bool treatEofAsEpsilon);
|
781
|
-
|
782
|
-
/// Do the actual work of walking epsilon edges.
|
783
|
-
virtual void closure_(Ref<ATNConfig> const& config, ATNConfigSet *configs, ATNConfig::Set &closureBusy,
|
784
|
-
bool collectPredicates, bool fullCtx, int depth, bool treatEofAsEpsilon);
|
785
|
-
|
786
|
-
virtual Ref<ATNConfig> getEpsilonTarget(Ref<ATNConfig> const& config, const Transition *t, bool collectPredicates,
|
787
|
-
bool inContext, bool fullCtx, bool treatEofAsEpsilon);
|
788
|
-
virtual Ref<ATNConfig> actionTransition(Ref<ATNConfig> const& config, const ActionTransition *t);
|
789
|
-
|
790
|
-
virtual Ref<ATNConfig> predTransition(Ref<ATNConfig> const& config, const PredicateTransition *pt, bool collectPredicates,
|
791
|
-
bool inContext, bool fullCtx);
|
792
|
-
|
793
|
-
virtual Ref<ATNConfig> ruleTransition(Ref<ATNConfig> const& config, const RuleTransition *t);
|
794
|
-
|
795
|
-
/**
|
796
|
-
* Gets a {@link BitSet} containing the alternatives in {@code configs}
|
797
|
-
* which are part of one or more conflicting alternative subsets.
|
798
|
-
*
|
799
|
-
* @param configs The {@link ATNConfigSet} to analyze.
|
800
|
-
* @return The alternatives in {@code configs} which are part of one or more
|
801
|
-
* conflicting alternative subsets. If {@code configs} does not contain any
|
802
|
-
* conflicting subsets, this method returns an empty {@link BitSet}.
|
803
|
-
*/
|
804
|
-
virtual antlrcpp::BitSet getConflictingAlts(ATNConfigSet *configs);
|
805
|
-
|
806
|
-
/// <summary>
|
807
|
-
/// Sam pointed out a problem with the previous definition, v3, of
|
808
|
-
/// ambiguous states. If we have another state associated with conflicting
|
809
|
-
/// alternatives, we should keep going. For example, the following grammar
|
810
|
-
///
|
811
|
-
/// s : (ID | ID ID?) ';' ;
|
812
|
-
///
|
813
|
-
/// When the ATN simulation reaches the state before ';', it has a DFA
|
814
|
-
/// state that looks like: [12|1|[], 6|2|[], 12|2|[]]. Naturally
|
815
|
-
/// 12|1|[] and 12|2|[] conflict, but we cannot stop processing this node
|
816
|
-
/// because alternative to has another way to continue, via [6|2|[]].
|
817
|
-
/// The key is that we have a single state that has config's only associated
|
818
|
-
/// with a single alternative, 2, and crucially the state transitions
|
819
|
-
/// among the configurations are all non-epsilon transitions. That means
|
820
|
-
/// we don't consider any conflicts that include alternative 2. So, we
|
821
|
-
/// ignore the conflict between alts 1 and 2. We ignore a set of
|
822
|
-
/// conflicting alts when there is an intersection with an alternative
|
823
|
-
/// associated with a single alt state in the state->config-list map.
|
824
|
-
///
|
825
|
-
/// It's also the case that we might have two conflicting configurations but
|
826
|
-
/// also a 3rd nonconflicting configuration for a different alternative:
|
827
|
-
/// [1|1|[], 1|2|[], 8|3|[]]. This can come about from grammar:
|
828
|
-
///
|
829
|
-
/// a : A | A | A B ;
|
830
|
-
///
|
831
|
-
/// After matching input A, we reach the stop state for rule A, state 1.
|
832
|
-
/// State 8 is the state right before B. Clearly alternatives 1 and 2
|
833
|
-
/// conflict and no amount of further lookahead will separate the two.
|
834
|
-
/// However, alternative 3 will be able to continue and so we do not
|
835
|
-
/// stop working on this state. In the previous example, we're concerned
|
836
|
-
/// with states associated with the conflicting alternatives. Here alt
|
837
|
-
/// 3 is not associated with the conflicting configs, but since we can continue
|
838
|
-
/// looking for input reasonably, I don't declare the state done. We
|
839
|
-
/// ignore a set of conflicting alts when we have an alternative
|
840
|
-
/// that we still need to pursue.
|
841
|
-
/// </summary>
|
842
|
-
|
843
|
-
virtual antlrcpp::BitSet getConflictingAltsOrUniqueAlt(ATNConfigSet *configs);
|
844
|
-
|
845
|
-
virtual NoViableAltException noViableAlt(TokenStream *input, ParserRuleContext *outerContext,
|
846
|
-
ATNConfigSet *configs, size_t startIndex, bool deleteConfigs);
|
847
|
-
|
848
|
-
static size_t getUniqueAlt(ATNConfigSet *configs);
|
849
|
-
|
850
|
-
/// <summary>
|
851
|
-
/// Add an edge to the DFA, if possible. This method calls
|
852
|
-
/// <seealso cref="#addDFAState"/> to ensure the {@code to} state is present in the
|
853
|
-
/// DFA. If {@code from} is {@code null}, or if {@code t} is outside the
|
854
|
-
/// range of edges that can be represented in the DFA tables, this method
|
855
|
-
/// returns without adding the edge to the DFA.
|
856
|
-
/// <p/>
|
857
|
-
/// If {@code to} is {@code null}, this method returns {@code null}.
|
858
|
-
/// Otherwise, this method returns the <seealso cref="DFAState"/> returned by calling
|
859
|
-
/// <seealso cref="#addDFAState"/> for the {@code to} state.
|
860
|
-
/// </summary>
|
861
|
-
/// <param name="dfa"> The DFA </param>
|
862
|
-
/// <param name="from"> The source state for the edge </param>
|
863
|
-
/// <param name="t"> The input symbol </param>
|
864
|
-
/// <param name="to"> The target state for the edge
|
865
|
-
/// </param>
|
866
|
-
/// <returns> If {@code to} is {@code null}, this method returns {@code null};
|
867
|
-
/// otherwise this method returns the result of calling <seealso cref="#addDFAState"/>
|
868
|
-
/// on {@code to} </returns>
|
869
|
-
virtual dfa::DFAState *addDFAEdge(dfa::DFA &dfa, dfa::DFAState *from, ssize_t t, dfa::DFAState *to);
|
870
|
-
|
871
|
-
/// <summary>
|
872
|
-
/// Add state {@code D} to the DFA if it is not already present, and return
|
873
|
-
/// the actual instance stored in the DFA. If a state equivalent to {@code D}
|
874
|
-
/// is already in the DFA, the existing state is returned. Otherwise this
|
875
|
-
/// method returns {@code D} after adding it to the DFA.
|
876
|
-
/// <p/>
|
877
|
-
/// If {@code D} is <seealso cref="#ERROR"/>, this method returns <seealso cref="#ERROR"/> and
|
878
|
-
/// does not change the DFA.
|
879
|
-
/// </summary>
|
880
|
-
/// <param name="dfa"> The dfa </param>
|
881
|
-
/// <param name="D"> The DFA state to add </param>
|
882
|
-
/// <returns> The state stored in the DFA. This will be either the existing
|
883
|
-
/// state if {@code D} is already in the DFA, or {@code D} itself if the
|
884
|
-
/// state was not already present. </returns>
|
885
|
-
virtual dfa::DFAState *addDFAState(dfa::DFA &dfa, dfa::DFAState *D);
|
886
|
-
|
887
|
-
virtual void reportAttemptingFullContext(dfa::DFA &dfa, const antlrcpp::BitSet &conflictingAlts,
|
888
|
-
ATNConfigSet *configs, size_t startIndex, size_t stopIndex);
|
889
|
-
|
890
|
-
virtual void reportContextSensitivity(dfa::DFA &dfa, size_t prediction, ATNConfigSet *configs,
|
891
|
-
size_t startIndex, size_t stopIndex);
|
892
|
-
|
893
|
-
/// If context sensitive parsing, we know it's ambiguity not conflict.
|
894
|
-
virtual void reportAmbiguity(dfa::DFA &dfa,
|
895
|
-
dfa::DFAState *D, // the DFA state from execATN() that had SLL conflicts
|
896
|
-
size_t startIndex, size_t stopIndex,
|
897
|
-
bool exact,
|
898
|
-
const antlrcpp::BitSet &ambigAlts,
|
899
|
-
ATNConfigSet *configs); // configs that LL not SLL considered conflicting
|
900
|
-
|
901
|
-
private:
|
902
|
-
// SLL, LL, or LL + exact ambig detection?
|
903
|
-
PredictionMode _mode;
|
904
|
-
|
905
|
-
static bool getLrLoopSetting();
|
906
|
-
void InitializeInstanceFields();
|
907
|
-
};
|
908
|
-
|
909
|
-
} // namespace atn
|
910
|
-
} // namespace antlr4
|
911
|
-
|