Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork298
Closed
Description
We are usingpyparsing to parse physical equation and parameter definitions. Potentially we are using it wrong, but the following (simplified) version works in 3.2.3, but fails in 3.2.4:
importstringfrompyparsingimportWord,Group,SuppressIDENTIFIER=Word(string.ascii_letters+"_",string.ascii_letters+string.digits+"_").setResultsName("identifier")# very broad definition here, whether this corresponds to a valid unit string will be checked laterUNIT=Word(string.ascii_letters+string.digits+"*/.- ").setResultsName("unit")PARAMETER_EQ=Group(IDENTIFIER+Suppress(":")+UNIT)print(repr(PARAMETER_EQ.parse_string("speed : meter/second")))
In 3.2.3, this prints:
ParseResults([ParseResults(['speed', 'meter/second'], {'identifier': 'speed', 'unit': 'meter/second'})], {})whereas in 3.2.4, it fails with:
Traceback (most recent call last): File"/home/mstimberg/scratch/pyparsing_issue.py", line15, in<module>print(repr(PARAMETER_EQ.parse_string("speed : meter/second")))~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^ File"/home/mstimberg/.cache/uv/archive-v0/b2gwMgK-avsJGeZiOPy1f/lib/python3.13/site-packages/pyparsing/core.py", line1306, inparse_string loc, tokens=self._parse(instring,0)~~~~~~~~~~~^^^^^^^^^^^^^ File"/home/mstimberg/.cache/uv/archive-v0/b2gwMgK-avsJGeZiOPy1f/lib/python3.13/site-packages/pyparsing/core.py", line933, in_parseNoCache loc, tokens=self.parseImpl(instring, pre_loc, do_actions)~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File"/home/mstimberg/.cache/uv/archive-v0/b2gwMgK-avsJGeZiOPy1f/lib/python3.13/site-packages/pyparsing/core.py", line5034, inparseImplreturnself.expr._parse(instring, loc, do_actions,callPreParse=False)~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File"/home/mstimberg/.cache/uv/archive-v0/b2gwMgK-avsJGeZiOPy1f/lib/python3.13/site-packages/pyparsing/core.py", line933, in_parseNoCache loc, tokens=self.parseImpl(instring, pre_loc, do_actions)~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File"/home/mstimberg/.cache/uv/archive-v0/b2gwMgK-avsJGeZiOPy1f/lib/python3.13/site-packages/pyparsing/core.py", line4513, inparseImpl loc, exprtokens= e._parse(instring, loc, do_actions)~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ File"/home/mstimberg/.cache/uv/archive-v0/b2gwMgK-avsJGeZiOPy1f/lib/python3.13/site-packages/pyparsing/core.py", line937, in_parseNoCache loc, tokens=self.parseImpl(instring, pre_loc, do_actions)~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File"/home/mstimberg/.cache/uv/archive-v0/b2gwMgK-avsJGeZiOPy1f/lib/python3.13/site-packages/pyparsing/core.py", line3290, inparseImpl_regex result=self.re_match(instring, loc)^^^^^^^^^^^^^AttributeError:'Word' object has no attribute 're_match'
From reading the changelog, it might be related to the fix for#612?
Metadata
Metadata
Assignees
Labels
No labels