]> granicus.if.org Git - flex/commitdiff
8-bit char support.
authorVern Paxson <vern@ee.lbl.gov>
Tue, 16 Jan 1990 10:29:10 +0000 (10:29 +0000)
committerVern Paxson <vern@ee.lbl.gov>
Tue, 16 Jan 1990 10:29:10 +0000 (10:29 +0000)
2.2 Release.

yylex.c

diff --git a/yylex.c b/yylex.c
index 2e1ceadb81b084e97c1b6ae908bc59fb60bb13ce..ea12936a41002d58be0a32880583f8b620c9ae7a 100644 (file)
--- a/yylex.c
+++ b/yylex.c
@@ -35,6 +35,7 @@ static char rcsid[] =
 
 #endif
 
+#include <ctype.h>
 #include "flexdef.h"
 #include "parse.h"
 
@@ -175,43 +176,11 @@ int yylex()
                        fprintf( stderr, "\\%c", yylval );
                        break;
 
-                   case 1:
-                   case 2:
-                   case 3:
-                   case 4:
-                   case 5:
-                   case 6:
-                   case 7:
-                   case 8:
-                   case 9:
-                   case 10:
-                   case 11:
-                   case 12:
-                   case 13:
-                   case 14:
-                   case 15:
-                   case 16:
-                   case 17:
-                   case 18:
-                   case 19:
-                   case 20:
-                   case 21:
-                   case 22:
-                   case 23:
-                   case 24:
-                   case 25:
-                   case 26:
-                   case 27:
-                   case 28:
-                   case 29:
-                   case 30:
-                   case 31:
-                   case 127:
-                       fprintf( stderr, "\\%.3o", yylval );
-                       break;
-
                    default:
-                       (void) putc( yylval, stderr );
+                       if ( ! isascii( yylval ) || ! isprint( yylval ) )
+                           fprintf( stderr, "\\%.3o", yylval );
+                       else
+                           (void) putc( yylval, stderr );
                        break;
                    }