@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.
Files changed (158) hide show
  1. package/__tests__/end-to-end.test.ts +256 -0
  2. package/coverage/clover.xml +12857 -0
  3. package/coverage/coverage-final.json +3 -0
  4. package/coverage/lcov-report/base.css +224 -0
  5. package/coverage/lcov-report/block-navigation.js +79 -0
  6. package/coverage/lcov-report/favicon.png +0 -0
  7. package/coverage/lcov-report/index.html +126 -0
  8. package/coverage/lcov-report/index.js.html +104 -0
  9. package/coverage/lcov-report/out.js.html +41126 -0
  10. package/coverage/lcov-report/prettify.css +1 -0
  11. package/coverage/lcov-report/prettify.js +2 -0
  12. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  13. package/coverage/lcov-report/sorter.js +170 -0
  14. package/coverage/lcov.info +24801 -0
  15. package/index.d.ts +118 -0
  16. package/index.js +8 -0
  17. package/index.ts +141 -0
  18. package/jest.config.js +11 -0
  19. package/out.js +13708 -0
  20. package/package.json +22 -17
  21. package/tsconfig.json +5 -3
  22. package/.idea/apexdocs-dart.iml +0 -18
  23. package/.idea/jsLibraryMappings.xml +0 -6
  24. package/.idea/libraries/Dart_Packages.xml +0 -556
  25. package/.idea/libraries/Dart_SDK.xml +0 -28
  26. package/.idea/misc.xml +0 -6
  27. package/.idea/modules.xml +0 -8
  28. package/.idea/runConfigurations/_template__of_Dart_Test.xml +0 -6
  29. package/.idea/vcs.xml +0 -6
  30. package/CHANGELOG.md +0 -3
  31. package/README.md +0 -26
  32. package/TODO.md +0 -5
  33. package/analysis_options.yaml +0 -30
  34. package/antlr4-4.9.2/CHANGELOG.md +0 -4
  35. package/antlr4-4.9.2/LICENSE +0 -52
  36. package/antlr4-4.9.2/README.md +0 -11
  37. package/antlr4-4.9.2/analysis_options.yaml +0 -1
  38. package/antlr4-4.9.2/lib/antlr4.dart +0 -21
  39. package/antlr4-4.9.2/lib/src/atn/atn.dart +0 -18
  40. package/antlr4-4.9.2/lib/src/atn/src/atn.dart +0 -170
  41. package/antlr4-4.9.2/lib/src/atn/src/atn_config.dart +0 -242
  42. package/antlr4-4.9.2/lib/src/atn/src/atn_config_set.dart +0 -283
  43. package/antlr4-4.9.2/lib/src/atn/src/atn_deserializer.dart +0 -809
  44. package/antlr4-4.9.2/lib/src/atn/src/atn_simulator.dart +0 -95
  45. package/antlr4-4.9.2/lib/src/atn/src/atn_state.dart +0 -296
  46. package/antlr4-4.9.2/lib/src/atn/src/atn_type.dart +0 -14
  47. package/antlr4-4.9.2/lib/src/atn/src/info.dart +0 -553
  48. package/antlr4-4.9.2/lib/src/atn/src/lexer_action.dart +0 -601
  49. package/antlr4-4.9.2/lib/src/atn/src/lexer_action_executor.dart +0 -167
  50. package/antlr4-4.9.2/lib/src/atn/src/lexer_atn_simulator.dart +0 -731
  51. package/antlr4-4.9.2/lib/src/atn/src/parser_atn_simulator.dart +0 -2630
  52. package/antlr4-4.9.2/lib/src/atn/src/profiling_atn_simulator.dart +0 -229
  53. package/antlr4-4.9.2/lib/src/atn/src/semantic_context.dart +0 -404
  54. package/antlr4-4.9.2/lib/src/atn/src/transition.dart +0 -305
  55. package/antlr4-4.9.2/lib/src/dfa/dfa.dart +0 -8
  56. package/antlr4-4.9.2/lib/src/dfa/src/dfa.dart +0 -138
  57. package/antlr4-4.9.2/lib/src/dfa/src/dfa_serializer.dart +0 -76
  58. package/antlr4-4.9.2/lib/src/dfa/src/dfa_state.dart +0 -151
  59. package/antlr4-4.9.2/lib/src/error/error.dart +0 -10
  60. package/antlr4-4.9.2/lib/src/error/src/diagnostic_error_listener.dart +0 -116
  61. package/antlr4-4.9.2/lib/src/error/src/error_listener.dart +0 -241
  62. package/antlr4-4.9.2/lib/src/error/src/error_strategy.dart +0 -902
  63. package/antlr4-4.9.2/lib/src/error/src/errors.dart +0 -204
  64. package/antlr4-4.9.2/lib/src/input_stream.dart +0 -335
  65. package/antlr4-4.9.2/lib/src/interval_set.dart +0 -735
  66. package/antlr4-4.9.2/lib/src/lexer.dart +0 -343
  67. package/antlr4-4.9.2/lib/src/ll1_analyzer.dart +0 -204
  68. package/antlr4-4.9.2/lib/src/misc/multi_map.dart +0 -32
  69. package/antlr4-4.9.2/lib/src/misc/pair.dart +0 -34
  70. package/antlr4-4.9.2/lib/src/parser.dart +0 -777
  71. package/antlr4-4.9.2/lib/src/parser_interpreter.dart +0 -393
  72. package/antlr4-4.9.2/lib/src/parser_rule_context.dart +0 -275
  73. package/antlr4-4.9.2/lib/src/prediction_context.dart +0 -877
  74. package/antlr4-4.9.2/lib/src/recognizer.dart +0 -182
  75. package/antlr4-4.9.2/lib/src/rule_context.dart +0 -192
  76. package/antlr4-4.9.2/lib/src/runtime_meta_data.dart +0 -188
  77. package/antlr4-4.9.2/lib/src/token.dart +0 -431
  78. package/antlr4-4.9.2/lib/src/token_factory.dart +0 -88
  79. package/antlr4-4.9.2/lib/src/token_source.dart +0 -241
  80. package/antlr4-4.9.2/lib/src/token_stream.dart +0 -627
  81. package/antlr4-4.9.2/lib/src/tree/src/pattern/chunk.dart +0 -90
  82. package/antlr4-4.9.2/lib/src/tree/src/pattern/parse_tree_match.dart +0 -635
  83. package/antlr4-4.9.2/lib/src/tree/src/tree.dart +0 -370
  84. package/antlr4-4.9.2/lib/src/tree/src/trees.dart +0 -226
  85. package/antlr4-4.9.2/lib/src/tree/tree.dart +0 -10
  86. package/antlr4-4.9.2/lib/src/util/bit_set.dart +0 -308
  87. package/antlr4-4.9.2/lib/src/util/murmur_hash.dart +0 -77
  88. package/antlr4-4.9.2/lib/src/util/utils.dart +0 -31
  89. package/antlr4-4.9.2/lib/src/vocabulary.dart +0 -254
  90. package/antlr4-4.9.2/pubspec.yaml +0 -13
  91. package/example/node_example/index.js +0 -8
  92. package/example/node_example/package.json +0 -12
  93. package/example/node_example_ts/package-lock.json +0 -70
  94. package/example/node_example_ts/package.json +0 -19
  95. package/example/node_example_ts/src/index.js +0 -5
  96. package/example/node_example_ts/src/index.ts +0 -9
  97. package/example/node_example_ts/tsconfig.json +0 -79
  98. package/js/dart2jsout.js +0 -25898
  99. package/js/dart2jsout.js.map +0 -16
  100. package/js/index.d.ts +0 -1
  101. package/js/index.js +0 -4
  102. package/js/out.js +0 -26023
  103. package/js/out.js.map +0 -16
  104. package/js/package-lock.json +0 -57
  105. package/js/preamble.js +0 -125
  106. package/lib/apexdocs_dart.dart +0 -28
  107. package/lib/src/antlr/grammars/Apexdoc/ApexdocLexer.g4 +0 -120
  108. package/lib/src/antlr/grammars/Apexdoc/ApexdocParser.g4 +0 -158
  109. package/lib/src/antlr/grammars/Apexdoc/gen/ApexdocLexer.interp +0 -95
  110. package/lib/src/antlr/grammars/Apexdoc/gen/ApexdocLexer.java +0 -238
  111. package/lib/src/antlr/grammars/Apexdoc/gen/ApexdocLexer.tokens +0 -23
  112. package/lib/src/antlr/grammars/apex/ApexLexer.g4 +0 -255
  113. package/lib/src/antlr/grammars/apex/ApexParser.g4 +0 -567
  114. package/lib/src/antlr/grammars/apex/examples/ApexClass.cls +0 -6
  115. package/lib/src/antlr/lib/apex/ApexLexer.dart +0 -1223
  116. package/lib/src/antlr/lib/apex/ApexLexer.interp +0 -393
  117. package/lib/src/antlr/lib/apex/ApexLexer.tokens +0 -212
  118. package/lib/src/antlr/lib/apex/ApexParser.dart +0 -9349
  119. package/lib/src/antlr/lib/apex/ApexParser.interp +0 -326
  120. package/lib/src/antlr/lib/apex/ApexParser.tokens +0 -212
  121. package/lib/src/antlr/lib/apex/ApexParserBaseListener.dart +0 -1036
  122. package/lib/src/antlr/lib/apex/ApexParserListener.dart +0 -975
  123. package/lib/src/antlr/lib/apexdoc/ApexdocLexer.dart +0 -373
  124. package/lib/src/antlr/lib/apexdoc/ApexdocLexer.interp +0 -95
  125. package/lib/src/antlr/lib/apexdoc/ApexdocLexer.tokens +0 -23
  126. package/lib/src/antlr/lib/apexdoc/ApexdocParser.dart +0 -2471
  127. package/lib/src/antlr/lib/apexdoc/ApexdocParser.interp +0 -69
  128. package/lib/src/antlr/lib/apexdoc/ApexdocParser.tokens +0 -23
  129. package/lib/src/antlr/lib/apexdoc/ApexdocParserBaseListener.dart +0 -252
  130. package/lib/src/antlr/lib/apexdoc/ApexdocParserListener.dart +0 -215
  131. package/lib/src/builders/builders.dart +0 -32
  132. package/lib/src/model/apex_file_manifest.dart +0 -37
  133. package/lib/src/model/apex_file_manifest.g.dart +0 -18
  134. package/lib/src/model/declaration.dart +0 -50
  135. package/lib/src/model/doc_comment.dart +0 -117
  136. package/lib/src/model/doc_comment.g.dart +0 -118
  137. package/lib/src/model/members.dart +0 -143
  138. package/lib/src/model/members.g.dart +0 -105
  139. package/lib/src/model/types.dart +0 -159
  140. package/lib/src/model/types.g.dart +0 -111
  141. package/lib/src/service/apex_listener.dart +0 -226
  142. package/lib/src/service/apexdoc_listener.dart +0 -82
  143. package/lib/src/service/parsers.dart +0 -33
  144. package/lib/src/service/utils/parsing/access_modifiers_parser.dart +0 -33
  145. package/lib/src/service/utils/parsing/parameters_parser.dart +0 -18
  146. package/lib/src/service/utils/parsing/parsing_utils.dart +0 -2
  147. package/lib/src/service/walker.dart +0 -82
  148. package/pubspec.yaml +0 -19
  149. package/test/apex_file_manifest_test.dart +0 -16
  150. package/test/apex_listener_test.dart +0 -703
  151. package/test/apexdoc_parser_test.dart +0 -179
  152. package/test/doc_comment_test.dart +0 -89
  153. package/test/members_serialization_test.dart +0 -158
  154. package/test/members_test.dart +0 -178
  155. package/test/types_serialization_test.dart +0 -191
  156. package/test/types_test.dart +0 -311
  157. package/test/walker_test.dart +0 -58
  158. package/tool/grind.dart +0 -20
