syncraft 0.2.5__tar.gz → 0.2.7__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.2.7/PKG-INFO +56 -0
- syncraft-0.2.7/README.md +42 -0
- {syncraft-0.2.5 → syncraft-0.2.7}/pyproject.toml +12 -2
- syncraft-0.2.7/syncraft/__init__.py +80 -0
- {syncraft-0.2.5 → syncraft-0.2.7}/syncraft/algebra.py +143 -214
- {syncraft-0.2.5 → syncraft-0.2.7}/syncraft/ast.py +62 -7
- syncraft-0.2.7/syncraft/cache.py +113 -0
- {syncraft-0.2.5 → syncraft-0.2.7}/syncraft/constraint.py +184 -134
- syncraft-0.2.7/syncraft/dev.py +9 -0
- {syncraft-0.2.5 → syncraft-0.2.7}/syncraft/finder.py +17 -12
- {syncraft-0.2.5 → syncraft-0.2.7}/syncraft/generator.py +80 -78
- syncraft-0.2.7/syncraft/lexer.py +131 -0
- syncraft-0.2.7/syncraft/parser.py +272 -0
- {syncraft-0.2.5 → syncraft-0.2.7}/syncraft/syntax.py +187 -100
- syncraft-0.2.7/syncraft/utils.py +214 -0
- syncraft-0.2.7/syncraft/walker.py +147 -0
- syncraft-0.2.7/syncraft.egg-info/PKG-INFO +56 -0
- {syncraft-0.2.5 → syncraft-0.2.7}/syncraft.egg-info/SOURCES.txt +7 -2
- {syncraft-0.2.5 → syncraft-0.2.7}/syncraft.egg-info/requires.txt +0 -1
- {syncraft-0.2.5 → syncraft-0.2.7}/tests/test_bimap.py +32 -25
- {syncraft-0.2.5 → syncraft-0.2.7}/tests/test_constraint.py +3 -2
- {syncraft-0.2.5 → syncraft-0.2.7}/tests/test_find.py +2 -1
- syncraft-0.2.7/tests/test_lazy.py +107 -0
- {syncraft-0.2.5 → syncraft-0.2.7}/tests/test_parse.py +8 -7
- {syncraft-0.2.5 → syncraft-0.2.7}/tests/test_to.py +6 -5
- syncraft-0.2.7/tests/test_walk.py +24 -0
- syncraft-0.2.5/PKG-INFO +0 -113
- syncraft-0.2.5/README.md +0 -98
- syncraft-0.2.5/syncraft/__init__.py +0 -59
- syncraft-0.2.5/syncraft/diagnostic.py +0 -70
- syncraft-0.2.5/syncraft/parser.py +0 -421
- syncraft-0.2.5/syncraft.egg-info/PKG-INFO +0 -113
- syncraft-0.2.5/tests/test_until.py +0 -40
- {syncraft-0.2.5 → syncraft-0.2.7}/LICENSE +0 -0
- {syncraft-0.2.5 → syncraft-0.2.7}/setup.cfg +0 -0
- {syncraft-0.2.5 → syncraft-0.2.7}/syncraft/py.typed +0 -0
- {syncraft-0.2.5 → syncraft-0.2.7}/syncraft/sqlite3.py +0 -0
- {syncraft-0.2.5 → syncraft-0.2.7}/syncraft.egg-info/dependency_links.txt +0 -0
- {syncraft-0.2.5 → syncraft-0.2.7}/syncraft.egg-info/top_level.txt +0 -0
syncraft-0.2.7/PKG-INFO
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: syncraft
|
|
3
|
+
Version: 0.2.7
|
|
4
|
+
Summary: Parser combinator library
|
|
5
|
+
Author-email: Michael Afmokt <michael@esacca.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: parser,combinator,sql,sqlite,generator,printer
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: rstr>=3.2.2
|
|
12
|
+
Requires-Dist: sqlglot>=27.7.0
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# Syncraft
|
|
16
|
+
|
|
17
|
+
Syncraft is a parser/generator combinator library for Python. It helps you
|
|
18
|
+
|
|
19
|
+
- Build grammars
|
|
20
|
+
- Parse SQL statement to AST
|
|
21
|
+
- Search AST by grammar
|
|
22
|
+
- Convert AST to dataclass
|
|
23
|
+
- Check constraints over the AST/dataclass
|
|
24
|
+
- Change dataclass and convert back to AST
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
### pip
|
|
30
|
+
```bash
|
|
31
|
+
pip install syncraft
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### uv
|
|
35
|
+
```bash
|
|
36
|
+
uv add syncraft
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Python 3.10+ is required.
|
|
40
|
+
|
|
41
|
+
### With pip
|
|
42
|
+
```bash
|
|
43
|
+
pip install syncraft[dev]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### With uv
|
|
47
|
+
```bash
|
|
48
|
+
uv sync --group dev
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
TODO
|
|
52
|
+
- [ ] debug constraint.datalog
|
|
53
|
+
- [ ] debug sqlite3
|
|
54
|
+
- [ ] collect terminal from syntax and build PLY lexer
|
|
55
|
+
- [ ] chunker
|
|
56
|
+
- [ ] unify in find
|
syncraft-0.2.7/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Syncraft
|
|
2
|
+
|
|
3
|
+
Syncraft is a parser/generator combinator library for Python. It helps you
|
|
4
|
+
|
|
5
|
+
- Build grammars
|
|
6
|
+
- Parse SQL statement to AST
|
|
7
|
+
- Search AST by grammar
|
|
8
|
+
- Convert AST to dataclass
|
|
9
|
+
- Check constraints over the AST/dataclass
|
|
10
|
+
- Change dataclass and convert back to AST
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
### pip
|
|
16
|
+
```bash
|
|
17
|
+
pip install syncraft
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### uv
|
|
21
|
+
```bash
|
|
22
|
+
uv add syncraft
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Python 3.10+ is required.
|
|
26
|
+
|
|
27
|
+
### With pip
|
|
28
|
+
```bash
|
|
29
|
+
pip install syncraft[dev]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### With uv
|
|
33
|
+
```bash
|
|
34
|
+
uv sync --group dev
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
TODO
|
|
38
|
+
- [ ] debug constraint.datalog
|
|
39
|
+
- [ ] debug sqlite3
|
|
40
|
+
- [ ] collect terminal from syntax and build PLY lexer
|
|
41
|
+
- [ ] chunker
|
|
42
|
+
- [ ] unify in find
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "syncraft"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.7"
|
|
4
4
|
description = "Parser combinator library"
|
|
5
5
|
license = "MIT"
|
|
6
6
|
license-files = ["LICENSE"]
|
|
@@ -9,7 +9,6 @@ authors = [{name = "Michael Afmokt", email = "michael@esacca.com"}]
|
|
|
9
9
|
keywords = ["parser", "combinator", "sql", "sqlite", "generator", 'printer']
|
|
10
10
|
requires-python = ">=3.10"
|
|
11
11
|
dependencies = [
|
|
12
|
-
"rich>=14.1.0",
|
|
13
12
|
"rstr>=3.2.2",
|
|
14
13
|
"sqlglot>=27.7.0",
|
|
15
14
|
]
|
|
@@ -23,6 +22,17 @@ dev = [
|
|
|
23
22
|
"mkdocstrings>=0.25.0",
|
|
24
23
|
"mkdocstrings-python>=1.10.0",
|
|
25
24
|
"mkdocs-macros-plugin>=1.0.5",
|
|
25
|
+
"graphviz>=0.21",
|
|
26
|
+
"railroad-diagrams>=3.0.1",
|
|
27
|
+
"rich>=14.1.0",
|
|
28
|
+
"ipython>=8.0.0",
|
|
29
|
+
"jupyter>=1.0.0",
|
|
30
|
+
"mkdocs-jupyter>=0.24.6",
|
|
31
|
+
"nbval>=0.10.0",
|
|
32
|
+
"pytest-profiling>=1.8.1",
|
|
33
|
+
"snakeviz>=2.2.2",
|
|
26
34
|
]
|
|
27
35
|
|
|
28
36
|
|
|
37
|
+
[tool.setuptools]
|
|
38
|
+
packages = ["syncraft"]
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
from .syntax import (
|
|
2
|
+
Description,
|
|
3
|
+
Syntax,
|
|
4
|
+
regex,
|
|
5
|
+
literal,
|
|
6
|
+
choice,
|
|
7
|
+
lazy,
|
|
8
|
+
success,
|
|
9
|
+
fail,
|
|
10
|
+
when,
|
|
11
|
+
run,
|
|
12
|
+
)
|
|
13
|
+
from .walker import (
|
|
14
|
+
walk,
|
|
15
|
+
)
|
|
16
|
+
from .algebra import (
|
|
17
|
+
Algebra,
|
|
18
|
+
Error,
|
|
19
|
+
Left,
|
|
20
|
+
Right,
|
|
21
|
+
Either,
|
|
22
|
+
)
|
|
23
|
+
from .parser import (
|
|
24
|
+
Parser,
|
|
25
|
+
parse,
|
|
26
|
+
sqlglot,
|
|
27
|
+
token,
|
|
28
|
+
identifier,
|
|
29
|
+
variable,
|
|
30
|
+
number,
|
|
31
|
+
string,
|
|
32
|
+
)
|
|
33
|
+
from .generator import (
|
|
34
|
+
Generator,
|
|
35
|
+
generate,
|
|
36
|
+
generate_with,
|
|
37
|
+
validate,
|
|
38
|
+
)
|
|
39
|
+
from .finder import (
|
|
40
|
+
Finder,
|
|
41
|
+
find,
|
|
42
|
+
matches,
|
|
43
|
+
anything,
|
|
44
|
+
)
|
|
45
|
+
from .constraint import (
|
|
46
|
+
FrozenDict,
|
|
47
|
+
Constraint,
|
|
48
|
+
Quantifier,
|
|
49
|
+
forall,
|
|
50
|
+
exists,
|
|
51
|
+
)
|
|
52
|
+
from .ast import (
|
|
53
|
+
AST,
|
|
54
|
+
Bimap,
|
|
55
|
+
Biarrow,
|
|
56
|
+
Token,
|
|
57
|
+
Then,
|
|
58
|
+
ThenKind,
|
|
59
|
+
Choice,
|
|
60
|
+
ChoiceKind,
|
|
61
|
+
Many,
|
|
62
|
+
Marked,
|
|
63
|
+
Collect,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
__all__ = [
|
|
67
|
+
# algebra
|
|
68
|
+
"Algebra", "Error", "Left", "Right", "Either",
|
|
69
|
+
# syntax & core
|
|
70
|
+
"Syntax", "choice", "lazy", "success", "fail", "run", "Description", "when",
|
|
71
|
+
# parsing/generation helpers
|
|
72
|
+
"parse", "sqlglot", "token", "identifier", "variable", "literal", "number", "string", "regex", "walk",
|
|
73
|
+
"generate", "generate_with", "validate", "Parser", "Generator",
|
|
74
|
+
# finder
|
|
75
|
+
"find", "matches", "anything", "Finder",
|
|
76
|
+
# constraints
|
|
77
|
+
"Constraint", "Quantifier", "forall", "exists", "FrozenDict",
|
|
78
|
+
# ast
|
|
79
|
+
"AST", "Token", "Then", "ThenKind", "Choice", "ChoiceKind", "Many", "Marked", "Collect", "Bimap", "Biarrow"
|
|
80
|
+
]
|