@cparra/apex-reflection 0.1.0-alpha.0 → 0.1.1-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/end-to-end.test.ts +256 -0
- package/coverage/clover.xml +12857 -0
- package/coverage/coverage-final.json +3 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +79 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +126 -0
- package/coverage/lcov-report/index.js.html +104 -0
- package/coverage/lcov-report/out.js.html +41126 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +170 -0
- package/coverage/lcov.info +24801 -0
- package/index.d.ts +118 -0
- package/index.js +8 -0
- package/index.ts +141 -0
- package/jest.config.js +11 -0
- package/out.js +13708 -0
- package/package.json +22 -17
- package/tsconfig.json +5 -3
- package/.idea/apexdocs-dart.iml +0 -18
- package/.idea/jsLibraryMappings.xml +0 -6
- package/.idea/libraries/Dart_Packages.xml +0 -556
- package/.idea/libraries/Dart_SDK.xml +0 -28
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/runConfigurations/_template__of_Dart_Test.xml +0 -6
- package/.idea/vcs.xml +0 -6
- package/CHANGELOG.md +0 -3
- package/README.md +0 -26
- package/TODO.md +0 -5
- package/analysis_options.yaml +0 -30
- package/antlr4-4.9.2/CHANGELOG.md +0 -4
- package/antlr4-4.9.2/LICENSE +0 -52
- package/antlr4-4.9.2/README.md +0 -11
- package/antlr4-4.9.2/analysis_options.yaml +0 -1
- package/antlr4-4.9.2/lib/antlr4.dart +0 -21
- package/antlr4-4.9.2/lib/src/atn/atn.dart +0 -18
- package/antlr4-4.9.2/lib/src/atn/src/atn.dart +0 -170
- package/antlr4-4.9.2/lib/src/atn/src/atn_config.dart +0 -242
- package/antlr4-4.9.2/lib/src/atn/src/atn_config_set.dart +0 -283
- package/antlr4-4.9.2/lib/src/atn/src/atn_deserializer.dart +0 -809
- package/antlr4-4.9.2/lib/src/atn/src/atn_simulator.dart +0 -95
- package/antlr4-4.9.2/lib/src/atn/src/atn_state.dart +0 -296
- package/antlr4-4.9.2/lib/src/atn/src/atn_type.dart +0 -14
- package/antlr4-4.9.2/lib/src/atn/src/info.dart +0 -553
- package/antlr4-4.9.2/lib/src/atn/src/lexer_action.dart +0 -601
- package/antlr4-4.9.2/lib/src/atn/src/lexer_action_executor.dart +0 -167
- package/antlr4-4.9.2/lib/src/atn/src/lexer_atn_simulator.dart +0 -731
- package/antlr4-4.9.2/lib/src/atn/src/parser_atn_simulator.dart +0 -2630
- package/antlr4-4.9.2/lib/src/atn/src/profiling_atn_simulator.dart +0 -229
- package/antlr4-4.9.2/lib/src/atn/src/semantic_context.dart +0 -404
- package/antlr4-4.9.2/lib/src/atn/src/transition.dart +0 -305
- package/antlr4-4.9.2/lib/src/dfa/dfa.dart +0 -8
- package/antlr4-4.9.2/lib/src/dfa/src/dfa.dart +0 -138
- package/antlr4-4.9.2/lib/src/dfa/src/dfa_serializer.dart +0 -76
- package/antlr4-4.9.2/lib/src/dfa/src/dfa_state.dart +0 -151
- package/antlr4-4.9.2/lib/src/error/error.dart +0 -10
- package/antlr4-4.9.2/lib/src/error/src/diagnostic_error_listener.dart +0 -116
- package/antlr4-4.9.2/lib/src/error/src/error_listener.dart +0 -241
- package/antlr4-4.9.2/lib/src/error/src/error_strategy.dart +0 -902
- package/antlr4-4.9.2/lib/src/error/src/errors.dart +0 -204
- package/antlr4-4.9.2/lib/src/input_stream.dart +0 -335
- package/antlr4-4.9.2/lib/src/interval_set.dart +0 -735
- package/antlr4-4.9.2/lib/src/lexer.dart +0 -343
- package/antlr4-4.9.2/lib/src/ll1_analyzer.dart +0 -204
- package/antlr4-4.9.2/lib/src/misc/multi_map.dart +0 -32
- package/antlr4-4.9.2/lib/src/misc/pair.dart +0 -34
- package/antlr4-4.9.2/lib/src/parser.dart +0 -777
- package/antlr4-4.9.2/lib/src/parser_interpreter.dart +0 -393
- package/antlr4-4.9.2/lib/src/parser_rule_context.dart +0 -275
- package/antlr4-4.9.2/lib/src/prediction_context.dart +0 -877
- package/antlr4-4.9.2/lib/src/recognizer.dart +0 -182
- package/antlr4-4.9.2/lib/src/rule_context.dart +0 -192
- package/antlr4-4.9.2/lib/src/runtime_meta_data.dart +0 -188
- package/antlr4-4.9.2/lib/src/token.dart +0 -431
- package/antlr4-4.9.2/lib/src/token_factory.dart +0 -88
- package/antlr4-4.9.2/lib/src/token_source.dart +0 -241
- package/antlr4-4.9.2/lib/src/token_stream.dart +0 -627
- package/antlr4-4.9.2/lib/src/tree/src/pattern/chunk.dart +0 -90
- package/antlr4-4.9.2/lib/src/tree/src/pattern/parse_tree_match.dart +0 -635
- package/antlr4-4.9.2/lib/src/tree/src/tree.dart +0 -370
- package/antlr4-4.9.2/lib/src/tree/src/trees.dart +0 -226
- package/antlr4-4.9.2/lib/src/tree/tree.dart +0 -10
- package/antlr4-4.9.2/lib/src/util/bit_set.dart +0 -308
- package/antlr4-4.9.2/lib/src/util/murmur_hash.dart +0 -77
- package/antlr4-4.9.2/lib/src/util/utils.dart +0 -31
- package/antlr4-4.9.2/lib/src/vocabulary.dart +0 -254
- package/antlr4-4.9.2/pubspec.yaml +0 -13
- package/example/node_example/index.js +0 -8
- package/example/node_example/package.json +0 -12
- package/example/node_example_ts/package-lock.json +0 -70
- package/example/node_example_ts/package.json +0 -19
- package/example/node_example_ts/src/index.js +0 -5
- package/example/node_example_ts/src/index.ts +0 -9
- package/example/node_example_ts/tsconfig.json +0 -79
- package/js/dart2jsout.js +0 -25898
- package/js/dart2jsout.js.map +0 -16
- package/js/index.d.ts +0 -1
- package/js/index.js +0 -4
- package/js/out.js +0 -26023
- package/js/out.js.map +0 -16
- package/js/package-lock.json +0 -57
- package/js/preamble.js +0 -125
- package/lib/apexdocs_dart.dart +0 -28
- package/lib/src/antlr/grammars/Apexdoc/ApexdocLexer.g4 +0 -120
- package/lib/src/antlr/grammars/Apexdoc/ApexdocParser.g4 +0 -158
- package/lib/src/antlr/grammars/Apexdoc/gen/ApexdocLexer.interp +0 -95
- package/lib/src/antlr/grammars/Apexdoc/gen/ApexdocLexer.java +0 -238
- package/lib/src/antlr/grammars/Apexdoc/gen/ApexdocLexer.tokens +0 -23
- package/lib/src/antlr/grammars/apex/ApexLexer.g4 +0 -255
- package/lib/src/antlr/grammars/apex/ApexParser.g4 +0 -567
- package/lib/src/antlr/grammars/apex/examples/ApexClass.cls +0 -6
- package/lib/src/antlr/lib/apex/ApexLexer.dart +0 -1223
- package/lib/src/antlr/lib/apex/ApexLexer.interp +0 -393
- package/lib/src/antlr/lib/apex/ApexLexer.tokens +0 -212
- package/lib/src/antlr/lib/apex/ApexParser.dart +0 -9349
- package/lib/src/antlr/lib/apex/ApexParser.interp +0 -326
- package/lib/src/antlr/lib/apex/ApexParser.tokens +0 -212
- package/lib/src/antlr/lib/apex/ApexParserBaseListener.dart +0 -1036
- package/lib/src/antlr/lib/apex/ApexParserListener.dart +0 -975
- package/lib/src/antlr/lib/apexdoc/ApexdocLexer.dart +0 -373
- package/lib/src/antlr/lib/apexdoc/ApexdocLexer.interp +0 -95
- package/lib/src/antlr/lib/apexdoc/ApexdocLexer.tokens +0 -23
- package/lib/src/antlr/lib/apexdoc/ApexdocParser.dart +0 -2471
- package/lib/src/antlr/lib/apexdoc/ApexdocParser.interp +0 -69
- package/lib/src/antlr/lib/apexdoc/ApexdocParser.tokens +0 -23
- package/lib/src/antlr/lib/apexdoc/ApexdocParserBaseListener.dart +0 -252
- package/lib/src/antlr/lib/apexdoc/ApexdocParserListener.dart +0 -215
- package/lib/src/builders/builders.dart +0 -32
- package/lib/src/model/apex_file_manifest.dart +0 -37
- package/lib/src/model/apex_file_manifest.g.dart +0 -18
- package/lib/src/model/declaration.dart +0 -50
- package/lib/src/model/doc_comment.dart +0 -117
- package/lib/src/model/doc_comment.g.dart +0 -118
- package/lib/src/model/members.dart +0 -143
- package/lib/src/model/members.g.dart +0 -105
- package/lib/src/model/types.dart +0 -159
- package/lib/src/model/types.g.dart +0 -111
- package/lib/src/service/apex_listener.dart +0 -226
- package/lib/src/service/apexdoc_listener.dart +0 -82
- package/lib/src/service/parsers.dart +0 -33
- package/lib/src/service/utils/parsing/access_modifiers_parser.dart +0 -33
- package/lib/src/service/utils/parsing/parameters_parser.dart +0 -18
- package/lib/src/service/utils/parsing/parsing_utils.dart +0 -2
- package/lib/src/service/walker.dart +0 -82
- package/pubspec.yaml +0 -19
- package/test/apex_file_manifest_test.dart +0 -16
- package/test/apex_listener_test.dart +0 -703
- package/test/apexdoc_parser_test.dart +0 -179
- package/test/doc_comment_test.dart +0 -89
- package/test/members_serialization_test.dart +0 -158
- package/test/members_test.dart +0 -178
- package/test/types_serialization_test.dart +0 -191
- package/test/types_test.dart +0 -311
- package/test/walker_test.dart +0 -58
- package/tool/grind.dart +0 -20
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
|
3
|
-
* Use of this file is governed by the BSD 3-clause license that
|
|
4
|
-
* can be found in the LICENSE.txt file in the project root.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import '../../atn/atn.dart';
|
|
8
|
-
import '../../dfa/dfa.dart';
|
|
9
|
-
import '../../interval_set.dart';
|
|
10
|
-
import '../../parser.dart';
|
|
11
|
-
import '../../util/bit_set.dart';
|
|
12
|
-
import 'error_listener.dart';
|
|
13
|
-
|
|
14
|
-
/// This implementation of [ANTLRErrorListener] can be used to identify
|
|
15
|
-
/// certain potential correctness and performance problems in grammars. "Reports"
|
|
16
|
-
/// are made by calling {@link Parser#notifyErrorListeners} with the appropriate
|
|
17
|
-
/// message.
|
|
18
|
-
///
|
|
19
|
-
/// <ul>
|
|
20
|
-
/// <li><b>Ambiguities</b>: These are cases where more than one path through the
|
|
21
|
-
/// grammar can match the input.</li>
|
|
22
|
-
/// <li><b>Weak context sensitivity</b>: These are cases where full-context
|
|
23
|
-
/// prediction resolved an SLL conflict to a unique alternative which equaled the
|
|
24
|
-
/// minimum alternative of the SLL conflict.</li>
|
|
25
|
-
/// <li><b>Strong (forced) context sensitivity</b>: These are cases where the
|
|
26
|
-
/// full-context prediction resolved an SLL conflict to a unique alternative,
|
|
27
|
-
/// <em>and</em> the minimum alternative of the SLL conflict was found to not be
|
|
28
|
-
/// a truly viable alternative. Two-stage parsing cannot be used for inputs where
|
|
29
|
-
/// this situation occurs.</li>
|
|
30
|
-
/// </ul>
|
|
31
|
-
class DiagnosticErrorListener extends BaseErrorListener {
|
|
32
|
-
/// When [true], only exactly known ambiguities are reported.
|
|
33
|
-
final bool exactOnly;
|
|
34
|
-
|
|
35
|
-
/// Initializes a new instance of [DiagnosticErrorListener], specifying
|
|
36
|
-
/// whether all ambiguities or only exact ambiguities are reported.
|
|
37
|
-
///
|
|
38
|
-
/// @param exactOnly [true] to report only exact ambiguities, otherwise
|
|
39
|
-
/// [false] to report all ambiguities.
|
|
40
|
-
DiagnosticErrorListener([this.exactOnly = true]);
|
|
41
|
-
|
|
42
|
-
@override
|
|
43
|
-
void reportAmbiguity(Parser recognizer, DFA dfa, int startIndex,
|
|
44
|
-
int stopIndex, bool exact, BitSet ambigAlts, ATNConfigSet configs) {
|
|
45
|
-
if (exactOnly && !exact) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
final decision = getDecisionDescription(recognizer, dfa);
|
|
50
|
-
final conflictingAlts = getConflictingAlts(ambigAlts, configs);
|
|
51
|
-
final text =
|
|
52
|
-
recognizer.tokenStream.getText(Interval.of(startIndex, stopIndex));
|
|
53
|
-
final message =
|
|
54
|
-
"reportAmbiguity d=$decision: ambigAlts=$conflictingAlts, input='$text'";
|
|
55
|
-
recognizer.notifyErrorListeners(message);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
@override
|
|
59
|
-
void reportAttemptingFullContext(Parser recognizer, DFA dfa, int startIndex,
|
|
60
|
-
int stopIndex, BitSet conflictingAlts, ATNConfigSet configs) {
|
|
61
|
-
final decision = getDecisionDescription(recognizer, dfa);
|
|
62
|
-
final text =
|
|
63
|
-
recognizer.tokenStream.getText(Interval.of(startIndex, stopIndex));
|
|
64
|
-
final message = "reportAttemptingFullContext d=$decision, input='$text'";
|
|
65
|
-
recognizer.notifyErrorListeners(message);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
@override
|
|
69
|
-
void reportContextSensitivity(Parser recognizer, DFA dfa, int startIndex,
|
|
70
|
-
int stopIndex, int prediction, ATNConfigSet configs) {
|
|
71
|
-
final decision = getDecisionDescription(recognizer, dfa);
|
|
72
|
-
final text =
|
|
73
|
-
recognizer.tokenStream.getText(Interval.of(startIndex, stopIndex));
|
|
74
|
-
final message = "reportContextSensitivity d=$decision, input='$text'";
|
|
75
|
-
recognizer.notifyErrorListeners(message);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
String getDecisionDescription(Parser recognizer, DFA dfa) {
|
|
79
|
-
final decision = dfa.decision;
|
|
80
|
-
final ruleIndex = dfa.atnStartState.ruleIndex;
|
|
81
|
-
|
|
82
|
-
final ruleNames = recognizer.ruleNames;
|
|
83
|
-
if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
|
|
84
|
-
return decision.toString();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
final ruleName = ruleNames[ruleIndex];
|
|
88
|
-
if (ruleName == null || ruleName.isEmpty) {
|
|
89
|
-
return decision.toString();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return '$decision ($ruleName)';
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/// Computes the set of conflicting or ambiguous alternatives from a
|
|
96
|
-
/// configuration set, if that information was not already provided by the
|
|
97
|
-
/// parser.
|
|
98
|
-
///
|
|
99
|
-
/// @param reportedAlts The set of conflicting or ambiguous alternatives, as
|
|
100
|
-
/// reported by the parser.
|
|
101
|
-
/// @param configs The conflicting or ambiguous configuration set.
|
|
102
|
-
/// @return Returns [reportedAlts] if it is not null, otherwise
|
|
103
|
-
/// returns the set of alternatives represented in [configs].
|
|
104
|
-
BitSet getConflictingAlts(BitSet reportedAlts, ATNConfigSet configs) {
|
|
105
|
-
if (reportedAlts != null) {
|
|
106
|
-
return reportedAlts;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
final result = BitSet();
|
|
110
|
-
for (var config in configs) {
|
|
111
|
-
result.set(config.alt);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return result;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
|
|
3
|
-
* Use of this file is governed by the BSD 3-clause license that
|
|
4
|
-
* can be found in the LICENSE.txt file in the project root.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import 'dart:io';
|
|
8
|
-
|
|
9
|
-
import '../../atn/atn.dart';
|
|
10
|
-
import '../../dfa/dfa.dart';
|
|
11
|
-
import '../../parser.dart';
|
|
12
|
-
import '../../recognizer.dart';
|
|
13
|
-
import '../../util/bit_set.dart';
|
|
14
|
-
import 'errors.dart';
|
|
15
|
-
|
|
16
|
-
abstract class ErrorListener {
|
|
17
|
-
/// Upon syntax error, notify any interested parties. This is not how to
|
|
18
|
-
/// recover from errors or compute error messages. [ANTLRErrorStrategy]
|
|
19
|
-
/// specifies how to recover from syntax errors and how to compute error
|
|
20
|
-
/// messages. This listener's job is simply to emit a computed message,
|
|
21
|
-
/// though it has enough information to create its own message in many cases.
|
|
22
|
-
///
|
|
23
|
-
/// <p>The [RecognitionException] is non-null for all syntax errors except
|
|
24
|
-
/// when we discover mismatched token errors that we can recover from
|
|
25
|
-
/// in-line, without returning from the surrounding rule (via the single
|
|
26
|
-
/// token insertion and deletion mechanism).</p>
|
|
27
|
-
///
|
|
28
|
-
/// @param recognizer
|
|
29
|
-
/// What parser got the error. From this
|
|
30
|
-
/// object, you can access the context as well
|
|
31
|
-
/// as the input stream.
|
|
32
|
-
/// @param offendingSymbol
|
|
33
|
-
/// The offending token in the input token
|
|
34
|
-
/// stream, unless recognizer is a lexer (then it's null). If
|
|
35
|
-
/// no viable alternative error, [e] has token at which we
|
|
36
|
-
/// started production for the decision.
|
|
37
|
-
/// @param line
|
|
38
|
-
/// The line number in the input where the error occurred.
|
|
39
|
-
/// @param charPositionInLine
|
|
40
|
-
/// The character position within that line where the error occurred.
|
|
41
|
-
/// @param msg
|
|
42
|
-
/// The message to emit.
|
|
43
|
-
/// @param e
|
|
44
|
-
/// The exception generated by the parser that led to
|
|
45
|
-
/// the reporting of an error. It is null in the case where
|
|
46
|
-
/// the parser was able to recover in line without exiting the
|
|
47
|
-
/// surrounding rule.
|
|
48
|
-
void syntaxError(Recognizer recognizer, Object offendingSymbol, int line,
|
|
49
|
-
int charPositionInLine, String msg, RecognitionException e);
|
|
50
|
-
|
|
51
|
-
/// This method is called by the parser when a full-context prediction
|
|
52
|
-
/// results in an ambiguity.
|
|
53
|
-
///
|
|
54
|
-
/// <p>Each full-context prediction which does not result in a syntax error
|
|
55
|
-
/// will call either {@link #reportContextSensitivity} or
|
|
56
|
-
/// {@link #reportAmbiguity}.</p>
|
|
57
|
-
///
|
|
58
|
-
/// <p>When [ambigAlts] is not null, it contains the set of potentially
|
|
59
|
-
/// viable alternatives identified by the prediction algorithm. When
|
|
60
|
-
/// [ambigAlts] is null, use {@link ATNConfigSet#getAlts} to obtain the
|
|
61
|
-
/// represented alternatives from the [configs] argument.</p>
|
|
62
|
-
///
|
|
63
|
-
/// <p>When [exact] is [true], <em>all</em> of the potentially
|
|
64
|
-
/// viable alternatives are truly viable, i.e. this is reporting an exact
|
|
65
|
-
/// ambiguity. When [exact] is [false], <em>at least two</em> of
|
|
66
|
-
/// the potentially viable alternatives are viable for the current input, but
|
|
67
|
-
/// the prediction algorithm terminated as soon as it determined that at
|
|
68
|
-
/// least the <em>minimum</em> potentially viable alternative is truly
|
|
69
|
-
/// viable.</p>
|
|
70
|
-
///
|
|
71
|
-
/// <p>When the {@link PredictionMode#LL_EXACT_AMBIG_DETECTION} prediction
|
|
72
|
-
/// mode is used, the parser is required to identify exact ambiguities so
|
|
73
|
-
/// [exact] will always be [true].</p>
|
|
74
|
-
///
|
|
75
|
-
/// <p>This method is not used by lexers.</p>
|
|
76
|
-
///
|
|
77
|
-
/// @param recognizer the parser instance
|
|
78
|
-
/// @param dfa the DFA for the current decision
|
|
79
|
-
/// @param startIndex the input index where the decision started
|
|
80
|
-
/// @param stopIndex the input input where the ambiguity was identified
|
|
81
|
-
/// @param exact [true] if the ambiguity is exactly known, otherwise
|
|
82
|
-
/// [false]. This is always [true] when
|
|
83
|
-
/// {@link PredictionMode#LL_EXACT_AMBIG_DETECTION} is used.
|
|
84
|
-
/// @param ambigAlts the potentially ambiguous alternatives, or null
|
|
85
|
-
/// to indicate that the potentially ambiguous alternatives are the complete
|
|
86
|
-
/// set of represented alternatives in [configs]
|
|
87
|
-
/// @param configs the ATN configuration set where the ambiguity was
|
|
88
|
-
/// identified
|
|
89
|
-
void reportAmbiguity(Parser recognizer, DFA dfa, int startIndex,
|
|
90
|
-
int stopIndex, bool exact, BitSet ambigAlts, ATNConfigSet configs);
|
|
91
|
-
|
|
92
|
-
/// This method is called when an SLL conflict occurs and the parser is about
|
|
93
|
-
/// to use the full context information to make an LL decision.
|
|
94
|
-
///
|
|
95
|
-
/// <p>If one or more configurations in [configs] contains a semantic
|
|
96
|
-
/// predicate, the predicates are evaluated before this method is called. The
|
|
97
|
-
/// subset of alternatives which are still viable after predicates are
|
|
98
|
-
/// evaluated is reported in [conflictingAlts].</p>
|
|
99
|
-
///
|
|
100
|
-
/// <p>This method is not used by lexers.</p>
|
|
101
|
-
///
|
|
102
|
-
/// @param recognizer the parser instance
|
|
103
|
-
/// @param dfa the DFA for the current decision
|
|
104
|
-
/// @param startIndex the input index where the decision started
|
|
105
|
-
/// @param stopIndex the input index where the SLL conflict occurred
|
|
106
|
-
/// @param conflictingAlts The specific conflicting alternatives. If this is
|
|
107
|
-
/// null, the conflicting alternatives are all alternatives
|
|
108
|
-
/// represented in [configs]. At the moment, conflictingAlts is non-null
|
|
109
|
-
/// (for the reference implementation, but Sam's optimized version can see this
|
|
110
|
-
/// as null).
|
|
111
|
-
/// @param configs the ATN configuration set where the SLL conflict was
|
|
112
|
-
/// detected
|
|
113
|
-
void reportAttemptingFullContext(Parser recognizer, DFA dfa, int startIndex,
|
|
114
|
-
int stopIndex, BitSet conflictingAlts, ATNConfigSet configs);
|
|
115
|
-
|
|
116
|
-
/// This method is called by the parser when a full-context prediction has a
|
|
117
|
-
/// unique result.
|
|
118
|
-
///
|
|
119
|
-
/// <p>Each full-context prediction which does not result in a syntax error
|
|
120
|
-
/// will call either {@link #reportContextSensitivity} or
|
|
121
|
-
/// {@link #reportAmbiguity}.</p>
|
|
122
|
-
///
|
|
123
|
-
/// <p>For prediction implementations that only evaluate full-context
|
|
124
|
-
/// predictions when an SLL conflict is found (including the default
|
|
125
|
-
/// [ParserATNSimulator] implementation), this method reports cases
|
|
126
|
-
/// where SLL conflicts were resolved to unique full-context predictions,
|
|
127
|
-
/// i.e. the decision was context-sensitive. This report does not necessarily
|
|
128
|
-
/// indicate a problem, and it may appear even in completely unambiguous
|
|
129
|
-
/// grammars.</p>
|
|
130
|
-
///
|
|
131
|
-
/// <p>[configs] may have more than one represented alternative if the
|
|
132
|
-
/// full-context prediction algorithm does not evaluate predicates before
|
|
133
|
-
/// beginning the full-context prediction. In all cases, the final prediction
|
|
134
|
-
/// is passed as the [prediction] argument.</p>
|
|
135
|
-
///
|
|
136
|
-
/// <p>Note that the definition of "context sensitivity" in this method
|
|
137
|
-
/// differs from the concept in {@link DecisionInfo#contextSensitivities}.
|
|
138
|
-
/// This method reports all instances where an SLL conflict occurred but LL
|
|
139
|
-
/// parsing produced a unique result, whether or not that unique result
|
|
140
|
-
/// matches the minimum alternative in the SLL conflicting set.</p>
|
|
141
|
-
///
|
|
142
|
-
/// <p>This method is not used by lexers.</p>
|
|
143
|
-
///
|
|
144
|
-
/// @param recognizer the parser instance
|
|
145
|
-
/// @param dfa the DFA for the current decision
|
|
146
|
-
/// @param startIndex the input index where the decision started
|
|
147
|
-
/// @param stopIndex the input index where the context sensitivity was
|
|
148
|
-
/// finally determined
|
|
149
|
-
/// @param prediction the unambiguous result of the full-context prediction
|
|
150
|
-
/// @param configs the ATN configuration set where the unambiguous prediction
|
|
151
|
-
/// was determined
|
|
152
|
-
void reportContextSensitivity(Parser recognizer, DFA dfa, int startIndex,
|
|
153
|
-
int stopIndex, int prediction, ATNConfigSet configs);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
class BaseErrorListener extends ErrorListener {
|
|
157
|
-
@override
|
|
158
|
-
void reportAmbiguity(Parser recognizer, DFA dfa, int startIndex,
|
|
159
|
-
int stopIndex, bool exact, BitSet ambigAlts, ATNConfigSet configs) {}
|
|
160
|
-
|
|
161
|
-
@override
|
|
162
|
-
void reportAttemptingFullContext(Parser recognizer, DFA dfa, int startIndex,
|
|
163
|
-
int stopIndex, BitSet conflictingAlts, ATNConfigSet configs) {}
|
|
164
|
-
|
|
165
|
-
@override
|
|
166
|
-
void reportContextSensitivity(Parser recognizer, DFA dfa, int startIndex,
|
|
167
|
-
int stopIndex, int prediction, ATNConfigSet configs) {}
|
|
168
|
-
|
|
169
|
-
@override
|
|
170
|
-
void syntaxError(Recognizer<ATNSimulator> recognizer, Object offendingSymbol,
|
|
171
|
-
int line, int charPositionInLine, String msg, RecognitionException e) {}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
class ConsoleErrorListener extends BaseErrorListener {
|
|
175
|
-
/// Provides a default instance of [ConsoleErrorListener].
|
|
176
|
-
static final INSTANCE = ConsoleErrorListener();
|
|
177
|
-
|
|
178
|
-
/// {@inheritDoc}
|
|
179
|
-
///
|
|
180
|
-
/// <p>
|
|
181
|
-
/// This implementation prints messages to {@link System//err} containing the
|
|
182
|
-
/// values of [line], [charPositionInLine], and [msg] using
|
|
183
|
-
/// the following format.</p>
|
|
184
|
-
///
|
|
185
|
-
/// <pre>
|
|
186
|
-
/// line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
|
|
187
|
-
/// </pre>
|
|
188
|
-
@override
|
|
189
|
-
void syntaxError(recognizer, offendingSymbol, line, column, msg, e) {
|
|
190
|
-
stderr.writeln('line $line:$column $msg');
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/// This implementation of [ErrorListener] dispatches all calls to a
|
|
195
|
-
/// collection of delegate listeners. This reduces the effort required to support multiple
|
|
196
|
-
/// listeners.
|
|
197
|
-
class ProxyErrorListener implements ErrorListener {
|
|
198
|
-
final List<ErrorListener> delegates;
|
|
199
|
-
|
|
200
|
-
ProxyErrorListener(this.delegates) {
|
|
201
|
-
if (delegates == null) {
|
|
202
|
-
throw ArgumentError.notNull('delegates');
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
@override
|
|
207
|
-
void syntaxError(Recognizer recognizer, Object offendingSymbol, int line,
|
|
208
|
-
int charPositionInLine, String msg, RecognitionException e) {
|
|
209
|
-
for (final listener in delegates) {
|
|
210
|
-
listener.syntaxError(
|
|
211
|
-
recognizer, offendingSymbol, line, charPositionInLine, msg, e);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
@override
|
|
216
|
-
void reportAmbiguity(Parser recognizer, DFA dfa, int startIndex,
|
|
217
|
-
int stopIndex, bool exact, BitSet ambigAlts, ATNConfigSet configs) {
|
|
218
|
-
for (final listener in delegates) {
|
|
219
|
-
listener.reportAmbiguity(
|
|
220
|
-
recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
@override
|
|
225
|
-
void reportAttemptingFullContext(Parser recognizer, DFA dfa, int startIndex,
|
|
226
|
-
int stopIndex, BitSet conflictingAlts, ATNConfigSet configs) {
|
|
227
|
-
for (final listener in delegates) {
|
|
228
|
-
listener.reportAttemptingFullContext(
|
|
229
|
-
recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
@override
|
|
234
|
-
void reportContextSensitivity(Parser recognizer, DFA dfa, int startIndex,
|
|
235
|
-
int stopIndex, int prediction, ATNConfigSet configs) {
|
|
236
|
-
for (final listener in delegates) {
|
|
237
|
-
listener.reportContextSensitivity(
|
|
238
|
-
recognizer, dfa, startIndex, stopIndex, prediction, configs);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|