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=0, value=None)
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.0.8.tar.gz
(8.1 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.0.8-py3-none-any.whl
(8.7 kB
view details)
File details
Details for the file typar-0.0.8.tar.gz.
File metadata
- Download URL: typar-0.0.8.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e916b4bbc109a3be84c889fe69951305b06d3bcb5ab64f9c07c686bdd7fd3763
|
|
| MD5 |
6faf01484fc4607590c0fe88157e4a9e
|
|
| BLAKE2b-256 |
1b7fa7bc60be3b2a4066dd1d7cb3112c0626e6a609aaa7797f6c965d2e22b78a
|
File details
Details for the file typar-0.0.8-py3-none-any.whl.
File metadata
- Download URL: typar-0.0.8-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 |
c4452450fc22f2c45c97466a2fecbea779355cab1a4e455827f9dc0e6d90dc37
|
|
| MD5 |
c43b5bcb4ed8aa2acd103e8d4a2b9e43
|
|
| BLAKE2b-256 |
1ba7eb543df6b9cfa08a4c15314ba13620777cd8c3da97a94b65d40dc3232a02
|