@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,308 +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:math';
|
|
8
|
-
import 'dart:typed_data';
|
|
9
|
-
|
|
10
|
-
class BitSet {
|
|
11
|
-
static final Uint32List EmptyBits = Uint32List(0);
|
|
12
|
-
static const BitsPerElement = 8 * 32;
|
|
13
|
-
|
|
14
|
-
Uint32List _data = EmptyBits;
|
|
15
|
-
|
|
16
|
-
BitSet([int nbits = 0]) {
|
|
17
|
-
if (nbits == 0) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
if (nbits < 0) throw RangeError('nbits');
|
|
21
|
-
|
|
22
|
-
if (nbits > 0) {
|
|
23
|
-
final length = ((nbits + BitsPerElement - 1) / BitsPerElement).floor();
|
|
24
|
-
_data = Uint32List(length);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static int getBitCount(Uint32List value) {
|
|
29
|
-
var data = 0;
|
|
30
|
-
final size = value.length;
|
|
31
|
-
final m1 = BigInt.parse('0x5555555555555555').toInt();
|
|
32
|
-
final m2 = BigInt.parse('0x3333333333333333').toInt();
|
|
33
|
-
final m4 = BigInt.parse('0x0F0F0F0F0F0F0F0F').toInt();
|
|
34
|
-
final m8 = BigInt.parse('0x00FF00FF00FF00FF').toInt();
|
|
35
|
-
final m16 = BigInt.parse('0x0000FFFF0000FFFF').toInt();
|
|
36
|
-
final h01 = BigInt.parse('0x0101010101010101').toInt();
|
|
37
|
-
|
|
38
|
-
var bitCount = 0;
|
|
39
|
-
final limit30 = size - size % 30;
|
|
40
|
-
|
|
41
|
-
// 64-bit tree merging (merging3)
|
|
42
|
-
for (var i = 0; i < limit30; i += 30, data += 30) {
|
|
43
|
-
var acc = 0;
|
|
44
|
-
for (var j = 0; j < 30; j += 3) {
|
|
45
|
-
var count1 = value[data + j];
|
|
46
|
-
var count2 = value[data + j + 1];
|
|
47
|
-
var half1 = value[data + j + 2];
|
|
48
|
-
var half2 = half1;
|
|
49
|
-
half1 &= m1;
|
|
50
|
-
half2 = (half2 >> 1) & m1;
|
|
51
|
-
count1 -= (count1 >> 1) & m1;
|
|
52
|
-
count2 -= (count2 >> 1) & m1;
|
|
53
|
-
count1 += half1;
|
|
54
|
-
count2 += half2;
|
|
55
|
-
count1 = (count1 & m2) + ((count1 >> 2) & m2);
|
|
56
|
-
count1 += (count2 & m2) + ((count2 >> 2) & m2);
|
|
57
|
-
acc += (count1 & m4) + ((count1 >> 4) & m4);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
acc = (acc & m8) + ((acc >> 8) & m8);
|
|
61
|
-
acc = (acc + (acc >> 16)) & m16;
|
|
62
|
-
acc = acc + (acc >> 32);
|
|
63
|
-
bitCount += acc;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// count the bits of the remaining bytes (MAX 29*8) using
|
|
67
|
-
// "Counting bits set, in parallel" from the "Bit Twiddling Hacks",
|
|
68
|
-
// the code uses wikipedia's 64-bit popcount_3() implementation:
|
|
69
|
-
// http://en.wikipedia.org/wiki/Hamming_weight#Efficient_implementation
|
|
70
|
-
for (var i = 0; i < size - limit30; i++) {
|
|
71
|
-
var x = value[data + i];
|
|
72
|
-
x = x - ((x >> 1) & m1);
|
|
73
|
-
x = (x & m2) + ((x >> 2) & m2);
|
|
74
|
-
x = (x + (x >> 4)) & m4;
|
|
75
|
-
bitCount += ((x * h01) >> 56);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return bitCount;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
static final List<int> index64 = [
|
|
82
|
-
0,
|
|
83
|
-
47,
|
|
84
|
-
1,
|
|
85
|
-
56,
|
|
86
|
-
48,
|
|
87
|
-
27,
|
|
88
|
-
2,
|
|
89
|
-
60,
|
|
90
|
-
57,
|
|
91
|
-
49,
|
|
92
|
-
41,
|
|
93
|
-
37,
|
|
94
|
-
28,
|
|
95
|
-
16,
|
|
96
|
-
3,
|
|
97
|
-
61,
|
|
98
|
-
54,
|
|
99
|
-
58,
|
|
100
|
-
35,
|
|
101
|
-
52,
|
|
102
|
-
50,
|
|
103
|
-
42,
|
|
104
|
-
21,
|
|
105
|
-
44,
|
|
106
|
-
38,
|
|
107
|
-
32,
|
|
108
|
-
29,
|
|
109
|
-
23,
|
|
110
|
-
17,
|
|
111
|
-
11,
|
|
112
|
-
4,
|
|
113
|
-
62,
|
|
114
|
-
46,
|
|
115
|
-
55,
|
|
116
|
-
26,
|
|
117
|
-
59,
|
|
118
|
-
40,
|
|
119
|
-
36,
|
|
120
|
-
15,
|
|
121
|
-
53,
|
|
122
|
-
34,
|
|
123
|
-
51,
|
|
124
|
-
20,
|
|
125
|
-
43,
|
|
126
|
-
31,
|
|
127
|
-
22,
|
|
128
|
-
10,
|
|
129
|
-
45,
|
|
130
|
-
25,
|
|
131
|
-
39,
|
|
132
|
-
14,
|
|
133
|
-
33,
|
|
134
|
-
19,
|
|
135
|
-
30,
|
|
136
|
-
9,
|
|
137
|
-
24,
|
|
138
|
-
13,
|
|
139
|
-
18,
|
|
140
|
-
8,
|
|
141
|
-
12,
|
|
142
|
-
7,
|
|
143
|
-
6,
|
|
144
|
-
5,
|
|
145
|
-
63
|
|
146
|
-
];
|
|
147
|
-
|
|
148
|
-
static int BitScanForward(int value) {
|
|
149
|
-
if (value == 0) return -1;
|
|
150
|
-
|
|
151
|
-
final debruijn64 = BigInt.parse('0x03f79d71b4cb0a89');
|
|
152
|
-
final temp = (BigInt.from(((value ^ (value - 1)))) * debruijn64 >> 58);
|
|
153
|
-
return index64[(temp % BigInt.from(64)).toInt()];
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
BitSet clone() {
|
|
157
|
-
final result = BitSet();
|
|
158
|
-
result._data = List.from(_data);
|
|
159
|
-
return result;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
void clear(int index) {
|
|
163
|
-
if (index < 0) throw RangeError('index');
|
|
164
|
-
|
|
165
|
-
final element = (index / BitsPerElement).floor();
|
|
166
|
-
if (element >= _data.length) return;
|
|
167
|
-
|
|
168
|
-
_data[element] &= ~(1 << (index % BitsPerElement));
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
bool operator [](int index) {
|
|
172
|
-
return get(index);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
bool get(int index) {
|
|
176
|
-
if (index < 0) throw RangeError('index');
|
|
177
|
-
|
|
178
|
-
final element = (index / BitsPerElement).floor();
|
|
179
|
-
if (element >= _data.length) return false;
|
|
180
|
-
|
|
181
|
-
return (_data[element] & (1 << (index % BitsPerElement))) != 0;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
void set(int index) {
|
|
185
|
-
if (index < 0) throw RangeError('index');
|
|
186
|
-
|
|
187
|
-
final element = (index / BitsPerElement).floor();
|
|
188
|
-
if (element >= _data.length) {
|
|
189
|
-
final newList = Uint32List(max(_data.length * 2, element + 1))
|
|
190
|
-
..setRange(0, _data.length, _data);
|
|
191
|
-
_data = newList;
|
|
192
|
-
}
|
|
193
|
-
_data[element] |= 1 << (index % BitsPerElement);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
bool get isEmpty {
|
|
197
|
-
for (var i = 0; i < _data.length; i++) {
|
|
198
|
-
if (_data[i] != 0) return false;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
return true;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
int get cardinality {
|
|
205
|
-
return getBitCount(_data);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
int nextset(int fromIndex) {
|
|
209
|
-
if (fromIndex < 0) throw RangeError('fromIndex');
|
|
210
|
-
|
|
211
|
-
if (isEmpty) return -1;
|
|
212
|
-
|
|
213
|
-
var i = (fromIndex / BitsPerElement).floor();
|
|
214
|
-
if (i >= _data.length) return -1;
|
|
215
|
-
|
|
216
|
-
var current = _data[i] & ~((1 << (fromIndex % BitsPerElement)) - 1);
|
|
217
|
-
|
|
218
|
-
while (true) {
|
|
219
|
-
final bit = BitScanForward(current);
|
|
220
|
-
if (bit >= 0) return bit + i * BitsPerElement;
|
|
221
|
-
|
|
222
|
-
i++;
|
|
223
|
-
if (i >= _data.length) break;
|
|
224
|
-
|
|
225
|
-
current = _data[i];
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return -1;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
void and(BitSet set) {
|
|
232
|
-
if (set == null) throw ArgumentError.notNull('set');
|
|
233
|
-
|
|
234
|
-
final length = min(_data.length, set._data.length);
|
|
235
|
-
for (var i = 0; i < length; i++) {
|
|
236
|
-
_data[i] &= set._data[i];
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
for (var i = length; i < _data.length; i++) {
|
|
240
|
-
_data[i] = 0;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
void or(BitSet set) {
|
|
245
|
-
if (set == null) throw ArgumentError.notNull('set');
|
|
246
|
-
|
|
247
|
-
if (set._data.length > _data.length) {
|
|
248
|
-
final newList = Uint32List(set._data.length)
|
|
249
|
-
..setRange(0, _data.length, _data);
|
|
250
|
-
_data = newList;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
for (var i = 0; i < set._data.length; i++) {
|
|
254
|
-
_data[i] |= set._data[i];
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
@override
|
|
259
|
-
bool operator ==(obj) {
|
|
260
|
-
final other = obj as BitSet;
|
|
261
|
-
if (other == null) return false;
|
|
262
|
-
|
|
263
|
-
if (isEmpty) return other.isEmpty;
|
|
264
|
-
|
|
265
|
-
final minlength = min(_data.length, other._data.length);
|
|
266
|
-
for (var i = 0; i < minlength; i++) {
|
|
267
|
-
if (_data[i] != other._data[i]) return false;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
for (var i = minlength; i < _data.length; i++) {
|
|
271
|
-
if (_data[i] != 0) return false;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
for (var i = minlength; i < other._data.length; i++) {
|
|
275
|
-
if (other._data[i] != 0) return false;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
return true;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
@override
|
|
282
|
-
int get hashCode {
|
|
283
|
-
var result = 1;
|
|
284
|
-
for (var i = 0; i < _data.length; i++) {
|
|
285
|
-
if (_data[i] != 0) {
|
|
286
|
-
result = result * 31 ^ i;
|
|
287
|
-
result = result * 31 ^ _data[i];
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
return result.hashCode;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
@override
|
|
295
|
-
String toString() {
|
|
296
|
-
final builder = StringBuffer();
|
|
297
|
-
builder.write('{');
|
|
298
|
-
|
|
299
|
-
for (var i = nextset(0); i >= 0; i = nextset(i + 1)) {
|
|
300
|
-
if (builder.length > 1) builder.write(', ');
|
|
301
|
-
|
|
302
|
-
builder.write(i);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
builder.write('}');
|
|
306
|
-
return builder.toString();
|
|
307
|
-
}
|
|
308
|
-
}
|
|
@@ -1,77 +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
|
-
class MurmurHash {
|
|
8
|
-
static final int DEFAULT_SEED = 0;
|
|
9
|
-
|
|
10
|
-
/// Initialize the hash using the specified [seed].
|
|
11
|
-
///
|
|
12
|
-
/// @param seed the seed
|
|
13
|
-
/// @return the intermediate hash value
|
|
14
|
-
static int initialize([int seed]) {
|
|
15
|
-
return seed ?? DEFAULT_SEED;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/// Update the intermediate hash value for the next input [value].
|
|
19
|
-
///
|
|
20
|
-
/// @param hash the intermediate hash value
|
|
21
|
-
/// @param value the value to add to the current hash
|
|
22
|
-
/// @return the updated intermediate hash value
|
|
23
|
-
static int update(int hash, [value]) {
|
|
24
|
-
final c1 = 0xCC9E2D51;
|
|
25
|
-
final c2 = 0x1B873593;
|
|
26
|
-
final r1 = 15;
|
|
27
|
-
final r2 = 13;
|
|
28
|
-
final m = 5;
|
|
29
|
-
final n = 0xE6546B64;
|
|
30
|
-
|
|
31
|
-
var k = value is int ? value : value?.hashCode ?? 0;
|
|
32
|
-
|
|
33
|
-
k = k * c1;
|
|
34
|
-
k = (k << r1) | (k >> (32 - r1));
|
|
35
|
-
k = k * c2;
|
|
36
|
-
|
|
37
|
-
hash = hash ^ k;
|
|
38
|
-
hash = (hash << r2) | (hash >> (32 - r2));
|
|
39
|
-
hash = hash * m + n;
|
|
40
|
-
|
|
41
|
-
return hash;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/// Apply the final computation steps to the intermediate value [hash]
|
|
45
|
-
/// to form the final result of the MurmurHash 3 hash function.
|
|
46
|
-
///
|
|
47
|
-
/// @param hash the intermediate hash value
|
|
48
|
-
/// @param numberOfWords the number of integer values added to the hash
|
|
49
|
-
/// @return the final hash result
|
|
50
|
-
static int finish(int hash, int numberOfWords) {
|
|
51
|
-
hash = hash ^ (numberOfWords * 4);
|
|
52
|
-
hash = hash ^ (hash >> 16);
|
|
53
|
-
hash = hash * 0x85EBCA6B;
|
|
54
|
-
hash = hash ^ (hash >> 13);
|
|
55
|
-
hash = hash * 0xC2B2AE35;
|
|
56
|
-
hash = hash ^ (hash >> 16);
|
|
57
|
-
return hash;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/// Utility function to compute the hash code of an array using the
|
|
61
|
-
/// MurmurHash algorithm.
|
|
62
|
-
///
|
|
63
|
-
/// @param <T> the array element type
|
|
64
|
-
/// @param data the array data
|
|
65
|
-
/// @param seed the seed for the MurmurHash algorithm
|
|
66
|
-
/// @return the hash code of the data
|
|
67
|
-
static int getHashCode<T>(List<T> data, int seed) {
|
|
68
|
-
var hash = initialize(seed);
|
|
69
|
-
|
|
70
|
-
for (var value in data) {
|
|
71
|
-
hash = update(hash, value);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
hash = finish(hash, data.length);
|
|
75
|
-
return hash;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,31 +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
|
-
/// Convert array of strings to string→index map. Useful for
|
|
8
|
-
/// converting rulenames to name→ruleindex map.
|
|
9
|
-
Map<String, int> toMap(List<String> keys) {
|
|
10
|
-
final m = {};
|
|
11
|
-
for (var i = 0; i < keys.length; i++) {
|
|
12
|
-
m[keys[i]] = i;
|
|
13
|
-
}
|
|
14
|
-
return m;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
String arrayToString(a) {
|
|
18
|
-
return '[' + a.join(', ') + ']';
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
String escapeWhitespace(String s, [bool escapeSpaces = false]) {
|
|
22
|
-
if (escapeSpaces) s = s.replaceAll(' ', '\u00B7');
|
|
23
|
-
s = s.replaceAll('\n', r'\n');
|
|
24
|
-
s = s.replaceAll('\r', r'\r');
|
|
25
|
-
s = s.replaceAll('\t', r'\t');
|
|
26
|
-
return s;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
bool isLowerCase(String s) => s.toLowerCase() == s;
|
|
30
|
-
|
|
31
|
-
bool isUpperCase(String s) => s.toUpperCase() == s;
|
|
@@ -1,254 +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:math';
|
|
8
|
-
|
|
9
|
-
import 'token.dart';
|
|
10
|
-
|
|
11
|
-
/// This interface provides information about the vocabulary used by a
|
|
12
|
-
/// recognizer.
|
|
13
|
-
///
|
|
14
|
-
/// @see Recognizer#getVocabulary()
|
|
15
|
-
abstract class Vocabulary {
|
|
16
|
-
/// Returns the highest token type value. It can be used to iterate from
|
|
17
|
-
/// zero to that number, inclusively, thus querying all stored entries.
|
|
18
|
-
/// @return the highest token type value
|
|
19
|
-
int get maxTokenType;
|
|
20
|
-
|
|
21
|
-
/// Gets the string literal associated with a token type. The string returned
|
|
22
|
-
/// by this method, when not null, can be used unaltered in a parser
|
|
23
|
-
/// grammar to represent this token type.
|
|
24
|
-
///
|
|
25
|
-
/// <p>The following table shows examples of lexer rules and the literal
|
|
26
|
-
/// names assigned to the corresponding token types.</p>
|
|
27
|
-
///
|
|
28
|
-
/// <table>
|
|
29
|
-
/// <tr>
|
|
30
|
-
/// <th>Rule</th>
|
|
31
|
-
/// <th>Literal Name</th>
|
|
32
|
-
/// <th>Java String Literal</th>
|
|
33
|
-
/// </tr>
|
|
34
|
-
/// <tr>
|
|
35
|
-
/// <td>{@code THIS : 'this';}</td>
|
|
36
|
-
/// <td>{@code 'this'}</td>
|
|
37
|
-
/// <td>{@code "'this'"}</td>
|
|
38
|
-
/// </tr>
|
|
39
|
-
/// <tr>
|
|
40
|
-
/// <td>{@code SQUOTE : '\'';}</td>
|
|
41
|
-
/// <td>{@code '\''}</td>
|
|
42
|
-
/// <td>{@code "'\\''"}</td>
|
|
43
|
-
/// </tr>
|
|
44
|
-
/// <tr>
|
|
45
|
-
/// <td>{@code ID : [A-Z]+;}</td>
|
|
46
|
-
/// <td>n/a</td>
|
|
47
|
-
/// <td>null</td>
|
|
48
|
-
/// </tr>
|
|
49
|
-
/// </table>
|
|
50
|
-
///
|
|
51
|
-
/// @param tokenType The token type.
|
|
52
|
-
///
|
|
53
|
-
/// @return The string literal associated with the specified token type, or
|
|
54
|
-
/// null if no string literal is associated with the type.
|
|
55
|
-
String getLiteralName(int tokenType);
|
|
56
|
-
|
|
57
|
-
/// Gets the symbolic name associated with a token type. The string returned
|
|
58
|
-
/// by this method, when not null, can be used unaltered in a parser
|
|
59
|
-
/// grammar to represent this token type.
|
|
60
|
-
///
|
|
61
|
-
/// <p>This method supports token types defined by any of the following
|
|
62
|
-
/// methods:</p>
|
|
63
|
-
///
|
|
64
|
-
/// <ul>
|
|
65
|
-
/// <li>Tokens created by lexer rules.</li>
|
|
66
|
-
/// <li>Tokens defined in a <code>tokens{}</code> block in a lexer or parser
|
|
67
|
-
/// grammar.</li>
|
|
68
|
-
/// <li>The implicitly defined [EOF] token, which has the token type
|
|
69
|
-
/// {@link Token#EOF}.</li>
|
|
70
|
-
/// </ul>
|
|
71
|
-
///
|
|
72
|
-
/// <p>The following table shows examples of lexer rules and the literal
|
|
73
|
-
/// names assigned to the corresponding token types.</p>
|
|
74
|
-
///
|
|
75
|
-
/// <table>
|
|
76
|
-
/// <tr>
|
|
77
|
-
/// <th>Rule</th>
|
|
78
|
-
/// <th>Symbolic Name</th>
|
|
79
|
-
/// </tr>
|
|
80
|
-
/// <tr>
|
|
81
|
-
/// <td>{@code THIS : 'this';}</td>
|
|
82
|
-
/// <td>[THIS]</td>
|
|
83
|
-
/// </tr>
|
|
84
|
-
/// <tr>
|
|
85
|
-
/// <td>{@code SQUOTE : '\'';}</td>
|
|
86
|
-
/// <td>[SQUOTE]</td>
|
|
87
|
-
/// </tr>
|
|
88
|
-
/// <tr>
|
|
89
|
-
/// <td>{@code ID : [A-Z]+;}</td>
|
|
90
|
-
/// <td>[ID]</td>
|
|
91
|
-
/// </tr>
|
|
92
|
-
/// </table>
|
|
93
|
-
///
|
|
94
|
-
/// @param tokenType The token type.
|
|
95
|
-
///
|
|
96
|
-
/// @return The symbolic name associated with the specified token type, or
|
|
97
|
-
/// null if no symbolic name is associated with the type.
|
|
98
|
-
String getSymbolicName(int tokenType);
|
|
99
|
-
|
|
100
|
-
/// Gets the display name of a token type.
|
|
101
|
-
///
|
|
102
|
-
/// <p>ANTLR provides a default implementation of this method, but
|
|
103
|
-
/// applications are free to override the behavior in any manner which makes
|
|
104
|
-
/// sense for the application. The default implementation returns the first
|
|
105
|
-
/// result from the following list which produces a non-null
|
|
106
|
-
/// result.</p>
|
|
107
|
-
///
|
|
108
|
-
/// <ol>
|
|
109
|
-
/// <li>The result of {@link #getLiteralName}</li>
|
|
110
|
-
/// <li>The result of {@link #getSymbolicName}</li>
|
|
111
|
-
/// <li>The result of {@link Integer#toString}</li>
|
|
112
|
-
/// </ol>
|
|
113
|
-
///
|
|
114
|
-
/// @param tokenType The token type.
|
|
115
|
-
///
|
|
116
|
-
/// @return The display name of the token type, for use in error reporting or
|
|
117
|
-
/// other user-visible messages which reference specific token types.
|
|
118
|
-
String getDisplayName(int tokenType);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/// This class provides a default implementation of the [Vocabulary]
|
|
122
|
-
/// interface.
|
|
123
|
-
class VocabularyImpl implements Vocabulary {
|
|
124
|
-
static const List<String> EMPTY_NAMES = [];
|
|
125
|
-
|
|
126
|
-
/// Gets an empty [Vocabulary] instance.
|
|
127
|
-
///
|
|
128
|
-
/// <p>
|
|
129
|
-
/// No literal or symbol names are assigned to token types, so
|
|
130
|
-
/// {@link #getDisplayName(int)} returns the numeric value for all tokens
|
|
131
|
-
/// except {@link Token#EOF}.</p>
|
|
132
|
-
static final VocabularyImpl EMPTY_VOCABULARY =
|
|
133
|
-
VocabularyImpl(EMPTY_NAMES, EMPTY_NAMES, EMPTY_NAMES);
|
|
134
|
-
|
|
135
|
-
final List<String> literalNames;
|
|
136
|
-
|
|
137
|
-
final List<String> symbolicNames;
|
|
138
|
-
|
|
139
|
-
final List<String> displayNames;
|
|
140
|
-
|
|
141
|
-
@override
|
|
142
|
-
int maxTokenType;
|
|
143
|
-
|
|
144
|
-
/// Constructs a new instance of [VocabularyImpl] from the specified
|
|
145
|
-
/// literal, symbolic, and display token names.
|
|
146
|
-
///
|
|
147
|
-
/// @param literalNames The literal names assigned to tokens, or null
|
|
148
|
-
/// if no literal names are assigned.
|
|
149
|
-
/// @param symbolicNames The symbolic names assigned to tokens, or
|
|
150
|
-
/// null if no symbolic names are assigned.
|
|
151
|
-
/// @param displayNames The display names assigned to tokens, or null
|
|
152
|
-
/// to use the values in [literalNames] and [symbolicNames] as
|
|
153
|
-
/// the source of display names, as described in
|
|
154
|
-
/// {@link #getDisplayName(int)}.
|
|
155
|
-
///
|
|
156
|
-
/// @see #getLiteralName(int)
|
|
157
|
-
/// @see #getSymbolicName(int)
|
|
158
|
-
/// @see #getDisplayName(int)
|
|
159
|
-
VocabularyImpl(this.literalNames, this.symbolicNames,
|
|
160
|
-
[this.displayNames = EMPTY_NAMES]) {
|
|
161
|
-
// See note here on -1 part: https://github.com/antlr/antlr4/pull/1146
|
|
162
|
-
maxTokenType = max(displayNames.length,
|
|
163
|
-
max(literalNames.length, symbolicNames.length)) -
|
|
164
|
-
1;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/// Returns a [VocabularyImpl] instance from the specified set of token
|
|
168
|
-
/// names. This method acts as a compatibility layer for the single
|
|
169
|
-
/// [tokenNames] array generated by previous releases of ANTLR.
|
|
170
|
-
///
|
|
171
|
-
/// <p>The resulting vocabulary instance returns null for
|
|
172
|
-
/// {@link #getLiteralName(int)} and {@link #getSymbolicName(int)}, and the
|
|
173
|
-
/// value from [tokenNames] for the display names.</p>
|
|
174
|
-
///
|
|
175
|
-
/// @param tokenNames The token names, or null if no token names are
|
|
176
|
-
/// available.
|
|
177
|
-
/// @return A [Vocabulary] instance which uses [tokenNames] for
|
|
178
|
-
/// the display names of tokens.
|
|
179
|
-
static Vocabulary fromTokenNames(List<String> tokenNames) {
|
|
180
|
-
if (tokenNames == null || tokenNames.isEmpty) {
|
|
181
|
-
return EMPTY_VOCABULARY;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
final literalNames = List<String>.from(tokenNames);
|
|
185
|
-
final symbolicNames = List<String>.from(tokenNames);
|
|
186
|
-
for (var i = 0; i < tokenNames.length; i++) {
|
|
187
|
-
final tokenName = tokenNames[i];
|
|
188
|
-
if (tokenName == null) {
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if (tokenName.isNotEmpty) {
|
|
193
|
-
final firstChar = tokenName[0];
|
|
194
|
-
if (firstChar == '\'') {
|
|
195
|
-
symbolicNames[i] = null;
|
|
196
|
-
continue;
|
|
197
|
-
} else if (firstChar.toUpperCase() == firstChar) {
|
|
198
|
-
literalNames[i] = null;
|
|
199
|
-
continue;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// wasn't a literal or symbolic name
|
|
204
|
-
literalNames[i] = null;
|
|
205
|
-
symbolicNames[i] = null;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return VocabularyImpl(literalNames, symbolicNames, tokenNames);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
@override
|
|
212
|
-
String getLiteralName(int tokenType) {
|
|
213
|
-
if (tokenType >= 0 && tokenType < literalNames.length) {
|
|
214
|
-
return literalNames[tokenType];
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
return null;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
@override
|
|
221
|
-
String getSymbolicName(int tokenType) {
|
|
222
|
-
if (tokenType >= 0 && tokenType < symbolicNames.length) {
|
|
223
|
-
return symbolicNames[tokenType];
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
if (tokenType == Token.EOF) {
|
|
227
|
-
return 'EOF';
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
return null;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
@override
|
|
234
|
-
String getDisplayName(int tokenType) {
|
|
235
|
-
if (tokenType >= 0 && tokenType < displayNames.length) {
|
|
236
|
-
final displayName = displayNames[tokenType];
|
|
237
|
-
if (displayName != null) {
|
|
238
|
-
return displayName;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
final literalName = getLiteralName(tokenType);
|
|
243
|
-
if (literalName != null) {
|
|
244
|
-
return literalName;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
final symbolicName = getSymbolicName(tokenType);
|
|
248
|
-
if (symbolicName != null) {
|
|
249
|
-
return symbolicName;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
return tokenType.toString();
|
|
253
|
-
}
|
|
254
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
name: "antlr4"
|
|
2
|
-
version: "4.9.2"
|
|
3
|
-
description: "New Dart runtime for ANTLR4."
|
|
4
|
-
homepage: "https://github.com/antlr/antlr4"
|
|
5
|
-
license: "BSD-3-Clause"
|
|
6
|
-
dependencies:
|
|
7
|
-
logging: ^0.11.4
|
|
8
|
-
collection: ^1.14.12
|
|
9
|
-
dev_dependencies:
|
|
10
|
-
pedantic: ^1.0.0
|
|
11
|
-
|
|
12
|
-
environment:
|
|
13
|
-
sdk: ">=2.7.0 <3.0.0"
|