Open gh-andre opened 3 years ago
Hi @gh-andre thanks for reporting this.
This is a consequence of
ts = p
on the start of a token (always the case).I'm not sure what to do about this at the moment, but thinking about it.
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 df0a63a7e779fa8e25c92099e65e9fd10a053241.
@adrian-thurston Thank you for looking into this. I worked it around in my code by checking whether ts
and pe
are the same, in addition to checking whether ts
is a null pointer or not. I'm not familiar with Ragel source and cannot comment on the proposed fix, but will be able to test it once I'm back in the office next week, if you don't mind the delay.
@adrian-thurston Sorry for the delay - colm
was conflicting with the one installed via dnf
and I needed how to build both from the commit.
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. ./scan abc
) and verified that ts
is set at the start of input, while te
is not set and in this example remains nullptr
, while pe
in each case is advanced past the end of the last character (i.e. points to the null character).
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.