[ragel-users] Re: fnext followed by fbreak
Adrian Thurston
thurs... at cs.queensu.ca
Sat Apr 12 23:53:50 UTC 2008
Oops, I forgot to cover that case. I'll fix that tomorrow.
-Adrian
-----Original Message-----
From: Andrei Polushin <polushin at gmail.com>
Date: Sun, 13 Apr 2008 05:25:02
To:ragel-users at googlegroups.com
Subject: [ragel-users] Re: fnext followed by fbreak
Adrian Thurston wrote:
> This has been fixed in trunk.
OK, thank you for that. But it still doesn't work for the scanner actions.
I've wrote a test program to clarify that, it's attached.
> Andrei Polushin wrote:
>> The action like this:
>>
>> action x {
>> fnext somewhere_else;
>> fbreak;
>> };
>>
>> become generated as follows:
>>
>> action x {
>> cs = 123; // fnext somewhere_else;
>> {p++; cs = 456; goto _out;} // fbreak;
>> };
>>
>> where '123' is the desired next state (aka somewhere_else),
>> and '456' is the default target state for the transition.
>>
>> That is, the effect of fnext is neglected, when followed by fbreak.
>>
>> For now, the workaround is to redeclare 'cs' in local block:
>>
>> action x {
>> fnext somewhere_else;
>> {int cs = -1; fbreak;}
>> };
>>
>> but I hope there should be a better solution for this.
>>
>> For actions that involve both fnext and fbreak, I would suggest
>> generating {cs = ...} in the beginning of the action, and omit
>> that assignnment in the code generated by fbreak.
--
Andrei Polushin
More information about the ragel-users
mailing list