syncraft 0.1.36__tar.gz → 0.1.38__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.
Potentially problematic release.
This version of syncraft might be problematic. Click here for more details.
- {syncraft-0.1.36 → syncraft-0.1.38}/PKG-INFO +1 -1
- {syncraft-0.1.36 → syncraft-0.1.38}/pyproject.toml +1 -1
- {syncraft-0.1.36 → syncraft-0.1.38}/syncraft/finder.py +2 -2
- {syncraft-0.1.36 → syncraft-0.1.38}/syncraft/syntax.py +13 -7
- {syncraft-0.1.36 → syncraft-0.1.38}/syncraft.egg-info/PKG-INFO +1 -1
- {syncraft-0.1.36 → syncraft-0.1.38}/syncraft.egg-info/SOURCES.txt +2 -1
- syncraft-0.1.38/tests/test_var.py +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/LICENSE +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/README.md +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/setup.cfg +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/syncraft/__init__.py +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/syncraft/algebra.py +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/syncraft/ast.py +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/syncraft/constraint.py +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/syncraft/diagnostic.py +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/syncraft/generator.py +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/syncraft/parser.py +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/syncraft/py.typed +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/syncraft/sqlite3.py +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/syncraft.egg-info/dependency_links.txt +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/syncraft.egg-info/requires.txt +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/syncraft.egg-info/top_level.txt +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/tests/test_bimap.py +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/tests/test_find.py +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/tests/test_parse.py +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/tests/test_to.py +0 -0
- {syncraft-0.1.36 → syncraft-0.1.38}/tests/test_until.py +0 -0
|
@@ -35,8 +35,8 @@ def matches(syntax: Syntax[Any, Any], data: ParseResult[Any])-> bool:
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
def find(syntax: Syntax[Any, Any], data: ParseResult[Any]) -> YieldGen[ParseResult[Any], None, None]:
|
|
38
|
-
if
|
|
39
|
-
if
|
|
38
|
+
if not isinstance(data, Marked):
|
|
39
|
+
if matches(syntax, data):
|
|
40
40
|
yield data
|
|
41
41
|
match data:
|
|
42
42
|
case Then(left=left, right=right):
|
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import (
|
|
4
4
|
Optional, Any, TypeVar, Generic, Callable, Tuple, cast,
|
|
5
|
-
Type, Literal, List
|
|
5
|
+
Type, Literal, List, overload
|
|
6
6
|
)
|
|
7
7
|
from dataclasses import dataclass, field, replace
|
|
8
8
|
from functools import reduce
|
|
@@ -250,14 +250,20 @@ class Syntax(Generic[A, S]):
|
|
|
250
250
|
|
|
251
251
|
|
|
252
252
|
######################################################################## data processing combinators #########################################################
|
|
253
|
+
@overload
|
|
254
|
+
def bind(self,
|
|
255
|
+
var: Variable,
|
|
256
|
+
collector: None = None)-> Syntax[A | Marked[A], S]: ...
|
|
257
|
+
|
|
258
|
+
@overload
|
|
259
|
+
def bind(self,
|
|
260
|
+
var: Variable,
|
|
261
|
+
collector: Type[E]) -> Syntax[Collect[A, E] | Marked[Collect[A, E]], S]: ...
|
|
262
|
+
|
|
253
263
|
def bind(self,
|
|
254
264
|
var: Variable,
|
|
255
|
-
collector: Optional[Type[E]]=None) -> Syntax[
|
|
256
|
-
|
|
257
|
-
Marked[Collect[A, E]] |
|
|
258
|
-
Collect[A, E], S]:
|
|
259
|
-
def bind_v(v: A | Marked[A] | Marked[Collect[A, E]] | Collect[A, E],
|
|
260
|
-
s: S)->Tuple[A | Marked[A] | Marked[Collect[A, E]] | Collect[A, E], S]:
|
|
265
|
+
collector: Optional[Type[E]]=None) -> Syntax[Any, S]:
|
|
266
|
+
def bind_v(v: Any, s: S)->Tuple[Any, S]:
|
|
261
267
|
return v, s.bind(var, v)
|
|
262
268
|
if callable(collector):
|
|
263
269
|
ret = self.to(collector).mark(var.name).map_all(bind_v) if var.name else self.to(collector).map_all(bind_v)
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|