@opra/client 0.10.0 → 0.11.0

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 (187) hide show
  1. package/package.json +1 -1
  2. package/typings/antlr4ts/ANTLRErrorListener.d.ts +43 -0
  3. package/typings/antlr4ts/ANTLRErrorStrategy.d.ts +109 -0
  4. package/typings/antlr4ts/ANTLRInputStream.d.ts +51 -0
  5. package/typings/antlr4ts/BailErrorStrategy.d.ts +48 -0
  6. package/typings/antlr4ts/BufferedTokenStream.d.ts +143 -0
  7. package/typings/antlr4ts/CharStream.d.ts +26 -0
  8. package/typings/antlr4ts/CharStreams.d.ts +54 -0
  9. package/typings/antlr4ts/CodePointBuffer.d.ts +40 -0
  10. package/typings/antlr4ts/CodePointCharStream.d.ts +45 -0
  11. package/typings/antlr4ts/CommonToken.d.ts +116 -0
  12. package/typings/antlr4ts/CommonTokenFactory.d.ts +53 -0
  13. package/typings/antlr4ts/CommonTokenStream.d.ts +52 -0
  14. package/typings/antlr4ts/ConsoleErrorListener.d.ts +29 -0
  15. package/typings/antlr4ts/Decorators.d.ts +8 -0
  16. package/typings/antlr4ts/DefaultErrorStrategy.d.ts +347 -0
  17. package/typings/antlr4ts/Dependents.d.ts +69 -0
  18. package/typings/antlr4ts/DiagnosticErrorListener.d.ts +60 -0
  19. package/typings/antlr4ts/FailedPredicateException.d.ts +21 -0
  20. package/typings/antlr4ts/InputMismatchException.d.ts +14 -0
  21. package/typings/antlr4ts/IntStream.d.ts +197 -0
  22. package/typings/antlr4ts/InterpreterRuleContext.d.ts +33 -0
  23. package/typings/antlr4ts/Lexer.d.ts +141 -0
  24. package/typings/antlr4ts/LexerInterpreter.d.ts +23 -0
  25. package/typings/antlr4ts/LexerNoViableAltException.d.ts +19 -0
  26. package/typings/antlr4ts/ListTokenSource.d.ts +86 -0
  27. package/typings/antlr4ts/NoViableAltException.d.ts +30 -0
  28. package/typings/antlr4ts/Parser.d.ts +372 -0
  29. package/typings/antlr4ts/ParserErrorListener.d.ts +112 -0
  30. package/typings/antlr4ts/ParserInterpreter.d.ts +151 -0
  31. package/typings/antlr4ts/ParserRuleContext.d.ts +169 -0
  32. package/typings/antlr4ts/ProxyErrorListener.d.ts +20 -0
  33. package/typings/antlr4ts/ProxyParserErrorListener.d.ts +21 -0
  34. package/typings/antlr4ts/RecognitionException.d.ts +87 -0
  35. package/typings/antlr4ts/Recognizer.d.ts +101 -0
  36. package/typings/antlr4ts/RuleContext.d.ts +124 -0
  37. package/typings/antlr4ts/RuleContextWithAltNum.d.ts +22 -0
  38. package/typings/antlr4ts/RuleDependency.d.ts +32 -0
  39. package/typings/antlr4ts/RuleVersion.d.ts +11 -0
  40. package/typings/antlr4ts/Token.d.ts +83 -0
  41. package/typings/antlr4ts/TokenFactory.d.ts +23 -0
  42. package/typings/antlr4ts/TokenSource.d.ts +67 -0
  43. package/typings/antlr4ts/TokenStream.d.ts +145 -0
  44. package/typings/antlr4ts/TokenStreamRewriter.d.ts +216 -0
  45. package/typings/antlr4ts/Vocabulary.d.ts +117 -0
  46. package/typings/antlr4ts/VocabularyImpl.d.ts +47 -0
  47. package/typings/antlr4ts/WritableToken.d.ts +13 -0
  48. package/typings/antlr4ts/atn/ATN.d.ts +123 -0
  49. package/typings/antlr4ts/atn/ATNConfig.d.ts +140 -0
  50. package/typings/antlr4ts/atn/ATNConfigSet.d.ts +113 -0
  51. package/typings/antlr4ts/atn/ATNDeserializationOptions.d.ts +26 -0
  52. package/typings/antlr4ts/atn/ATNDeserializer.d.ts +86 -0
  53. package/typings/antlr4ts/atn/ATNSimulator.d.ts +28 -0
  54. package/typings/antlr4ts/atn/ATNState.d.ts +111 -0
  55. package/typings/antlr4ts/atn/ATNStateType.d.ts +19 -0
  56. package/typings/antlr4ts/atn/ATNType.d.ts +19 -0
  57. package/typings/antlr4ts/atn/AbstractPredicateTransition.d.ts +13 -0
  58. package/typings/antlr4ts/atn/ActionTransition.d.ts +17 -0
  59. package/typings/antlr4ts/atn/AmbiguityInfo.d.ts +60 -0
  60. package/typings/antlr4ts/atn/AtomTransition.d.ts +18 -0
  61. package/typings/antlr4ts/atn/BasicBlockStartState.d.ts +13 -0
  62. package/typings/antlr4ts/atn/BasicState.d.ts +13 -0
  63. package/typings/antlr4ts/atn/BlockEndState.d.ts +12 -0
  64. package/typings/antlr4ts/atn/BlockStartState.d.ts +10 -0
  65. package/typings/antlr4ts/atn/CodePointTransitions.d.ts +27 -0
  66. package/typings/antlr4ts/atn/ConflictInfo.d.ts +35 -0
  67. package/typings/antlr4ts/atn/ContextSensitivityInfo.d.ts +39 -0
  68. package/typings/antlr4ts/atn/DecisionEventInfo.d.ts +54 -0
  69. package/typings/antlr4ts/atn/DecisionInfo.d.ts +201 -0
  70. package/typings/antlr4ts/atn/DecisionState.d.ts +10 -0
  71. package/typings/antlr4ts/atn/EpsilonTransition.d.ts +24 -0
  72. package/typings/antlr4ts/atn/ErrorInfo.d.ts +32 -0
  73. package/typings/antlr4ts/atn/InvalidState.d.ts +13 -0
  74. package/typings/antlr4ts/atn/LL1Analyzer.d.ts +98 -0
  75. package/typings/antlr4ts/atn/LexerATNSimulator.d.ts +153 -0
  76. package/typings/antlr4ts/atn/LexerAction.d.ts +47 -0
  77. package/typings/antlr4ts/atn/LexerActionExecutor.d.ts +104 -0
  78. package/typings/antlr4ts/atn/LexerActionType.d.ts +44 -0
  79. package/typings/antlr4ts/atn/LexerChannelAction.d.ts +48 -0
  80. package/typings/antlr4ts/atn/LexerCustomAction.d.ts +73 -0
  81. package/typings/antlr4ts/atn/LexerIndexedCustomAction.d.ts +74 -0
  82. package/typings/antlr4ts/atn/LexerModeAction.d.ts +48 -0
  83. package/typings/antlr4ts/atn/LexerMoreAction.d.ts +47 -0
  84. package/typings/antlr4ts/atn/LexerPopModeAction.d.ts +47 -0
  85. package/typings/antlr4ts/atn/LexerPushModeAction.d.ts +48 -0
  86. package/typings/antlr4ts/atn/LexerSkipAction.d.ts +47 -0
  87. package/typings/antlr4ts/atn/LexerTypeAction.d.ts +47 -0
  88. package/typings/antlr4ts/atn/LookaheadEventInfo.d.ts +37 -0
  89. package/typings/antlr4ts/atn/LoopEndState.d.ts +11 -0
  90. package/typings/antlr4ts/atn/NotSetTransition.d.ts +14 -0
  91. package/typings/antlr4ts/atn/OrderedATNConfigSet.d.ts +23 -0
  92. package/typings/antlr4ts/atn/ParseInfo.d.ts +79 -0
  93. package/typings/antlr4ts/atn/ParserATNSimulator.d.ts +567 -0
  94. package/typings/antlr4ts/atn/PlusBlockStartState.d.ts +16 -0
  95. package/typings/antlr4ts/atn/PlusLoopbackState.d.ts +12 -0
  96. package/typings/antlr4ts/atn/PrecedencePredicateTransition.d.ts +21 -0
  97. package/typings/antlr4ts/atn/PredicateEvalInfo.d.ts +54 -0
  98. package/typings/antlr4ts/atn/PredicateTransition.d.ts +25 -0
  99. package/typings/antlr4ts/atn/PredictionContext.d.ts +89 -0
  100. package/typings/antlr4ts/atn/PredictionContextCache.d.ts +40 -0
  101. package/typings/antlr4ts/atn/PredictionMode.d.ts +89 -0
  102. package/typings/antlr4ts/atn/ProfilingATNSimulator.d.ts +55 -0
  103. package/typings/antlr4ts/atn/RangeTransition.d.ts +17 -0
  104. package/typings/antlr4ts/atn/RuleStartState.d.ts +13 -0
  105. package/typings/antlr4ts/atn/RuleStopState.d.ts +15 -0
  106. package/typings/antlr4ts/atn/RuleTransition.d.ts +22 -0
  107. package/typings/antlr4ts/atn/SemanticContext.d.ts +143 -0
  108. package/typings/antlr4ts/atn/SetTransition.d.ts +17 -0
  109. package/typings/antlr4ts/atn/SimulatorState.d.ts +17 -0
  110. package/typings/antlr4ts/atn/StarBlockStartState.d.ts +10 -0
  111. package/typings/antlr4ts/atn/StarLoopEntryState.d.ts +37 -0
  112. package/typings/antlr4ts/atn/StarLoopbackState.d.ts +11 -0
  113. package/typings/antlr4ts/atn/TokensStartState.d.ts +10 -0
  114. package/typings/antlr4ts/atn/Transition.d.ts +38 -0
  115. package/typings/antlr4ts/atn/TransitionType.d.ts +16 -0
  116. package/typings/antlr4ts/atn/WildcardTransition.d.ts +13 -0
  117. package/typings/antlr4ts/atn/index.d.ts +73 -0
  118. package/typings/antlr4ts/dfa/AcceptStateInfo.d.ts +33 -0
  119. package/typings/antlr4ts/dfa/DFA.d.ts +94 -0
  120. package/typings/antlr4ts/dfa/DFASerializer.d.ts +23 -0
  121. package/typings/antlr4ts/dfa/DFAState.d.ts +95 -0
  122. package/typings/antlr4ts/dfa/LexerDFASerializer.d.ts +10 -0
  123. package/typings/antlr4ts/dfa/index.d.ts +9 -0
  124. package/typings/antlr4ts/index.d.ts +49 -0
  125. package/typings/antlr4ts/misc/Args.d.ts +13 -0
  126. package/typings/antlr4ts/misc/Array2DHashMap.d.ts +20 -0
  127. package/typings/antlr4ts/misc/Array2DHashSet.d.ts +62 -0
  128. package/typings/antlr4ts/misc/ArrayEqualityComparator.d.ts +32 -0
  129. package/typings/antlr4ts/misc/Arrays.d.ts +18 -0
  130. package/typings/antlr4ts/misc/BitSet.d.ts +268 -0
  131. package/typings/antlr4ts/misc/Character.d.ts +7 -0
  132. package/typings/antlr4ts/misc/DefaultEqualityComparator.d.ts +31 -0
  133. package/typings/antlr4ts/misc/EqualityComparator.d.ts +29 -0
  134. package/typings/antlr4ts/misc/IntSet.d.ts +129 -0
  135. package/typings/antlr4ts/misc/IntegerList.d.ts +69 -0
  136. package/typings/antlr4ts/misc/IntegerStack.d.ts +15 -0
  137. package/typings/antlr4ts/misc/InterpreterDataReader.d.ts +39 -0
  138. package/typings/antlr4ts/misc/Interval.d.ts +57 -0
  139. package/typings/antlr4ts/misc/IntervalSet.d.ts +96 -0
  140. package/typings/antlr4ts/misc/MultiMap.d.ts +9 -0
  141. package/typings/antlr4ts/misc/MurmurHash.d.ts +45 -0
  142. package/typings/antlr4ts/misc/ObjectEqualityComparator.d.ts +32 -0
  143. package/typings/antlr4ts/misc/ParseCancellationException.d.ts +18 -0
  144. package/typings/antlr4ts/misc/Stubs.d.ts +31 -0
  145. package/typings/antlr4ts/misc/UUID.d.ts +13 -0
  146. package/typings/antlr4ts/misc/Utils.d.ts +15 -0
  147. package/typings/antlr4ts/misc/index.d.ts +25 -0
  148. package/typings/antlr4ts/tree/AbstractParseTreeVisitor.d.ts +103 -0
  149. package/typings/antlr4ts/tree/ErrorNode.d.ts +17 -0
  150. package/typings/antlr4ts/tree/ParseTree.d.ts +36 -0
  151. package/typings/antlr4ts/tree/ParseTreeListener.d.ts +26 -0
  152. package/typings/antlr4ts/tree/ParseTreeProperty.d.ts +28 -0
  153. package/typings/antlr4ts/tree/ParseTreeVisitor.d.ts +48 -0
  154. package/typings/antlr4ts/tree/ParseTreeWalker.d.ts +35 -0
  155. package/typings/antlr4ts/tree/RuleNode.d.ts +21 -0
  156. package/typings/antlr4ts/tree/SyntaxTree.d.ts +29 -0
  157. package/typings/antlr4ts/tree/TerminalNode.d.ts +27 -0
  158. package/typings/antlr4ts/tree/Tree.d.ts +36 -0
  159. package/typings/antlr4ts/tree/Trees.d.ts +75 -0
  160. package/typings/antlr4ts/tree/index.d.ts +16 -0
  161. package/typings/antlr4ts/tree/pattern/Chunk.d.ts +17 -0
  162. package/typings/antlr4ts/tree/pattern/ParseTreeMatch.d.ts +124 -0
  163. package/typings/antlr4ts/tree/pattern/ParseTreePattern.d.ts +98 -0
  164. package/typings/antlr4ts/tree/pattern/ParseTreePatternMatcher.d.ts +166 -0
  165. package/typings/antlr4ts/tree/pattern/RuleTagToken.d.ts +122 -0
  166. package/typings/antlr4ts/tree/pattern/TagChunk.d.ts +59 -0
  167. package/typings/antlr4ts/tree/pattern/TextChunk.d.ts +35 -0
  168. package/typings/antlr4ts/tree/pattern/TokenTagToken.d.ts +56 -0
  169. package/typings/antlr4ts/tree/pattern/index.d.ts +9 -0
  170. package/typings/antlr4ts/tree/xpath/XPath.d.ts +66 -0
  171. package/typings/antlr4ts/tree/xpath/XPathElement.d.ts +19 -0
  172. package/typings/antlr4ts/tree/xpath/XPathLexer.d.ts +36 -0
  173. package/typings/antlr4ts/tree/xpath/XPathLexerErrorListener.d.ts +10 -0
  174. package/typings/antlr4ts/tree/xpath/XPathRuleAnywhereElement.d.ts +14 -0
  175. package/typings/antlr4ts/tree/xpath/XPathRuleElement.d.ts +11 -0
  176. package/typings/antlr4ts/tree/xpath/XPathTokenAnywhereElement.d.ts +11 -0
  177. package/typings/antlr4ts/tree/xpath/XPathTokenElement.d.ts +11 -0
  178. package/typings/antlr4ts/tree/xpath/XPathWildcardAnywhereElement.d.ts +10 -0
  179. package/typings/antlr4ts/tree/xpath/XPathWildcardElement.d.ts +10 -0
  180. package/typings/antlr4ts/tree/xpath/index.d.ts +14 -0
  181. package/typings/common/filter/antlr/OpraFilterLexer.d.ts +4 -4
  182. package/typings/common/filter/antlr/OpraFilterParser.d.ts +8 -8
  183. package/typings/common/filter/antlr/OpraFilterVisitor.d.ts +1 -1
  184. package/typings/common/filter/error-listener.d.ts +2 -2
  185. package/typings/common/filter/errors.d.ts +2 -2
  186. package/typings/common/filter/filter-tree-visitor.d.ts +1 -1
  187. package/typings/common/filter/parse.d.ts +1 -1
