jflex
jflex copied to clipboard
[Feature] provide state stack, like in flex [sf#20]
Reported by jafl on 2007-07-28 00:00 UTC flex provides yy_push_state(int new_state) and yy_pop_state() and yy_top_state().
These are very useful when one wishes to reuse a state from several other states. The re-used state calls yy_pop_state() instead of BEGIN().
Commented by lsf37 on 2007-07-29 00:52 UTC Logged In: YES user_id=93534 Originator: NO
Hi John,
these two should already be supported if you use the file skeleton.nested as skeleton file for the spec (see also the command line options or the build options of jflex itself).
Cheers, Gerwin
Commented by jafl on 2007-07-30 19:49 UTC Logged In: YES user_id=1439262 Originator: YES
Actually, skeleton.nested provides a stream stack, not a state stack. I will work on implementing a similar skeleton for states, and send it to you.
Commented by jafl on 2007-07-30 20:28 UTC Skeleton file with state stack functionality
Commented by jafl on 2007-07-30 20:28 UTC Logged In: YES user_id=1439262 Originator: YES
I have the state stack working. File Added: skeleton.state_stack
Commented by lsf37 on 2007-08-01 22:30 UTC Logged In: YES user_id=93534 Originator: NO
Thanks, you're right, of course.
Updated by lsf37 on 2007-08-01 22:30 UTC
- priority: 5 --> 3
Commented by jafl on 2007-08-03 22:48 UTC Logged In: YES user_id=1439262 Originator: YES
My suggestion would be to include the state stack in the default skeleton. The patch is very minor and very useful :)