Skip to main content

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.5.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

typar-0.0.5-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file typar-0.0.5.tar.gz.

File metadata

  • Download URL: typar-0.0.5.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

Hashes for typar-0.0.5.tar.gz
Algorithm Hash digest
SHA256 ac80d8e7f95ea0598f56af462f778c1d4526765abd0b97e5f29195ed4e0389fe
MD5 ff96c7af86de700431b81103931e7471
BLAKE2b-256 b6ebbc1e1417d4f546eeba3be088ddebb0bd2500574bfb7b764731bfb429a2d9

See more details on using hashes here.

File details

Details for the file typar-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: typar-0.0.5-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

Hashes for typar-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9dd6410680490971dcd3b885661c05979897f036f9a0b01a9e10b204d9f8204b
MD5 0904c3c093127fbebadaf9ecb7905a29
BLAKE2b-256 016ff0e8bb52c4ed1ee276fca333bbab7b9a9c7c6d29c0f939f13a95464d358b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page