xwsyntax 0.6.0.4__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.
- README.md +109 -0
- xwsyntax-0.6.0.4.dist-info/METADATA +130 -0
- xwsyntax-0.6.0.4.dist-info/RECORD +5 -0
- xwsyntax-0.6.0.4.dist-info/WHEEL +4 -0
- xwsyntax-0.6.0.4.dist-info/licenses/LICENSE +22 -0
README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# xwsyntax
|
|
2
|
+
|
|
3
|
+
**One bidirectional grammar engine.** Parse text to AST, generate back, or convert between syntaxes (e.g. JSON to SQL). 100+ grammars (328+ files) for query, data, and code. Powers xwquery and editors; use it to create new syntaxes or bridge formats.
|
|
4
|
+
|
|
5
|
+
**Company:** eXonware.com · **Author:** eXonware Backend Team · **Email:** connect@exonware.com
|
|
6
|
+
**Version:** [version.py](src/exonware/xwsyntax/version.py) (`__version__`, `__date__`)
|
|
7
|
+
|
|
8
|
+
[](https://exonware.com)
|
|
9
|
+
[](https://www.python.org)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install exonware-xwsyntax
|
|
18
|
+
# Optional: full extras
|
|
19
|
+
pip install exonware-xwsyntax[full]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Depends on xwsystem. See [docs/GUIDE_01_USAGE.md](docs/GUIDE_01_USAGE.md) for details.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Quick start
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from exonware.xwsyntax import BidirectionalGrammar
|
|
30
|
+
|
|
31
|
+
grammar = BidirectionalGrammar.load('json')
|
|
32
|
+
ast = grammar.parse('{"name": "Alice", "age": 30}')
|
|
33
|
+
json_str = grammar.generate(ast)
|
|
34
|
+
|
|
35
|
+
# Convert between syntaxes
|
|
36
|
+
sql_grammar = BidirectionalGrammar.load('sql')
|
|
37
|
+
sql = sql_grammar.generate(ast)
|
|
38
|
+
# Same AST, different format
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Facade: `XWSyntax().parse(text, format_name)` or `validate(text, format_name)`.
|
|
42
|
+
List grammars: `list_grammars_quick()`, `load_grammar_quick(name)`.
|
|
43
|
+
Key code: [REF_14_DX](docs/REF_14_DX.md) · API: [REF_15_API](docs/REF_15_API.md).
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Examples
|
|
48
|
+
|
|
49
|
+
### Parse and validate with the facade
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from exonware.xwsyntax import XWSyntax
|
|
53
|
+
|
|
54
|
+
engine = XWSyntax()
|
|
55
|
+
ast = engine.parse("a = 1 + 2", format_name="python")
|
|
56
|
+
is_valid = engine.validate("a = 1 + 2", format_name="python")
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### List grammars and load by name
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from exonware.xwsyntax import list_grammars_quick, load_grammar_quick
|
|
63
|
+
|
|
64
|
+
names = list_grammars_quick()
|
|
65
|
+
grammar = load_grammar_quick(names[0])
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Convert JSON to SQL by reusing the AST
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from exonware.xwsyntax import BidirectionalGrammar
|
|
72
|
+
|
|
73
|
+
ast = BidirectionalGrammar.load("json").parse('{"name": "Alice", "age": 30}')
|
|
74
|
+
sql = BidirectionalGrammar.load("sql").generate(ast)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## What you get
|
|
80
|
+
|
|
81
|
+
| Area | Description |
|
|
82
|
+
|------|-------------|
|
|
83
|
+
| **Grammar read/write** | Parse input to native objects or tree; generate from AST. Grammar-driven; no hardcoded format maps. |
|
|
84
|
+
| **Bidirectional** | Parse to AST, generate back; convert between syntaxes (e.g. JSON to SQL) by swapping grammars. |
|
|
85
|
+
| **100+ grammars** | Query (SQL, Cypher, GraphQL, xwqueryscript, …), data/config, programming, markup, storage. 328+ grammar files (.lark + .json). |
|
|
86
|
+
| **xwquery and IDE** | Parsing and syntax for query languages; Monaco export and codec integration with xwsystem. |
|
|
87
|
+
|
|
88
|
+
Current phase: **Alpha.** M1–M2 done; xwquery consumption next. Status: [REF_22_PROJECT](docs/REF_22_PROJECT.md#project-status-overview).
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Docs and tests
|
|
93
|
+
|
|
94
|
+
- **Start:** [docs/INDEX.md](docs/INDEX.md)
|
|
95
|
+
- **Usage:** [docs/GUIDE_01_USAGE.md](docs/GUIDE_01_USAGE.md)
|
|
96
|
+
- **Requirements and status:** [REF_01_REQ](docs/REF_01_REQ.md), [REF_22_PROJECT](docs/REF_22_PROJECT.md)
|
|
97
|
+
- **API and design:** [REF_15_API](docs/REF_15_API.md), [REF_13_ARCH](docs/REF_13_ARCH.md), [REF_14_DX](docs/REF_14_DX.md)
|
|
98
|
+
- **Tests:** [REF_51_TEST](docs/REF_51_TEST.md). Run from project root: `python tests/runner.py`.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## License and links
|
|
103
|
+
|
|
104
|
+
MIT — [LICENSE](LICENSE).
|
|
105
|
+
**Homepage:** https://exonware.com · **Repository:** https://github.com/exonware/xwsyntax
|
|
106
|
+
|
|
107
|
+
Contributing → CONTRIBUTING.md · Security → SECURITY.md (when present).
|
|
108
|
+
|
|
109
|
+
*Built with ❤️ by eXonware.com - Revolutionizing Python Development Since 2025*
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xwsyntax
|
|
3
|
+
Version: 0.6.0.4
|
|
4
|
+
Summary: Convenience wrapper for exonware-xwsyntax - provides 'import xwsyntax' alias
|
|
5
|
+
Project-URL: Homepage, https://exonware.com
|
|
6
|
+
Project-URL: Repository, https://github.com/exonware/xwsyntax
|
|
7
|
+
Project-URL: Documentation, https://github.com/exonware/xwsyntax#readme
|
|
8
|
+
Project-URL: Subtree, https://github.com/exonware/xwsyntax.git
|
|
9
|
+
Author-email: eXonware Backend Team <connect@exonware.com>
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Python: >=3.12
|
|
13
|
+
Requires-Dist: exonware-xwsyntax
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: exonware-xwsyntax[dev]; extra == 'dev'
|
|
16
|
+
Provides-Extra: full
|
|
17
|
+
Requires-Dist: exonware-xwsyntax[full]; extra == 'full'
|
|
18
|
+
Provides-Extra: lazy
|
|
19
|
+
Requires-Dist: exonware-xwsyntax[lazy]; extra == 'lazy'
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# xwsyntax
|
|
23
|
+
|
|
24
|
+
**One bidirectional grammar engine.** Parse text to AST, generate back, or convert between syntaxes (e.g. JSON to SQL). 100+ grammars (328+ files) for query, data, and code. Powers xwquery and editors; use it to create new syntaxes or bridge formats.
|
|
25
|
+
|
|
26
|
+
**Company:** eXonware.com · **Author:** eXonware Backend Team · **Email:** connect@exonware.com
|
|
27
|
+
**Version:** [version.py](src/exonware/xwsyntax/version.py) (`__version__`, `__date__`)
|
|
28
|
+
|
|
29
|
+
[](https://exonware.com)
|
|
30
|
+
[](https://www.python.org)
|
|
31
|
+
[](LICENSE)
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install exonware-xwsyntax
|
|
39
|
+
# Optional: full extras
|
|
40
|
+
pip install exonware-xwsyntax[full]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Depends on xwsystem. See [docs/GUIDE_01_USAGE.md](docs/GUIDE_01_USAGE.md) for details.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Quick start
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from exonware.xwsyntax import BidirectionalGrammar
|
|
51
|
+
|
|
52
|
+
grammar = BidirectionalGrammar.load('json')
|
|
53
|
+
ast = grammar.parse('{"name": "Alice", "age": 30}')
|
|
54
|
+
json_str = grammar.generate(ast)
|
|
55
|
+
|
|
56
|
+
# Convert between syntaxes
|
|
57
|
+
sql_grammar = BidirectionalGrammar.load('sql')
|
|
58
|
+
sql = sql_grammar.generate(ast)
|
|
59
|
+
# Same AST, different format
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Facade: `XWSyntax().parse(text, format_name)` or `validate(text, format_name)`.
|
|
63
|
+
List grammars: `list_grammars_quick()`, `load_grammar_quick(name)`.
|
|
64
|
+
Key code: [REF_14_DX](docs/REF_14_DX.md) · API: [REF_15_API](docs/REF_15_API.md).
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Examples
|
|
69
|
+
|
|
70
|
+
### Parse and validate with the facade
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from exonware.xwsyntax import XWSyntax
|
|
74
|
+
|
|
75
|
+
engine = XWSyntax()
|
|
76
|
+
ast = engine.parse("a = 1 + 2", format_name="python")
|
|
77
|
+
is_valid = engine.validate("a = 1 + 2", format_name="python")
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### List grammars and load by name
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from exonware.xwsyntax import list_grammars_quick, load_grammar_quick
|
|
84
|
+
|
|
85
|
+
names = list_grammars_quick()
|
|
86
|
+
grammar = load_grammar_quick(names[0])
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Convert JSON to SQL by reusing the AST
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from exonware.xwsyntax import BidirectionalGrammar
|
|
93
|
+
|
|
94
|
+
ast = BidirectionalGrammar.load("json").parse('{"name": "Alice", "age": 30}')
|
|
95
|
+
sql = BidirectionalGrammar.load("sql").generate(ast)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## What you get
|
|
101
|
+
|
|
102
|
+
| Area | Description |
|
|
103
|
+
|------|-------------|
|
|
104
|
+
| **Grammar read/write** | Parse input to native objects or tree; generate from AST. Grammar-driven; no hardcoded format maps. |
|
|
105
|
+
| **Bidirectional** | Parse to AST, generate back; convert between syntaxes (e.g. JSON to SQL) by swapping grammars. |
|
|
106
|
+
| **100+ grammars** | Query (SQL, Cypher, GraphQL, xwqueryscript, …), data/config, programming, markup, storage. 328+ grammar files (.lark + .json). |
|
|
107
|
+
| **xwquery and IDE** | Parsing and syntax for query languages; Monaco export and codec integration with xwsystem. |
|
|
108
|
+
|
|
109
|
+
Current phase: **Alpha.** M1–M2 done; xwquery consumption next. Status: [REF_22_PROJECT](docs/REF_22_PROJECT.md#project-status-overview).
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Docs and tests
|
|
114
|
+
|
|
115
|
+
- **Start:** [docs/INDEX.md](docs/INDEX.md)
|
|
116
|
+
- **Usage:** [docs/GUIDE_01_USAGE.md](docs/GUIDE_01_USAGE.md)
|
|
117
|
+
- **Requirements and status:** [REF_01_REQ](docs/REF_01_REQ.md), [REF_22_PROJECT](docs/REF_22_PROJECT.md)
|
|
118
|
+
- **API and design:** [REF_15_API](docs/REF_15_API.md), [REF_13_ARCH](docs/REF_13_ARCH.md), [REF_14_DX](docs/REF_14_DX.md)
|
|
119
|
+
- **Tests:** [REF_51_TEST](docs/REF_51_TEST.md). Run from project root: `python tests/runner.py`.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## License and links
|
|
124
|
+
|
|
125
|
+
MIT — [LICENSE](LICENSE).
|
|
126
|
+
**Homepage:** https://exonware.com · **Repository:** https://github.com/exonware/xwsyntax
|
|
127
|
+
|
|
128
|
+
Contributing → CONTRIBUTING.md · Security → SECURITY.md (when present).
|
|
129
|
+
|
|
130
|
+
*Built with ❤️ by eXonware.com - Revolutionizing Python Development Since 2025*
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
README.md,sha256=Fl_MdlWwrK7AN-ZLi4LldWnS8feAmF9ZZXr4gbBtRq8,3683
|
|
2
|
+
xwsyntax-0.6.0.4.dist-info/METADATA,sha256=eLOdiL-NIVzzMxtnotyoW_ai1MKVmmSkWQhPTNP5nHM,4484
|
|
3
|
+
xwsyntax-0.6.0.4.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
4
|
+
xwsyntax-0.6.0.4.dist-info/licenses/LICENSE,sha256=02XAToLl-XJdT9so3X2oGW9TRkzWSY__rYPWtXFRYEw,1138
|
|
5
|
+
xwsyntax-0.6.0.4.dist-info/RECORD,,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 eXonware.com - eXonware Backend Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|