Flex 2.5.4
authormillert <millert@openbsd.org>
Tue, 10 Dec 1996 22:21:59 +0000 (22:21 +0000)
committermillert <millert@openbsd.org>
Tue, 10 Dec 1996 22:21:59 +0000 (22:21 +0000)
usr.bin/lex/VERSION
usr.bin/lex/flex.skl
usr.bin/lex/initscan.c
usr.bin/lex/libyywrap.c
usr.bin/lex/version.h

index cb2a4d1..c1e55be 100644 (file)
@@ -1,2 +1,2 @@
-A complete flex-2.5.3 distribution is available from ftp.ee.lbl.gov
+A complete flex-2.5.4 distribution is available from ftp.ee.lbl.gov
 or prep.ai.mit.edu
index 46d4b84..f650b16 100644 (file)
@@ -1,9 +1,9 @@
-/*     $OpenBSD: flex.skl,v 1.3 1996/07/13 22:21:58 millert Exp $      */
+/*     $OpenBSD: flex.skl,v 1.4 1996/12/10 22:22:00 millert Exp $      */
 
 /* A lexical scanner generated by flex */
 
 /* Scanner skeleton version:
- * $Header: /home/cvs/src/usr.bin/lex/flex.skl,v 1.3 1996/07/13 22:21:58 millert Exp $
+ * $Header: /home/cvs/src/usr.bin/lex/flex.skl,v 1.4 1996/12/10 22:22:00 millert Exp $
  */
 
 #define FLEX_SCANNER
@@ -252,7 +252,7 @@ void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
 
 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
-YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str ));
+YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
 %*
 
@@ -785,7 +785,7 @@ int yyFlexLexer::yy_get_next_buffer()
                /* don't do the read, it's not guaranteed to return an EOF,
                 * just force an EOF
                 */
-               yy_n_chars = 0;
+               yy_current_buffer->yy_n_chars = yy_n_chars = 0;
 
        else
                {
@@ -840,6 +840,8 @@ int yyFlexLexer::yy_get_next_buffer()
                /* Read in more data. */
                YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
                        yy_n_chars, num_to_read );
+
+               yy_current_buffer->yy_n_chars = yy_n_chars;
                }
 
        if ( yy_n_chars == 0 )
@@ -949,7 +951,8 @@ void yyFlexLexer::yyunput( int c, register char* yy_bp )
 
                yy_cp += (int) (dest - source);
                yy_bp += (int) (dest - source);
-               yy_n_chars = yy_current_buffer->yy_buf_size;
+               yy_current_buffer->yy_n_chars =
+                       yy_n_chars = yy_current_buffer->yy_buf_size;
 
                if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
                        YY_FATAL_ERROR( "flex scanner push-back overflow" );
@@ -999,13 +1002,26 @@ int yyFlexLexer::yyinput()
 
                        switch ( yy_get_next_buffer() )
                                {
+                               case EOB_ACT_LAST_MATCH:
+                                       /* This happens because yy_g_n_b()
+                                        * sees that we've accumulated a
+                                        * token and flags that we need to
+                                        * try matching the token before
+                                        * proceeding.  But for input(),
+                                        * there's no matching to consider.
+                                        * So convert the EOB_ACT_LAST_MATCH
+                                        * to EOB_ACT_END_OF_FILE.
+                                        */
+
+                                       /* Reset buffer status. */
+                                       yyrestart( yyin );
+
+                                       /* fall through */
+
                                case EOB_ACT_END_OF_FILE:
                                        {
                                        if ( yywrap() )
-                                               {
-                                               yy_c_buf_p = yytext_ptr + offset;
                                                return EOF;
-                                               }
 
                                        if ( ! yy_did_buffer_switch_on_eof )
                                                YY_NEW_FILE;
@@ -1019,15 +1035,6 @@ int yyFlexLexer::yyinput()
                                case EOB_ACT_CONTINUE_SCAN:
                                        yy_c_buf_p = yytext_ptr + offset;
                                        break;
-
-                               case EOB_ACT_LAST_MATCH:
-#ifdef __cplusplus
-                                       YY_FATAL_ERROR(
-                                       "unexpected last match in yyinput()" );
-#else
-                                       YY_FATAL_ERROR(
-                                       "unexpected last match in input()" );
-#endif
                                }
                        }
                }
@@ -1225,6 +1232,9 @@ YY_BUFFER_STATE b;
 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
 %*
        {
+       if ( ! b )
+               return;
+
        b->yy_n_chars = 0;
 
        /* We always need two end-of-buffer characters.  The first causes
@@ -1288,17 +1298,17 @@ yy_size_t size;
 #ifndef YY_NO_SCAN_STRING
 %-
 #ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_string( yyconst char *str )
+YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
 #else
-YY_BUFFER_STATE yy_scan_string( str )
-yyconst char *str;
+YY_BUFFER_STATE yy_scan_string( yy_str )
+yyconst char *yy_str;
 #endif
        {
        int len;
-       for ( len = 0; str[len]; ++len )
+       for ( len = 0; yy_str[len]; ++len )
                ;
 
-       return yy_scan_bytes( str, len );
+       return yy_scan_bytes( yy_str, len );
        }
 %*
 #endif
index b402dd2..c9c1f3b 100644 (file)
@@ -1,10 +1,10 @@
-/*     $OpenBSD: initscan.c,v 1.3 1996/07/13 22:22:03 millert Exp $    */
+/*     $OpenBSD: initscan.c,v 1.4 1996/12/10 22:22:01 millert Exp $    */
 
 #line 2 "scan.c"
 /* A lexical scanner generated by flex */
 
 /* Scanner skeleton version:
- * $Header: /home/cvs/src/usr.bin/lex/Attic/initscan.c,v 1.3 1996/07/13 22:22:03 millert Exp $
+ * $Header: /home/cvs/src/usr.bin/lex/Attic/initscan.c,v 1.4 1996/12/10 22:22:01 millert Exp $
  */
 
 #define FLEX_SCANNER
@@ -239,7 +239,7 @@ void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
 
 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
-YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str ));
+YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
 
 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
