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 hashes)
Built Distribution
Parsea-0.0.2-py3-none-any.whl
(3.6 kB
view hashes)