@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,95 +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 '../../dfa/dfa.dart';
|
|
8
|
-
import '../../prediction_context.dart';
|
|
9
|
-
import 'atn.dart';
|
|
10
|
-
import 'atn_config_set.dart';
|
|
11
|
-
|
|
12
|
-
abstract class ATNSimulator {
|
|
13
|
-
/// Must distinguish between missing edge and edge we know leads nowhere */
|
|
14
|
-
|
|
15
|
-
static final DFAState ERROR =
|
|
16
|
-
DFAState(stateNumber: 0x7FFFFFFF, configs: ATNConfigSet());
|
|
17
|
-
|
|
18
|
-
final ATN atn;
|
|
19
|
-
|
|
20
|
-
/// The context cache maps all PredictionContext objects that are equals()
|
|
21
|
-
/// to a single cached copy. This cache is shared across all contexts
|
|
22
|
-
/// in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet
|
|
23
|
-
/// to use only cached nodes/graphs in addDFAState(). We don't want to
|
|
24
|
-
/// fill this during closure() since there are lots of contexts that
|
|
25
|
-
/// pop up but are not used ever again. It also greatly slows down closure().
|
|
26
|
-
///
|
|
27
|
-
/// <p>This cache makes a huge difference in memory and a little bit in speed.
|
|
28
|
-
/// For the Java grammar on java.*, it dropped the memory requirements
|
|
29
|
-
/// at the end from 25M to 16M. We don't store any of the full context
|
|
30
|
-
/// graphs in the DFA because they are limited to local context only,
|
|
31
|
-
/// but apparently there's a lot of repetition there as well. We optimize
|
|
32
|
-
/// the config contexts before storing the config set in the DFA states
|
|
33
|
-
/// by literally rebuilding them with cached subgraphs only.</p>
|
|
34
|
-
///
|
|
35
|
-
/// <p>I tried a cache for use during closure operations, that was
|
|
36
|
-
/// whacked after each adaptivePredict(). It cost a little bit
|
|
37
|
-
/// more time I think and doesn't save on the overall footprint
|
|
38
|
-
/// so it's not worth the complexity.</p>
|
|
39
|
-
final PredictionContextCache sharedContextCache;
|
|
40
|
-
|
|
41
|
-
ATNSimulator(this.atn, this.sharedContextCache);
|
|
42
|
-
|
|
43
|
-
void reset();
|
|
44
|
-
|
|
45
|
-
/// Clear the DFA cache used by the current instance. Since the DFA cache may
|
|
46
|
-
/// be shared by multiple ATN simulators, this method may affect the
|
|
47
|
-
/// performance (but not accuracy) of other parsers which are being used
|
|
48
|
-
/// concurrently.
|
|
49
|
-
///
|
|
50
|
-
/// @throws UnsupportedOperationException if the current instance does not
|
|
51
|
-
/// support clearing the DFA.
|
|
52
|
-
///
|
|
53
|
-
/// @since 4.3
|
|
54
|
-
void clearDFA() {
|
|
55
|
-
throw UnsupportedError(
|
|
56
|
-
'This ATN simulator does not support clearing the DFA.');
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
PredictionContext getCachedContext(PredictionContext context) {
|
|
60
|
-
if (sharedContextCache == null) return context;
|
|
61
|
-
|
|
62
|
-
final visited = <PredictionContext, PredictionContext>{};
|
|
63
|
-
return PredictionContext.getCachedContext(
|
|
64
|
-
context, sharedContextCache, visited);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/// Used to cache [PredictionContext] objects. Its used for the shared
|
|
69
|
-
/// context cash associated with contexts in DFA states. This cache
|
|
70
|
-
/// can be used for both lexers and parsers.
|
|
71
|
-
class PredictionContextCache {
|
|
72
|
-
final cache = <PredictionContext, PredictionContext>{};
|
|
73
|
-
|
|
74
|
-
/// Add a context to the cache and return it. If the context already exists,
|
|
75
|
-
/// return that one instead and do not add a new context to the cache.
|
|
76
|
-
/// Protect shared cache from unsafe thread access.
|
|
77
|
-
PredictionContext add(PredictionContext ctx) {
|
|
78
|
-
if (ctx == PredictionContext.EMPTY) return PredictionContext.EMPTY;
|
|
79
|
-
final existing = cache[ctx];
|
|
80
|
-
if (existing != null) {
|
|
81
|
-
// System.out.println(name+" reuses "+existing);
|
|
82
|
-
return existing;
|
|
83
|
-
}
|
|
84
|
-
cache[ctx] = ctx;
|
|
85
|
-
return ctx;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
PredictionContext operator [](PredictionContext ctx) {
|
|
89
|
-
return cache[ctx];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
int get length {
|
|
93
|
-
return cache.length;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
@@ -1,296 +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
|
-
|
|
9
|
-
import 'package:logging/logging.dart';
|
|
10
|
-
|
|
11
|
-
import '../../interval_set.dart';
|
|
12
|
-
import 'atn.dart';
|
|
13
|
-
import 'transition.dart';
|
|
14
|
-
|
|
15
|
-
var INITIAL_NUM_TRANSITIONS = 4;
|
|
16
|
-
|
|
17
|
-
enum StateType {
|
|
18
|
-
INVALID_TYPE,
|
|
19
|
-
BASIC,
|
|
20
|
-
RULE_START,
|
|
21
|
-
BLOCK_START,
|
|
22
|
-
PLUS_BLOCK_START,
|
|
23
|
-
STAR_BLOCK_START,
|
|
24
|
-
TOKEN_START,
|
|
25
|
-
RULE_STOP,
|
|
26
|
-
BLOCK_END,
|
|
27
|
-
STAR_LOOP_BACK,
|
|
28
|
-
STAR_LOOP_ENTRY,
|
|
29
|
-
PLUS_LOOP_BACK,
|
|
30
|
-
LOOP_END,
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/// The following images show the relation of states and
|
|
34
|
-
/// {@link ATNState#transitions} for various grammar constructs.
|
|
35
|
-
///
|
|
36
|
-
/// <ul>
|
|
37
|
-
///
|
|
38
|
-
/// <li>Solid edges marked with an ε indicate a required
|
|
39
|
-
/// [EpsilonTransition].</li>
|
|
40
|
-
///
|
|
41
|
-
/// <li>Dashed edges indicate locations where any transition derived from
|
|
42
|
-
/// [Transition] might appear.</li>
|
|
43
|
-
///
|
|
44
|
-
/// <li>Dashed nodes are place holders for either a sequence of linked
|
|
45
|
-
/// [BasicState] states or the inclusion of a block representing a nested
|
|
46
|
-
/// construct in one of the forms below.</li>
|
|
47
|
-
///
|
|
48
|
-
/// <li>Nodes showing multiple outgoing alternatives with a {@code ...} support
|
|
49
|
-
/// any number of alternatives (one or more). Nodes without the {@code ...} only
|
|
50
|
-
/// support the exact number of alternatives shown in the diagram.</li>
|
|
51
|
-
///
|
|
52
|
-
/// </ul>
|
|
53
|
-
///
|
|
54
|
-
/// <h2>Basic Blocks</h2>
|
|
55
|
-
///
|
|
56
|
-
/// <h3>Rule</h3>
|
|
57
|
-
///
|
|
58
|
-
/// <embed src="images/Rule.svg" type="image/svg+xml"/>
|
|
59
|
-
///
|
|
60
|
-
/// <h3>Block of 1 or more alternatives</h3>
|
|
61
|
-
///
|
|
62
|
-
/// <embed src="images/Block.svg" type="image/svg+xml"/>
|
|
63
|
-
///
|
|
64
|
-
/// <h2>Greedy Loops</h2>
|
|
65
|
-
///
|
|
66
|
-
/// <h3>Greedy Closure: {@code (...)*}</h3>
|
|
67
|
-
///
|
|
68
|
-
/// <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
|
|
69
|
-
///
|
|
70
|
-
/// <h3>Greedy Positive Closure: {@code (...)+}</h3>
|
|
71
|
-
///
|
|
72
|
-
/// <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
|
|
73
|
-
///
|
|
74
|
-
/// <h3>Greedy Optional: {@code (...)?}</h3>
|
|
75
|
-
///
|
|
76
|
-
/// <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
|
|
77
|
-
///
|
|
78
|
-
/// <h2>Non-Greedy Loops</h2>
|
|
79
|
-
///
|
|
80
|
-
/// <h3>Non-Greedy Closure: {@code (...)*?}</h3>
|
|
81
|
-
///
|
|
82
|
-
/// <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
|
|
83
|
-
///
|
|
84
|
-
/// <h3>Non-Greedy Positive Closure: {@code (...)+?}</h3>
|
|
85
|
-
///
|
|
86
|
-
/// <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
|
|
87
|
-
///
|
|
88
|
-
/// <h3>Non-Greedy Optional: {@code (...)??}</h3>
|
|
89
|
-
///
|
|
90
|
-
/// <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
|
|
91
|
-
abstract class ATNState {
|
|
92
|
-
static final int INITIAL_NUM_TRANSITIONS = 4;
|
|
93
|
-
|
|
94
|
-
static final int INVALID_STATE_NUMBER = -1;
|
|
95
|
-
|
|
96
|
-
/// Which ATN are we in? */
|
|
97
|
-
ATN atn;
|
|
98
|
-
|
|
99
|
-
int stateNumber = INVALID_STATE_NUMBER;
|
|
100
|
-
|
|
101
|
-
int ruleIndex; // at runtime, we don't have Rule objects
|
|
102
|
-
|
|
103
|
-
bool epsilonOnlyTransitions = false;
|
|
104
|
-
|
|
105
|
-
/// Track the transitions emanating from this ATN state. */
|
|
106
|
-
List<Transition> transitions = [];
|
|
107
|
-
|
|
108
|
-
/// Used to cache lookahead during parsing, not used during construction */
|
|
109
|
-
IntervalSet nextTokenWithinRule;
|
|
110
|
-
|
|
111
|
-
@override
|
|
112
|
-
int get hashCode {
|
|
113
|
-
return stateNumber;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
@override
|
|
117
|
-
bool operator ==(Object o) {
|
|
118
|
-
// are these states same object?
|
|
119
|
-
if (o is ATNState) return stateNumber == o.stateNumber;
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
bool isNonGreedyExitState() {
|
|
124
|
-
return false;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
@override
|
|
128
|
-
String toString() {
|
|
129
|
-
return stateNumber.toString();
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
int get numberOfTransitions {
|
|
133
|
-
return transitions.length;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
void addTransition(Transition e) {
|
|
137
|
-
addTransitionAt(transitions.length, e);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
void addTransitionAt(int index, Transition e) {
|
|
141
|
-
if (transitions.isEmpty) {
|
|
142
|
-
epsilonOnlyTransitions = e.isEpsilon;
|
|
143
|
-
} else if (epsilonOnlyTransitions != e.isEpsilon) {
|
|
144
|
-
log('ATN state $stateNumber has both epsilon and non-epsilon transitions.\n',
|
|
145
|
-
level: Level.SEVERE.value);
|
|
146
|
-
epsilonOnlyTransitions = false;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
var alreadyPresent = false;
|
|
150
|
-
for (var t in transitions) {
|
|
151
|
-
if (t.target.stateNumber == e.target.stateNumber) {
|
|
152
|
-
if (t.label != null && e.label != null && t.label == e.label) {
|
|
153
|
-
// System.err.println("Repeated transition upon "+e.label()+" from "+stateNumber+"->"+t.target.stateNumber);
|
|
154
|
-
alreadyPresent = true;
|
|
155
|
-
break;
|
|
156
|
-
} else if (t.isEpsilon && e.isEpsilon) {
|
|
157
|
-
// System.err.println("Repeated epsilon transition from "+stateNumber+"->"+t.target.stateNumber);
|
|
158
|
-
alreadyPresent = true;
|
|
159
|
-
break;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
if (!alreadyPresent) {
|
|
164
|
-
transitions.insert(index, e);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
Transition transition(int i) {
|
|
169
|
-
return transitions[i];
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
void setTransition(int i, Transition e) {
|
|
173
|
-
transitions[i] = e;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
Transition removeTransition(int index) {
|
|
177
|
-
return transitions.removeAt(index);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
StateType get stateType;
|
|
181
|
-
|
|
182
|
-
bool onlyHasEpsilonTransitions() => epsilonOnlyTransitions;
|
|
183
|
-
|
|
184
|
-
void setRuleIndex(int ruleIndex) {
|
|
185
|
-
this.ruleIndex = ruleIndex;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
class BasicState extends ATNState {
|
|
190
|
-
@override
|
|
191
|
-
StateType get stateType => StateType.BASIC;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
class RuleStartState extends ATNState {
|
|
195
|
-
var stopState;
|
|
196
|
-
var isLeftRecursiveRule = false;
|
|
197
|
-
|
|
198
|
-
@override
|
|
199
|
-
StateType get stateType => StateType.RULE_START;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
abstract class DecisionState extends ATNState {
|
|
203
|
-
int decision = 0;
|
|
204
|
-
bool nonGreedy = false;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// The start of a regular {@code (...)} block.
|
|
208
|
-
abstract class BlockStartState extends DecisionState {
|
|
209
|
-
BlockEndState endState;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
class BasicBlockStartState extends BlockStartState {
|
|
213
|
-
@override
|
|
214
|
-
StateType get stateType => StateType.BLOCK_START;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/// Start of {@code (A|B|...)+} loop. Technically a decision state, but
|
|
218
|
-
/// we don't use for code generation; somebody might need it, so I'm defining
|
|
219
|
-
/// it for completeness. In reality, the [PlusLoopbackState] node is the
|
|
220
|
-
/// real decision-making note for {@code A+}.
|
|
221
|
-
class PlusBlockStartState extends BlockStartState {
|
|
222
|
-
PlusLoopbackState loopBackState;
|
|
223
|
-
|
|
224
|
-
@override
|
|
225
|
-
StateType get stateType => StateType.PLUS_BLOCK_START;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/// The block that begins a closure loop.
|
|
229
|
-
class StarBlockStartState extends BlockStartState {
|
|
230
|
-
@override
|
|
231
|
-
StateType get stateType => StateType.STAR_BLOCK_START;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/// The Tokens rule start state linking to each lexer rule start state */
|
|
235
|
-
class TokensStartState extends DecisionState {
|
|
236
|
-
@override
|
|
237
|
-
StateType get stateType => StateType.TOKEN_START;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/// The last node in the ATN for a rule, unless that rule is the start symbol.
|
|
241
|
-
/// In that case, there is one transition to EOF. Later, we might encode
|
|
242
|
-
/// references to all calls to this rule to compute FOLLOW sets for
|
|
243
|
-
/// error handling.
|
|
244
|
-
class RuleStopState extends ATNState {
|
|
245
|
-
@override
|
|
246
|
-
StateType get stateType => StateType.RULE_STOP;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/// Terminal node of a simple {@code (a|b|c)} block.
|
|
250
|
-
class BlockEndState extends ATNState {
|
|
251
|
-
BlockStartState startState;
|
|
252
|
-
|
|
253
|
-
@override
|
|
254
|
-
StateType get stateType => StateType.BLOCK_END;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
class StarLoopbackState extends ATNState {
|
|
258
|
-
StarLoopEntryState get loopEntryState {
|
|
259
|
-
return transition(0).target;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
@override
|
|
263
|
-
StateType get stateType => StateType.STAR_LOOP_BACK;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
class StarLoopEntryState extends DecisionState {
|
|
267
|
-
StarLoopbackState loopBackState;
|
|
268
|
-
|
|
269
|
-
/// Indicates whether this state can benefit from a precedence DFA during SLL
|
|
270
|
-
/// decision making.
|
|
271
|
-
///
|
|
272
|
-
/// <p>This is a computed property that is calculated during ATN deserialization
|
|
273
|
-
/// and stored for use in [ParserATNSimulator] and
|
|
274
|
-
/// [ParserInterpreter].</p>
|
|
275
|
-
///
|
|
276
|
-
/// @see DFA#isPrecedenceDfa()
|
|
277
|
-
bool isPrecedenceDecision = false;
|
|
278
|
-
|
|
279
|
-
@override
|
|
280
|
-
StateType get stateType => StateType.STAR_LOOP_ENTRY;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/// Decision state for {@code A+} and {@code (A|B)+}. It has two transitions:
|
|
284
|
-
/// one to the loop back to start of the block and one to exit.
|
|
285
|
-
class PlusLoopbackState extends DecisionState {
|
|
286
|
-
@override
|
|
287
|
-
StateType get stateType => StateType.PLUS_LOOP_BACK;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/// Mark the end of a * or + loop.
|
|
291
|
-
class LoopEndState extends ATNState {
|
|
292
|
-
ATNState loopBackState;
|
|
293
|
-
|
|
294
|
-
@override
|
|
295
|
-
StateType get stateType => StateType.LOOP_END;
|
|
296
|
-
}
|
|
@@ -1,14 +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
|
-
/// Represents the type of recognizer an ATN applies to.
|
|
8
|
-
enum ATNType {
|
|
9
|
-
/// A lexer grammar.
|
|
10
|
-
LEXER,
|
|
11
|
-
|
|
12
|
-
/// A parser grammar.
|
|
13
|
-
PARSER
|
|
14
|
-
}
|