-
Notifications
You must be signed in to change notification settings - Fork 46
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
Ragel v7 scanner does not set/reset ts/te after the loop ending in a full token #76
Comments
Hi @gh-andre thanks for reporting this. This is a consequence of
I'm not sure what to do about this at the moment, but thinking about it. |
The ts var is currently getting set on EOF due to ragel 7 executing from-state actions on EOF. This is a regression from ragel 6. refs #76.
In ragel 7, from-state actions are executed on EOF, which means that after a machine sees EOF ts will be set, which is unexpected. Instead, set TS on an entering character-transition action. refs #76
Note that this is only the case after EOF. It means you can check that EOF has not been reached yet. It's still not ideal though. It should stay at zero. |
Proposed solution in df0a63a. |
@adrian-thurston Thank you for looking into this. I worked it around in my code by checking whether |
@adrian-thurston Sorry for the delay - I tested various scenarios and the new Ragel behaves the same as v6.10. I also tested the scenario I forgot to mention, when the first token is incomplete (i.e. Seems to be working well for the scenarios I can think of. Thanks again for looking into this. |
@gh-andre great, thanks for trying it out! |
This is a regression from Ragel 6.10, which set
ts
andte
pointers as described in the manual, which says this:Here's the program to show this behavior:
Compiled on CentOS 8 Stream with Ragel 7.0.0.12, which is available as a package, and with Ragel 6.10, built on the same machine from the source at http://www.colm.net/files/ragel/ragel-6.10.tar.gz.
Both scanners ran this way:
Ragel 6.10 produces this output:
Ragel 7 produces this output:
ts
is no longer reset to a null pointer after the execution loop if the input ends in a full token.The text was updated successfully, but these errors were encountered: