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

Inline-sequences, blocks and assignments #76

Closed
phorward opened this issue Oct 9, 2022 · 1 comment
Closed

Inline-sequences, blocks and assignments #76

phorward opened this issue Oct 9, 2022 · 1 comment
Assignees
Labels
bug Something isn't working syntax

Comments

@phorward
Copy link
Member

phorward commented Oct 9, 2022

This issue focuses a main problem with current Tokay programs:

What if I want to parse something using Parselets / Tokens, and use the result of this parse afterwards?

This program:

print("stage 1 " + repr(x))
x = (Int _ Int expect EOF  ast("test"))
print("stage 2 " + repr(x))

executed with input 1 2 prints

stage 1 void

And that's all.

Because the inline sequence inside of the assignment is successfully parsed, and this causes the main block to stop successfully.


There is currently no way to get the problem implemented, except by assigning a parselet to x, but this also does not allow to run the anonymous parselet assigned to x twice:

print("stage 1 " + repr(x))
x = @{Int _ Int expect EOF  ast("test")}
print("stage 2 " + repr(x))
print("stage 3 " + repr(x))

results in

stage 1 void
stage 2 (emit => "test", children => (1, 2), offset => 0, row => 1, col => 1, stop_offset => 3, stop_row => 1, stop_col => 4)

which is the wanted behavior of the first program. stage 3 is not executed, because the block successfully stops before.

A solution has to be evaluated to fix this issue, either by different syntax or by different behavior, that is almost backward-compatible.

@phorward phorward added bug Something isn't working syntax labels Oct 9, 2022
@phorward phorward self-assigned this Oct 9, 2022
@phorward phorward changed the title Inline-sequences and assignments Inline-sequences, blocks and assignments Oct 9, 2022
@phorward phorward changed the title Inline-sequences, blocks and assignments Frames with inline reader extend Oct 18, 2022
@phorward phorward changed the title Frames with inline reader extend Parsable areas with in-place reader extend Oct 18, 2022
@phorward phorward changed the title Parsable areas with in-place reader extend Inline-sequences, blocks and assignments Oct 18, 2022
@phorward
Copy link
Member Author

Ok closing now, as the @(...) syntax introduces a sequence separately parsed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working syntax
Projects
None yet
Development

No branches or pull requests

1 participant