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.2.tar.gz (7.9 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.2-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: typar-0.0.2.tar.gz
  • Upload date:
  • Size: 7.9 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.2.tar.gz
Algorithm Hash digest
SHA256 0d07b6fca07feafcfbba9d94fb76d55aec1507b9f58c71238ee0a54bbe44149a
MD5 cc2d2b4b4ec66b48bc2930f043a4fabd
BLAKE2b-256 91386dd14d68999f03e0e64bcc1e54d226b84b531dc83dd138fd457b4af924b6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: typar-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 06059c17051a5276c4449ba37b3bb836bbde519ce8d396ac2d0fdf217d5208dd
MD5 163e80b161768629301b65ee5bdef63a
BLAKE2b-256 29c5420b9234b3c6397c8cf54cd9d7bf274263a15354aabe59149eb9afdfc419

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