summaryrefslogtreecommitdiff
path: root/flex.skl
diff options
context:
space:
mode:
authorJohn Millaway <john43@users.sourceforge.net>2003-02-28 11:27:10 +0000
committerJohn Millaway <john43@users.sourceforge.net>2003-02-28 11:27:10 +0000
commit74af518aecbe477db93ebfdb04df70210fda3af0 (patch)
treebfd0a66e8af53a87c5d6dceb8e3ce77373e43131 /flex.skl
parent44a9a45a62c97fbcd83b579a7c281c8cfe80a8bf (diff)
Removed yy_current_buffer from the planet.
Input buffer states are now in an internal unbounded stack. Added new internal function, yyensure_buffer_stack. Added new API function, yypush_buffer_state. Added new API function, yypop_buffer_state. Documented the new API calls in the manual. Macro YY_BUFFER_STATE now refers to top of stack. This revision breaks the C++ scanner (again.)
Diffstat (limited to 'flex.skl')
-rw-r--r--flex.skl269
1 files changed, 205 insertions, 64 deletions
diff --git a/flex.skl b/flex.skl
index c3c1fc9..c4d70d1 100644
--- a/flex.skl
+++ b/flex.skl
@@ -393,16 +393,28 @@ struct yy_buffer_state
%c-only Standard (non-C++) definition
%not-for-header
%if-not-reentrant
-static YY_BUFFER_STATE yy_current_buffer = 0;
+
+/* Stack of input buffers. */
+static size_t yy_buffer_stack_top = 0; /*<< index of top of stack. */
+static size_t yy_buffer_stack_max = 0; /*<< capacity of stack. */
+static YY_BUFFER_STATE * yy_buffer_stack = 0; /*<< Stack as an array. */
%endif
%ok-for-header
%pop
-
/* We provide macros for accessing buffer states in case in the
* future we want to put the buffer states in a more general
* "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( YY_G(yy_buffer_stack) \
+ ? YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)] \
+ : NULL)
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
*/
-#define YY_CURRENT_BUFFER yy_current_buffer
+#define YY_CURRENT_BUFFER_FAST YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)]
%push
%c-only Standard (non-C++) definition
@@ -438,8 +450,11 @@ YY_BUFFER_STATE yy_create_buffer YY_PARAMS(( FILE *file, int size YY_PROTO_LAST_
void yy_delete_buffer YY_PARAMS(( YY_BUFFER_STATE b YY_PROTO_LAST_ARG ));
void yy_init_buffer YY_PARAMS(( YY_BUFFER_STATE b, FILE *file YY_PROTO_LAST_ARG ));
void yy_flush_buffer YY_PARAMS(( YY_BUFFER_STATE b YY_PROTO_LAST_ARG ));
+void yypush_buffer_state YY_PARAMS(( YY_BUFFER_STATE new_buffer YY_PROTO_LAST_ARG ));
+void yypop_buffer_state YY_PARAMS(( YY_PROTO_ONLY_ARG ));
+void yyensure_buffer_stack YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#define YY_FLUSH_BUFFER yy_flush_buffer( YY_G(yy_current_buffer) YY_CALL_LAST_ARG)
+#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER YY_CALL_LAST_ARG)
YY_BUFFER_STATE yy_scan_buffer YY_PARAMS(( char *base, yy_size_t size YY_PROTO_LAST_ARG ));
YY_BUFFER_STATE yy_scan_string YY_PARAMS(( yyconst char *yy_str YY_PROTO_LAST_ARG ));
@@ -455,21 +470,25 @@ void yyfree YY_PARAMS(( void * YY_PROTO_LAST_ARG ));
#define yy_set_interactive(is_interactive) \
{ \
- if ( ! YY_G(yy_current_buffer) ) \
- YY_G(yy_current_buffer) = \
+ if ( ! YY_CURRENT_BUFFER ){ \
+ yyensure_buffer_stack (YY_CALL_ONLY_ARG); \
+ YY_CURRENT_BUFFER_FAST = \
yy_create_buffer( yyin, YY_BUF_SIZE YY_CALL_LAST_ARG); \
- YY_G(yy_current_buffer)->yy_is_interactive = is_interactive; \
+ } \
+ YY_CURRENT_BUFFER_FAST->yy_is_interactive = is_interactive; \
}
#define yy_set_bol(at_bol) \
{ \
- if ( ! YY_G(yy_current_buffer) ) \
- YY_G(yy_current_buffer) = \
+ if ( ! YY_CURRENT_BUFFER ){\
+ yyensure_buffer_stack (YY_CALL_ONLY_ARG); \
+ YY_CURRENT_BUFFER_FAST = \
yy_create_buffer( yyin, YY_BUF_SIZE YY_CALL_LAST_ARG); \
- YY_G(yy_current_buffer)->yy_at_bol = at_bol; \
+ } \
+ YY_CURRENT_BUFFER_FAST->yy_at_bol = at_bol; \
}
-#define YY_AT_BOL() (YY_G(yy_current_buffer)->yy_at_bol)
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_FAST->yy_at_bol)
%% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
@@ -531,7 +550,9 @@ struct yyguts_t
/* The rest are the same as the globals declared in the non-reentrant scanner. */
FILE *yyin_r, *yyout_r;
- YY_BUFFER_STATE yy_current_buffer;
+ size_t yy_buffer_stack_top; /*<< index of top of stack. */
+ size_t yy_buffer_stack_max; /*<< capacity of stack. */
+ YY_BUFFER_STATE * yy_buffer_stack; /*<< Stack as an array. */
char yy_hold_char;
int yy_n_chars;
int yyleng_r;
@@ -934,9 +955,11 @@ YY_DECL
yyout = & std::cout;
%pop
- if ( ! YY_G(yy_current_buffer) )
- YY_G(yy_current_buffer) =
+ if ( ! YY_CURRENT_BUFFER ) {
+ yyensure_buffer_stack (YY_CALL_ONLY_ARG);
+ YY_CURRENT_BUFFER_FAST =
yy_create_buffer( yyin, YY_BUF_SIZE YY_CALL_LAST_ARG);
+ }
yy_load_buffer_state( YY_CALL_ONLY_ARG );
}
@@ -980,20 +1003,20 @@ do_action: /* This label is used only to access EOF actions. */
*yy_cp = YY_G(yy_hold_char);
YY_RESTORE_YY_MORE_OFFSET
- if ( YY_G(yy_current_buffer)->yy_buffer_status == YY_BUFFER_NEW )
+ if ( YY_CURRENT_BUFFER_FAST->yy_buffer_status == YY_BUFFER_NEW )
{
/* We're scanning a new file or input source. It's
* possible that this happened because the user
* just pointed yyin at a new source and called
* yylex(). If so, then we have to assure
- * consistency between yy_current_buffer and our
+ * consistency between YY_CURRENT_BUFFER and our
* globals. Here is the right place to do so, because
* this is the first action (other than possibly a
* back-up) that will match for the new input source.
*/
- YY_G(yy_n_chars) = YY_G(yy_current_buffer)->yy_n_chars;
- YY_G(yy_current_buffer)->yy_input_file = yyin;
- YY_G(yy_current_buffer)->yy_buffer_status = YY_BUFFER_NORMAL;
+ YY_G(yy_n_chars) = YY_CURRENT_BUFFER_FAST->yy_n_chars;
+ YY_CURRENT_BUFFER_FAST->yy_input_file = yyin;
+ YY_CURRENT_BUFFER_FAST->yy_buffer_status = YY_BUFFER_NORMAL;
}
/* Note that here we test for yy_c_buf_p "<=" to the position
@@ -1003,7 +1026,7 @@ do_action: /* This label is used only to access EOF actions. */
* end-of-buffer state). Contrast this with the test
* in input().
*/
- if ( YY_G(yy_c_buf_p) <= &YY_G(yy_current_buffer)->yy_ch_buf[YY_G(yy_n_chars)] )
+ if ( YY_G(yy_c_buf_p) <= &YY_CURRENT_BUFFER_FAST->yy_ch_buf[YY_G(yy_n_chars)] )
{ /* This was really a NUL. */
yy_state_type yy_next_state;
@@ -1082,7 +1105,7 @@ do_action: /* This label is used only to access EOF actions. */
case EOB_ACT_LAST_MATCH:
YY_G(yy_c_buf_p) =
- &YY_G(yy_current_buffer)->yy_ch_buf[YY_G(yy_n_chars)];
+ &YY_CURRENT_BUFFER_FAST->yy_ch_buf[YY_G(yy_n_chars)];
yy_current_state = yy_get_previous_state( YY_CALL_ONLY_ARG );
@@ -1205,16 +1228,16 @@ static int yy_get_next_buffer YYFARGS0(void)
int yyFlexLexer::yy_get_next_buffer()
%pop
{
- register char *dest = YY_G(yy_current_buffer)->yy_ch_buf;
+ register char *dest = YY_CURRENT_BUFFER_FAST->yy_ch_buf;
register char *source = YY_G(yytext_ptr);
register int number_to_move, i;
int ret_val;
- if ( YY_G(yy_c_buf_p) > &YY_G(yy_current_buffer)->yy_ch_buf[YY_G(yy_n_chars) + 1] )
+ if ( YY_G(yy_c_buf_p) > &YY_CURRENT_BUFFER_FAST->yy_ch_buf[YY_G(yy_n_chars) + 1] )
YY_FATAL_ERROR(
"fatal flex scanner internal error--end of buffer missed" );
- if ( YY_G(yy_current_buffer)->yy_fill_buffer == 0 )
+ if ( YY_CURRENT_BUFFER_FAST->yy_fill_buffer == 0 )
{ /* Don't try to fill the buffer, so this is an EOF. */
if ( YY_G(yy_c_buf_p) - YY_G(yytext_ptr) - YY_MORE_ADJ == 1 )
{
@@ -1241,16 +1264,16 @@ int yyFlexLexer::yy_get_next_buffer()
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
- if ( YY_G(yy_current_buffer)->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ if ( YY_CURRENT_BUFFER_FAST->yy_buffer_status == YY_BUFFER_EOF_PENDING )
/* don't do the read, it's not guaranteed to return an EOF,
* just force an EOF
*/
- YY_G(yy_current_buffer)->yy_n_chars = YY_G(yy_n_chars) = 0;
+ YY_CURRENT_BUFFER_FAST->yy_n_chars = YY_G(yy_n_chars) = 0;
else
{
size_t num_to_read =
- YY_G(yy_current_buffer)->yy_buf_size - number_to_move - 1;
+ YY_CURRENT_BUFFER_FAST->yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 )
{ /* Not enough room in the buffer - grow it. */
@@ -1260,7 +1283,7 @@ int yyFlexLexer::yy_get_next_buffer()
#else
/* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = YY_G(yy_current_buffer);
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
int yy_c_buf_p_offset =
(int) (YY_G(yy_c_buf_p) - b->yy_ch_buf);
@@ -1289,7 +1312,7 @@ int yyFlexLexer::yy_get_next_buffer()
YY_G(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
- num_to_read = YY_G(yy_current_buffer)->yy_buf_size -
+ num_to_read = YY_CURRENT_BUFFER_FAST->yy_buf_size -
number_to_move - 1;
#endif
}
@@ -1298,10 +1321,10 @@ int yyFlexLexer::yy_get_next_buffer()
num_to_read = YY_READ_BUF_SIZE;
/* Read in more data. */
- YY_INPUT( (&YY_G(yy_current_buffer)->yy_ch_buf[number_to_move]),
+ YY_INPUT( (&YY_CURRENT_BUFFER_FAST->yy_ch_buf[number_to_move]),
YY_G(yy_n_chars), num_to_read );
- YY_G(yy_current_buffer)->yy_n_chars = YY_G(yy_n_chars);
+ YY_CURRENT_BUFFER_FAST->yy_n_chars = YY_G(yy_n_chars);
}
if ( YY_G(yy_n_chars) == 0 )
@@ -1315,7 +1338,7 @@ int yyFlexLexer::yy_get_next_buffer()
else
{
ret_val = EOB_ACT_LAST_MATCH;
- YY_G(yy_current_buffer)->yy_buffer_status =
+ YY_CURRENT_BUFFER_FAST->yy_buffer_status =
YY_BUFFER_EOF_PENDING;
}
}
@@ -1324,10 +1347,10 @@ int yyFlexLexer::yy_get_next_buffer()
ret_val = EOB_ACT_CONTINUE_SCAN;
YY_G(yy_n_chars) += number_to_move;
- YY_G(yy_current_buffer)->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
- YY_G(yy_current_buffer)->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+ YY_CURRENT_BUFFER_FAST->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+ YY_CURRENT_BUFFER_FAST->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
- YY_G(yytext_ptr) = &YY_G(yy_current_buffer)->yy_ch_buf[0];
+ YY_G(yytext_ptr) = &YY_CURRENT_BUFFER_FAST->yy_ch_buf[0];
return ret_val;
}
@@ -1389,24 +1412,24 @@ int yyFlexLexer::yy_get_next_buffer()
/* undo effects of setting up yytext */
*yy_cp = YY_G(yy_hold_char);
- if ( yy_cp < YY_G(yy_current_buffer)->yy_ch_buf + 2 )
+ if ( yy_cp < YY_CURRENT_BUFFER_FAST->yy_ch_buf + 2 )
{ /* need to shift things up to make room */
/* +2 for EOB chars. */
register int number_to_move = YY_G(yy_n_chars) + 2;
- register char *dest = &YY_G(yy_current_buffer)->yy_ch_buf[
- YY_G(yy_current_buffer)->yy_buf_size + 2];
+ register char *dest = &YY_CURRENT_BUFFER_FAST->yy_ch_buf[
+ YY_CURRENT_BUFFER_FAST->yy_buf_size + 2];
register char *source =
- &YY_G(yy_current_buffer)->yy_ch_buf[number_to_move];
+ &YY_CURRENT_BUFFER_FAST->yy_ch_buf[number_to_move];
- while ( source > YY_G(yy_current_buffer)->yy_ch_buf )
+ while ( source > YY_CURRENT_BUFFER_FAST->yy_ch_buf )
*--dest = *--source;
yy_cp += (int) (dest - source);
yy_bp += (int) (dest - source);
- YY_G(yy_current_buffer)->yy_n_chars =
- YY_G(yy_n_chars) = YY_G(yy_current_buffer)->yy_buf_size;
+ YY_CURRENT_BUFFER_FAST->yy_n_chars =
+ YY_G(yy_n_chars) = YY_CURRENT_BUFFER_FAST->yy_buf_size;
- if ( yy_cp < YY_G(yy_current_buffer)->yy_ch_buf + 2 )
+ if ( yy_cp < YY_CURRENT_BUFFER_FAST->yy_ch_buf + 2 )
YY_FATAL_ERROR( "flex scanner push-back overflow" );
}
@@ -1450,7 +1473,7 @@ int yyFlexLexer::yy_get_next_buffer()
* If this occurs *before* the EOB characters, then it's a
* valid NUL; if not, then we've hit the end of the buffer.
*/
- if ( YY_G(yy_c_buf_p) < &YY_G(yy_current_buffer)->yy_ch_buf[YY_G(yy_n_chars)] )
+ if ( YY_G(yy_c_buf_p) < &YY_CURRENT_BUFFER_FAST->yy_ch_buf[YY_G(yy_n_chars)] )
/* This was really a NUL. */
*YY_G(yy_c_buf_p) = '\0';
@@ -1518,11 +1541,13 @@ int yyFlexLexer::yy_get_next_buffer()
void yyFlexLexer::yyrestart( std::istream* input_file )
%pop
{
- if ( ! YY_G(yy_current_buffer) )
- YY_G(yy_current_buffer) =
+ if ( ! YY_CURRENT_BUFFER ){
+ yyensure_buffer_stack (YY_CALL_ONLY_ARG);
+ YY_CURRENT_BUFFER_FAST =
yy_create_buffer( yyin, YY_BUF_SIZE YY_CALL_LAST_ARG);
+ }
- yy_init_buffer( YY_G(yy_current_buffer), input_file YY_CALL_LAST_ARG);
+ yy_init_buffer( YY_CURRENT_BUFFER, input_file YY_CALL_LAST_ARG);
yy_load_buffer_state( YY_CALL_ONLY_ARG );
}
@@ -1533,18 +1558,24 @@ int yyFlexLexer::yy_get_next_buffer()
void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
%pop
{
- if ( YY_G(yy_current_buffer) == new_buffer )
+ /* TODO. We should be able to replace this entire function body
+ * with
+ * yypop_buffer_state();
+ * yypush_buffer_state(new_buffer);
+ */
+ yyensure_buffer_stack (YY_CALL_ONLY_ARG);
+ if ( YY_CURRENT_BUFFER == new_buffer )
return;
- if ( YY_G(yy_current_buffer) )
+ if ( YY_CURRENT_BUFFER )
{
/* Flush out information for old buffer. */
*YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
- YY_G(yy_current_buffer)->yy_buf_pos = YY_G(yy_c_buf_p);
- YY_G(yy_current_buffer)->yy_n_chars = YY_G(yy_n_chars);
+ YY_CURRENT_BUFFER_FAST->yy_buf_pos = YY_G(yy_c_buf_p);
+ YY_CURRENT_BUFFER_FAST->yy_n_chars = YY_G(yy_n_chars);
}
- YY_G(yy_current_buffer) = new_buffer;
+ YY_CURRENT_BUFFER_FAST = new_buffer;
yy_load_buffer_state( YY_CALL_ONLY_ARG );
/* We don't actually know whether we did this switch during
@@ -1563,9 +1594,9 @@ int yyFlexLexer::yy_get_next_buffer()
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;
- yyin = YY_G(yy_current_buffer)->yy_input_file;
+ YY_G(yy_n_chars) = YY_CURRENT_BUFFER_FAST->yy_n_chars;
+ YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_CURRENT_BUFFER_FAST->yy_buf_pos;
+ yyin = YY_CURRENT_BUFFER_FAST->yy_input_file;
YY_G(yy_hold_char) = *YY_G(yy_c_buf_p);
}
@@ -1608,8 +1639,8 @@ int yyFlexLexer::yy_get_next_buffer()
if ( ! b )
return;
- if ( b == YY_G(yy_current_buffer) )
- YY_G(yy_current_buffer) = (YY_BUFFER_STATE) 0;
+ if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+ YY_CURRENT_BUFFER_FAST = (YY_BUFFER_STATE) 0;
if ( b->yy_is_our_buffer )
yyfree( (void *) b->yy_ch_buf YY_CALL_LAST_ARG );
@@ -1688,10 +1719,111 @@ void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
b->yy_at_bol = 1;
b->yy_buffer_status = YY_BUFFER_NEW;
- if ( b == YY_G(yy_current_buffer) )
+ if ( b == YY_CURRENT_BUFFER )
yy_load_buffer_state( YY_CALL_ONLY_ARG );
}
+%push
+%c-only
+/** Pushes the new state onto the stack. The new state becomes
+ * the current state. This function will allocate the stack
+ * if necessary.
+ */
+void yypush_buffer_state YYFARGS1(YY_BUFFER_STATE,new_buffer)
+{
+ if (new_buffer == NULL)
+ return;
+
+ yyensure_buffer_stack(YY_CALL_ONLY_ARG);
+
+ /* This block is copied from yy_switch_to_buffer. */
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
+ YY_CURRENT_BUFFER_FAST->yy_buf_pos = YY_G(yy_c_buf_p);
+ YY_CURRENT_BUFFER_FAST->yy_n_chars = YY_G(yy_n_chars);
+ }
+
+ /* Only push if top exists. Otherwise, replace top. */
+ if (YY_CURRENT_BUFFER)
+ YY_G(yy_buffer_stack_top)++;
+ YY_CURRENT_BUFFER_FAST = new_buffer;
+
+ /* copied from yy_switch_to_buffer. */
+ yy_load_buffer_state( YY_CALL_ONLY_ARG );
+ YY_G(yy_did_buffer_switch_on_eof) = 1;
+}
+%pop
+
+%push
+%c-only
+/** Removes and DELETES the top of the stack, if present.
+ * The next element becomes the new top, if present.
+ */
+void yypop_buffer_state YYFARGS0(void)
+{
+ if (!YY_CURRENT_BUFFER)
+ return;
+
+ yy_delete_buffer(YY_CURRENT_BUFFER YY_CALL_LAST_ARG);
+ YY_CURRENT_BUFFER_FAST = NULL;
+ if (YY_G(yy_buffer_stack_top) > 0)
+ --YY_G(yy_buffer_stack_top);
+
+ if (YY_CURRENT_BUFFER) {
+ yy_load_buffer_state( YY_CALL_ONLY_ARG );
+ YY_G(yy_did_buffer_switch_on_eof) = 1;
+ }
+}
+%pop
+
+%push
+%c-only
+/** Allocates the stack if it does not exist.
+ * Guarantees space for at least one push.
+ */
+void yyensure_buffer_stack YYFARGS0(void)
+{
+ int num_to_alloc;
+
+ if (!YY_G(yy_buffer_stack)) {
+
+ /* First allocation is just for 2 elements, since we don't know if this
+ * scanner will even need a stack. We use 2 instead of 1 to avoid an
+ * immediate realloc on the next call.
+ */
+ num_to_alloc = 1;
+ YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
+ (num_to_alloc * sizeof(struct yy_buffer_state*)
+ YY_CALL_LAST_ARG);
+
+ memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+
+ YY_G(yy_buffer_stack_max) = num_to_alloc;
+ YY_G(yy_buffer_stack_top) = 0;
+ return;
+ }
+
+ if (YY_G(yy_buffer_stack_top) >= (YY_G(yy_buffer_stack_max)) - 1){
+
+ /* Increase the buffer to prepare for a possible push. */
+ int grow_size = 8 /* arbitrary grow size */;
+
+ num_to_alloc = YY_G(yy_buffer_stack_max) + grow_size;
+ YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
+ (YY_G(yy_buffer_stack),
+ num_to_alloc * sizeof(struct yy_buffer_state*)
+ YY_CALL_LAST_ARG);
+
+ /* zero only the new slots.*/
+ memset(YY_G(yy_buffer_stack) + YY_G(yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
+ YY_G(yy_buffer_stack_max) = num_to_alloc;
+ }
+}
+%pop
+
+
#ifndef YY_NO_SCAN_BUFFER
%push
@@ -2020,7 +2152,9 @@ static int yy_init_globals YYFARGS0(void)
#ifdef YY_USE_LINENO
yylineno = 1;
#endif
- YY_G(yy_current_buffer) = 0;
+ YY_G(yy_buffer_stack) = 0;
+ YY_G(yy_buffer_stack_top) = 0;
+ YY_G(yy_buffer_stack_max) = 0;
YY_G(yy_c_buf_p) = (char *) 0;
YY_G(yy_init) = 1;
YY_G(yy_start) = 0;
@@ -2093,16 +2227,23 @@ int yylex_init( ptr_yy_globals )
/* yylex_destroy is for both reentrant and non-reentrant scanners. */
int yylex_destroy YYFARGS0(void)
{
- /* Destroy the current (main) buffer. */
- yy_delete_buffer( YY_G(yy_current_buffer) YY_CALL_LAST_ARG );
- YY_G(yy_current_buffer) = NULL;
+ int i;
+
+ /* Pop the buffer stack, destroying each element. */
+ while(YY_CURRENT_BUFFER){
+ yy_delete_buffer( YY_CURRENT_BUFFER YY_CALL_LAST_ARG );
+ YY_CURRENT_BUFFER_FAST = NULL;
+ yypop_buffer_state(YY_CALL_ONLY_ARG);
+ }
+
+ /* Destroy the stack itself. */
+ yyfree(YY_G(yy_buffer_stack) YY_CALL_LAST_ARG);
+ YY_G(yy_buffer_stack) = NULL;
#if defined(YY_STACK_USED) || defined(YY_REENTRANT)
/* Destroy the start condition stack. */
- if (YY_G(yy_start_stack) ){
yyfree( YY_G(yy_start_stack) YY_CALL_LAST_ARG );
YY_G(yy_start_stack) = NULL;
- }
#endif
#ifdef YY_USES_REJECT