We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I hope you don't mind that I ask another about grammar but I'm stuck and the error makes no sense to me.
Example to reproduce
from parsimonious.grammar import Grammar grammar = Grammar(r""" properties_def = "[" ws? properties_comma? "]" ws? properties_comma = property_def ("," ws? property_def)* property_def = id ws? "=" ws? property_value ws? property_value = bool / number / string # Primitives bool = "true" / "false" number = ~r'-?\d*(\.\d+)?' string = ~r'"[^"]*"' / ~r"'[^']*'" id = ~r'\w[\w-]*' ws = ~r"\s+" """) properties_str = 'profile="system:hysteresis",lower="29 °C",upper="30 °C"' # this works grammar['properties_comma'].match(properties_str) # parsimonious.exceptions.ParseError: Rule 'ws' didn't match at '"system:hysteresis",' (line 1, column 10). grammar['properties_def'].match('[' + properties_str + ']')
This works:
grammar['properties_comma'].match('profile="system:hysteresis",lower="29 °C",upper="30 °C"')
This throws an error:
grammar['properties_def'].match('[profile="system:hysteresis",lower="29 °C",upper="30 °C"]')
parsimonious.exceptions.ParseError: Rule 'ws' didn't match at '"system:hysteresis",' (line 1, column 10).
This seems to be the faulty rule:
"[" ws? properties_comma? "]" ws?
which does not match
'[' + properties_str + ']'
However I marked both ws rules as optional so the ParseError makes no sense. Do you have any idea why this ws error is raised?
ParseError
Thank you for your help!
The text was updated successfully, but these errors were encountered:
Another PEG parser does not throw the error with the same rule so this is most likely a bug
Sorry, something went wrong.
No branches or pull requests
I hope you don't mind that I ask another about grammar but I'm stuck and the error makes no sense to me.
Example to reproduce
This works:
This throws an error:
This seems to be the faulty rule:
which does not match
However I marked both ws rules as optional so the
ParseError
makes no sense.Do you have any idea why this ws error is raised?
Thank you for your help!
The text was updated successfully, but these errors were encountered: