@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,182 +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 'vocabulary.dart';
|
|
8
|
-
import 'atn/atn.dart';
|
|
9
|
-
import 'error/error.dart';
|
|
10
|
-
import 'input_stream.dart';
|
|
11
|
-
import 'rule_context.dart';
|
|
12
|
-
import 'token.dart';
|
|
13
|
-
import 'token_factory.dart';
|
|
14
|
-
import 'util/utils.dart';
|
|
15
|
-
|
|
16
|
-
abstract class Recognizer<ATNInterpreter extends ATNSimulator> {
|
|
17
|
-
static const EOF = -1;
|
|
18
|
-
|
|
19
|
-
static final Map<Vocabulary, Map<String, int>> tokenTypeMapCache = {};
|
|
20
|
-
static final Map<List<String>, Map<String, int>> ruleIndexMapCache = {};
|
|
21
|
-
final List<ErrorListener> _listeners = [ConsoleErrorListener.INSTANCE];
|
|
22
|
-
|
|
23
|
-
/// The ATN interpreter used by the recognizer for prediction.
|
|
24
|
-
ATNInterpreter interpreter;
|
|
25
|
-
int _stateNumber = -1;
|
|
26
|
-
|
|
27
|
-
List<String> get ruleNames;
|
|
28
|
-
|
|
29
|
-
/// Get the vocabulary used by the recognizer.
|
|
30
|
-
///
|
|
31
|
-
/// @return A [Vocabulary] instance providing information about the
|
|
32
|
-
/// vocabulary used by the grammar.
|
|
33
|
-
Vocabulary get vocabulary;
|
|
34
|
-
|
|
35
|
-
/// Get a map from token names to token types.
|
|
36
|
-
///
|
|
37
|
-
/// <p>Used for XPath and tree pattern compilation.</p>
|
|
38
|
-
Map<String, int> get tokenTypeMap {
|
|
39
|
-
final _vocabulary = vocabulary;
|
|
40
|
-
|
|
41
|
-
var result = tokenTypeMapCache[_vocabulary];
|
|
42
|
-
if (result == null) {
|
|
43
|
-
result = {};
|
|
44
|
-
for (var i = 0; i <= getATN().maxTokenType; i++) {
|
|
45
|
-
final literalName = _vocabulary.getLiteralName(i);
|
|
46
|
-
if (literalName != null) {
|
|
47
|
-
result[literalName] = i;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
final symbolicName = _vocabulary.getSymbolicName(i);
|
|
51
|
-
if (symbolicName != null) {
|
|
52
|
-
result[symbolicName] = i;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
result['EOF'] = Token.EOF;
|
|
57
|
-
result = Map.unmodifiable(result);
|
|
58
|
-
tokenTypeMapCache[_vocabulary] = result;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return result;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/// Get a map from rule names to rule indexes.
|
|
65
|
-
///
|
|
66
|
-
/// <p>Used for XPath and tree pattern compilation.</p>
|
|
67
|
-
Map<String, int> get ruleIndexMap {
|
|
68
|
-
final _ruleNames = ruleNames;
|
|
69
|
-
if (_ruleNames == null) {
|
|
70
|
-
throw UnsupportedError(
|
|
71
|
-
'The current recognizer does not provide a list of rule names.');
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
var result = ruleIndexMapCache[_ruleNames];
|
|
75
|
-
if (result == null) {
|
|
76
|
-
result = Map.unmodifiable(toMap(_ruleNames));
|
|
77
|
-
ruleIndexMapCache[_ruleNames] = result;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return result;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
int getTokenType(String tokenName) {
|
|
84
|
-
final ttype = tokenTypeMap[tokenName];
|
|
85
|
-
if (ttype != null) return ttype;
|
|
86
|
-
return Token.INVALID_TYPE;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/// If this recognizer was generated, it will have a serialized ATN
|
|
90
|
-
/// representation of the grammar.
|
|
91
|
-
///
|
|
92
|
-
/// <p>For interpreters, we don't know their serialized ATN despite having
|
|
93
|
-
/// created the interpreter from it.</p>
|
|
94
|
-
String get serializedATN {
|
|
95
|
-
throw UnsupportedError('there is no serialized ATN');
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/// For debugging and other purposes, might want the grammar name.
|
|
99
|
-
/// Have ANTLR generate an implementation for this method.
|
|
100
|
-
String get grammarFileName;
|
|
101
|
-
|
|
102
|
-
/// Get the [ATN] used by the recognizer for prediction.
|
|
103
|
-
///
|
|
104
|
-
/// @return The [ATN] used by the recognizer for prediction.
|
|
105
|
-
ATN getATN();
|
|
106
|
-
|
|
107
|
-
/// If profiling during the parse/lex, this will return DecisionInfo records
|
|
108
|
-
/// for each decision in recognizer in a ParseInfo object.
|
|
109
|
-
///
|
|
110
|
-
/// @since 4.3
|
|
111
|
-
ParseInfo get parseInfo {
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/// What is the error header, normally line/character position information? */
|
|
116
|
-
String getErrorHeader(RecognitionException e) {
|
|
117
|
-
final line = e.offendingToken.line;
|
|
118
|
-
final charPositionInLine = e.offendingToken.charPositionInLine;
|
|
119
|
-
return 'line $line:$charPositionInLine';
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/// @exception NullPointerException if [listener] is null.
|
|
123
|
-
void addErrorListener(ErrorListener listener) {
|
|
124
|
-
if (listener == null) {
|
|
125
|
-
throw ArgumentError.notNull('listener');
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
_listeners.add(listener);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
void removeErrorListener(ErrorListener listener) {
|
|
132
|
-
_listeners.remove(listener);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
void removeErrorListeners() {
|
|
136
|
-
_listeners.clear();
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
List<ErrorListener> get errorListeners {
|
|
140
|
-
return _listeners;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
ErrorListener get errorListenerDispatch {
|
|
144
|
-
return ProxyErrorListener(errorListeners);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// subclass needs to override these if there are sempreds or actions
|
|
148
|
-
// that the ATN interp needs to execute
|
|
149
|
-
bool sempred(RuleContext _localctx, int ruleIndex, int actionIndex) {
|
|
150
|
-
return true;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
bool precpred(RuleContext localctx, int precedence) {
|
|
154
|
-
return true;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
void action(RuleContext _localctx, int ruleIndex, int actionIndex) {}
|
|
158
|
-
|
|
159
|
-
int get state {
|
|
160
|
-
return _stateNumber;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/// Indicate that the recognizer has changed internal state that is
|
|
164
|
-
/// consistent with the ATN state passed in. This way we always know
|
|
165
|
-
/// where we are in the ATN as the parser goes along. The rule
|
|
166
|
-
/// context objects form a stack that lets us see the stack of
|
|
167
|
-
/// invoking rules. Combine this and we have complete ATN
|
|
168
|
-
/// configuration information.
|
|
169
|
-
set state(int atnState) {
|
|
170
|
-
// System.err.println("setState "+atnState);
|
|
171
|
-
_stateNumber = atnState;
|
|
172
|
-
// if ( traceATNStates ) _ctx.trace(atnState);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
IntStream get inputStream;
|
|
176
|
-
|
|
177
|
-
set inputStream(IntStream input);
|
|
178
|
-
|
|
179
|
-
TokenFactory get tokenFactory;
|
|
180
|
-
|
|
181
|
-
set tokenFactory(TokenFactory input);
|
|
182
|
-
}
|
|
@@ -1,192 +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 'interval_set.dart';
|
|
9
|
-
import 'parser.dart';
|
|
10
|
-
import 'parser_rule_context.dart';
|
|
11
|
-
import 'recognizer.dart';
|
|
12
|
-
import 'tree/tree.dart';
|
|
13
|
-
|
|
14
|
-
/// A rule context is a record of a single rule invocation.
|
|
15
|
-
///
|
|
16
|
-
/// We form a stack of these context objects using the parent
|
|
17
|
-
/// pointer. A parent pointer of null indicates that the current
|
|
18
|
-
/// context is the bottom of the stack. The ParserRuleContext subclass
|
|
19
|
-
/// as a children list so that we can turn this data structure into a
|
|
20
|
-
/// tree.
|
|
21
|
-
///
|
|
22
|
-
/// The root node always has a null pointer and invokingState of -1.
|
|
23
|
-
///
|
|
24
|
-
/// Upon entry to parsing, the first invoked rule function creates a
|
|
25
|
-
/// context object (a subclass specialized for that rule such as
|
|
26
|
-
/// SContext) and makes it the root of a parse tree, recorded by field
|
|
27
|
-
/// Parser._ctx.
|
|
28
|
-
///
|
|
29
|
-
/// public final SContext s() throws RecognitionException {
|
|
30
|
-
/// SContext _localctx = new SContext(_ctx, getState()); <-- create new node
|
|
31
|
-
/// enterRule(_localctx, 0, RULE_s); <-- push it
|
|
32
|
-
/// ...
|
|
33
|
-
/// exitRule(); <-- pop back to _localctx
|
|
34
|
-
/// return _localctx;
|
|
35
|
-
/// }
|
|
36
|
-
///
|
|
37
|
-
/// A subsequent rule invocation of r from the start rule s pushes a
|
|
38
|
-
/// new context object for r whose parent points at s and use invoking
|
|
39
|
-
/// state is the state with r emanating as edge label.
|
|
40
|
-
///
|
|
41
|
-
/// The invokingState fields from a context object to the root
|
|
42
|
-
/// together form a stack of rule indication states where the root
|
|
43
|
-
/// (bottom of the stack) has a -1 sentinel value. If we invoke start
|
|
44
|
-
/// symbol s then call r1, which calls r2, the would look like
|
|
45
|
-
/// this:
|
|
46
|
-
///
|
|
47
|
-
/// SContext[-1] <- root node (bottom of the stack)
|
|
48
|
-
/// R1Context[p] <- p in rule s called r1
|
|
49
|
-
/// R2Context[q] <- q in rule r1 called r2
|
|
50
|
-
///
|
|
51
|
-
/// So the top of the stack, _ctx, represents a call to the current
|
|
52
|
-
/// rule and it holds the return address from another rule that invoke
|
|
53
|
-
/// to this rule. To invoke a rule, we must always have a current context.
|
|
54
|
-
///
|
|
55
|
-
/// The parent contexts are useful for computing lookahead sets and
|
|
56
|
-
/// getting error information.
|
|
57
|
-
///
|
|
58
|
-
/// These objects are used during parsing and prediction.
|
|
59
|
-
/// For the special case of parsers, we use the subclass
|
|
60
|
-
/// ParserRuleContext.
|
|
61
|
-
///
|
|
62
|
-
/// @see ParserRuleContext
|
|
63
|
-
abstract class RuleContext extends RuleNode {
|
|
64
|
-
/// What context invoked this rule?
|
|
65
|
-
@override
|
|
66
|
-
RuleContext parent;
|
|
67
|
-
|
|
68
|
-
/// What state invoked the rule associated with this context?
|
|
69
|
-
/// The "return address" is the followState of invokingState
|
|
70
|
-
/// If parent is null, this should be -1.
|
|
71
|
-
int invokingState;
|
|
72
|
-
|
|
73
|
-
RuleContext({this.parent, this.invokingState}) {
|
|
74
|
-
invokingState = invokingState ?? -1;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
int depth() {
|
|
78
|
-
var n = 0;
|
|
79
|
-
var p = this;
|
|
80
|
-
while (p != null) {
|
|
81
|
-
p = p.parent;
|
|
82
|
-
n++;
|
|
83
|
-
}
|
|
84
|
-
return n;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/// A context is empty if there is no invoking state; meaning nobody call
|
|
88
|
-
/// current context.
|
|
89
|
-
bool get isEmpty => invokingState == -1;
|
|
90
|
-
|
|
91
|
-
/// satisfy the ParseTree / SyntaxTree interface
|
|
92
|
-
@override
|
|
93
|
-
Interval get sourceInterval => Interval.INVALID;
|
|
94
|
-
|
|
95
|
-
@override
|
|
96
|
-
RuleContext get ruleContext => this;
|
|
97
|
-
|
|
98
|
-
@override
|
|
99
|
-
RuleContext get payload => this;
|
|
100
|
-
|
|
101
|
-
/// Return the combined text of all child nodes. This method only considers
|
|
102
|
-
/// tokens which have been added to the parse tree.
|
|
103
|
-
/// <p>
|
|
104
|
-
/// Since tokens on hidden channels (e.g. whitespace or comments) are not
|
|
105
|
-
/// added to the parse trees, they will not appear in the output of this
|
|
106
|
-
/// method.
|
|
107
|
-
@override
|
|
108
|
-
String get text {
|
|
109
|
-
if (childCount == 0) {
|
|
110
|
-
return '';
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
final builder = StringBuffer();
|
|
114
|
-
for (var i = 0; i < childCount; i++) {
|
|
115
|
-
builder.write(getChild(i).text);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return builder.toString();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
int get ruleIndex => -1;
|
|
122
|
-
|
|
123
|
-
/// For rule associated with this parse tree internal node, return
|
|
124
|
-
/// the outer alternative number used to match the input. Default
|
|
125
|
-
/// implementation does not compute nor store this alt num. Create
|
|
126
|
-
/// a subclass of ParserRuleContext with backing field and set
|
|
127
|
-
/// option contextSuperClass.
|
|
128
|
-
/// to set it.
|
|
129
|
-
int get altNumber => ATN.INVALID_ALT_NUMBER;
|
|
130
|
-
|
|
131
|
-
/// Set the outer alternative number for this context node. Default
|
|
132
|
-
/// implementation does nothing to avoid backing field overhead for
|
|
133
|
-
/// trees that don't need it. Create
|
|
134
|
-
/// a subclass of ParserRuleContext with backing field and set
|
|
135
|
-
/// option contextSuperClass.
|
|
136
|
-
set altNumber(int altNumber) {}
|
|
137
|
-
|
|
138
|
-
@override
|
|
139
|
-
ParseTree getChild<T>(int i) {
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
@override
|
|
144
|
-
int get childCount => 0;
|
|
145
|
-
|
|
146
|
-
@override
|
|
147
|
-
T accept<T>(ParseTreeVisitor<T> visitor) {
|
|
148
|
-
return visitor.visitChildren(this);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/// Print out a whole tree, not just a node, in LISP format
|
|
152
|
-
/// (root child1 .. childN). Print just a node if this is a leaf.
|
|
153
|
-
///
|
|
154
|
-
@override
|
|
155
|
-
String toStringTree({List<String> ruleNames, Parser parser}) {
|
|
156
|
-
return Trees.toStringTree(this, ruleNames: ruleNames, recog: parser);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
@override
|
|
160
|
-
String toString(
|
|
161
|
-
{List<String> ruleNames, Recognizer recog, RuleContext stop}) {
|
|
162
|
-
ruleNames = ruleNames ?? recog?.ruleNames;
|
|
163
|
-
final buf = StringBuffer();
|
|
164
|
-
var p = this;
|
|
165
|
-
buf.write('[');
|
|
166
|
-
while (p != null && p != stop) {
|
|
167
|
-
if (ruleNames == null) {
|
|
168
|
-
if (!p.isEmpty) {
|
|
169
|
-
buf.write(p.invokingState);
|
|
170
|
-
}
|
|
171
|
-
} else {
|
|
172
|
-
final ruleIndex = p.ruleIndex;
|
|
173
|
-
final ruleName = ruleIndex >= 0 && ruleIndex < ruleNames.length
|
|
174
|
-
? ruleNames[ruleIndex]
|
|
175
|
-
: ruleIndex.toString();
|
|
176
|
-
buf.write(ruleName);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (p.parent != null &&
|
|
180
|
-
(ruleNames != null || !p.parent.isEmpty)) {
|
|
181
|
-
buf.write(' ');
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
p = p.parent;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
buf.write(']');
|
|
188
|
-
return buf.toString();
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
static final EMPTY = ParserRuleContext();
|
|
192
|
-
}
|
|
@@ -1,188 +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:developer';
|
|
8
|
-
import 'dart:math' as math;
|
|
9
|
-
|
|
10
|
-
import 'package:logging/logging.dart';
|
|
11
|
-
|
|
12
|
-
/// This class provides access to the current version of the ANTLR 4 runtime
|
|
13
|
-
/// library as compile-time and runtime constants, along with methods for
|
|
14
|
-
/// checking for matching version numbers and notifying listeners in the case
|
|
15
|
-
/// where a version mismatch is detected.
|
|
16
|
-
///
|
|
17
|
-
/// <p>
|
|
18
|
-
/// The runtime version information is provided by {@link #VERSION} and
|
|
19
|
-
/// {@link #getRuntimeVersion()}. Detailed information about these values is
|
|
20
|
-
/// provided in the documentation for each member.</p>
|
|
21
|
-
///
|
|
22
|
-
/// <p>
|
|
23
|
-
/// The runtime version check is implemented by {@link #checkVersion}. Detailed
|
|
24
|
-
/// information about incorporating this call into user code, as well as its use
|
|
25
|
-
/// in generated code, is provided in the documentation for the method.</p>
|
|
26
|
-
///
|
|
27
|
-
/// <p>
|
|
28
|
-
/// Version strings x.y and x.y.z are considered "compatible" and no error
|
|
29
|
-
/// would be generated. Likewise, version strings x.y-SNAPSHOT and x.y.z are
|
|
30
|
-
/// considered "compatible" because the major and minor components x.y
|
|
31
|
-
/// are the same in each.</p>
|
|
32
|
-
///
|
|
33
|
-
/// <p>
|
|
34
|
-
/// To trap any error messages issued by this code, use System.setErr()
|
|
35
|
-
/// in your main() startup code.
|
|
36
|
-
/// </p>
|
|
37
|
-
///
|
|
38
|
-
/// @since 4.3
|
|
39
|
-
class RuntimeMetaData {
|
|
40
|
-
/// A compile-time constant containing the current version of the ANTLR 4
|
|
41
|
-
/// runtime library.
|
|
42
|
-
///
|
|
43
|
-
/// <p>
|
|
44
|
-
/// This compile-time constant value allows generated parsers and other
|
|
45
|
-
/// libraries to include a literal reference to the version of the ANTLR 4
|
|
46
|
-
/// runtime library the code was compiled against. At each release, we
|
|
47
|
-
/// change this value.</p>
|
|
48
|
-
///
|
|
49
|
-
/// <p>Version numbers are assumed to have the form
|
|
50
|
-
///
|
|
51
|
-
/// <em>major</em>.<em>minor</em>.<em>patch</em>.<em>revision</em>-<em>suffix</em>,
|
|
52
|
-
///
|
|
53
|
-
/// with the individual components defined as follows.</p>
|
|
54
|
-
///
|
|
55
|
-
/// <ul>
|
|
56
|
-
/// <li><em>major</em> is a required non-negative integer, and is equal to
|
|
57
|
-
/// {@code 4} for ANTLR 4.</li>
|
|
58
|
-
/// <li><em>minor</em> is a required non-negative integer.</li>
|
|
59
|
-
/// <li><em>patch</em> is an optional non-negative integer. When
|
|
60
|
-
/// <em>patch</em> is omitted, the {@code .} (dot) appearing before it is
|
|
61
|
-
/// also omitted.</li>
|
|
62
|
-
/// <li><em>revision</em> is an optional non-negative integer, and may only
|
|
63
|
-
/// be included when <em>patch</em> is also included. When <em>revision</em>
|
|
64
|
-
/// is omitted, the {@code .} (dot) appearing before it is also omitted.</li>
|
|
65
|
-
/// <li><em>suffix</em> is an optional string. When <em>suffix</em> is
|
|
66
|
-
/// omitted, the {@code -} (hyphen-minus) appearing before it is also
|
|
67
|
-
/// omitted.</li>
|
|
68
|
-
/// </ul>
|
|
69
|
-
static final String VERSION = '4.9.2';
|
|
70
|
-
|
|
71
|
-
/// Gets the currently executing version of the ANTLR 4 runtime library.
|
|
72
|
-
///
|
|
73
|
-
/// <p>
|
|
74
|
-
/// This method provides runtime access to the [VERSION] field, as
|
|
75
|
-
/// opposed to directly referencing the field as a compile-time constant.</p>
|
|
76
|
-
///
|
|
77
|
-
/// @return The currently executing version of the ANTLR 4 library
|
|
78
|
-
static String get runtimeVersion {
|
|
79
|
-
return VERSION;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/// This method provides the ability to detect mismatches between the version
|
|
83
|
-
/// of ANTLR 4 used to generate a parser, the version of the ANTLR runtime a
|
|
84
|
-
/// parser was compiled against, and the version of the ANTLR runtime which
|
|
85
|
-
/// is currently executing.
|
|
86
|
-
///
|
|
87
|
-
/// <p>
|
|
88
|
-
/// The version check is designed to detect the following two specific
|
|
89
|
-
/// scenarios.</p>
|
|
90
|
-
///
|
|
91
|
-
/// <ul>
|
|
92
|
-
/// <li>The ANTLR Tool version used for code generation does not match the
|
|
93
|
-
/// currently executing runtime version.</li>
|
|
94
|
-
/// <li>The ANTLR Runtime version referenced at the time a parser was
|
|
95
|
-
/// compiled does not match the currently executing runtime version.</li>
|
|
96
|
-
/// </ul>
|
|
97
|
-
///
|
|
98
|
-
/// <p>
|
|
99
|
-
/// Starting with ANTLR 4.3, the code generator emits a call to this method
|
|
100
|
-
/// using two constants in each generated lexer and parser: a hard-coded
|
|
101
|
-
/// constant indicating the version of the tool used to generate the parser
|
|
102
|
-
/// and a reference to the compile-time constant {@link #VERSION}. At
|
|
103
|
-
/// runtime, this method is called during the initialization of the generated
|
|
104
|
-
/// parser to detect mismatched versions, and notify the registered listeners
|
|
105
|
-
/// prior to creating instances of the parser.</p>
|
|
106
|
-
///
|
|
107
|
-
/// <p>
|
|
108
|
-
/// This method does not perform any detection or filtering of semantic
|
|
109
|
-
/// changes between tool and runtime versions. It simply checks for a
|
|
110
|
-
/// version match and emits an error to stderr if a difference
|
|
111
|
-
/// is detected.</p>
|
|
112
|
-
///
|
|
113
|
-
/// <p>
|
|
114
|
-
/// Note that some breaking changes between releases could result in other
|
|
115
|
-
/// types of runtime exceptions, such as a [LinkageError], prior to
|
|
116
|
-
/// calling this method. In these cases, the underlying version mismatch will
|
|
117
|
-
/// not be reported here. This method is primarily intended to
|
|
118
|
-
/// notify users of potential semantic changes between releases that do not
|
|
119
|
-
/// result in binary compatibility problems which would be detected by the
|
|
120
|
-
/// class loader. As with semantic changes, changes that break binary
|
|
121
|
-
/// compatibility between releases are mentioned in the release notes
|
|
122
|
-
/// accompanying the affected release.</p>
|
|
123
|
-
///
|
|
124
|
-
/// <p>
|
|
125
|
-
/// <strong>Additional note for target developers:</strong> The version check
|
|
126
|
-
/// implemented by this class is designed to address specific compatibility
|
|
127
|
-
/// concerns that may arise during the execution of Java applications. Other
|
|
128
|
-
/// targets should consider the implementation of this method in the context
|
|
129
|
-
/// of that target's known execution environment, which may or may not
|
|
130
|
-
/// resemble the design provided for the Java target.</p>
|
|
131
|
-
///
|
|
132
|
-
/// @param generatingToolVersion The version of the tool used to generate a parser.
|
|
133
|
-
/// This value may be null when called from user code that was not generated
|
|
134
|
-
/// by, and does not reference, the ANTLR 4 Tool itself.
|
|
135
|
-
/// @param compileTimeVersion The version of the runtime the parser was
|
|
136
|
-
/// compiled against. This should always be passed using a direct reference
|
|
137
|
-
/// to [VERSION].
|
|
138
|
-
static void checkVersion(
|
|
139
|
-
String generatingToolVersion, String compileTimeVersion) {
|
|
140
|
-
final runtimeVersion = VERSION;
|
|
141
|
-
var runtimeConflictsWithGeneratingTool = false;
|
|
142
|
-
var runtimeConflictsWithCompileTimeTool = false;
|
|
143
|
-
|
|
144
|
-
if (generatingToolVersion != null) {
|
|
145
|
-
runtimeConflictsWithGeneratingTool =
|
|
146
|
-
!(runtimeVersion == generatingToolVersion) &&
|
|
147
|
-
!(getMajorMinorVersion(runtimeVersion) ==
|
|
148
|
-
getMajorMinorVersion(generatingToolVersion));
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
runtimeConflictsWithCompileTimeTool =
|
|
152
|
-
!(runtimeVersion == compileTimeVersion) &&
|
|
153
|
-
!(getMajorMinorVersion(runtimeVersion) ==
|
|
154
|
-
getMajorMinorVersion(compileTimeVersion));
|
|
155
|
-
|
|
156
|
-
if (runtimeConflictsWithGeneratingTool) {
|
|
157
|
-
log('ANTLR Tool version $generatingToolVersion used for code generation does not match the current runtime version $runtimeVersion',
|
|
158
|
-
level: Level.SEVERE.value);
|
|
159
|
-
}
|
|
160
|
-
if (runtimeConflictsWithCompileTimeTool) {
|
|
161
|
-
log('ANTLR Runtime version $compileTimeVersion used for parser compilation does not match the current runtime version $runtimeVersion',
|
|
162
|
-
level: Level.SEVERE.value);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/// Gets the major and minor version numbers from a version string. For
|
|
167
|
-
/// details about the syntax of the input [version].
|
|
168
|
-
/// E.g., from x.y.z return x.y.
|
|
169
|
-
///
|
|
170
|
-
/// @param version The complete version string.
|
|
171
|
-
/// @return A string of the form <em>major</em>.<em>minor</em> containing
|
|
172
|
-
/// only the major and minor components of the version string.
|
|
173
|
-
static String getMajorMinorVersion(String version) {
|
|
174
|
-
final firstDot = version.indexOf('.');
|
|
175
|
-
final secondDot = firstDot >= 0 ? version.indexOf('.', firstDot + 1) : -1;
|
|
176
|
-
final firstDash = version.indexOf('-');
|
|
177
|
-
var referenceLength = version.length;
|
|
178
|
-
if (secondDot >= 0) {
|
|
179
|
-
referenceLength = math.min(referenceLength, secondDot);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (firstDash >= 0) {
|
|
183
|
-
referenceLength = math.min(referenceLength, firstDash);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return version.substring(0, referenceLength);
|
|
187
|
-
}
|
|
188
|
-
}
|