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

"What the heck is an infix stopper?!" #2115

Open
zoffixznet opened this Issue Jul 22, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@zoffixznet
Contributor

zoffixznet commented Jul 22, 2018

$ perl6 -e '"" ~~ /(.)\1+/;'                                                                                                                                                                                                         
[...]
    expecting any of:
        infix stopper
        term

A user on #2110 mentioned the infix stopper and I recall having a discussion about its presence in the error message about 2 years ago...

However, I still don't know what the heck is an infix stopper either. Maybe it should be reworded/removed from the error?

@jnthn

This comment has been minimized.

Show comment
Hide comment
@jnthn

jnthn Jul 22, 2018

Member

An infix stopper is something that tells us we should not try to parse an infix at this point. Consider say "abc42def" ~~ m|\d+|. Ordinarily, | in a regex is treated as an alternation, but since the infixstopper matches the current regex terminator, we don't continue and try to parse an infix at that point. The |
is thus treated as the end of the regex.

The "expected" list is generated by seeing what we were looking for at the the high watermark when the parse failed. In various cases, however, the high watermark expectations list doesn't add any value (I think including the case discusses in #2110).

I think we should probably add a method that is called by the code that renders compile-time exceptions to ask if we should include the expectation data. Then we can override that like method include-expectations { False } to opt exceptions out of it where it makes no sense.

Member

jnthn commented Jul 22, 2018

An infix stopper is something that tells us we should not try to parse an infix at this point. Consider say "abc42def" ~~ m|\d+|. Ordinarily, | in a regex is treated as an alternation, but since the infixstopper matches the current regex terminator, we don't continue and try to parse an infix at that point. The |
is thus treated as the end of the regex.

The "expected" list is generated by seeing what we were looking for at the the high watermark when the parse failed. In various cases, however, the high watermark expectations list doesn't add any value (I think including the case discusses in #2110).

I think we should probably add a method that is called by the code that renders compile-time exceptions to ask if we should include the expectation data. Then we can override that like method include-expectations { False } to opt exceptions out of it where it makes no sense.

@MasterDuke17

This comment has been minimized.

Show comment
Hide comment
@MasterDuke17

MasterDuke17 Jul 23, 2018

Contributor

There was some related/relevant commentary in #871.

Contributor

MasterDuke17 commented Jul 23, 2018

There was some related/relevant commentary in #871.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment