[ragel-users] Unexpected final state action call

Adrian Thurston thurston at complang.org
Sat Apr 9 17:29:55 UTC 2011


You could do one of the following, depending on your parsing requirements.

1. exclude ( '||' '|'* ) from content.
2. specify %end

If things get too complicated, you may want to switch to a scanner.


On 11-04-09 02:40 AM, Andrey Vityuk wrote:
> Actually I found solution:
> action start { System.out.println("start. fpc = " + fpc); }
> action end  { System.out.println("end. fpc = " + fpc); }
>
> content = (any+ -- '||') >start ;
> main := content . '||' @end . '\n'?;
>
> But the problem is my original rules are more complex:
> content = '||' . (any+ -- '||') >start ;
> main := content+ . '||' @end . '\n'?;
>
> For input: "||abc||efg||" they work fine:
> start. fpc = 2
> end. fpc = 6
> start. fpc = 7
> end. fpc = 11
> start. fpc = 12
> Consumed all: true
>
> But for input: "||abc|||" I am getting unxpected calls:
> start. fpc = 2
> end. fpc = 6
> start. fpc = 7
> end. fpc = 7
> start. fpc = 8
> Consumed all: true
>
>
>
> _______________________________________________
> ragel-users mailing list
> ragel-users at complang.org
> http://www.complang.org/mailman/listinfo/ragel-users

-- 
Dr. Adrian D. Thurston
http://www.complang.org/thurston/

_______________________________________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/mailman/listinfo/ragel-users



More information about the ragel-users mailing list