summaryrefslogtreecommitdiff
path: root/flex.skl
diff options
context:
space:
mode:
authorVern Paxson <vern@ee.lbl.gov>1993-12-04 22:02:54 +0000
committerVern Paxson <vern@ee.lbl.gov>1993-12-04 22:02:54 +0000
commitb0c3575e2b004975e7bff9689774d692006ef598 (patch)
treed7f79696d52d9ffb3fefaa8052d221e4adbeefaa /flex.skl
parentf04862cc1f038e69b6a374eee3d5f8094d60926c (diff)
Fixed bug in pointing yyin at a new file and resuming scanning
Diffstat (limited to 'flex.skl')
-rw-r--r--flex.skl14
1 files changed, 14 insertions, 0 deletions
diff --git a/flex.skl b/flex.skl
index 85c5c0d..b30016d 100644
--- a/flex.skl
+++ b/flex.skl
@@ -402,6 +402,20 @@ do_action: /* This label is used only to access EOF actions. */
/* Undo the effects of YY_DO_BEFORE_ACTION. */
*yy_cp = yy_hold_char;
+ if ( yy_current_buffer->yy_input_file != yyin )
+ {
+ /* This can happen if we scan a file, yywrap() returns
+ * 1, and then later the user points yyin at a new
+ * file to resume scanning. We have to assure
+ * 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 file.
+ */
+ yy_current_buffer->yy_input_file = yyin;
+ yy_n_chars = yy_current_buffer->yy_n_chars;
+ }
+
/* Note that here we test for yy_c_buf_p "<=" to the position
* of the first EOB in the buffer, since yy_c_buf_p will
* already have been incremented past the NUL character