@@ -0,0 +1,123 @@
1
+ /*!
2
+ * Copyright 2016 The ANTLR Project. All rights reserved.
3
+ * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
4
+ */
5
+ import { ATNState } from "./ATNState";
6
+ import { ATNType } from "./ATNType";
7
+ import { DecisionState } from "./DecisionState";
8
+ import { DFA } from "../dfa/DFA";
9
+ import { IntervalSet } from "../misc/IntervalSet";
10
+ import { LexerAction } from "./LexerAction";
11
+ import { PredictionContext } from "./PredictionContext";
12
+ import { RuleContext } from "../RuleContext";
13
+ import { RuleStartState } from "./RuleStartState";
14
+ import { RuleStopState } from "./RuleStopState";
15
+ import { TokensStartState } from "./TokensStartState";
16
+ /** */
17
+ export declare class ATN {
18
+ readonly states: ATNState[];
19
+ /** Each subrule/rule is a decision point and we must track them so we
20
+ * can go back later and build DFA predictors for them. This includes
21
+ * all the rules, subrules, optional blocks, ()+, ()* etc...
22
+ */
23
+ decisionToState: DecisionState[];
24
+ /**
25
+ * Maps from rule index to starting state number.
26
+ */
27
+ ruleToStartState: RuleStartState[];
28
+ /**
29
+ * Maps from rule index to stop state number.
30
+ */
31
+ ruleToStopState: RuleStopState[];
32
+ modeNameToStartState: Map<string, TokensStartState>;
33
+ /**
34
+ * The type of the ATN.
35
+ */
36
+ grammarType: ATNType;
37
+ /**
38
+ * The maximum value for any symbol recognized by a transition in the ATN.
39
+ */
40
+ maxTokenType: number;
41
+ /**
42
+ * For lexer ATNs, this maps the rule index to the resulting token type.
43
+ * For parser ATNs, this maps the rule index to the generated bypass token
44
+ * type if the
45
+ * {@link ATNDeserializationOptions#isGenerateRuleBypassTransitions}
46
+ * deserialization option was specified; otherwise, this is `undefined`.
47
+ */
48
+ ruleToTokenType: Int32Array;
49
+ /**
50
+ * For lexer ATNs, this is an array of {@link LexerAction} objects which may
51
+ * be referenced by action transitions in the ATN.
52
+ */
53
+ lexerActions: LexerAction[];
54
+ modeToStartState: TokensStartState[];
55
+ private contextCache;
56
+ decisionToDFA: DFA[];
57
+ modeToDFA: DFA[];
58
+ LL1Table: Map<number, number>;
59
+ /** Used for runtime deserialization of ATNs from strings */
60
+ constructor(grammarType: ATNType, maxTokenType: number);
61
+ clearDFA(): void;
62
+ get contextCacheSize(): number;
63
+ getCachedContext(context: PredictionContext): PredictionContext;
64
+ getDecisionToDFA(): DFA[];
65
+ /** Compute the set of valid tokens that can occur starting in state `s`.
66
+ * If `ctx` is {@link PredictionContext#EMPTY_LOCAL}, the set of tokens will not include what can follow
67
+ * the rule surrounding `s`. In other words, the set will be
68
+ * restricted to tokens reachable staying within `s`'s rule.
69
+ */
70
+ nextTokens(s: ATNState, /*@NotNull*/ ctx: PredictionContext): IntervalSet;
71
+ /**
72
+ * Compute the set of valid tokens that can occur starting in `s` and
73
+ * staying in same rule. {@link Token#EPSILON} is in set if we reach end of
74
+ * rule.
75
+ */
76
+ nextTokens(/*@NotNull*/ s: ATNState): IntervalSet;
77
+ addState(state: ATNState): void;
78
+ removeState(state: ATNState): void;
79
+ defineMode(name: string, s: TokensStartState): void;
80
+ defineDecisionState(s: DecisionState): number;
81
+ getDecisionState(decision: number): DecisionState | undefined;
82
+ get numberOfDecisions(): number;
83
+ /**
84
+ * Computes the set of input symbols which could follow ATN state number
85
+ * `stateNumber` in the specified full `context`. This method
86
+ * considers the complete parser context, but does not evaluate semantic
87
+ * predicates (i.e. all predicates encountered during the calculation are
88
+ * assumed true). If a path in the ATN exists from the starting state to the
89
+ * {@link RuleStopState} of the outermost context without matching any
90
+ * symbols, {@link Token#EOF} is added to the returned set.
91
+ *
92
+ * If `context` is `undefined`, it is treated as
93
+ * {@link ParserRuleContext#EMPTY}.
94
+ *
95
+ * Note that this does NOT give you the set of all tokens that could
96
+ * appear at a given token position in the input phrase. In other words, it
97
+ * does not answer:
98
+ *
99
+ * > Given a specific partial input phrase, return the set of all
100
+ * > tokens that can follow the last token in the input phrase.
101
+ *
102
+ * The big difference is that with just the input, the parser could land
103
+ * right in the middle of a lookahead decision. Getting all
104
+ * *possible* tokens given a partial input stream is a separate
105
+ * computation. See https://github.com/antlr/antlr4/issues/1428
106
+ *
107
+ * For this function, we are specifying an ATN state and call stack to
108
+ * compute what token(s) can come next and specifically: outside of a
109
+ * lookahead decision. That is what you want for error reporting and
110
+ * recovery upon parse error.
111
+ *
112
+ * @param stateNumber the ATN state number
113
+ * @param context the full parse context
114
+ * @returns The set of potentially valid input symbols which could follow the
115
+ * specified state in the specified context.
116
+ * @ if the ATN does not contain a state with
117
+ * number `stateNumber`
118
+ */
119
+ getExpectedTokens(stateNumber: number, context: RuleContext | undefined): IntervalSet;
120
+ }
121
+ export declare namespace ATN {
122
+ const INVALID_ALT_NUMBER: number;
123
+ }
@@ -0,0 +1,140 @@
1
+ /*!
2
+ * Copyright 2016 The ANTLR Project. All rights reserved.
3
+ * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
4
+ */
5
+ import { ATNState } from "./ATNState";
6
+ import { Equatable } from "../misc/Stubs";
7
+ import { LexerActionExecutor } from "./LexerActionExecutor";
8
+ import { PredictionContext } from "./PredictionContext";
9
+ import { PredictionContextCache } from "./PredictionContextCache";
10
+ import { Recognizer } from "../Recognizer";
11
+ import { SemanticContext } from "./SemanticContext";
12
+ /**
13
+ * Represents a location with context in an ATN. The location is identified by the following values:
14
+ *
15
+ * * The current ATN state
16
+ * * The predicted alternative
17
+ * * The semantic context which must be true for this configuration to be enabled
18
+ * * The syntactic context, which is represented as a graph-structured stack whose path(s) lead to the root of the rule
19
+ * invocations leading to this state
20
+ *
21
+ * In addition to these values, `ATNConfig` stores several properties about paths taken to get to the location which
22
+ * were added over time to help with performance, correctness, and/or debugging.
23
+ *
24
+ * * `reachesIntoOuterContext`:: Used to ensure semantic predicates are not evaluated in the wrong context.
25
+ * * `hasPassedThroughNonGreedyDecision`: Used for enabling first-match-wins instead of longest-match-wins after
26
+ * crossing a non-greedy decision.
27
+ * * `lexerActionExecutor`: Used for tracking the lexer action(s) to execute should this instance be selected during
28
+ * lexing.
29
+ * * `isPrecedenceFilterSuppressed`: A state variable for one of the dynamic disambiguation strategies employed by
30
+ * `ParserATNSimulator.applyPrecedenceFilter`.
31
+ *
32
+ * Due to the use of a graph-structured stack, a single `ATNConfig` is capable of representing many individual ATN
33
+ * configurations which reached the same location in an ATN by following different paths.
34
+ *
35
+ * PERF: To conserve memory, `ATNConfig` is split into several different concrete types. `ATNConfig` itself stores the
36
+ * minimum amount of information typically used to define an `ATNConfig` instance. Various derived types provide
37
+ * additional storage space for cases where a non-default value is used for some of the object properties. The
38
+ * `ATNConfig.create` and `ATNConfig.transform` methods automatically select the smallest concrete type capable of
39
+ * representing the unique information for any given `ATNConfig`.
40
+ */
41
+ export declare class ATNConfig implements Equatable {
42
+ /** The ATN state associated with this configuration */
43
+ private _state;
44
+ /**
45
+ * This is a bit-field currently containing the following values.
46
+ *
47
+ * * 0x00FFFFFF: Alternative
48
+ * * 0x7F000000: Outer context depth
49
+ * * 0x80000000: Suppress precedence filter
50
+ */
51
+ private altAndOuterContextDepth;
52
+ /** The stack of invoking states leading to the rule/states associated
53
+ * with this config. We track only those contexts pushed during
54
+ * execution of the ATN simulator.
55
+ */
56
+ private _context;
57
+ constructor(/*@NotNull*/ state: ATNState, alt: number, /*@NotNull*/ context: PredictionContext);
58
+ constructor(/*@NotNull*/ state: ATNState, /*@NotNull*/ c: ATNConfig, /*@NotNull*/ context: PredictionContext);
59
+ static create(/*@NotNull*/ state: ATNState, alt: number, context: PredictionContext): ATNConfig;
60
+ static create(/*@NotNull*/ state: ATNState, alt: number, context: PredictionContext, /*@NotNull*/ semanticContext: SemanticContext): ATNConfig;
61
+ static create(/*@NotNull*/ state: ATNState, alt: number, context: PredictionContext, /*@*/ semanticContext: SemanticContext, lexerActionExecutor: LexerActionExecutor | undefined): ATNConfig;
62
+ /** Gets the ATN state associated with this configuration */
63
+ get state(): ATNState;
64
+ /** What alt (or lexer rule) is predicted by this configuration */
65
+ get alt(): number;
66
+ get context(): PredictionContext;
67
+ set context(context: PredictionContext);
68
+ get reachesIntoOuterContext(): boolean;
69
+ /**
70
+ * We cannot execute predicates dependent upon local context unless
71
+ * we know for sure we are in the correct context. Because there is
72
+ * no way to do this efficiently, we simply cannot evaluate
73
+ * dependent predicates unless we are in the rule that initially
74
+ * invokes the ATN simulator.
75
+ *
76
+ * closure() tracks the depth of how far we dip into the outer context:
77
+ * depth &gt; 0. Note that it may not be totally accurate depth since I
78
+ * don't ever decrement. TODO: make it a boolean then
79
+ */
80
+ get outerContextDepth(): number;
81
+ set outerContextDepth(outerContextDepth: number);
82
+ get lexerActionExecutor(): LexerActionExecutor | undefined;
83
+ get semanticContext(): SemanticContext;
84
+ get hasPassedThroughNonGreedyDecision(): boolean;
85
+ clone(): ATNConfig;
86
+ transform(/*@NotNull*/ state: ATNState, checkNonGreedy: boolean): ATNConfig;
87
+ transform(/*@NotNull*/ state: ATNState, checkNonGreedy: boolean, /*@NotNull*/ semanticContext: SemanticContext): ATNConfig;
88
+ transform(/*@NotNull*/ state: ATNState, checkNonGreedy: boolean, context: PredictionContext): ATNConfig;
89
+ transform(/*@NotNull*/ state: ATNState, checkNonGreedy: boolean, lexerActionExecutor: LexerActionExecutor): ATNConfig;
90
+ private transformImpl;
91
+ private static checkNonGreedyDecision;
92
+ appendContext(context: number, contextCache: PredictionContextCache): ATNConfig;
93
+ appendContext(context: PredictionContext, contextCache: PredictionContextCache): ATNConfig;
94
+ /**
95
+ * Determines if this `ATNConfig` fully contains another `ATNConfig`.
96
+ *
97
+ * An ATN configuration represents a position (including context) in an ATN during parsing. Since `ATNConfig` stores
98
+ * the context as a graph, a single `ATNConfig` instance is capable of representing many ATN configurations which
99
+ * are all in the same "location" but have different contexts. These `ATNConfig` instances are again merged when
100
+ * they are added to an `ATNConfigSet`. This method supports `ATNConfigSet.contains` by evaluating whether a
101
+ * particular `ATNConfig` contains all of the ATN configurations represented by another `ATNConfig`.
102
+ *
103
+ * An `ATNConfig` _a_ contains another `ATNConfig` _b_ if all of the following conditions are met:
104
+ *
105
+ * * The configurations are in the same state (`state`)
106
+ * * The configurations predict the same alternative (`alt`)
107
+ * * The semantic context of _a_ implies the semantic context of _b_ (this method performs a weaker equality check)
108
+ * * Joining the prediction contexts of _a_ and _b_ results in the prediction context of _a_
109
+ *
110
+ * This method implements a conservative approximation of containment. As a result, when this method returns `true`
111
+ * it is known that parsing from `subconfig` can only recognize a subset of the inputs which can be recognized
112
+ * starting at the current `ATNConfig`. However, due to the imprecise evaluation of implication for the semantic
113
+ * contexts, no assumptions can be made about the relationship between the configurations when this method returns
114
+ * `false`.
115
+ *
116
+ * @param subconfig The sub configuration.
117
+ * @returns `true` if this configuration contains `subconfig`; otherwise, `false`.
118
+ */
119
+ contains(subconfig: ATNConfig): boolean;
120
+ get isPrecedenceFilterSuppressed(): boolean;
121
+ set isPrecedenceFilterSuppressed(value: boolean);
122
+ /** An ATN configuration is equal to another if both have
123
+ * the same state, they predict the same alternative, and
124
+ * syntactic/semantic contexts are the same.
125
+ */
126
+ equals(o: any): boolean;
127
+ hashCode(): number;
128
+ /**
129
+ * Returns a graphical representation of the current `ATNConfig` in Graphviz format. The graph can be stored to a
130
+ * **.dot** file and then rendered to an image using Graphviz.
131
+ *
132
+ * @returns A Graphviz graph representing the current `ATNConfig`.
133
+ *
134
+ * @see http://www.graphviz.org/
135
+ */
136
+ toDotString(): string;
137
+ toString(): string;
138
+ toString(recog: Recognizer<any, any> | undefined, showAlt: boolean): string;
139
+ toString(recog: Recognizer<any, any> | undefined, showAlt: boolean, showContext: boolean): string;
140
+ }
@@ -0,0 +1,113 @@
1
+ /*!
2
+ * Copyright 2016 The ANTLR Project. All rights reserved.
3
+ * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
4
+ */
5
+ import { Array2DHashSet } from "../misc/Array2DHashSet";
6
+ import { ATNConfig } from "./ATNConfig";
7
+ import { ATNSimulator } from "./ATNSimulator";
8
+ import { ATNState } from "./ATNState";
9
+ import { BitSet } from "../misc/BitSet";
10
+ import { ConflictInfo } from "./ConflictInfo";
11
+ import { JavaSet } from "../misc/Stubs";
12
+ import { PredictionContextCache } from "./PredictionContextCache";
13
+ /**
14
+ * Represents a set of ATN configurations (see `ATNConfig`). As configurations are added to the set, they are merged
15
+ * with other `ATNConfig` instances already in the set when possible using the graph-structured stack.
16
+ *
17
+ * An instance of this class represents the complete set of positions (with context) in an ATN which would be associated
18
+ * with a single DFA state. Its internal representation is more complex than traditional state used for NFA to DFA
19
+ * conversion due to performance requirements (both improving speed and reducing memory overhead) as well as supporting
20
+ * features such as semantic predicates and non-greedy operators in a form to support ANTLR's prediction algorithm.
21
+ *
22
+ * @author Sam Harwell
23
+ */
24
+ export declare class ATNConfigSet implements JavaSet<ATNConfig> {
25
+ /**
26
+ * This maps (state, alt) -> merged {@link ATNConfig}. The key does not account for
27
+ * the {@link ATNConfig#getSemanticContext} of the value, which is only a problem if a single
28
+ * `ATNConfigSet` contains two configs with the same state and alternative
29
+ * but different semantic contexts. When this case arises, the first config
30
+ * added to this map stays, and the remaining configs are placed in {@link #unmerged}.
31
+ *
32
+ * This map is only used for optimizing the process of adding configs to the set,
33
+ * and is `undefined` for read-only sets stored in the DFA.
34
+ */
35
+ private mergedConfigs?;
36
+ /**
37
+ * This is an "overflow" list holding configs which cannot be merged with one
38
+ * of the configs in {@link #mergedConfigs} but have a colliding key. This
39
+ * occurs when two configs in the set have the same state and alternative but
40
+ * different semantic contexts.
41
+ *
42
+ * This list is only used for optimizing the process of adding configs to the set,
43
+ * and is `undefined` for read-only sets stored in the DFA.
44
+ */
45
+ private unmerged?;
46
+ /**
47
+ * This is a list of all configs in this set.
48
+ */
49
+ private configs;
50
+ private _uniqueAlt;
51
+ private _conflictInfo?;
52
+ private _hasSemanticContext;
53
+ private _dipsIntoOuterContext;
54
+ /**
55
+ * When `true`, this config set represents configurations where the entire
56
+ * outer context has been consumed by the ATN interpreter. This prevents the
57
+ * {@link ParserATNSimulator#closure} from pursuing the global FOLLOW when a
58
+ * rule stop state is reached with an empty prediction context.
59
+ *
60
+ * Note: `outermostConfigSet` and {@link #dipsIntoOuterContext} should never
61
+ * be true at the same time.
62
+ */
63
+ private outermostConfigSet;
64
+ private cachedHashCode;
65
+ constructor();
66
+ constructor(set: ATNConfigSet, readonly: boolean);
67
+ /**
68
+ * Get the set of all alternatives represented by configurations in this
69
+ * set.
70
+ */
71
+ getRepresentedAlternatives(): BitSet;
72
+ get isReadOnly(): boolean;
73
+ get isOutermostConfigSet(): boolean;
74
+ set isOutermostConfigSet(outermostConfigSet: boolean);
75
+ getStates(): Array2DHashSet<ATNState>;
76
+ optimizeConfigs(interpreter: ATNSimulator): void;
77
+ clone(readonly: boolean): ATNConfigSet;
78
+ get size(): number;
79
+ get isEmpty(): boolean;
80
+ contains(o: any): boolean;
81
+ [Symbol.iterator](): IterableIterator<ATNConfig>;
82
+ toArray(): ATNConfig[];
83
+ add(e: ATNConfig): boolean;
84
+ add(e: ATNConfig, contextCache: PredictionContextCache | undefined): boolean;
85
+ private updatePropertiesForMergedConfig;
86
+ private updatePropertiesForAddedConfig;
87
+ protected canMerge(left: ATNConfig, leftKey: {
88
+ state: number;
89
+ alt: number;
90
+ }, right: ATNConfig): boolean;
91
+ protected getKey(e: ATNConfig): {
92
+ state: number;
93
+ alt: number;
94
+ };
95
+ containsAll(c: Iterable<any>): boolean;
96
+ addAll(c: Iterable<ATNConfig>): boolean;
97
+ addAll(c: Iterable<ATNConfig>, contextCache: PredictionContextCache): boolean;
98
+ clear(): void;
99
+ equals(obj: any): boolean;
100
+ hashCode(): number;
101
+ toString(): string;
102
+ toString(showContext: boolean): string;
103
+ get uniqueAlt(): number;
104
+ get hasSemanticContext(): boolean;
105
+ set hasSemanticContext(value: boolean);
106
+ get conflictInfo(): ConflictInfo | undefined;
107
+ set conflictInfo(conflictInfo: ConflictInfo | undefined);
108
+ get conflictingAlts(): BitSet | undefined;
109
+ get isExactConflict(): boolean;
110
+ get dipsIntoOuterContext(): boolean;
111
+ get(index: number): ATNConfig;
112
+ protected ensureWritable(): void;
113
+ }
@@ -0,0 +1,26 @@
1
+ /*!
2
+ * Copyright 2016 The ANTLR Project. All rights reserved.
3
+ * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
4
+ */
5
+ /**
6
+ *
7
+ * @author Sam Harwell
8
+ */
9
+ export declare class ATNDeserializationOptions {
10
+ private static _defaultOptions?;
11
+ private readOnly;
12
+ private verifyATN;
13
+ private generateRuleBypassTransitions;
14
+ private optimize;
15
+ constructor(options?: ATNDeserializationOptions);
16
+ static get defaultOptions(): ATNDeserializationOptions;
17
+ get isReadOnly(): boolean;
18
+ makeReadOnly(): void;
19
+ get isVerifyATN(): boolean;
20
+ set isVerifyATN(verifyATN: boolean);
21
+ get isGenerateRuleBypassTransitions(): boolean;
22
+ set isGenerateRuleBypassTransitions(generateRuleBypassTransitions: boolean);
23
+ get isOptimize(): boolean;
24
+ set isOptimize(optimize: boolean);
25
+ protected throwIfReadOnly(): void;
26
+ }
@@ -0,0 +1,86 @@
1
+ /*!
2
+ * Copyright 2016 The ANTLR Project. All rights reserved.
3
+ * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
4
+ */
5
+ import { ATN } from "./ATN";
6
+ import { ATNDeserializationOptions } from "./ATNDeserializationOptions";
7
+ import { ATNState } from "./ATNState";
8
+ import { ATNStateType } from "./ATNStateType";
9
+ import { IntervalSet } from "../misc/IntervalSet";
10
+ import { LexerAction } from "./LexerAction";
11
+ import { LexerActionType } from "./LexerActionType";
12
+ import { Transition } from "./Transition";
13
+ import { TransitionType } from "./TransitionType";
14
+ import { UUID } from "../misc/UUID";
15
+ /**
16
+ *
17
+ * @author Sam Harwell
18
+ */
19
+ export declare class ATNDeserializer {
20
+ static get SERIALIZED_VERSION(): number;
21
+ /**
22
+ * This is the earliest supported serialized UUID.
23
+ */
24
+ private static readonly BASE_SERIALIZED_UUID;
25
+ /**
26
+ * This UUID indicates an extension of {@link #ADDED_PRECEDENCE_TRANSITIONS}
27
+ * for the addition of lexer actions encoded as a sequence of
28
+ * {@link LexerAction} instances.
29
+ */
30
+ private static readonly ADDED_LEXER_ACTIONS;
31
+ /**
32
+ * This UUID indicates the serialized ATN contains two sets of
33
+ * IntervalSets, where the second set's values are encoded as
34
+ * 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
35
+ */
36
+ private static readonly ADDED_UNICODE_SMP;
37
+ /**
38
+ * This list contains all of the currently supported UUIDs, ordered by when
39
+ * the feature first appeared in this branch.
40
+ */
41
+ private static readonly SUPPORTED_UUIDS;
42
+ /**
43
+ * This is the current serialized UUID.
44
+ */
45
+ private static readonly SERIALIZED_UUID;
46
+ private readonly deserializationOptions;
47
+ constructor(deserializationOptions?: ATNDeserializationOptions);
48
+ /**
49
+ * Determines if a particular serialized representation of an ATN supports
50
+ * a particular feature, identified by the {@link UUID} used for serializing
51
+ * the ATN at the time the feature was first introduced.
52
+ *
53
+ * @param feature The {@link UUID} marking the first time the feature was
54
+ * supported in the serialized ATN.
55
+ * @param actualUuid The {@link UUID} of the actual serialized ATN which is
56
+ * currently being deserialized.
57
+ * @returns `true` if the `actualUuid` value represents a
58
+ * serialized ATN at or after the feature identified by `feature` was
59
+ * introduced; otherwise, `false`.
60
+ */
61
+ protected static isFeatureSupported(feature: UUID, actualUuid: UUID): boolean;
62
+ private static getUnicodeDeserializer;
63
+ deserialize(data: Uint16Array): ATN;
64
+ private deserializeSets;
65
+ /**
66
+ * Analyze the {@link StarLoopEntryState} states in the specified ATN to set
67
+ * the {@link StarLoopEntryState#precedenceRuleDecision} field to the
68
+ * correct value.
69
+ *
70
+ * @param atn The ATN.
71
+ */
72
+ protected markPrecedenceDecisions(atn: ATN): void;
73
+ protected verifyATN(atn: ATN): void;
74
+ protected checkCondition(condition: boolean, message?: string): void;
75
+ private static inlineSetRules;
76
+ private static combineChainedEpsilons;
77
+ private static optimizeSets;
78
+ private static identifyTailCalls;
79
+ private static testTailCall;
80
+ protected static toInt(c: number): number;
81
+ protected static toInt32(data: Uint16Array, offset: number): number;
82
+ protected static toUUID(data: Uint16Array, offset: number): UUID;
83
+ protected edgeFactory(atn: ATN, type: TransitionType, src: number, trg: number, arg1: number, arg2: number, arg3: number, sets: IntervalSet[]): Transition;
84
+ protected stateFactory(type: ATNStateType, ruleIndex: number): ATNState;
85
+ protected lexerActionFactory(type: LexerActionType, data1: number, data2: number): LexerAction;
86
+ }
@@ -0,0 +1,28 @@
1
+ /*!
2
+ * Copyright 2016 The ANTLR Project. All rights reserved.
3
+ * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
4
+ */
5
+ import { ATN } from "./ATN";
6
+ import { DFAState } from "../dfa/DFAState";
7
+ export declare abstract class ATNSimulator {
8
+ /** Must distinguish between missing edge and edge we know leads nowhere */
9
+ private static _ERROR;
10
+ static get ERROR(): DFAState;
11
+ atn: ATN;
12
+ constructor(atn: ATN);
13
+ abstract reset(): void;
14
+ /**
15
+ * Clear the DFA cache used by the current instance. Since the DFA cache may
16
+ * be shared by multiple ATN simulators, this method may affect the
17
+ * performance (but not accuracy) of other parsers which are being used
18
+ * concurrently.
19
+ *
20
+ * @ if the current instance does not
21
+ * support clearing the DFA.
22
+ *
23
+ * @since 4.3
24
+ */
25
+ clearDFA(): void;
26
+ }
27
+ export declare namespace ATNSimulator {
28
+ }
@@ -0,0 +1,111 @@
1
+ /*!
2
+ * Copyright 2016 The ANTLR Project. All rights reserved.
3
+ * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
4
+ */
5
+ import { ATN } from "./ATN";
6
+ import { ATNStateType } from "./ATNStateType";
7
+ import { IntervalSet } from "../misc/IntervalSet";
8
+ import { Transition } from "./Transition";
9
+ /**
10
+ * The following images show the relation of states and
11
+ * {@link ATNState#transitions} for various grammar constructs.
12
+ *
13
+ * * Solid edges marked with an &#0949; indicate a required
14
+ * {@link EpsilonTransition}.
15
+ *
16
+ * * Dashed edges indicate locations where any transition derived from
17
+ * {@link Transition} might appear.
18
+ *
19
+ * * Dashed nodes are place holders for either a sequence of linked
20
+ * {@link BasicState} states or the inclusion of a block representing a nested
21
+ * construct in one of the forms below.
22
+ *
23
+ * * Nodes showing multiple outgoing alternatives with a `...` support
24
+ * any number of alternatives (one or more). Nodes without the `...` only
25
+ * support the exact number of alternatives shown in the diagram.
26
+ *
27
+ * <h2>Basic Blocks</h2>
28
+ *
29
+ * <h3>Rule</h3>
30
+ *
31
+ * <embed src="images/Rule.svg" type="image/svg+xml"/>
32
+ *
33
+ * <h3>Block of 1 or more alternatives</h3>
34
+ *
35
+ * <embed src="images/Block.svg" type="image/svg+xml"/>
36
+ *
37
+ * <h2>Greedy Loops</h2>
38
+ *
39
+ * <h3>Greedy Closure: `(...)*`</h3>
40
+ *
41
+ * <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
42
+ *
43
+ * <h3>Greedy Positive Closure: `(...)+`</h3>
44
+ *
45
+ * <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
46
+ *
47
+ * <h3>Greedy Optional: `(...)?`</h3>
48
+ *
49
+ * <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
50
+ *
51
+ * <h2>Non-Greedy Loops</h2>
52
+ *
53
+ * <h3>Non-Greedy Closure: `(...)*?`</h3>
54
+ *
55
+ * <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
56
+ *
57
+ * <h3>Non-Greedy Positive Closure: `(...)+?`</h3>
58
+ *
59
+ * <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
60
+ *
61
+ * <h3>Non-Greedy Optional: `(...)??`</h3>
62
+ *
63
+ * <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
64
+ */
65
+ export declare abstract class ATNState {
66
+ /** Which ATN are we in? */
67
+ atn?: ATN;
68
+ stateNumber: number;
69
+ ruleIndex: number;
70
+ epsilonOnlyTransitions: boolean;
71
+ /** Track the transitions emanating from this ATN state. */
72
+ protected transitions: Transition[];
73
+ protected optimizedTransitions: Transition[];
74
+ /** Used to cache lookahead during parsing, not used during construction */
75
+ nextTokenWithinRule?: IntervalSet;
76
+ /**
77
+ * Gets the state number.
78
+ *
79
+ * @returns the state number
80
+ */
81
+ getStateNumber(): number;
82
+ /**
83
+ * For all states except {@link RuleStopState}, this returns the state
84
+ * number. Returns -1 for stop states.
85
+ *
86
+ * @returns -1 for {@link RuleStopState}, otherwise the state number
87
+ */
88
+ get nonStopStateNumber(): number;
89
+ hashCode(): number;
90
+ equals(o: any): boolean;
91
+ get isNonGreedyExitState(): boolean;
92
+ toString(): string;
93
+ getTransitions(): Transition[];
94
+ get numberOfTransitions(): number;
95
+ addTransition(e: Transition, index?: number): void;
96
+ transition(i: number): Transition;
97
+ setTransition(i: number, e: Transition): void;
98
+ removeTransition(index: number): Transition;
99
+ abstract readonly stateType: ATNStateType;
100
+ get onlyHasEpsilonTransitions(): boolean;
101
+ setRuleIndex(ruleIndex: number): void;
102
+ get isOptimized(): boolean;
103
+ get numberOfOptimizedTransitions(): number;
104
+ getOptimizedTransition(i: number): Transition;
105
+ addOptimizedTransition(e: Transition): void;
106
+ setOptimizedTransition(i: number, e: Transition): void;
107
+ removeOptimizedTransition(i: number): void;
108
+ }
109
+ export declare namespace ATNState {
110
+ const INVALID_STATE_NUMBER: number;
111
+ }
@@ -0,0 +1,19 @@
1
+ /*!
2
+ * Copyright 2016 The ANTLR Project. All rights reserved.
3
+ * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
4
+ */
5
+ export declare enum ATNStateType {
6
+ INVALID_TYPE = 0,
7
+ BASIC = 1,
8
+ RULE_START = 2,
9
+ BLOCK_START = 3,
10
+ PLUS_BLOCK_START = 4,
11
+ STAR_BLOCK_START = 5,
12
+ TOKEN_START = 6,
13
+ RULE_STOP = 7,
14
+ BLOCK_END = 8,
15
+ STAR_LOOP_BACK = 9,
16
+ STAR_LOOP_ENTRY = 10,
17
+ PLUS_LOOP_BACK = 11,
18
+ LOOP_END = 12
19
+ }
@@ -0,0 +1,19 @@
1
+ /*!
2
+ * Copyright 2016 The ANTLR Project. All rights reserved.
3
+ * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
4
+ */
5
+ /**
6
+ * Represents the type of recognizer an ATN applies to.
7
+ *
8
+ * @author Sam Harwell
9
+ */
10
+ export declare const enum ATNType {
11
+ /**
12
+ * A lexer grammar.
13
+ */
14
+ LEXER = 0,
15
+ /**
16
+ * A parser grammar.
17
+ */
18
+ PARSER = 1
19
+ }