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.7.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.7-py3-none-any.whl
(8.5 kB
view details)
File details
Details for the file typar-0.0.7.tar.gz.
File metadata
- Download URL: typar-0.0.7.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 |
b444ebe2ae2f410fd972dfb5857126833db2f34c18aa47a2264bd5d2fd3dc412
|
|
| MD5 |
b2c31a523bc0a012822eac6723c70cb0
|
|
| BLAKE2b-256 |
2bfea125e807e9fb73a29a861ddb0b18d5a40b1a7b737785fb88eaf189ee9f5a
|
File details
Details for the file typar-0.0.7-py3-none-any.whl.
File metadata
- Download URL: typar-0.0.7-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 |
52d3c42791c46366549f19fe4ec87b1e66c9e5a5a4cd044a3410b5cb0f9ce2a2
|
|
| MD5 |
921ce1429b28614adb8f70171a30b9b1
|
|
| BLAKE2b-256 |
507f05f4fd8d361d2d823d938ce1eba87dd4695d6b101508cbf634863b91c297
|