neogeny / TatSu

竜 TatSu generates Python parsers from grammars in a variation of EBNF
https://tatsu.readthedocs.io/
Other
403 stars 48 forks source link

Does TatSu 5.8.3 still pick up the regex module automatically? #294

Closed pressureless closed 1 year ago

pressureless commented 1 year ago

My grammar contains Unicode rules, it works well with TatSu 4.4.0 which picks up the regex module automatically. I encountered performance issue when parsing multiple expressions, so I decided to update my Tatsu version. However, TatSu 5.8.3 can't compile the grammar any more. I'm sure regex is installed and the problem is due to the Unicode rules (If I removed the rules, TatSu 5.8.3 would compile). Any help is appreciated.

pressureless commented 1 year ago

My Python version was 3.8.5. TatSu 5.6.1 can still compile the grammar.

pressureless commented 1 year ago

Python 3.10.7 + TatSu 5.7.3 works, 5.7.4 and 5.8.0 won't work. Maybe it's due to the changes

image
apalala commented 1 year ago

TatSu stopped picking up the regex package as there is no automated way to check if it keeps up with changes to the re package.

In your case, you could opt for for patching sys.modules to replace re with regex.