[ragel-users] Actions embedded into unexpected transitions?
Adrian Thurston
thurston at complang.org
Fri Feb 6 00:31:25 UTC 2009
I still can't see the problem. Can you restate it, if it's still an issue?
-Adrian
Dmitry Marakasov wrote:
> * Adrian Thurston (thurston at complang.org) wrote:
>
>> Sorry I went to fast and didn't see your problem. My mail program was
>> highlighting the lines beginning with ">", causing some confusion for me.
>>
>> The bit of info that you're missing is that action embedding operators
>> bind more tightly than concatenation. Use:
>>
>> b := ( a 'b'+ ) >{print} %{print};
>>
>> and I think you'll get what you want.
>
> That would be too easy :)
>
> Actually that was just an example, the real cause is more complex,
> and my goal is to save all informaion encountered while parsing
> subexpression amd process it as a whole when it's finished. Like
> that:
>
> char *a_start;
> char *a_end;
>
> a = 'a'+
> > { a_start = p; }
> % { a_end = p; }
> ;
>
> b = a 'b'+
> > { a_start = a_end = 0; /* reset state */ }
> % { printf("subexpr finished, there were %d a's\n", a_end-a_start); }
> ;
>
> main := b+;
>
More information about the ragel-users
mailing list