llparse 0.1.0__tar.gz → 0.1.1__tar.gz

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 (38) hide show
  1. {llparse-0.1.0/llparse.egg-info → llparse-0.1.1}/PKG-INFO +5 -1
  2. llparse-0.1.0/PKG-INFO → llparse-0.1.1/README.md +4 -10
  3. {llparse-0.1.0 → llparse-0.1.1}/llparse/C_compiler.py +2 -2
  4. {llparse-0.1.0 → llparse-0.1.1}/llparse/compilator.py +5 -1
  5. {llparse-0.1.0 → llparse-0.1.1}/llparse/frontend.py +7 -7
  6. {llparse-0.1.0 → llparse-0.1.1}/llparse/pybuilder/builder.py +1 -1
  7. {llparse-0.1.0 → llparse-0.1.1}/llparse/pybuilder/main_code.py +2 -1
  8. {llparse-0.1.0 → llparse-0.1.1}/llparse/pyfront/front.py +11 -4
  9. llparse-0.1.1/llparse/pyfront/namespace.py +3 -0
  10. {llparse-0.1.0 → llparse-0.1.1}/llparse/pyfront/nodes.py +11 -4
  11. llparse-0.1.0/README.md → llparse-0.1.1/llparse.egg-info/PKG-INFO +14 -0
  12. {llparse-0.1.0 → llparse-0.1.1}/pyproject.toml +1 -1
  13. llparse-0.1.0/llparse/pyfront/namespace.py +0 -1
  14. {llparse-0.1.0 → llparse-0.1.1}/LICENSE +0 -0
  15. {llparse-0.1.0 → llparse-0.1.1}/llparse/__init__.py +0 -0
  16. {llparse-0.1.0 → llparse-0.1.1}/llparse/constants.py +0 -0
  17. {llparse-0.1.0 → llparse-0.1.1}/llparse/cython_builder.py +0 -0
  18. {llparse-0.1.0 → llparse-0.1.1}/llparse/debug.py +0 -0
  19. {llparse-0.1.0 → llparse-0.1.1}/llparse/dot.py +0 -0
  20. {llparse-0.1.0 → llparse-0.1.1}/llparse/enumerator.py +0 -0
  21. {llparse-0.1.0 → llparse-0.1.1}/llparse/header.py +0 -0
  22. {llparse-0.1.0 → llparse-0.1.1}/llparse/llparse.py +0 -0
  23. {llparse-0.1.0 → llparse-0.1.1}/llparse/pybuilder/__init__.py +0 -0
  24. {llparse-0.1.0 → llparse-0.1.1}/llparse/pybuilder/loopchecker.py +0 -0
  25. {llparse-0.1.0 → llparse-0.1.1}/llparse/pybuilder/parsemap.py +0 -0
  26. {llparse-0.1.0 → llparse-0.1.1}/llparse/pyfront/containers.py +0 -0
  27. {llparse-0.1.0 → llparse-0.1.1}/llparse/pyfront/implementation.py +0 -0
  28. {llparse-0.1.0 → llparse-0.1.1}/llparse/pyfront/peephole.py +0 -0
  29. {llparse-0.1.0 → llparse-0.1.1}/llparse/pyfront/transform.py +0 -0
  30. {llparse-0.1.0 → llparse-0.1.1}/llparse/settings.py +0 -0
  31. {llparse-0.1.0 → llparse-0.1.1}/llparse/spanalloc.py +0 -0
  32. {llparse-0.1.0 → llparse-0.1.1}/llparse/test.py +0 -0
  33. {llparse-0.1.0 → llparse-0.1.1}/llparse/tire.py +0 -0
  34. {llparse-0.1.0 → llparse-0.1.1}/llparse/trie.py +0 -0
  35. {llparse-0.1.0 → llparse-0.1.1}/llparse.egg-info/SOURCES.txt +0 -0
  36. {llparse-0.1.0 → llparse-0.1.1}/llparse.egg-info/dependency_links.txt +0 -0
  37. {llparse-0.1.0 → llparse-0.1.1}/llparse.egg-info/top_level.txt +0 -0
  38. {llparse-0.1.0 → llparse-0.1.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: llparse
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: A Parody of llparse written for writing C Parsers with Python
5
5
  Author-email: Vizonex <VizonexBusiness@gmail.com>
6
6
  Requires-Python: >=3.9
@@ -9,6 +9,10 @@ License-File: LICENSE
9
9
  Dynamic: license-file
10
10
 
11
11
  # pyllparse
12
+ [![PyPI version](https://badge.fury.io/py/llparse.svg)](https://badge.fury.io/py/llparse)
13
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/llparse)](https://badge.fury.io/py/llparse)
14
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
15
+
12
16
  A python parody of the typescript library llparse.
13
17
 
14
18
  I take no credit for the orginal work done by indutny and I was originally very nervous about making
@@ -1,14 +1,8 @@
1
- Metadata-Version: 2.4
2
- Name: llparse
3
- Version: 0.1.0
4
- Summary: A Parody of llparse written for writing C Parsers with Python
5
- Author-email: Vizonex <VizonexBusiness@gmail.com>
6
- Requires-Python: >=3.9
7
- Description-Content-Type: text/markdown
8
- License-File: LICENSE
9
- Dynamic: license-file
10
-
11
1
  # pyllparse
2
+ [![PyPI version](https://badge.fury.io/py/llparse.svg)](https://badge.fury.io/py/llparse)
3
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/llparse)](https://badge.fury.io/py/llparse)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
12
6
  A python parody of the typescript library llparse.
13
7
 
14
8
  I take no credit for the orginal work done by indutny and I was originally very nervous about making
@@ -182,9 +182,9 @@ class CCompiler:
182
182
  else:
183
183
  # TODO (Vizonex) Merge lines 139 & 140 together in a future update
184
184
  callback = (
185
- f"({info.prefix}__span_cb)"
185
+ f"(({info.prefix}__span_cb)"
186
186
  + ctx.spanCbField(span.index)
187
- + f"({callback})"
187
+ + f")"
188
188
  )
189
189
 
190
190
  args = [ctx.stateArg(), posField, f"(const char*) {ctx.endPosArg()}"]
@@ -105,6 +105,9 @@ class Code(Generic[T]):
105
105
  def build(self, ctx: "Compilation", out: list[str]):
106
106
  pass
107
107
 
108
+ def __hash__(self):
109
+ return hash(self.ref)
110
+
108
111
 
109
112
  class External(Code[_frontend.code.External]):
110
113
  def build(self, ctx: "Compilation", out: list[str]):
@@ -167,7 +170,7 @@ class Load(Field):
167
170
  def doBuild(self, ctx: "Compilation", out: list[str]):
168
171
  out.append(f"return {self.field(ctx)};")
169
172
 
170
-
173
+
171
174
  # BIG ONE
172
175
 
173
176
 
@@ -409,6 +412,7 @@ class Empty(Node):
409
412
  def __init__(self, ref: _frontend.node.Empty) -> None:
410
413
  self.ref = ref
411
414
  super().__init__(ref)
415
+
412
416
 
413
417
  def doBuild(self, out: list[str]):
414
418
  assert self.ref.otherwise
@@ -309,18 +309,18 @@ class Frontend:
309
309
  bailout = False
310
310
  for child in trie.children:
311
311
  if isinstance(child.node, TrieEmpty):
312
- print(
313
- 'non-leaf trie child of "%s" prevents table allocation' % node.name
314
- )
312
+ # print(
313
+ # 'non-leaf trie child of "%s" prevents table allocation' % node.name
314
+ # )
315
315
  bailout = False
316
316
  continue
317
317
 
318
318
  empty: TrieEmpty = child.node
319
319
  if getattr(empty, "value", None) is None:
320
- print(
321
- 'value passing trie leaf of "%s" prevents table allocation'
322
- % node.name
323
- )
320
+ # print(
321
+ # 'value passing trie leaf of "%s" prevents table allocation'
322
+ # % node.name
323
+ # )
324
324
  bailout = False
325
325
  continue
326
326
 
@@ -1,6 +1,6 @@
1
1
  from typing import Literal, Optional, Union
2
2
 
3
- import pyparse.pybuilder.main_code as code
3
+ from ..pybuilder import main_code as code
4
4
 
5
5
  # from pydot import graph_from_dot_data
6
6
 
@@ -37,7 +37,8 @@ class Code:
37
37
 
38
38
  self.signature = signature
39
39
  self.name = name
40
-
40
+ def __hash__(self):
41
+ return hash(self.signature + self.name)
41
42
 
42
43
  class Field(Code):
43
44
  def __init__(self, signature: str, name: str, field: str) -> None:
@@ -10,12 +10,12 @@ T = TypeVar("T")
10
10
  Signature = TypeVar("Signature", bytes, str)
11
11
 
12
12
 
13
- @dataclass
13
+ @dataclass(unsafe_hash=True)
14
14
  class IWrap(Generic[T]):
15
15
  ref: T
16
16
 
17
- def __hash__(self) -> int:
18
- return hash(self.ref)
17
+ # def __hash__(self) -> int:
18
+ # return hash(self.ref)
19
19
 
20
20
 
21
21
  def toCacheKey(value: Union[int, bool]) -> str:
@@ -33,6 +33,8 @@ class Code:
33
33
  cacheKey: str
34
34
  name: str
35
35
 
36
+ def __hash__(self):
37
+ return hash(self.cacheKey)
36
38
 
37
39
  class External(Code):
38
40
  """Inherits from the `Code` class as a subclass of `Code`"""
@@ -44,8 +46,10 @@ class External(Code):
44
46
  @dataclass
45
47
  class Field(Code):
46
48
  """Inherits from `Code`"""
47
-
48
49
  field: str
50
+
51
+ def __hash__(self):
52
+ return hash(self.cacheKey)
49
53
 
50
54
 
51
55
  class FieldValueError(Exception):
@@ -167,6 +171,9 @@ class IUniqueName:
167
171
  name: str
168
172
  originalName: str
169
173
 
174
+ def __hash__(self):
175
+ return hash(self.originalName)
176
+
170
177
 
171
178
  @dataclass
172
179
  class Identifier:
@@ -0,0 +1,3 @@
1
+ from ..pyfront import transform as transform
2
+ from ..pyfront import nodes as node
3
+ from ..pyfront import front as code
@@ -26,11 +26,13 @@ class Slot:
26
26
  return self.privNode
27
27
 
28
28
 
29
- @dataclass
29
+ @dataclass(unsafe_hash=True)
30
30
  class IUniqueName:
31
31
  name: str
32
32
  originalName: str
33
33
 
34
+ # def __hash__(self):
35
+ # return hash(self.name)
34
36
 
35
37
  @dataclass
36
38
  class IOtherwiseEdge:
@@ -81,6 +83,8 @@ class Node:
81
83
  if otherwise:
82
84
  yield Slot(otherwise.node, otherwise.node)
83
85
 
86
+ def __hash__(self):
87
+ return hash(self.id)
84
88
 
85
89
  class Consume(Node):
86
90
  def __init__(self, id: IUniqueName, field: str) -> None:
@@ -115,8 +119,11 @@ class Invoke(Node):
115
119
 
116
120
 
117
121
  class Empty(Node):
118
- def __init__(self, id: IUniqueName) -> None:
119
- super().__init__(id)
122
+ # def __init__(self, id: IUniqueName) -> None:
123
+ # super().__init__(id)
124
+
125
+ def __hash__(self):
126
+ return hash(self.id)
120
127
 
121
128
 
122
129
  class Error(Node):
@@ -172,7 +179,7 @@ class SpanStart(Node):
172
179
  self.field = field
173
180
  self.callback = callback
174
181
  super().__init__(id)
175
-
182
+
176
183
 
177
184
  class SpanEnd(Node):
178
185
  def __init__(
@@ -1,4 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: llparse
3
+ Version: 0.1.1
4
+ Summary: A Parody of llparse written for writing C Parsers with Python
5
+ Author-email: Vizonex <VizonexBusiness@gmail.com>
6
+ Requires-Python: >=3.9
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Dynamic: license-file
10
+
1
11
  # pyllparse
12
+ [![PyPI version](https://badge.fury.io/py/llparse.svg)](https://badge.fury.io/py/llparse)
13
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/llparse)](https://badge.fury.io/py/llparse)
14
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
15
+
2
16
  A python parody of the typescript library llparse.
3
17
 
4
18
  I take no credit for the orginal work done by indutny and I was originally very nervous about making
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "llparse"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  description = "A Parody of llparse written for writing C Parsers with Python"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -1 +0,0 @@
1
- from ..pyfront import transform as transform
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes