I have a scanner, that if an optional final state is reached can be
simplified to accept any input, and stop trying to match scanners
expressions.
For example :
final := any* :>> final_char @final_action any*;
main := |*
foo => { do_stuff(); };
bar => { do_more_stuff(); };
final_exp => { fgoto final; };
any => { reset_states(); }
*|;
The problem is that 'ts' will stay where final_exp matched, and the amount
of chars to backtrack will grow indefinitely as the last any* of 'final'
matches.
Is there a good way to address this problem?
I could stop parsing the input after final_char is found, but we can imagine
a case where we would still want to match something after 'final_char' is
found, but break away from the main scanner, to have a simpler set of rules.
Thanks,
Matthieu.
--
Matthieu Tourne
_______________________________________________
ragel-users mailing list
[email protected]
http://www.complang.org/mailman/listinfo/ragel-users