]> granicus.if.org Git - flex/commitdiff
skeleton uses %push/%pop to keep skelout() scope sane.
authorJohn Millaway <john43@users.sourceforge.net>
Thu, 19 Sep 2002 23:20:34 +0000 (23:20 +0000)
committerJohn Millaway <john43@users.sourceforge.net>
Thu, 19 Sep 2002 23:20:34 +0000 (23:20 +0000)
skel commands are omitted unless --debug enabled.

flex.skl
misc.c

index 4435b3427ffb7ff966bffc0a5cb4c783cfe0c228..7fe6791bf038eda5e642d26da598c74432c630e6 100644 (file)
--- a/flex.skl
+++ b/flex.skl
 #define YY_FLEX_MINOR_VERSION 5
 
 /* First, we deal with  platform-specific or compiler-specific issues. */
-%c-only
+
 /* begin standard C headers. */
+%push
+%c-only
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <stdint.h>
+%pop
+
 %push
 %tables-serialization-code-begin
 #include <netinet/in.h>
 %pop
 /* end standard C headers. */
+
+%push
 %c++-only
 /* begin standard C++ headers. */
 #include <iostream> 
 #include <cerrno>
 #include <cstdlib>
 /* end standard C++ headers. */
-%c-or-c++
+%pop
 
 #ifdef __cplusplus
 
@@ -55,9 +60,6 @@
 #ifdef YY_TRADITIONAL_FUNC_DEFS
 #undef YY_TRADITIONAL_FUNC_DEFS
 #endif
-%c++-only
-#define FLEX_STD   std::
-%c-or-c++
 
 /* The "const" storage-class-modifier is valid. */
 #define YY_USE_CONST
@@ -233,11 +235,12 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
 extern size_t yyleng;
 #endif
 
+%push
 %c-only
 #ifndef YY_REENTRANT
 extern FILE *yyin, *yyout;
 #endif
-%c-or-c++
+%pop
 
 #define EOB_ACT_CONTINUE_SCAN 0
 #define EOB_ACT_END_OF_FILE 1
@@ -306,11 +309,16 @@ typedef unsigned int yy_size_t;
 #define YY_STRUCT_YY_BUFFER_STATE
 struct yy_buffer_state
        {
+%push
 %c-only
        FILE *yy_input_file;
+%pop
+
+%push
 %c++-only
-       FLEX_STD istream* yy_input_file;
-%c-or-c++
+       std::istream* yy_input_file;
+%pop
+
 
        char *yy_ch_buf;                /* input buffer */
        char *yy_buf_pos;               /* current position in input buffer */
@@ -366,13 +374,14 @@ struct yy_buffer_state
        };
 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
 
+%push
 %c-only Standard (non-C++) definition
 %not-for-header
 #ifndef YY_REENTRANT
 static YY_BUFFER_STATE yy_current_buffer = 0;
 #endif
 %ok-for-header
-%c-or-c++
+%pop
 
 /* We provide macros for accessing buffer states in case in the
  * future we want to put the buffer states in a more general
@@ -380,7 +389,7 @@ static YY_BUFFER_STATE yy_current_buffer = 0;
  */
 #define YY_CURRENT_BUFFER yy_current_buffer
 
-
+%push
 %c-only Standard (non-C++) definition
 
 #ifndef YY_REENTRANT
@@ -421,7 +430,7 @@ YY_BUFFER_STATE yy_scan_buffer YY_PARAMS(( char *base, yy_size_t size YY_PROTO_L
 YY_BUFFER_STATE yy_scan_string YY_PARAMS(( yyconst char *yy_str YY_PROTO_LAST_ARG ));
 YY_BUFFER_STATE yy_scan_bytes YY_PARAMS(( yyconst char *bytes, int len YY_PROTO_LAST_ARG ));
 
-%c-or-c++
+%pop
 
 
 void *yyalloc YY_PARAMS(( yy_size_t YY_PROTO_LAST_ARG ));
@@ -450,6 +459,7 @@ void yyfree YY_PARAMS(( void * YY_PROTO_LAST_ARG ));
 
 %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
 
+%push
 %c-only Standard (non-C++) definition
 %not-for-header
 static yy_state_type yy_get_previous_state YY_PARAMS(( YY_PROTO_ONLY_ARG ));
@@ -457,7 +467,7 @@ static yy_state_type yy_try_NUL_trans YY_PARAMS(( yy_state_type current_state  Y
 static int yy_get_next_buffer YY_PARAMS(( YY_PROTO_ONLY_ARG ));
 static void yy_fatal_error YY_PARAMS(( yyconst char msg[] YY_PROTO_LAST_ARG ));
 %ok-for-header
-%c-or-c++
+%pop
 
 /* Done after the current pattern has been matched and before the
  * corresponding action - sets up yytext.
@@ -470,8 +480,6 @@ static void yy_fatal_error YY_PARAMS(( yyconst char msg[] YY_PROTO_LAST_ARG ));
 %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \
        YY_G(yy_c_buf_p) = yy_cp;
 
-%c-or-c++
-
 %not-for-header
 %% [4.0] data tables for the DFA and the user's section 1 definitions go here
 %ok-for-header
@@ -481,20 +489,23 @@ static void yy_fatal_error YY_PARAMS(( yyconst char msg[] YY_PROTO_LAST_ARG ));
  * The user has a chance to override it with an option.
  */
 #ifndef YY_NO_UNISTD_H
+%push
 %c-only
 #include <unistd.h>
+%pop
+%push
 %c++-only
 #ifdef HAVE_CUNISTD
 #include <cunistd>
 #endif
-%c-or-c++
+%pop
 #endif /* !YY_NO_UNISTD_H */
 
-
 #ifndef YY_EXTRA_TYPE
 #define YY_EXTRA_TYPE void *
 #endif
 
+%push
 %c-only Reentrant structure and macros (non-C++).
 #ifdef YY_REENTRANT
 
@@ -654,13 +665,12 @@ extern int yywrap YY_PARAMS(( YY_PROTO_ONLY_ARG ));
 #endif
 #endif
 
-%c-only
 %not-for-header
 #ifndef YY_NO_UNPUT
 static void yyunput YY_PARAMS(( int c, char *buf_ptr  YY_PROTO_LAST_ARG));
 #endif
 %ok-for-header
-%c-or-c++
+%pop
 
 #ifndef yytext_ptr
 static void yy_flex_strncpy YY_PARAMS(( char *, yyconst char *, int YY_PROTO_LAST_ARG));
@@ -671,6 +681,7 @@ static int yy_flex_strlen YY_PARAMS(( yyconst char * YY_PROTO_LAST_ARG));
 #endif
 
 #ifndef YY_NO_INPUT
+%push
 %c-only Standard (non-C++) definition
 %not-for-header
 #ifdef __cplusplus
@@ -679,9 +690,10 @@ static int yyinput YY_PARAMS(( YY_PROTO_ONLY_ARG ));
 static int input YY_PARAMS(( YY_PROTO_ONLY_ARG ));
 #endif
 %ok-for-header
-%c-or-c++
+%pop
 #endif
 
+
 #if YY_STACK_USED
 #ifndef YY_REENTRANT
 %not-for-header
@@ -714,6 +726,7 @@ static int yy_top_state YY_PARAMS(( YY_PROTO_ONLY_ARG ));
 /* Copy whatever the last rule matched to the standard output. */
 
 #ifndef ECHO
+%push
 %c-only Standard (non-C++) definition
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
@@ -721,7 +734,7 @@ static int yy_top_state YY_PARAMS(( YY_PROTO_ONLY_ARG ));
 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
 %c++-only C++ definition
 #define ECHO LexerOutput( yytext, yyleng )
-%c-or-c++
+%pop
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -730,10 +743,12 @@ static int yy_top_state YY_PARAMS(( YY_PROTO_ONLY_ARG ));
 #ifndef YY_INPUT
 #define YY_INPUT(buf,result,max_size) \
 %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \
+\
+%push\
 %c++-only C++ definition \
        if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
                YY_FATAL_ERROR( "input in flex scanner failed" );
-%c-or-c++
+%pop
 #endif
 
 /* No semi-colon after return; correct usage is to write "yyterminate();" -
@@ -751,11 +766,12 @@ static int yy_top_state YY_PARAMS(( YY_PROTO_ONLY_ARG ));
 
 /* Report a fatal error. */
 #ifndef YY_FATAL_ERROR
+%push
 %c-only
 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg YY_CALL_LAST_ARG)
 %c++-only
 #define YY_FATAL_ERROR(msg) LexerError( msg )
-%c-or-c++
+%pop
 #endif
 
 %push
@@ -792,14 +808,16 @@ struct yytbl_reader {
     uint32_t bread; /**< bytes read since beginning of current tableset */
 };
 
-/* end tables serialization structures and prototypes */
 %pop
+/* end tables serialization structures and prototypes */
+
 %ok-for-header
 
 /* Default declaration of generated scanner - a define so the user can
  * easily add parameters.
  */
 #ifndef YY_DECL
+%push
 %c-only Standard (non-C++) definition
 
 /* If the bison pure parser is used, then bison will provide
@@ -824,9 +842,10 @@ extern int yylex YY_LEX_PROTO;
 #define YY_DECL int yylex YY_LEX_DECLARATION
 %c++-only C++ definition
 #define YY_DECL int yyFlexLexer::yylex()
-%c-or-c++
+%pop
 #endif
 
+
 /* Code executed at the beginning of each rule, after yytext and yyleng
  * have been set up.
  */
@@ -882,18 +901,20 @@ YY_DECL
                        YY_G(yy_start) = 1;     /* first start state */
 
                if ( ! yyin )
+%push
 %c-only
                        yyin = stdin;
 %c++-only
-                       yyin = & FLEX_STD cin;
-%c-or-c++
+                       yyin = & std::cin;
+%pop
 
                if ( ! yyout )
+%push
 %c-only
                        yyout = stdout;
 %c++-only
-                       yyout = & FLEX_STD cout;
-%c-or-c++
+                       yyout = & std::cout;
+%pop
 
                if ( ! YY_G(yy_current_buffer) )
                        YY_G(yy_current_buffer) =
@@ -1061,9 +1082,11 @@ do_action:       /* This label is used only to access EOF actions. */
                } /* end of scanning one token */
        } /* end of yylex */
 %ok-for-header
+
+%push
 %c++-only
 %not-for-header
-yyFlexLexer::yyFlexLexer( FLEX_STD istream* arg_yyin, FLEX_STD ostream* arg_yyout )
+yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
        {
        yyin = arg_yyin;
        yyout = arg_yyout;
@@ -1099,7 +1122,7 @@ yyFlexLexer::~yyFlexLexer()
        yy_delete_buffer( yy_current_buffer YY_CALL_LAST_ARG);
        }
 
-void yyFlexLexer::switch_streams( FLEX_STD  istream* new_in, FLEX_STD ostream* new_out )
+void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
        {
        if ( new_in )
                {
@@ -1146,7 +1169,7 @@ void yyFlexLexer::LexerOutput( const char* buf, int size )
        (void) yyout->write( buf, size );
        }
 %ok-for-header
-%c-or-c++
+%pop
 
 /* yy_get_next_buffer - try to read in a new buffer
  *
@@ -1156,12 +1179,13 @@ void yyFlexLexer::LexerOutput( const char* buf, int size )
  *     EOB_ACT_END_OF_FILE - end of file
  */
 
+%push
 %c-only
 %not-for-header
 static int yy_get_next_buffer YYFARGS0(void)
 %c++-only
 int yyFlexLexer::yy_get_next_buffer()
-%c-or-c++
+%pop
        {
        register char *dest = YY_G(yy_current_buffer)->yy_ch_buf;
        register char *source = YY_G(yytext_ptr);
@@ -1293,12 +1317,13 @@ int yyFlexLexer::yy_get_next_buffer()
 
 /* yy_get_previous_state - get the state just before the EOB char was reached */
 
+%push
 %c-only
 %not-for-header
-static yy_state_type yy_get_previous_state YYFARGS0(void)
+    static yy_state_type yy_get_previous_state YYFARGS0(void)
 %c++-only
-yy_state_type yyFlexLexer::yy_get_previous_state()
-%c-or-c++
+    yy_state_type yyFlexLexer::yy_get_previous_state()
+%pop
        {
        register yy_state_type yy_current_state;
        register char *yy_cp;
@@ -1319,12 +1344,12 @@ yy_state_type yyFlexLexer::yy_get_previous_state()
  * synopsis
  *     next_state = yy_try_NUL_trans( current_state );
  */
-
+%push
 %c-only
-static yy_state_type yy_try_NUL_trans  YYFARGS1( yy_state_type, yy_current_state)
+    static yy_state_type yy_try_NUL_trans  YYFARGS1( yy_state_type, yy_current_state)
 %c++-only
-yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
-%c-or-c++
+    yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
+%pop
        {
        register int yy_is_jam;
 %% [17.0] code to find the next state, and perhaps do backing up, goes here
@@ -1333,12 +1358,13 @@ yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
        }
 
 
+%push
 %c-only
 #ifndef YY_NO_UNPUT
-static void yyunput YYFARGS2( int,c, register char *,yy_bp)
+    static void yyunput YYFARGS2( int,c, register char *,yy_bp)
 %c++-only
-void yyFlexLexer::yyunput( int c, register char* yy_bp)
-%c-or-c++
+    void yyFlexLexer::yyunput( int c, register char* yy_bp)
+%pop
        {
        register char *yy_cp = YY_G(yy_c_buf_p);
 
@@ -1377,21 +1403,24 @@ void yyFlexLexer::yyunput( int c, register char* yy_bp)
        YY_G(yy_hold_char) = *yy_cp;
        YY_G(yy_c_buf_p) = yy_cp;
        }
+%push
 %c-only
 #endif /* ifndef YY_NO_UNPUT */
-%c-or-c++
-
+%pop
 
+%push
 %c-only
 #ifndef YY_NO_INPUT
 #ifdef __cplusplus
-static int yyinput YYFARGS0(void)
+    static int yyinput YYFARGS0(void)
 #else
-static int input  YYFARGS0(void)
+    static int input  YYFARGS0(void)
 #endif
+
 %c++-only
-int yyFlexLexer::yyinput()
-%c-or-c++
+    int yyFlexLexer::yyinput()
+%pop
+
        {
        int c;
 
@@ -1459,15 +1488,17 @@ int yyFlexLexer::yyinput()
 
        return c;
        }
+%push
 %c-only
 #endif /* ifndef YY_NO_INPUT */
-%c-or-c++
+%pop
 
+%push
 %c-only
-void yyrestart  YYFARGS1( FILE *,input_file)
+    void yyrestart  YYFARGS1( FILE *,input_file)
 %c++-only
-void yyFlexLexer::yyrestart( FLEX_STD istream* input_file )
-%c-or-c++
+    void yyFlexLexer::yyrestart( std::istream* input_file )
+%pop
        {
        if ( ! YY_G(yy_current_buffer) )
                YY_G(yy_current_buffer) =
@@ -1477,12 +1508,12 @@ void yyFlexLexer::yyrestart( FLEX_STD istream* input_file )
        yy_load_buffer_state( YY_CALL_ONLY_ARG );
        }
 
-
+%push
 %c-only
-void yy_switch_to_buffer  YYFARGS1( YY_BUFFER_STATE ,new_buffer)
+    void yy_switch_to_buffer  YYFARGS1( YY_BUFFER_STATE ,new_buffer)
 %c++-only
-void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
-%c-or-c++
+    void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+%pop
        {
        if ( YY_G(yy_current_buffer) == new_buffer )
                return;
@@ -1507,11 +1538,12 @@ void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
        }
 
 
+%push
 %c-only
-void yy_load_buffer_state  YYFARGS0(void)
+    void yy_load_buffer_state  YYFARGS0(void)
 %c++-only
-void yyFlexLexer::yy_load_buffer_state()
-%c-or-c++
+    void yyFlexLexer::yy_load_buffer_state()
+%pop
        {
        YY_G(yy_n_chars) = YY_G(yy_current_buffer)->yy_n_chars;
        YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_G(yy_current_buffer)->yy_buf_pos;
@@ -1519,12 +1551,12 @@ void yyFlexLexer::yy_load_buffer_state()
        YY_G(yy_hold_char) = *YY_G(yy_c_buf_p);
        }
 
-
+%push
 %c-only
-YY_BUFFER_STATE yy_create_buffer  YYFARGS2( FILE *,file, int ,size)
+    YY_BUFFER_STATE yy_create_buffer  YYFARGS2( FILE *,file, int ,size)
 %c++-only
-YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( FLEX_STD istream* file, int size )
-%c-or-c++
+    YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
+%pop
        {
        YY_BUFFER_STATE b;
 
@@ -1548,12 +1580,12 @@ YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( FLEX_STD istream* file, int size
        return b;
        }
 
-
+%push
 %c-only
-void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b)
+    void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b)
 %c++-only
-void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
-%c-or-c++
+    void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
+%pop
        {
        if ( ! b )
                return;
@@ -1568,6 +1600,7 @@ void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
        }
 
 
+%push
 %c-only
 #ifndef YY_ALWAYS_INTERACTIVE
 #ifndef YY_NEVER_INTERACTIVE
@@ -1576,14 +1609,17 @@ extern int isatty YY_PARAMS(( int ));
 #endif /* __cplusplus */
 #endif /* !YY_NEVER_INTERACTIVE */
 #endif /* !YY_ALWAYS_INTERACTIVE */
+%pop
 
-void yy_init_buffer  YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file)
+%push
+%c-only
+    void yy_init_buffer  YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file)
 %c++-only
 #ifndef YY_NEVER_INTERACTIVE
 extern "C" int isatty YY_PARAMS(( int ));
 #endif
-void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, FLEX_STD istream* file )
-%c-or-c++
+void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
+%pop
 
        {
        int oerrno = errno;
@@ -1593,6 +1629,7 @@ void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, FLEX_STD istream* file )
        b->yy_input_file = file;
        b->yy_fill_buffer = 1;
 
+%push
 %c-only
 #if YY_ALWAYS_INTERACTIVE
        b->yy_is_interactive = 1;
@@ -1605,16 +1642,16 @@ void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, FLEX_STD istream* file )
 #endif
 %c++-only
        b->yy_is_interactive = 0;
-%c-or-c++
+%pop
        errno = oerrno;
        }
 
-
+%push
 %c-only
-void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b)
+    void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b)
 %c++-only
-void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
-%c-or-c++
+    void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
+%pop
        {
        if ( ! b )
                return;
@@ -1636,10 +1673,10 @@ void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
        if ( b == YY_G(yy_current_buffer) )
                yy_load_buffer_state( YY_CALL_ONLY_ARG );
        }
-%c-or-c++
 
 
 #ifndef YY_NO_SCAN_BUFFER
+%push
 %c-only
 YY_BUFFER_STATE yy_scan_buffer  YYFARGS2( char *,base, yy_size_t ,size)
        {
@@ -1669,11 +1706,12 @@ YY_BUFFER_STATE yy_scan_buffer  YYFARGS2( char *,base, yy_size_t ,size)
 
        return b;
        }
-%c-or-c++
+%pop
 #endif
 
 
 #ifndef YY_NO_SCAN_STRING
+%push
 %c-only
 YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *,yy_str)
        {
@@ -1683,11 +1721,12 @@ YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *,yy_str)
 
        return yy_scan_bytes( yy_str, len YY_CALL_LAST_ARG);
        }
-%c-or-c++
+%pop
 #endif
 
 
 #ifndef YY_NO_SCAN_BYTES
+%push
 %c-only
 YY_BUFFER_STATE yy_scan_bytes  YYFARGS2( yyconst char *,bytes, int ,len)
        {
@@ -1718,16 +1757,17 @@ YY_BUFFER_STATE yy_scan_bytes  YYFARGS2( yyconst char *,bytes, int ,len)
 
        return b;
        }
-%c-or-c++
+%pop
 #endif
 
 
 #ifndef YY_NO_PUSH_STATE
+%push
 %c-only
-static void yy_push_state YYFARGS1( int ,new_state)
+    static void yy_push_state YYFARGS1( int ,new_state)
 %c++-only
-void yyFlexLexer::yy_push_state( int new_state )
-%c-or-c++
+    void yyFlexLexer::yy_push_state( int new_state )
+%pop
        {
        if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) )
                {
@@ -1756,11 +1796,12 @@ void yyFlexLexer::yy_push_state( int new_state )
 
 
 #ifndef YY_NO_POP_STATE
+%push
 %c-only
-static void yy_pop_state  YYFARGS0(void)
+    static void yy_pop_state  YYFARGS0(void)
 %c++-only
-void yyFlexLexer::yy_pop_state()
-%c-or-c++
+    void yyFlexLexer::yy_pop_state()
+%pop
        {
        if ( --YY_G(yy_start_stack_ptr) < 0 )
                YY_FATAL_ERROR( "start-condition stack underflow" );
@@ -1771,11 +1812,12 @@ void yyFlexLexer::yy_pop_state()
 
 
 #ifndef YY_NO_TOP_STATE
+%push
 %c-only
-static int yy_top_state  YYFARGS0(void)
+    static int yy_top_state  YYFARGS0(void)
 %c++-only
-int yyFlexLexer::yy_top_state()
-%c-or-c++
+    int yyFlexLexer::yy_top_state()
+%pop
        {
        return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1];
        }
@@ -1785,21 +1827,20 @@ int yyFlexLexer::yy_top_state()
 #define YY_EXIT_FAILURE 2
 #endif
 
+%push
 %c-only
 static void yy_fatal_error YYFARGS1(yyconst char*, msg)
        {
        (void) fprintf( stderr, "%s\n", msg );
        exit( YY_EXIT_FAILURE );
        }
-
 %c++-only
-
 void yyFlexLexer::LexerError( yyconst char msg[] )
        {
-       FLEX_STD cerr << msg << '\n';
+       std::cerr << msg << std::endl;
        exit( YY_EXIT_FAILURE );
        }
-%c-or-c++
+%pop
 
 /* Redefine yyless() so it works in section 3 code. */
 
@@ -1821,6 +1862,7 @@ void yyFlexLexer::LexerError( yyconst char msg[] )
 
 /* Accessor  methods (get/set functions) to struct members. */
 
+%push
 %c-only
 #ifdef YY_REENTRANT
 #ifndef YY_NO_GET_EXTRA
@@ -1911,7 +1953,7 @@ void yyset_debug YYFARGS1( int ,bdebug)
     yy_flex_debug = bdebug ;
 }
 #endif /* !YY_NO_SET_DEBUG */
-%c-or-c++
+%pop
 
 #ifdef YY_REENTRANT
 /* Accessor methods for yylval and yylloc */
@@ -2030,6 +2072,7 @@ int yylex_init( ptr_yy_globals )
 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
 int yylex_destroy  YYFARGS0(void)
 {
+%push
 %c-only SNIP! this currently causes conflicts with the c++ scanner
     /* Destroy the current (main) buffer. */
     yy_delete_buffer( YY_G(yy_current_buffer) YY_CALL_LAST_ARG );
@@ -2051,7 +2094,7 @@ int yylex_destroy  YYFARGS0(void)
     /* Destroy the main struct (reentrant only). */
     yyfree ( yyscanner YY_CALL_LAST_ARG );
 #endif
-%c-or-c++
+%pop
     return 0;
 }
 
diff --git a/misc.c b/misc.c
index 5364404193dcfbb17e11017d46f966d1801738d2..056ec47b40dd589197e6e3865d0ee8d27c098c0c 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -878,7 +878,7 @@ void skelout ()
                /* copy from skel array */
                if (buf[0] == '%') {    /* control line */
                        /* print the control line as a comment. */
-                       if (buf[1] != '#') {
+                       if (ddebug && buf[1] != '#') {
                                if (buf[strlen (buf) - 1] == '\\')
                                        out_str ("/* %s */\\\n", buf);
                                else
@@ -898,13 +898,19 @@ void skelout ()
                        }
             else if (cmd_match (CMD_PUSH)){
                 sko_push(do_copy,tablestoggle);
-                out_str("/*(state = (%s,",do_copy?"true":"false");
-                out_str(          "%s)*/\n",tablestoggle?"true":"false");
+                if(ddebug){
+                    out_str("/*(state = (%s,",do_copy?"true":"false");
+                    out_str(          "%s)*/",tablestoggle?"true":"false");
+                    out_str("%s\n", buf[strlen (buf) - 1] =='\\' ? "\\" : "");
+                }
             }
             else if (cmd_match (CMD_POP)){
                 sko_pop(&do_copy,&tablestoggle);
-                out_str("/*(state = (%s,",do_copy?"true":"false");
-                out_str(          "%s)*/\n",tablestoggle?"true":"false");
+                if(ddebug){
+                    out_str("/*(state = (%s,",do_copy?"true":"false");
+                    out_str(          "%s)*/",tablestoggle?"true":"false");
+                    out_str("%s\n", buf[strlen (buf) - 1] =='\\' ? "\\" : "");
+                }
             }
                        else if (cmd_match (CMD_TABLES_SER_BEGIN)) {
                                tablestoggle = true;