[ragel-users] two newbie questions

Adrian Thurston thurs... at cs.queensu.ca
Sun Sep 23 17:41:53 UTC 2007

ry wrote:
> 1. I find myself calling %action and %eof(action) a lot. for example:
>     string = ( any - pair_sep )* >string_mark %string_store
> %eof(string_store);
>  if I wanted to parse the string "hello".

In the current version there is no operator that does both at the same
time because of the fact that transition actions and EOF actions are
written using two different write commands. This would mean that a
single action could get written out in two different surrounding
contexts. This is something I will address in version 6. Both transition
actions and EOF actions will get written out by write exec. This will
open the door to defining embedding operators that are called on
transitions and the EOF event.

In the meantime you could send some EOF character (perhaps 0) and just
use %action.

> 2. I want to change a machine slightly based on input to a program. I
> just would like to change one
>   sep = '&';
> to
>   sep = ',';

You can do this using conditions. See the attached example.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: tmp.rl
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20070923/8574e77f/attachment-0001.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20070923/8574e77f/attachment-0001.sig>

More information about the ragel-users mailing list