parcon
parcon copied to clipboard
A Python parser combinator and formatter combinator library that's fast, easy to use, and provides informative error messages
``` Traceback (most recent call last): File "/home/user/.virtualenvs/ubpf/lib/python3.10/site-packages/parcon/ordered_dict.py", line 11, in from thread import get_ident as _get_ident ModuleNotFoundError: No module named 'thread' ```
On newer Python versions, `thread` module was renamed to `threading` and low level functions are available in `_thread` module. Thats why `ordered_dict.py` backport fails on newer Python versions (e.g. Python...
This has already been been fixed here. But just to remind you what the error was: File "sd-example.py", line 13, in from parcon.railroad import Then, Or, Token, Loop, Bullet, Nothing...
Hi, When trying to graph a Keyword() instance, an exception is thrown. Sample code: ``` > from parcon import * > Keyword(Literal('a'), Literal('b')).graph() Traceback (most recent call last): File "",...
Convert function and method calls to new API. Rename first parameter of size and draw functions to reflect its actual type. The first parameter of both size and draw functions...
Supports cases where the user wants to return some mutable object, but a new instance each time. For instance, Optional(something, default={}) will return the exact same dict each time, which...
`parcon.Exact` doesn't play nicely out-of-the-box when trying to match whitespace at the start of a string. I've added some tests for the existing behaviour, including using `thing.parse_string(s, whitespace=parcon.Invalid())`, but I...
``` from parcon import SignificantLiteral, Regex Digits = Regex(ur"[0-9]+") DecimalLiteral = ((Digits + SignificantLiteral(".") + Digits) | (SignificantLiteral(".") + Digits)) SinglePeriod = SignificantLiteral(".") BadExpr = (SignificantLiteral("junk that won't match") |...