@@ -1,601 +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 '../../lexer.dart';
8
- import '../../util/murmur_hash.dart';
9
-
10
- /// Represents the serialization type of a [LexerAction].
11
- ///
12
- /// @since 4.2
13
- enum LexerActionType {
14
- /// The type of a [LexerChannelAction] action.
15
- CHANNEL,
16
- /// The type of a [LexerCustomAction] action.
17
- CUSTOM,
18
- /// The type of a [LexerModeAction] action.
19
- MODE,
20
- /// The type of a [LexerMoreAction] action.
21
- MORE,
22
- /// The type of a [LexerPopModeAction] action.
23
- POP_MODE,
24
- /// The type of a [LexerPushModeAction] action.
25
- PUSH_MODE,
26
- /// The type of a [LexerSkipAction] action.
27
- SKIP,
28
- /// The type of a [LexerTypeAction] action.
29
- TYPE,
30
- }
31
-
32
- /// Represents a single action which can be executed following the successful
33
- /// match of a lexer rule. Lexer actions are used for both embedded action syntax
34
- /// and ANTLR 4's new lexer command syntax.
35
- ///
36
- /// @since 4.2
37
- abstract class LexerAction {
38
- /// Gets the serialization type of the lexer action.
39
- ///
40
- /// @return The serialization type of the lexer action.
41
- LexerActionType get actionType;
42
-
43
- /// Gets whether the lexer action is position-dependent. Position-dependent
44
- /// actions may have different semantics depending on the [CharStream]
45
- /// index at the time the action is executed.
46
- ///
47
- /// <p>Many lexer commands, including [type], [skip], and
48
- /// [more], do not check the input index during their execution.
49
- /// Actions like this are position-independent, and may be stored more
50
- /// efficiently as part of the {@link LexerATNConfig#lexerActionExecutor}.</p>
51
- ///
52
- /// @return [true] if the lexer action semantics can be affected by the
53
- /// position of the input [CharStream] at the time it is executed;
54
- /// otherwise, [false].
55
- bool get isPositionDependent;
56
-
57
- /// Execute the lexer action in the context of the specified [Lexer].
58
- ///
59
- /// <p>For position-dependent actions, the input stream must already be
60
- /// positioned correctly prior to calling this method.</p>
61
- ///
62
- /// @param lexer The lexer instance.
63
- void execute(Lexer lexer);
64
- }
65
-
66
- /// Implements the [channel] lexer action by calling
67
- /// {@link Lexer#setChannel} with the assigned channel.
68
- ///
69
- /// @since 4.2
70
- class LexerChannelAction implements LexerAction {
71
- /// Gets the channel to use for the [Token] created by the lexer.
72
- ///
73
- /// @return The channel to use for the [Token] created by the lexer.
74
- final int channel;
75
-
76
- /// Constructs a new [channel] action with the specified channel value.
77
- /// @param channel The channel value to pass to {@link Lexer#setChannel}.
78
- LexerChannelAction(this.channel);
79
-
80
- @override
81
- LexerActionType get actionType => LexerActionType.CHANNEL;
82
-
83
- @override
84
- bool get isPositionDependent => false;
85
-
86
- /// {@inheritDoc}
87
- ///
88
- /// <p>This action is implemented by calling {@link Lexer#setChannel} with the
89
- /// value provided by {@link #getChannel}.</p>
90
- @override
91
- void execute(Lexer lexer) {
92
- lexer.channel = channel;
93
- }
94
-
95
- @override
96
- int get hashCode {
97
- var hash = MurmurHash.initialize();
98
- hash = MurmurHash.update(hash, actionType.index);
99
- hash = MurmurHash.update(hash, channel);
100
- return MurmurHash.finish(hash, 2);
101
- }
102
-
103
- @override
104
- bool operator ==(Object obj) {
105
- if (identical(obj, this)) {
106
- return true;
107
- } else if (obj is LexerChannelAction) {
108
- return channel == obj.channel;
109
- }
110
-
111
- return false;
112
- }
113
-
114
- @override
115
- String toString() {
116
- return 'channel($channel)';
117
- }
118
- }
119
-
120
- /// Executes a custom lexer action by calling {@link Recognizer#action} with the
121
- /// rule and action indexes assigned to the custom action. The implementation of
122
- /// a custom action is added to the generated code for the lexer in an override
123
- /// of {@link Recognizer#action} when the grammar is compiled.
124
- ///
125
- /// <p>This class may represent embedded actions created with the <code>{...}</code>
126
- /// syntax in ANTLR 4, as well as actions created for lexer commands where the
127
- /// command argument could not be evaluated when the grammar was compiled.</p>
128
- ///
129
- /// @since 4.2
130
- class LexerCustomAction implements LexerAction {
131
- /// Gets the rule index to use for calls to {@link Recognizer#action}.
132
- ///
133
- /// @return The rule index for the custom action.
134
- final int ruleIndex;
135
-
136
- /// Gets the action index to use for calls to {@link Recognizer#action}.
137
- ///
138
- /// @return The action index for the custom action.
139
- final int actionIndex;
140
-
141
- /// Constructs a custom lexer action with the specified rule and action
142
- /// indexes.
143
- ///
144
- /// @param ruleIndex The rule index to use for calls to
145
- /// {@link Recognizer#action}.
146
- /// @param actionIndex The action index to use for calls to
147
- /// {@link Recognizer#action}.
148
- LexerCustomAction(this.ruleIndex, this.actionIndex);
149
-
150
- /// {@inheritDoc}
151
- ///
152
- /// @return This method returns {@link LexerActionType#CUSTOM}.
153
-
154
- @override
155
- LexerActionType get actionType => LexerActionType.CUSTOM;
156
-
157
- /// Gets whether the lexer action is position-dependent. Position-dependent
158
- /// actions may have different semantics depending on the [CharStream]
159
- /// index at the time the action is executed.
160
- ///
161
- /// <p>Custom actions are position-dependent since they may represent a
162
- /// user-defined embedded action which makes calls to methods like
163
- /// {@link Lexer#getText}.</p>
164
- ///
165
- /// @return This method returns [true].
166
-
167
- @override
168
- bool get isPositionDependent => true;
169
-
170
- /// {@inheritDoc}
171
- ///
172
- /// <p>Custom actions are implemented by calling {@link Lexer#action} with the
173
- /// appropriate rule and action indexes.</p>
174
-
175
- @override
176
- void execute(Lexer lexer) {
177
- lexer.action(null, ruleIndex, actionIndex);
178
- }
179
-
180
- @override
181
- int get hashCode {
182
- var hash = MurmurHash.initialize();
183
- hash = MurmurHash.update(hash, actionType.index);
184
- hash = MurmurHash.update(hash, ruleIndex);
185
- hash = MurmurHash.update(hash, actionIndex);
186
- return MurmurHash.finish(hash, 3);
187
- }
188
-
189
- @override
190
- bool operator ==(Object obj) {
191
- if (identical(obj, this)) {
192
- return true;
193
- } else if (obj is LexerCustomAction) {
194
- return ruleIndex == obj.ruleIndex && actionIndex == obj.actionIndex;
195
- }
196
- return false;
197
- }
198
- }
199
-
200
- /// Implements the [mode] lexer action by calling {@link Lexer#mode} with
201
- /// the assigned mode.
202
- ///
203
- /// @since 4.2
204
- class LexerModeAction implements LexerAction {
205
- /// Get the lexer mode this action should transition the lexer to.
206
- ///
207
- /// @return The lexer mode for this [mode] command.
208
- final int mode;
209
-
210
- /// Constructs a new [mode] action with the specified mode value.
211
- /// @param mode The mode value to pass to {@link Lexer#mode}.
212
- LexerModeAction(this.mode);
213
-
214
- /// {@inheritDoc}
215
- /// @return This method returns {@link LexerActionType#MODE}.
216
-
217
- @override
218
- LexerActionType get actionType => LexerActionType.MODE;
219
-
220
- /// {@inheritDoc}
221
- /// @return This method returns [false].
222
-
223
- @override
224
- bool get isPositionDependent => false;
225
-
226
- /// {@inheritDoc}
227
- ///
228
- /// <p>This action is implemented by calling {@link Lexer#mode} with the
229
- /// value provided by {@link #getMode}.</p>
230
-
231
- @override
232
- void execute(Lexer lexer) {
233
- lexer.mode(mode);
234
- }
235
-
236
- @override
237
- int get hashCode {
238
- var hash = MurmurHash.initialize();
239
- hash = MurmurHash.update(hash, actionType.index);
240
- hash = MurmurHash.update(hash, mode);
241
- return MurmurHash.finish(hash, 2);
242
- }
243
-
244
- @override
245
- bool operator ==(Object obj) {
246
- if (identical(obj, this)) {
247
- return true;
248
- } else if (obj is LexerModeAction) {
249
- return mode == obj.mode;
250
- }
251
- return false;
252
- }
253
-
254
- @override
255
- String toString() {
256
- return 'mode($mode)';
257
- }
258
- }
259
-
260
- /// Implements the [more] lexer action by calling {@link Lexer#more}.
261
- ///
262
- /// <p>The [more] command does not have any parameters, so this action is
263
- /// implemented as a singleton instance exposed by {@link #INSTANCE}.</p>
264
- ///
265
- /// @since 4.2
266
- class LexerMoreAction implements LexerAction {
267
- /// Provides a singleton instance of this parameterless lexer action.
268
- static final LexerMoreAction INSTANCE = LexerMoreAction();
269
-
270
- /// {@inheritDoc}
271
- /// @return This method returns {@link LexerActionType#MORE}.
272
- @override
273
- LexerActionType get actionType => LexerActionType.MORE;
274
-
275
- /// {@inheritDoc}
276
- /// @return This method returns [false].
277
-
278
- @override
279
- bool get isPositionDependent => false;
280
-
281
- /// {@inheritDoc}
282
- ///
283
- /// <p>This action is implemented by calling {@link Lexer#more}.</p>
284
-
285
- @override
286
- void execute(Lexer lexer) {
287
- lexer.more();
288
- }
289
-
290
- @override
291
- int get hashCode {
292
- var hash = MurmurHash.initialize();
293
- hash = MurmurHash.update(hash, actionType.index);
294
- return MurmurHash.finish(hash, 1);
295
- }
296
-
297
- @override
298
- bool operator ==(Object obj) {
299
- return identical(obj, this);
300
- }
301
-
302
- @override
303
- String toString() {
304
- return 'more';
305
- }
306
- }
307
-
308
- /// Implements the [popMode] lexer action by calling {@link Lexer#popMode}.
309
- ///
310
- /// <p>The [popMode] command does not have any parameters, so this action is
311
- /// implemented as a singleton instance exposed by {@link #INSTANCE}.</p>
312
- ///
313
- /// @since 4.2
314
- class LexerPopModeAction implements LexerAction {
315
- /// Provides a singleton instance of this parameterless lexer action.
316
- static final LexerPopModeAction INSTANCE = LexerPopModeAction();
317
-
318
- /// {@inheritDoc}
319
- /// @return This method returns {@link LexerActionType#POP_MODE}.
320
-
321
- @override
322
- LexerActionType get actionType => LexerActionType.POP_MODE;
323
-
324
- /// {@inheritDoc}
325
- /// @return This method returns [false].
326
-
327
- @override
328
- bool get isPositionDependent => false;
329
-
330
- /// {@inheritDoc}
331
- ///
332
- /// <p>This action is implemented by calling {@link Lexer#popMode}.</p>
333
-
334
- @override
335
- void execute(Lexer lexer) {
336
- lexer.popMode();
337
- }
338
-
339
- @override
340
- int get hashCode {
341
- var hash = MurmurHash.initialize();
342
- hash = MurmurHash.update(hash, actionType.index);
343
- return MurmurHash.finish(hash, 1);
344
- }
345
-
346
- @override
347
- bool operator ==(Object obj) {
348
- return identical(obj, this);
349
- }
350
-
351
- @override
352
- String toString() {
353
- return 'popMode';
354
- }
355
- }
356
-
357
- /// Implements the [pushMode] lexer action by calling
358
- /// {@link Lexer#pushMode} with the assigned mode.
359
- ///
360
- /// @since 4.2
361
- class LexerPushModeAction implements LexerAction {
362
- /// Get the lexer mode this action should transition the lexer to.
363
- ///
364
- /// @return The lexer mode for this [pushMode] command.
365
- final int mode;
366
-
367
- /// Constructs a new [pushMode] action with the specified mode value.
368
- /// @param mode The mode value to pass to {@link Lexer#pushMode}.
369
- LexerPushModeAction(this.mode);
370
-
371
- /// {@inheritDoc}
372
- /// @return This method returns {@link LexerActionType#PUSH_MODE}.
373
-
374
- @override
375
- LexerActionType get actionType => LexerActionType.PUSH_MODE;
376
-
377
- /// {@inheritDoc}
378
- /// @return This method returns [false].
379
-
380
- @override
381
- bool get isPositionDependent => false;
382
-
383
- /// {@inheritDoc}
384
- ///
385
- /// <p>This action is implemented by calling {@link Lexer#pushMode} with the
386
- /// value provided by {@link #getMode}.</p>
387
-
388
- @override
389
- void execute(Lexer lexer) {
390
- lexer.pushMode(mode);
391
- }
392
-
393
- @override
394
- int get hashCode {
395
- var hash = MurmurHash.initialize();
396
- hash = MurmurHash.update(hash, actionType.index);
397
- hash = MurmurHash.update(hash, mode);
398
- return MurmurHash.finish(hash, 2);
399
- }
400
-
401
- @override
402
- bool operator ==(Object obj) {
403
- if (identical(obj, this)) {
404
- return true;
405
- } else if (obj is LexerPushModeAction) {
406
- return mode == obj.mode;
407
- }
408
- return false;
409
- }
410
-
411
- @override
412
- String toString() {
413
- return 'pushMode($mode)';
414
- }
415
- }
416
-
417
- /// Implements the [skip] lexer action by calling {@link Lexer#skip}.
418
- ///
419
- /// <p>The [skip] command does not have any parameters, so this action is
420
- /// implemented as a singleton instance exposed by {@link #INSTANCE}.</p>
421
- ///
422
- /// @since 4.2
423
- class LexerSkipAction implements LexerAction {
424
- /// Provides a singleton instance of this parameterless lexer action.
425
- static final LexerSkipAction INSTANCE = LexerSkipAction();
426
-
427
- /// {@inheritDoc}
428
- /// @return This method returns {@link LexerActionType#SKIP}.
429
-
430
- @override
431
- LexerActionType get actionType => LexerActionType.SKIP;
432
-
433
- /// {@inheritDoc}
434
- /// @return This method returns [false].
435
-
436
- @override
437
- bool get isPositionDependent => false;
438
-
439
- /// {@inheritDoc}
440
- ///
441
- /// <p>This action is implemented by calling {@link Lexer#skip}.</p>
442
- @override
443
- void execute(Lexer lexer) {
444
- lexer.skip();
445
- }
446
-
447
- @override
448
- int get hashCode {
449
- var hash = MurmurHash.initialize();
450
- hash = MurmurHash.update(hash, actionType.index);
451
- return MurmurHash.finish(hash, 1);
452
- }
453
-
454
- @override
455
- bool operator ==(Object obj) {
456
- return identical(obj, this);
457
- }
458
-
459
- @override
460
- String toString() {
461
- return 'skip';
462
- }
463
- }
464
-
465
- /// Implements the [type] lexer action by calling {@link Lexer#setType}
466
- /// with the assigned type.
467
- ///
468
- /// @since 4.2
469
- class LexerTypeAction implements LexerAction {
470
- /// Gets the type to assign to a token created by the lexer.
471
- /// @return The type to assign to a token created by the lexer.
472
- final int type;
473
-
474
- /// Constructs a new [type] action with the specified token type value.
475
- /// @param type The type to assign to the token using {@link Lexer#setType}.
476
- LexerTypeAction(this.type);
477
-
478
- /// {@inheritDoc}
479
- /// @return This method returns {@link LexerActionType#TYPE}.
480
- @override
481
- LexerActionType get actionType => LexerActionType.TYPE;
482
-
483
- /// {@inheritDoc}
484
- /// @return This method returns [false].
485
-
486
- @override
487
- bool get isPositionDependent => false;
488
-
489
- /// {@inheritDoc}
490
- ///
491
- /// <p>This action is implemented by calling {@link Lexer#setType} with the
492
- /// value provided by {@link #getType}.</p>
493
-
494
- @override
495
- void execute(Lexer lexer) {
496
- lexer.type = type;
497
- }
498
-
499
- @override
500
- int get hashCode {
501
- var hash = MurmurHash.initialize();
502
- hash = MurmurHash.update(hash, actionType.index);
503
- hash = MurmurHash.update(hash, type);
504
- return MurmurHash.finish(hash, 2);
505
- }
506
-
507
- @override
508
- bool operator ==(Object obj) {
509
- if (identical(obj, this)) {
510
- return true;
511
- } else if (obj is LexerTypeAction) {
512
- return type == obj.type;
513
- }
514
- return false;
515
- }
516
-
517
- @override
518
- String toString() {
519
- return 'type($type)';
520
- }
521
- }
522
-
523
- /// This implementation of [LexerAction] is used for tracking input offsets
524
- /// for position-dependent actions within a [LexerActionExecutor].
525
- ///
526
- /// <p>This action is not serialized as part of the ATN, and is only required for
527
- /// position-dependent lexer actions which appear at a location other than the
528
- /// end of a rule. For more information about DFA optimizations employed for
529
- /// lexer actions, see {@link LexerActionExecutor#append} and
530
- /// {@link LexerActionExecutor#fixOffsetBeforeMatch}.</p>
531
- ///
532
- /// @since 4.2
533
- class LexerIndexedCustomAction implements LexerAction {
534
- /// Gets the location in the input [CharStream] at which the lexer
535
- /// action should be executed. The value is interpreted as an offset relative
536
- /// to the token start index.
537
- ///
538
- /// @return The location in the input [CharStream] at which the lexer
539
- /// action should be executed.
540
- final int offset;
541
-
542
- /// Gets the lexer action to execute.
543
- ///
544
- /// @return A [LexerAction] object which executes the lexer action.
545
- final LexerAction action;
546
-
547
- /// Constructs a new indexed custom action by associating a character offset
548
- /// with a [LexerAction].
549
- ///
550
- /// <p>Note: This class is only required for lexer actions for which
551
- /// {@link LexerAction#isPositionDependent} returns [true].</p>
552
- ///
553
- /// @param offset The offset into the input [CharStream], relative to
554
- /// the token start index, at which the specified lexer action should be
555
- /// executed.
556
- /// @param action The lexer action to execute at a particular offset in the
557
- /// input [CharStream].
558
- LexerIndexedCustomAction(this.offset, this.action);
559
-
560
- /// {@inheritDoc}
561
- ///
562
- /// @return This method returns the result of calling {@link #getActionType}
563
- /// on the [LexerAction] returned by {@link #getAction}.
564
- @override
565
- LexerActionType get actionType => action.actionType;
566
-
567
- /// {@inheritDoc}
568
- /// @return This method returns [true].
569
-
570
- @override
571
- bool get isPositionDependent => true;
572
-
573
- /// {@inheritDoc}
574
- ///
575
- /// <p>This method calls {@link #execute} on the result of {@link #getAction}
576
- /// using the provided [lexer].</p>
577
-
578
- @override
579
- void execute(Lexer lexer) {
580
- // assume the input stream position was properly set by the calling code
581
- action.execute(lexer);
582
- }
583
-
584
- @override
585
- int get hashCode {
586
- var hash = MurmurHash.initialize();
587
- hash = MurmurHash.update(hash, offset);
588
- hash = MurmurHash.update(hash, action);
589
- return MurmurHash.finish(hash, 2);
590
- }
591
-
592
- @override
593
- bool operator ==(Object obj) {
594
- if (obj == this) {
595
- return true;
596
- } else if (obj is LexerIndexedCustomAction) {
597
- return offset == obj.offset && action == obj.action;
598
- }
599
- return false;
600
- }
601
- }