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

Extend Until to exclude terminator from ParseGraph #360

Closed
mvanaken opened this issue Feb 23, 2023 · 0 comments · Fixed by #361 or #369
Closed

Extend Until to exclude terminator from ParseGraph #360

mvanaken opened this issue Feb 23, 2023 · 0 comments · Fixed by #361 or #369
Milestone

Comments

@mvanaken
Copy link
Contributor

mvanaken commented Feb 23, 2023

There are three scenarios where you would like to use Until:

  1. when there is a separate terminator between structure A and B (A|T|B)
  2. when you know how the structure A ends (AT|B)
  3. when you know how the next structure B starts (A|TB)

The current implementation of Until parses two structures: a def and the terminator.
The current implementation can handle 1. correctly, but for 2 and 3 requires some hacky solutions with some drawbacks. See examples solutions below.

  1. until("A", T)
  2. until("A", post(EMPTY, endsWith(T)))
  3. until("A", sub(T, CURRENT_OFFSET))

Especially for scenario 3, the "T" part is parsed twice and is also available twice in the parseGraph.
This can be resolved by allowing two implementations of Until where you can specify if the terminator should be part of the parseGraph.

jvdb added a commit that referenced this issue Feb 23, 2023
…hout adding the terminator to the ParseGraph.

Co-Authored-By: Marja van Aken <marja@infix.ai>
@jvdb jvdb changed the title Extend Until to exclude terminator from parsergraph Extend Until to exclude terminator from ParseGraph Feb 23, 2023
jvdb added a commit that referenced this issue Feb 23, 2023
…constructur.

Co-Authored-By: Marja van Aken <marja@infix.ai>
jvdb added a commit that referenced this issue Feb 24, 2023
Co-Authored-By: Marja van Aken <marja@infix.ai>
mvanaken added a commit that referenced this issue Mar 2, 2023
mvanaken added a commit that referenced this issue Mar 2, 2023
This clearly shows the difference in parseGraph between the two
variants.

Co-authored-by: jvdb <jeroen@infix.ai>
mvanaken added a commit that referenced this issue Mar 2, 2023
mvanaken added a commit that referenced this issue Mar 2, 2023
Adjusted the test accordingly. The difference shows that we parse the
terminator twice and it has the same name.

Co-authored-by: jvdb <jeroen@infix.ai>
mvanaken added a commit that referenced this issue Mar 2, 2023
#360: Add variant to Until to allow parsing excluding terminator
jvdb added a commit that referenced this issue Mar 2, 2023
@mvanaken mvanaken added this to the 10.0.0 milestone Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant