[ragel-users] When exactly is the eof variable required?

Tim Goddard tim at goddard.net.nz
Mon Feb 24 02:28:45 UTC 2014


I'm guessing that string can't include the null character, but can be of 
variable length (kleene star, etc). When the expression ends with "string", 
it could be cut short while still having a valid expression by the end of the 
file, and need to take finishing actions when it sees the EOF. When the 
expression ends with 0, an EOF could not mark the end of the expression 
and cause any other action to be taken, so the eof mark is unused.

The fact that it's a null character will be irrelevant - any character which 
can't be in "string" would have the same effect.

Cheers,

Tim

On Sun, 23 Feb 2014 22:40:59 Grégory Pakosz wrote:
> Hello,
> 
> I'm currently discovering Ragel and I am wondering when the eof
> variable is required?
> 
> More exactly, I noticed in the following in the params.rl example:
> 
> output = '-o' 0? string 0 @output;
> 
> I understand the machines are defined to accept and consume NUL
> characters. This is the reason why the params_execute function is
> given strlen(argv[a])+1.
> 
> However, if I change params.rl to:
> 
> output = '-o' 0? string @output;
> 
> Then Ragel starts making use of the eof variable, which params.rl
> doesn't define.
> 
> Can someone please explain me why removing that 0 in the machine 
makes
> Ragel use the eof variable?
> 
> Thank you,
> Gregory
> 
> _______________________________________________
> ragel-users mailing list
> ragel-users at complang.org
> http://www.complang.org/mailman/listinfo/ragel-users

_______________________________________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/mailman/listinfo/ragel-users



More information about the ragel-users mailing list