diff options
author | Vern Paxson <vern@ee.lbl.gov> | 1993-12-11 10:56:41 +0000 |
---|---|---|
committer | Vern Paxson <vern@ee.lbl.gov> | 1993-12-11 10:56:41 +0000 |
commit | ffeaa226cbad2ee5c88f635ddcb73459041400f5 (patch) | |
tree | 7a3b50896bfd78b5031ff965b08a089fce6ff66b /flex.skl | |
parent | dd1c92afa2e6fc13fbb6d9b4f9172f607d44c0d7 (diff) |
Added yy_fill_buffer
Diffstat (limited to 'flex.skl')
-rw-r--r-- | flex.skl | 32 |
1 files changed, 29 insertions, 3 deletions
@@ -174,7 +174,12 @@ struct yy_buffer_state * instead of fread(), to make sure we stop fetching input after * each newline. */ - int is_interactive; + int yy_is_interactive; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; /* Whether we've seen an EOF on this buffer. */ int yy_eof_status; @@ -591,6 +596,25 @@ int yyFlexLexer::yy_get_next_buffer() YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a singled characater, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + /* Try to read more data. */ /* First move last chars to start of buffer. */ @@ -1004,11 +1028,13 @@ void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file ) b->yy_buf_pos = &b->yy_ch_buf[1]; %- - b->is_interactive = file ? isatty( fileno(file) ) : 0; + b->yy_is_interactive = file ? isatty( fileno(file) ) : 0; %+ - b->is_interactive = 0; + b->yy_is_interactive = 0; %* + b->yy_fill_buffer = 1; + b->yy_eof_status = EOF_NOT_SEEN; } |