Skip to content
New issue

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

Parsley fails to parse #25

Open
TheOtherMarcus opened this issue May 23, 2013 · 1 comment
Open

Parsley fails to parse #25

TheOtherMarcus opened this issue May 23, 2013 · 1 comment

Comments

@TheOtherMarcus
Copy link

Have you abandoned Launchpad? I think I managed to install parsley-master over Parsley 1.1 and ran the test with the same result as before:

https://bugs.launchpad.net/parsley/+bug/1183224

@TheOtherMarcus
Copy link
Author

This is not exactly a bug in Parsley, it just works different compared to PyMeta2. The meaning of the two string quotes (', ") should be described better in the documentation. Se below for a possible parser improvement as well.

In the test code, I try to match using " - ". The double quoted string is matched as a Token, and Parsley helpfully removes any whitespace that may come before it, effectively matching the pattern (' '* ' - '). This will of course never match. The correct pattern to use in this case is ' - ', which is matched against the exact string.

It works in PyMeta2 because " - " is not matched as a Token, but as a string. The PyMeta2 parser will parse ' - ' successfully, but it will never match, as it is handled by the exactly matcher, which only compares the first character on the input stream against the string. A pattern that works both in Parsley and PyMeta2 would have to be written as (' ' '-' ' '). (PyMeta2 has a token matcher as well, but I am unsure if it can be invoked.)

Maybe the Parsley grammar should fail to parse Tokens that start with whitespace. PyMeta2 on the other hand should fail on anything longer than a single character within single quotes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant