Menu

#20 provide state stack, like in flex

open
generator (17)
3
2007-08-01
2007-07-28
John Lindal
No

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

Discussion

  • Gerwin Klein

    Gerwin Klein - 2007-07-29

    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

     
  • John Lindal

    John Lindal - 2007-07-30

    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.

     
  • John Lindal

    John Lindal - 2007-07-30

    Skeleton file with state stack functionality

     
  • John Lindal

    John Lindal - 2007-07-30

    Logged In: YES
    user_id=1439262
    Originator: YES

    I have the state stack working.
    File Added: skeleton.state_stack

     
  • Gerwin Klein

    Gerwin Klein - 2007-08-01

    Logged In: YES
    user_id=93534
    Originator: NO

    Thanks, you're right, of course.

     
  • Gerwin Klein

    Gerwin Klein - 2007-08-01
    • priority: 5 --> 3
     
  • John Lindal

    John Lindal - 2007-08-03

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