@@ -1272,7 +1272,7 @@ char *yytext;
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-/* $Header: /home/cvs/src/usr.bin/lex/Attic/initscan.c,v 1.3 1996/07/13 22:22:03 millert Exp $ */
+/* $Header: /home/cvs/src/usr.bin/lex/Attic/initscan.c,v 1.4 1996/12/10 22:22:01 millert Exp $ */
 
 #include "flexdef.h"
 #include "parse.h"
@@ -2931,7 +2931,7 @@ static int yy_get_next_buffer()
                /* don't do the read, it's not guaranteed to return an EOF,
                 * just force an EOF
                 */
-               yy_n_chars = 0;
+               yy_current_buffer->yy_n_chars = yy_n_chars = 0;
 
        else
                {
@@ -2986,6 +2986,8 @@ static int yy_get_next_buffer()
                /* Read in more data. */
                YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
                        yy_n_chars, num_to_read );
+
+               yy_current_buffer->yy_n_chars = yy_n_chars;
                }
 
        if ( yy_n_chars == 0 )
@@ -3111,7 +3113,8 @@ register char *yy_bp;
 
                yy_cp += (int) (dest - source);
                yy_bp += (int) (dest - source);
-               yy_n_chars = yy_current_buffer->yy_buf_size;
+               yy_current_buffer->yy_n_chars =
+                       yy_n_chars = yy_current_buffer->yy_buf_size;
 
                if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
                        YY_FATAL_ERROR( "flex scanner push-back overflow" );
@@ -3154,13 +3157,26 @@ static int input()
 
                        switch ( yy_get_next_buffer() )
                                {
+                               case EOB_ACT_LAST_MATCH:
+                                       /* This happens because yy_g_n_b()
+                                        * sees that we've accumulated a
+                                        * token and flags that we need to
+                                        * try matching the token before
+                                        * proceeding.  But for input(),
+                                        * there's no matching to consider.
+                                        * So convert the EOB_ACT_LAST_MATCH
+                                        * to EOB_ACT_END_OF_FILE.
+                                        */
+
+                                       /* Reset buffer status. */
+                                       yyrestart( yyin );
+
+                                       /* fall through */
+
                                case EOB_ACT_END_OF_FILE:
                                        {
                                        if ( yywrap() )
-                                               {
-                                               yy_c_buf_p = yytext_ptr + offset;
                                                return EOF;
-                                               }
 
                                        if ( ! yy_did_buffer_switch_on_eof )
                                                YY_NEW_FILE;
@@ -3174,15 +3190,6 @@ static int input()
                                case EOB_ACT_CONTINUE_SCAN:
                                        yy_c_buf_p = yytext_ptr + offset;
                                        break;
-
-                               case EOB_ACT_LAST_MATCH:
-#ifdef __cplusplus
-                                       YY_FATAL_ERROR(
-                                       "unexpected last match in yyinput()" );
-#else
-                                       YY_FATAL_ERROR(
-                                       "unexpected last match in input()" );
-#endif
                                }
                        }
                }
@@ -3347,6 +3354,9 @@ YY_BUFFER_STATE b;
 #endif
 
        {
+       if ( ! b )
+               return;
+
        b->yy_n_chars = 0;
 
        /* We always need two end-of-buffer characters.  The first causes
@@ -3406,17 +3416,17 @@ yy_size_t size;
 
 #ifndef YY_NO_SCAN_STRING
 #ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_string( yyconst char *str )
+YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
 #else
-YY_BUFFER_STATE yy_scan_string( str )
-yyconst char *str;
+YY_BUFFER_STATE yy_scan_string( yy_str )
+yyconst char *yy_str;
 #endif
        {
        int len;
-       for ( len = 0; str[len]; ++len )
+       for ( len = 0; yy_str[len]; ++len )
                ;
 
-       return yy_scan_bytes( str, len );
+       return yy_scan_bytes( yy_str, len );
        }
 #endif
 
index a6be065..89a1c86 100644 (file)
@@ -1,14 +1,15 @@
-/*     $OpenBSD: libyywrap.c,v 1.3 1996/07/13 22:22:06 millert Exp $   */
+/*     $OpenBSD: libyywrap.c,v 1.4 1996/12/10 22:22:03 millert Exp $   */
 
 /* libyywrap - flex run-time support library "yywrap" function */
 
-/* $Header: /home/cvs/src/usr.bin/lex/libyywrap.c,v 1.3 1996/07/13 22:22:06 millert Exp $ */
+/* $Header: /home/cvs/src/usr.bin/lex/libyywrap.c,v 1.4 1996/12/10 22:22:03 millert Exp $ */
 
 #include <sys/cdefs.h>
 
 int yywrap __P((void));
 
-int yywrap()
+int
+yywrap()
        {
        return 1;
        }
index b6a64e2..abe28b1 100644 (file)
@@ -1,3 +1,3 @@
-/*     $OpenBSD: version.h,v 1.3 1996/07/13 22:22:14 millert Exp $     */
+/*     $OpenBSD: version.h,v 1.4 1996/12/10 22:22:03 millert Exp $     */
 
-#define FLEX_VERSION "2.5.3"
+#define FLEX_VERSION "2.5.4"