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 git+https://github.com/UniverseFly/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.1.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.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: typar-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 b252c10e673f6e0e95a9d4a1b522f1696720c22a28c6c616bab715aa70bb0514
MD5 3f97638571650a09db3f7440bda6fa4d
BLAKE2b-256 c66bb3acbfd3b20d5a109ef99c69289e6abb4bffd72327b288af66eb3586bdb6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: typar-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 78cacb01748860bfae0386bcf157caa794d8c1bfe10f76beda6c20f512b493f1
MD5 04e4712d62ece8892b4e43edb27d3497
BLAKE2b-256 a43b6b76314dc7a06015ae29d75dce5f6cfc11f372bea1824850680fba4e30ef

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