Simple Scannerless Parser library for Python
Project description
Parsea
Simple Scannerless Parser library for Python
Usage
from Parsea import Parsea
class Parser(Parsea):
def parseInt(self, string: str):
self.init(string)
num = self.while_strings("0123456789")
return int(num) if num else None
def parseAlpha(self, string: str):
self.init(string)
alpha = self.while_strings(self.in_range("a","z")+self.in_range("A","Z"))
return alpha if alpha else None
p = Parser()
print(p.parseInt('1203')) # 1203
print(p.parseInt('heLLo')) # None
print(p.parseAlpha('heLLo')) # heLLo
print(p.parseAlpha('1203')) # None
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Parsea-0.0.2.tar.gz
(3.5 kB
view details)
Built Distribution
File details
Details for the file Parsea-0.0.2.tar.gz
.
File metadata
- Download URL: Parsea-0.0.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 394e00143acfdef0ccffcd737d053688686e852709612a82f3bd94a73016b180 |
|
MD5 | 9d4e40f9dbb2712a75775ed72b2a44dc |
|
BLAKE2b-256 | ede4104fbc8cb8b30593a09863cf7572db68e422519978bdbdd232735d078bed |
File details
Details for the file Parsea-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: Parsea-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49db2690b89169d5616061cf8d4b0e9a15dbec1783c183484e2fbc1d3c4a9611 |
|
MD5 | 510034188bbff506c01a544eac62293e |
|
BLAKE2b-256 | d485be5329fc0dc81f6a7e0e95d5a31e6b9ae7d6ac99460d26e373b3ef97c882 |