[ragel] EOF actions question

Adrian Thurston thurston at colm.net
Tue Oct 24 21:52:32 UTC 2017


Hi Will, you'll need to set the eof variable equal to pe on the buffer 
block where you want to indicate EOF.

On 2017-10-22 11:12, Will Dowling wrote:
> Hi folks,
> 
> I’m a newcomer to ragel and was hoping someone can help me better
> understand when actions execute.
> Specifically, I’m not sure why an EOF final state action is not firing.
> 
> Here’s a self-contained example of what I’m trying to achieve:
> https://gist.github.com/dowlingw/39953db1b166003c1474fa10a20616de
> 
> In the example, I’m keeping track of the character pointer to extract
> the token when the machine is finished.
> This is modelled around how I’ve seen it done elsewhere, but maybe
> there’s a better way.
> 
> From my understanding from the guide and looking at the graphviz 
> output:
> 
> %capture 	would never fire because the machine is at EOF, so never
> exits the userid machine
> @capture 	will work, but will execute every character the userid
> machine processes
> %/capture 	should(?) fire because the machine is in the userid state
> when it reaches EOF
> 
> But the last one doesn’t appear to work the way I’d expect - so I’m
> probably misunderstanding things.
> 
> If anyone is able to point me in the right direction, I’d be super 
> grateful.
> (On the unlikely chance it’s something environmental, I’m running
> Ragel 6.10 on go1.8.3 darwin/amd64)
> 
> In either case, thanks for maintaining an awesome tool!
> 
> Cheers :)
> 
> 
> Will Dowling
> 
> E: will at autodeist.com
> 
> 
> _______________________________________________
> ragel mailing list
> ragel at colm.net
> http://www.colm.net/cgi-bin/mailman/listinfo/ragel




More information about the ragel-users mailing list