[ragel-users] Re: syntax improvement, new operators
Erich Ocean
er... at atlasocean.com
Sat Feb 10 18:29:31 UTC 2007
action a1 {}
action a2 {}
action skippable {}
action not_skippable {}
sub = ( 'a' 'b'* ) >a1 $a2;
main := (sub? >skippable %not_skippable) . 'c';
If 'skippable' was a machine-level Start action, it would always be
executed before %not_skippable, whereas the character-level > action
is only executed if a character happens to be recognized by 'sub'
prior to accepting.
A machine-level 'Start' action would be symmetric with % in all
cases. > is not symmetric with %; it's closest symmetry is @ (at
least it's always guaranteed to be executed before @ in the same
machine).
Best, Erich
On Feb 10, 2007, at 10:09 AM, Adrian Thurston wrote:
>
> Hi Erich,
>
> Entering actions are always executed before any other actions which
> have
> been previously embedded in the machine. In this example sub is
> evaluated and all its actions are embedded. Then the first action is
> embedded, but it goes to the front of any action list it is put in
> because it is a starting action.
>
> action a1 {}
> action a2 {}
> action first {}
>
> sub = ( 'a' 'b'* ) >a1 $a2;
> main := sub >first;
>
> Regards,
> Adrian
>
> Erich Ocean wrote:
>> I find how the current action operators work intuitive, it's the
>> *naming* that I find unintuitive. (Perhaps that should have been
>> changed along with the behavior change in 4.0.)
>>
>> It might be worthwhile to add a new machine-level action operator
>> that was always executed before any other action was executed by the
>> machine (we could call it Start), though I don't have any ready use
>> for one.
>>
>> Best, Erich
>>
>>
>
> >
More information about the ragel-users
mailing list