jflex icon indicating copy to clipboard operation
jflex copied to clipboard

[Feature] provide state stack, like in flex [sf#20]

Open lsf37 opened this issue 10 years ago • 7 comments
trafficstars

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().

lsf37 avatar Feb 15 '15 11:02 lsf37

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

lsf37 avatar Feb 15 '15 11:02 lsf37

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.

lsf37 avatar Feb 15 '15 11:02 lsf37

Commented by jafl on 2007-07-30 20:28 UTC Skeleton file with state stack functionality

lsf37 avatar Feb 15 '15 11:02 lsf37

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

lsf37 avatar Feb 15 '15 11:02 lsf37

Commented by lsf37 on 2007-08-01 22:30 UTC Logged In: YES user_id=93534 Originator: NO

Thanks, you're right, of course.

lsf37 avatar Feb 15 '15 11:02 lsf37

Updated by lsf37 on 2007-08-01 22:30 UTC

  • priority: 5 --> 3

lsf37 avatar Feb 15 '15 11:02 lsf37

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 :)

lsf37 avatar Feb 15 '15 11:02 lsf37