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.6.tar.gz
(8.0 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.6-py3-none-any.whl
(8.5 kB
view details)
File details
Details for the file typar-0.0.6.tar.gz.
File metadata
- Download URL: typar-0.0.6.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
897dc9e500b439f76428f335eae8e975e20ece32a9edd5005facc6666e995a1b
|
|
| MD5 |
f65e98887be3e74217b92f394c42af02
|
|
| BLAKE2b-256 |
e46303a60c750bf5ff10e2b5114cbe6905dd054dcb7cd7b9dfb2a3dd48eaff47
|
File details
Details for the file typar-0.0.6-py3-none-any.whl.
File metadata
- Download URL: typar-0.0.6-py3-none-any.whl
- Upload date:
- Size: 8.5 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 |
294a738bc39a814ba362d8990fca87d6b86e10f0a7f2e4c72d1215416efdb593
|
|
| MD5 |
f657c482a5f2b11f7cbf7cd50b105823
|
|
| BLAKE2b-256 |
f3210bfcdc8a64db24afc37ec894ed5ac766c940cd51a3d35c89ccb3149f832e
|