Fully-typed combinatorial parsing library in Python
Project description
typar
A fully-typed combinatorial parsing library in Python.
Installation
pip install typar
Example
Execute python -m typar.example to run the example below:
import typar
year = typar.regex("[0-9]{4}")
month = typar.regex("[0-9]{2}")
day = typar.regex("[0-9]{2}")
dash = typar.string("-")
fulldate = year + dash + month + dash + day << typar.eof()
print(fulldate.parse("2019-01-01"))
# Result(index=10, value=(((('2019', '-'), '01'), '-'), '01'))
print(fulldate.parse("2019-01-01x"))
# Result(index=10, value=<ERR>)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
typar-0.1.0.tar.gz
(8.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
typar-0.1.0-py3-none-any.whl
(8.7 kB
view details)
File details
Details for the file typar-0.1.0.tar.gz.
File metadata
- Download URL: typar-0.1.0.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e24343ba37aae9812d51c647472e50f057773cf103246f3f9fa1c8efc632a901
|
|
| MD5 |
30a837dc6e9c1be7c8cb5ce0c40ee893
|
|
| BLAKE2b-256 |
c705250de787624b5c7bb4fc8c070d1b32bb252f903e03f0a2df24f70ccbce50
|
File details
Details for the file typar-0.1.0-py3-none-any.whl.
File metadata
- Download URL: typar-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e1989046983e6c44dc627377098a367722a6d8b9390a2dfc78a4e5d6c9f751b
|
|
| MD5 |
f79f70dca836231e3956f51b671e649f
|
|
| BLAKE2b-256 |
29b94a4c8c14d411e2203c9c3a28ed8c4febad5bd6982bab70fbf8dcc703e943
|