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

Delimiters consisting of multiple elements are shown in wrong order #27

Open
nichtich opened this issue Feb 29, 2024 · 6 comments
Open

Comments

@nichtich
Copy link

With

echo 'x=x|1..,("a" "b")|' > x.peggy; ./bin/peggy-tracks.js x.peggy

You get

x

but the result should be

x

@hildjj
Copy link
Contributor

hildjj commented Feb 29, 2024

I remember we had some discussion of this before. let me see if I can find it.

@hildjj
Copy link
Contributor

hildjj commented Feb 29, 2024

Maybe it was on Discord. Shrug. I remember the gist being I was upset that it was wrong (as you point out) and several people chimed in that it was easier to read when it was wrong because they are L2R biased. Then I suggested a backwards-S-curve, but that seemed so ugly nobody wanted it. Then we moved on to other things. :)

@hildjj
Copy link
Contributor

hildjj commented Feb 29, 2024

Here is the discussion #11 (comment)

@nichtich
Copy link
Author

nichtich commented Mar 1, 2024

It seems to have been ignored in the discussion to solve other things first. In any case, the current outcome is wrong. The only workaround is not not allow multiple elements in delimiters. If readability is the matter, a small arrow head might help to indicate the reverse direction.

@hildjj
Copy link
Contributor

hildjj commented Mar 1, 2024

If we reverse the return sequence, we have to recursively reverse all sequences deeper in it as well. Are there any other constructs that would need to be reversed?

@nichtich
Copy link
Author

nichtich commented Mar 1, 2024

I don't think there are other constructs but sequences. If a delimiter contains another repetition group with multiple elements, the inner delimiter list would need to be reversed twice but anyone writing such grammar would better need to be punished.

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

2 participants