omlish 0.0.0.dev56__py3-none-any.whl → 0.0.0.dev58__py3-none-any.whl

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 (68) hide show
  1. omlish/__about__.py +2 -2
  2. omlish/antlr/__init__.py +0 -0
  3. omlish/antlr/_runtime/BufferedTokenStream.py +305 -0
  4. omlish/antlr/_runtime/CommonTokenFactory.py +64 -0
  5. omlish/antlr/_runtime/CommonTokenStream.py +90 -0
  6. omlish/antlr/_runtime/FileStream.py +30 -0
  7. omlish/antlr/_runtime/InputStream.py +90 -0
  8. omlish/antlr/_runtime/IntervalSet.py +183 -0
  9. omlish/antlr/_runtime/LL1Analyzer.py +176 -0
  10. omlish/antlr/_runtime/Lexer.py +332 -0
  11. omlish/antlr/_runtime/ListTokenSource.py +147 -0
  12. omlish/antlr/_runtime/Parser.py +583 -0
  13. omlish/antlr/_runtime/ParserInterpreter.py +173 -0
  14. omlish/antlr/_runtime/ParserRuleContext.py +189 -0
  15. omlish/antlr/_runtime/PredictionContext.py +632 -0
  16. omlish/antlr/_runtime/Recognizer.py +150 -0
  17. omlish/antlr/_runtime/RuleContext.py +230 -0
  18. omlish/antlr/_runtime/StdinStream.py +14 -0
  19. omlish/antlr/_runtime/Token.py +158 -0
  20. omlish/antlr/_runtime/TokenStreamRewriter.py +258 -0
  21. omlish/antlr/_runtime/Utils.py +36 -0
  22. omlish/antlr/_runtime/__init__.py +24 -0
  23. omlish/antlr/_runtime/_pygrun.py +174 -0
  24. omlish/antlr/_runtime/atn/ATN.py +135 -0
  25. omlish/antlr/_runtime/atn/ATNConfig.py +162 -0
  26. omlish/antlr/_runtime/atn/ATNConfigSet.py +215 -0
  27. omlish/antlr/_runtime/atn/ATNDeserializationOptions.py +27 -0
  28. omlish/antlr/_runtime/atn/ATNDeserializer.py +449 -0
  29. omlish/antlr/_runtime/atn/ATNSimulator.py +50 -0
  30. omlish/antlr/_runtime/atn/ATNState.py +267 -0
  31. omlish/antlr/_runtime/atn/ATNType.py +20 -0
  32. omlish/antlr/_runtime/atn/LexerATNSimulator.py +573 -0
  33. omlish/antlr/_runtime/atn/LexerAction.py +301 -0
  34. omlish/antlr/_runtime/atn/LexerActionExecutor.py +146 -0
  35. omlish/antlr/_runtime/atn/ParserATNSimulator.py +1664 -0
  36. omlish/antlr/_runtime/atn/PredictionMode.py +502 -0
  37. omlish/antlr/_runtime/atn/SemanticContext.py +333 -0
  38. omlish/antlr/_runtime/atn/Transition.py +271 -0
  39. omlish/antlr/_runtime/atn/__init__.py +4 -0
  40. omlish/antlr/_runtime/dfa/DFA.py +136 -0
  41. omlish/antlr/_runtime/dfa/DFASerializer.py +76 -0
  42. omlish/antlr/_runtime/dfa/DFAState.py +129 -0
  43. omlish/antlr/_runtime/dfa/__init__.py +4 -0
  44. omlish/antlr/_runtime/error/DiagnosticErrorListener.py +110 -0
  45. omlish/antlr/_runtime/error/ErrorListener.py +75 -0
  46. omlish/antlr/_runtime/error/ErrorStrategy.py +712 -0
  47. omlish/antlr/_runtime/error/Errors.py +176 -0
  48. omlish/antlr/_runtime/error/__init__.py +4 -0
  49. omlish/antlr/_runtime/tree/Chunk.py +33 -0
  50. omlish/antlr/_runtime/tree/ParseTreeMatch.py +121 -0
  51. omlish/antlr/_runtime/tree/ParseTreePattern.py +75 -0
  52. omlish/antlr/_runtime/tree/ParseTreePatternMatcher.py +377 -0
  53. omlish/antlr/_runtime/tree/RuleTagToken.py +53 -0
  54. omlish/antlr/_runtime/tree/TokenTagToken.py +50 -0
  55. omlish/antlr/_runtime/tree/Tree.py +194 -0
  56. omlish/antlr/_runtime/tree/Trees.py +114 -0
  57. omlish/antlr/_runtime/tree/__init__.py +2 -0
  58. omlish/antlr/_runtime/xpath/XPath.py +272 -0
  59. omlish/antlr/_runtime/xpath/XPathLexer.py +98 -0
  60. omlish/antlr/_runtime/xpath/__init__.py +4 -0
  61. omlish/formats/json/cli.py +76 -7
  62. omlish/formats/props.py +6 -2
  63. {omlish-0.0.0.dev56.dist-info → omlish-0.0.0.dev58.dist-info}/METADATA +1 -1
  64. {omlish-0.0.0.dev56.dist-info → omlish-0.0.0.dev58.dist-info}/RECORD +68 -9
  65. {omlish-0.0.0.dev56.dist-info → omlish-0.0.0.dev58.dist-info}/LICENSE +0 -0
  66. {omlish-0.0.0.dev56.dist-info → omlish-0.0.0.dev58.dist-info}/WHEEL +0 -0
  67. {omlish-0.0.0.dev56.dist-info → omlish-0.0.0.dev58.dist-info}/entry_points.txt +0 -0
  68. {omlish-0.0.0.dev56.dist-info → omlish-0.0.0.dev58.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,267 @@
1
+ # type: ignore
2
+ # ruff: noqa
3
+ # flake8: noqa
4
+ #
5
+ # Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
6
+ # Use of this file is governed by the BSD 3-clause license that
7
+ # can be found in the LICENSE.txt file in the project root.
8
+ #
9
+
10
+ # The following images show the relation of states and
11
+ # {@link ATNState#transitions} for various grammar constructs.
12
+ #
13
+ # <ul>
14
+ #
15
+ # <li>Solid edges marked with an &#0949; indicate a required
16
+ # {@link EpsilonTransition}.</li>
17
+ #
18
+ # <li>Dashed edges indicate locations where any transition derived from
19
+ # {@link Transition} might appear.</li>
20
+ #
21
+ # <li>Dashed nodes are place holders for either a sequence of linked
22
+ # {@link BasicState} states or the inclusion of a block representing a nested
23
+ # construct in one of the forms below.</li>
24
+ #
25
+ # <li>Nodes showing multiple outgoing alternatives with a {@code ...} support
26
+ # any number of alternatives (one or more). Nodes without the {@code ...} only
27
+ # support the exact number of alternatives shown in the diagram.</li>
28
+ #
29
+ # </ul>
30
+ #
31
+ # <h2>Basic Blocks</h2>
32
+ #
33
+ # <h3>Rule</h3>
34
+ #
35
+ # <embed src="images/Rule.svg" type="image/svg+xml"/>
36
+ #
37
+ # <h3>Block of 1 or more alternatives</h3>
38
+ #
39
+ # <embed src="images/Block.svg" type="image/svg+xml"/>
40
+ #
41
+ # <h2>Greedy Loops</h2>
42
+ #
43
+ # <h3>Greedy Closure: {@code (...)*}</h3>
44
+ #
45
+ # <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
46
+ #
47
+ # <h3>Greedy Positive Closure: {@code (...)+}</h3>
48
+ #
49
+ # <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
50
+ #
51
+ # <h3>Greedy Optional: {@code (...)?}</h3>
52
+ #
53
+ # <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
54
+ #
55
+ # <h2>Non-Greedy Loops</h2>
56
+ #
57
+ # <h3>Non-Greedy Closure: {@code (...)*?}</h3>
58
+ #
59
+ # <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
60
+ #
61
+ # <h3>Non-Greedy Positive Closure: {@code (...)+?}</h3>
62
+ #
63
+ # <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
64
+ #
65
+ # <h3>Non-Greedy Optional: {@code (...)??}</h3>
66
+ #
67
+ # <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
68
+ #
69
+
70
+ from .Transition import Transition
71
+
72
+ INITIAL_NUM_TRANSITIONS = 4
73
+
74
+ class ATNState(object):
75
+ __slots__ = (
76
+ 'atn', 'stateNumber', 'stateType', 'ruleIndex', 'epsilonOnlyTransitions',
77
+ 'transitions', 'nextTokenWithinRule',
78
+ )
79
+
80
+ # constants for serialization
81
+ INVALID_TYPE = 0
82
+ BASIC = 1
83
+ RULE_START = 2
84
+ BLOCK_START = 3
85
+ PLUS_BLOCK_START = 4
86
+ STAR_BLOCK_START = 5
87
+ TOKEN_START = 6
88
+ RULE_STOP = 7
89
+ BLOCK_END = 8
90
+ STAR_LOOP_BACK = 9
91
+ STAR_LOOP_ENTRY = 10
92
+ PLUS_LOOP_BACK = 11
93
+ LOOP_END = 12
94
+
95
+ serializationNames = [
96
+ "INVALID",
97
+ "BASIC",
98
+ "RULE_START",
99
+ "BLOCK_START",
100
+ "PLUS_BLOCK_START",
101
+ "STAR_BLOCK_START",
102
+ "TOKEN_START",
103
+ "RULE_STOP",
104
+ "BLOCK_END",
105
+ "STAR_LOOP_BACK",
106
+ "STAR_LOOP_ENTRY",
107
+ "PLUS_LOOP_BACK",
108
+ "LOOP_END" ]
109
+
110
+ INVALID_STATE_NUMBER = -1
111
+
112
+ def __init__(self):
113
+ # Which ATN are we in?
114
+ self.atn = None
115
+ self.stateNumber = ATNState.INVALID_STATE_NUMBER
116
+ self.stateType = None
117
+ self.ruleIndex = 0 # at runtime, we don't have Rule objects
118
+ self.epsilonOnlyTransitions = False
119
+ # Track the transitions emanating from this ATN state.
120
+ self.transitions = []
121
+ # Used to cache lookahead during parsing, not used during construction
122
+ self.nextTokenWithinRule = None
123
+
124
+ def __hash__(self):
125
+ return self.stateNumber
126
+
127
+ def __eq__(self, other):
128
+ return isinstance(other, ATNState) and self.stateNumber==other.stateNumber
129
+
130
+ def onlyHasEpsilonTransitions(self):
131
+ return self.epsilonOnlyTransitions
132
+
133
+ def isNonGreedyExitState(self):
134
+ return False
135
+
136
+ def __str__(self):
137
+ return str(self.stateNumber)
138
+
139
+ def addTransition(self, trans:Transition, index:int=-1):
140
+ if len(self.transitions)==0:
141
+ self.epsilonOnlyTransitions = trans.isEpsilon
142
+ elif self.epsilonOnlyTransitions != trans.isEpsilon:
143
+ self.epsilonOnlyTransitions = False
144
+ # TODO System.err.format(Locale.getDefault(), "ATN state %d has both epsilon and non-epsilon transitions.\n", stateNumber);
145
+ if index==-1:
146
+ self.transitions.append(trans)
147
+ else:
148
+ self.transitions.insert(index, trans)
149
+
150
+ class BasicState(ATNState):
151
+
152
+ def __init__(self):
153
+ super().__init__()
154
+ self.stateType = self.BASIC
155
+
156
+
157
+ class DecisionState(ATNState):
158
+ __slots__ = ('decision', 'nonGreedy')
159
+ def __init__(self):
160
+ super().__init__()
161
+ self.decision = -1
162
+ self.nonGreedy = False
163
+
164
+ # The start of a regular {@code (...)} block.
165
+ class BlockStartState(DecisionState):
166
+ __slots__ = 'endState'
167
+
168
+ def __init__(self):
169
+ super().__init__()
170
+ self.endState = None
171
+
172
+ class BasicBlockStartState(BlockStartState):
173
+
174
+ def __init__(self):
175
+ super().__init__()
176
+ self.stateType = self.BLOCK_START
177
+
178
+ # Terminal node of a simple {@code (a|b|c)} block.
179
+ class BlockEndState(ATNState):
180
+ __slots__ = 'startState'
181
+
182
+ def __init__(self):
183
+ super().__init__()
184
+ self.stateType = self.BLOCK_END
185
+ self.startState = None
186
+
187
+ # The last node in the ATN for a rule, unless that rule is the start symbol.
188
+ # In that case, there is one transition to EOF. Later, we might encode
189
+ # references to all calls to this rule to compute FOLLOW sets for
190
+ # error handling.
191
+ #
192
+ class RuleStopState(ATNState):
193
+
194
+ def __init__(self):
195
+ super().__init__()
196
+ self.stateType = self.RULE_STOP
197
+
198
+ class RuleStartState(ATNState):
199
+ __slots__ = ('stopState', 'isPrecedenceRule')
200
+
201
+ def __init__(self):
202
+ super().__init__()
203
+ self.stateType = self.RULE_START
204
+ self.stopState = None
205
+ self.isPrecedenceRule = False
206
+
207
+ # Decision state for {@code A+} and {@code (A|B)+}. It has two transitions:
208
+ # one to the loop back to start of the block and one to exit.
209
+ #
210
+ class PlusLoopbackState(DecisionState):
211
+
212
+ def __init__(self):
213
+ super().__init__()
214
+ self.stateType = self.PLUS_LOOP_BACK
215
+
216
+ # Start of {@code (A|B|...)+} loop. Technically a decision state, but
217
+ # we don't use for code generation; somebody might need it, so I'm defining
218
+ # it for completeness. In reality, the {@link PlusLoopbackState} node is the
219
+ # real decision-making note for {@code A+}.
220
+ #
221
+ class PlusBlockStartState(BlockStartState):
222
+ __slots__ = 'loopBackState'
223
+
224
+ def __init__(self):
225
+ super().__init__()
226
+ self.stateType = self.PLUS_BLOCK_START
227
+ self.loopBackState = None
228
+
229
+ # The block that begins a closure loop.
230
+ class StarBlockStartState(BlockStartState):
231
+
232
+ def __init__(self):
233
+ super().__init__()
234
+ self.stateType = self.STAR_BLOCK_START
235
+
236
+ class StarLoopbackState(ATNState):
237
+
238
+ def __init__(self):
239
+ super().__init__()
240
+ self.stateType = self.STAR_LOOP_BACK
241
+
242
+
243
+ class StarLoopEntryState(DecisionState):
244
+ __slots__ = ('loopBackState', 'isPrecedenceDecision')
245
+
246
+ def __init__(self):
247
+ super().__init__()
248
+ self.stateType = self.STAR_LOOP_ENTRY
249
+ self.loopBackState = None
250
+ # Indicates whether this state can benefit from a precedence DFA during SLL decision making.
251
+ self.isPrecedenceDecision = None
252
+
253
+ # Mark the end of a * or + loop.
254
+ class LoopEndState(ATNState):
255
+ __slots__ = 'loopBackState'
256
+
257
+ def __init__(self):
258
+ super().__init__()
259
+ self.stateType = self.LOOP_END
260
+ self.loopBackState = None
261
+
262
+ # The Tokens rule start state linking to each lexer rule start state */
263
+ class TokensStartState(DecisionState):
264
+
265
+ def __init__(self):
266
+ super().__init__()
267
+ self.stateType = self.TOKEN_START
@@ -0,0 +1,20 @@
1
+ # type: ignore
2
+ # ruff: noqa
3
+ # flake8: noqa
4
+ # Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
5
+ # Use of this file is governed by the BSD 3-clause license that
6
+ # can be found in the LICENSE.txt file in the project root.
7
+ #/
8
+
9
+ from enum import IntEnum
10
+
11
+ # Represents the type of recognizer an ATN applies to.
12
+
13
+ class ATNType(IntEnum):
14
+
15
+ LEXER = 0
16
+ PARSER = 1
17
+
18
+ @classmethod
19
+ def fromOrdinal(cls, i:int):
20
+ return cls._value2member_map_[i]