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

documentation of whitespace handling #19

Open
bernstei opened this issue Aug 20, 2021 · 2 comments
Open

documentation of whitespace handling #19

bernstei opened this issue Aug 20, 2021 · 2 comments

Comments

@bernstei
Copy link

bernstei commented Aug 20, 2021

Is there any more complete documentation of the whitespace handling? I'm trying to parse a list of regexps that are surrounded by containing tokens (think "1.0 2.0 3.0"), with mandatory spaces separating them. Repeat doesn't work, because it accepts a sequence w/o any space, and if I add a space to the regex it fails to match the last item if there's no space after it. List with delimiter=" " doesn't work either. If I look for repetition of a Keyword instead of a Regex it behaves as expected, presumably because keywords have to be separated by something. More explicit information on where whitespace is or isn't required would be helpful to figure out how to do this, I think. E.g. what exactly needs to separate keywords? whitespace? word breaks\b? Is it true that List delimiters can't be whitespace?

As a secondary question, what's the best way to match what I need (a list of regexps with spaces as delimiters, but no space required after the final one)? Must I do Sequence(Repeat(Regex(re + '\s'), mi=0), re) ?

@bernstei
Copy link
Author

bernstei commented Aug 20, 2021

by way of followup, should Sequence(Repeat(r_float, mi=0), r_float) be the same as Repeat(r_float), where r_float = Regex('...') ? I would have thought yes, but the second matches strings that the first does not. Is that a bug that I should open a separate issue for, or is it expected (and if so, can you explain why)?

@bernstei
Copy link
Author

I was able to get my code working with a better regexp, but I still think some more explicit explanation of how it decides when each element ends would be helpful, as would a list with whitespace delimiters.

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