1 diff -urN flex-2.5.4.orig/initscan.c flex-2.5.4/initscan.c
2 --- flex-2.5.4.orig/initscan.c Sat Sep 7 11:02:56 2002
3 +++ flex-2.5.4/initscan.c Sat Sep 7 11:05:50 2002
10 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
12 @@ -1291,7 +1292,15 @@
16 + if(strlen(yytext) < MAXLINE) \
18 strcpy( nmstr, yytext ); \
22 + fputs("Input line too long!\n", stderr); \
24 + } /* end of else */ \
27 #define PUT_BACK_STRING(str, start) \
35 /* Macros after this point can all be overridden by user definitions in
37 @@ -1428,9 +1437,20 @@
38 YY_FATAL_ERROR( "input in flex scanner failed" ); \
41 - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
42 - && ferror( yyin ) ) \
43 - YY_FATAL_ERROR( "input in flex scanner failed" );
47 + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
49 + if( errno != EINTR) \
51 + YY_FATAL_ERROR( "input in flex scanner failed" ); \
60 /* No semi-colon after return; correct usage is to write "yyterminate();" -
62 register char *yy_cp, *yy_bp;
68 static int bracelevel, didadef, indented_code;
69 static int doing_rule_action = false;
71 Char nmdef[MAXLINE], myesc();
79 @@ -1580,32 +1600,32 @@
85 indented_code = true; BEGIN(CODEBLOCK);
91 ACTION_ECHO; yy_push_state( COMMENT );
97 yy_push_state( LINEDIR );
117 line_directive_out( (FILE *) 0, 1 );
118 @@ -1615,12 +1635,12 @@
133 @@ -1632,95 +1652,103 @@
139 yytext_is_array = false; ++linenum;
145 yytext_is_array = true; ++linenum;
151 BEGIN(OPTION); return OPTION_OP;
157 ++linenum; /* ignore */
163 ++linenum; /* ignore */
169 synerr( _( "unrecognized '%' directive" ) );
176 + if(strlen(yytext) < MAXLINE)
178 strcpy( nmstr, yytext );
182 + fputs("Input line too long!\n", stderr);
184 + } /* end of else */
199 ++linenum; /* allows blank lines in section 1 */
205 ACTION_ECHO; ++linenum; /* maybe end of comment line */
213 ACTION_ECHO; yy_pop_state();
231 ++linenum; ACTION_ECHO;
245 linenum = myctoi( yytext );
252 flex_free( (void *) infilename );
253 infilename = copy_string( yytext + 1 );
254 @@ -1729,24 +1757,24 @@
260 /* ignore spurious characters */
268 ++linenum; BEGIN(INITIAL);
283 @@ -1758,14 +1786,24 @@
289 /* separates name and definition */
296 + if(strlen(yytext) < MAXLINE)
298 strcpy( (char *) nmdef, yytext );
302 + fputs("Input line too long!\n", stderr);
304 + } /* end of else */
308 /* Skip trailing whitespace. */
309 for ( i = strlen( (char *) nmdef ) - 1;
310 @@ -1781,7 +1819,7 @@
318 synerr( _( "incomplete name definition" ) );
319 @@ -1793,94 +1831,94 @@
325 ++linenum; BEGIN(INITIAL);
343 option_sense = ! option_sense;
349 csize = option_sense ? 128 : 256;
355 csize = option_sense ? 256 : 128;
361 long_align = option_sense;
368 action_define( "YY_ALWAYS_INTERACTIVE", option_sense );
375 yytext_is_array = option_sense;
381 backing_up_report = option_sense;
387 interactive = ! option_sense;
393 C_plus_plus = option_sense;
399 caseins = ! option_sense;
405 caseins = option_sense;
411 ddebug = option_sense;
417 spprdflt = ! option_sense;
423 useecs = option_sense;
430 useecs = usemecs = false;
431 use_read = fullspd = true;
432 @@ -1888,7 +1926,7 @@
439 useecs = usemecs = false;
440 use_read = fulltbl = true;
441 @@ -1896,22 +1934,22 @@
447 ACTION_IFDEF("YY_NO_INPUT", ! option_sense);
453 interactive = option_sense;
459 lex_compat = option_sense;
466 action_define( "YY_MAIN", option_sense );
467 do_yywrap = ! option_sense;
468 @@ -1919,138 +1957,146 @@
474 usemecs = option_sense;
481 action_define( "YY_NEVER_INTERACTIVE", option_sense );
488 performance_report += option_sense ? 1 : -1;
494 yytext_is_array = ! option_sense;
500 use_read = option_sense;
506 reject_really_used = option_sense;
512 action_define( "YY_STACK_USED", option_sense );
518 do_stdinit = option_sense;
524 use_stdout = option_sense;
530 ACTION_IFDEF("YY_NO_UNPUT", ! option_sense);
536 printstats = option_sense;
542 nowarn = ! option_sense;
548 do_yylineno = option_sense;
554 yymore_really_used = option_sense;
560 do_yywrap = option_sense;
566 ACTION_IFDEF("YY_NO_PUSH_STATE", ! option_sense);
572 ACTION_IFDEF("YY_NO_POP_STATE", ! option_sense);
578 ACTION_IFDEF("YY_NO_TOP_STATE", ! option_sense);
584 ACTION_IFDEF("YY_NO_SCAN_BUFFER", ! option_sense);
590 ACTION_IFDEF("YY_NO_SCAN_BYTES", ! option_sense);
596 ACTION_IFDEF("YY_NO_SCAN_STRING", ! option_sense);
621 + if(strlen(yytext + 1 ) < MAXLINE)
623 strcpy( nmstr, yytext + 1 );
627 + fputs("Input line too long!\n", stderr);
629 + } /* end of else */
630 nmstr[strlen( nmstr ) - 1] = '\0';
639 format_synerr( _( "unrecognized %%option: %s" ),
641 @@ -2060,28 +2106,28 @@
647 ++linenum; BEGIN(INITIAL);
654 ++bracelevel; yyless( 2 ); /* eat only %{ */
660 --bracelevel; yyless( 2 ); /* eat only %} */
666 ACTION_ECHO; /* indented code in prolog */
672 { /* non-indented code */
673 if ( bracelevel <= 0 )
674 { /* not in %{ ... %} */
675 @@ -2096,16 +2142,16 @@
687 ++linenum; ACTION_ECHO;
689 case YY_STATE_EOF(SECT2PROLOG):
695 @@ -2116,12 +2162,12 @@
701 ++linenum; /* allow blank lines in section 2 */
708 indented_code = false;
709 doing_codeblock = true;
710 @@ -2131,17 +2177,17 @@
716 BEGIN(SC); return '<';
728 BEGIN(QUOTE); return '"';
731 @@ -2149,7 +2195,7 @@
732 yy_c_buf_p = yy_cp = yy_bp + 1;
733 YY_DO_BEFORE_ACTION; /* set up yytext again */
737 BEGIN(NUM); return '{';
740 @@ -2157,12 +2203,12 @@
741 yy_c_buf_p = yy_cp = yy_bp + 1;
742 YY_DO_BEFORE_ACTION; /* set up yytext again */
754 BEGIN(PERCENT_BRACE_ACTION);
755 @@ -2177,12 +2223,12 @@
761 continued_action = true; ++linenum; return '\n';
768 yyless( yyleng - 2 ); /* put back '/', '*' */
770 @@ -2192,12 +2238,12 @@
776 /* allow indented rules */
783 /* This rule is separate from the one below because
784 * otherwise we get variable trailing context, so
785 @@ -2217,7 +2263,7 @@
793 continued_action = false;
794 @@ -2233,15 +2279,15 @@
813 @@ -2250,11 +2296,19 @@
822 + if(strlen(yytext ) < MAXLINE)
824 strcpy( nmstr, yytext );
828 + fputs("Input line too long!\n", stderr);
832 /* Check to see if we've already encountered this
834 @@ -2287,12 +2341,20 @@
841 register Char *nmdefptr;
844 + if(strlen(yytext + 1 ) < MAXLINE)
846 strcpy( nmstr, yytext + 1 );
850 + fputs("Input line too long!\n", stderr);
852 + } /* end of else */
853 nmstr[yyleng - 2] = '\0'; /* chop trailing brace */
855 if ( (nmdefptr = ndlookup( nmstr )) == 0 )
856 @@ -2324,24 +2386,24 @@
862 return (unsigned char) yytext[0];
876 return (unsigned char) yytext[0];
882 BEGIN(SECT2); return '>';
885 @@ -2349,17 +2411,17 @@
886 yy_c_buf_p = yy_cp = yy_bp + 1;
887 YY_DO_BEFORE_ACTION; /* set up yytext again */
891 BEGIN(CARETISBOL); return '>';
904 format_synerr( _( "bad <start condition>: %s" ),
906 @@ -2368,23 +2430,23 @@
912 BEGIN(SECT2); return '^';
925 BEGIN(SECT2); return '"';
932 synerr( _( "missing quote" ) );
934 @@ -2399,7 +2461,7 @@
935 yy_c_buf_p = yy_cp = yy_bp + 1;
936 YY_DO_BEFORE_ACTION; /* set up yytext again */
940 BEGIN(CCL); return '^';
943 @@ -2407,12 +2469,12 @@
944 yy_c_buf_p = yy_cp = yy_bp + 1;
945 YY_DO_BEFORE_ACTION; /* set up yytext again */
955 BEGIN(CCL); RETURNCHAR;
958 @@ -2422,22 +2484,22 @@
959 yy_c_buf_p = yy_cp = yy_bp + 1;
960 YY_DO_BEFORE_ACTION; /* set up yytext again */
976 BEGIN(SECT2); return ']';
983 synerr( _( "bad character class" ) );
985 @@ -2448,67 +2510,67 @@
991 BEGIN(CCL); return CCE_ALNUM;
997 BEGIN(CCL); return CCE_ALPHA;
1003 BEGIN(CCL); return CCE_BLANK;
1009 BEGIN(CCL); return CCE_CNTRL;
1015 BEGIN(CCL); return CCE_DIGIT;
1021 BEGIN(CCL); return CCE_GRAPH;
1027 BEGIN(CCL); return CCE_LOWER;
1033 BEGIN(CCL); return CCE_PRINT;
1039 BEGIN(CCL); return CCE_PUNCT;
1045 BEGIN(CCL); return CCE_SPACE;
1051 BEGIN(CCL); return CCE_UPPER;
1057 BEGIN(CCL); return CCE_XDIGIT;
1065 _( "bad character class expression: %s" ),
1066 @@ -2520,7 +2582,7 @@
1073 yylval = myctoi( yytext );
1075 @@ -2528,17 +2590,17 @@
1087 BEGIN(SECT2); return '}';
1094 synerr( _( "bad character inside {}'s" ) );
1096 @@ -2547,7 +2609,7 @@
1103 synerr( _( "missing }" ) );
1105 @@ -2559,18 +2621,18 @@
1117 ACTION_ECHO; yy_push_state( COMMENT );
1126 CHECK_REJECT(yytext);
1127 @@ -2578,7 +2640,7 @@
1135 CHECK_YYMORE(yytext);
1136 @@ -2587,12 +2649,12 @@
1151 @@ -2612,37 +2674,37 @@
1157 ACTION_ECHO; ++bracelevel;
1163 ACTION_ECHO; --bracelevel;
1181 ACTION_ECHO; /* character constant */
1187 ACTION_ECHO; BEGIN(ACTION_STRING);
1196 @@ -2658,41 +2720,41 @@
1222 ++linenum; ACTION_ECHO;
1228 ACTION_ECHO; BEGIN(ACTION);
1237 case YY_STATE_EOF(COMMENT):
1238 case YY_STATE_EOF(ACTION):
1239 case YY_STATE_EOF(ACTION_STRING):
1243 synerr( _( "EOF encountered inside an action" ) );
1245 @@ -2700,7 +2762,7 @@
1252 yylval = myesc( (Char *) yytext );
1254 @@ -2713,25 +2775,25 @@
1262 case YY_STATE_EOF(SECT3):
1265 sectnum = 0; yyterminate();
1272 format_synerr( _( "bad character: %s" ), yytext );
1278 YY_FATAL_ERROR( "flex scanner jammed" );
1280 -#line 2736 "scan.c"
1281 +#line 2799 "scan.c"
1282 case YY_STATE_EOF(INITIAL):
1283 case YY_STATE_EOF(SECT2):
1284 case YY_STATE_EOF(CODEBLOCK):
1285 @@ -3626,7 +3688,7 @@
1294 diff -urN flex-2.5.4.orig/scan.l flex-2.5.4/scan.l
1295 --- flex-2.5.4.orig/scan.l Sun Jul 27 04:44:13 1997
1296 +++ flex-2.5.4/scan.l Sat Sep 7 11:04:34 2002
1300 #define RETURNNAME \
1301 + if(strlen(yytext) < MAXLINE) \
1303 strcpy( nmstr, yytext ); \
1307 + fputs("Input line too long!\n", stderr); \
1309 + } /* end of else */ \
1312 #define PUT_BACK_STRING(str, start) \
1313 @@ -136,7 +144,15 @@
1314 ^"%"[^sxaceknopr{}].* synerr( _( "unrecognized '%' directive" ) );
1317 + if(strlen(yytext) < MAXLINE)
1319 strcpy( nmstr, yytext );
1323 + fputs("Input line too long!\n", stderr);
1325 + } /* end of else */
1329 @@ -184,7 +200,17 @@
1330 {WS} /* separates name and definition */
1333 + if(strlen(yytext) < MAXLINE)
1335 strcpy( (char *) nmdef, yytext );
1339 + fputs("Input line too long!\n", stderr);
1341 + } /* end of else */
1345 /* Skip trailing whitespace. */
1346 for ( i = strlen( (char *) nmdef ) - 1;
1347 @@ -277,7 +303,15 @@
1348 yyclass return OPT_YYCLASS;
1351 + if(strlen(yytext + 1 ) < MAXLINE)
1353 strcpy( nmstr, yytext + 1 );
1357 + fputs("Input line too long!\n", stderr);
1359 + } /* end of else */
1360 nmstr[strlen( nmstr ) - 1] = '\0';
1363 @@ -401,7 +435,15 @@
1364 "["({FIRST_CCL_CHAR}|{CCL_EXPR})({CCL_CHAR}|{CCL_EXPR})* {
1367 + if(strlen(yytext ) < MAXLINE)
1369 strcpy( nmstr, yytext );
1373 + fputs("Input line too long!\n", stderr);
1377 /* Check to see if we've already encountered this
1379 @@ -436,7 +478,15 @@
1380 register Char *nmdefptr;
1383 + if(strlen(yytext + 1 ) < MAXLINE)
1385 strcpy( nmstr, yytext + 1 );
1389 + fputs("Input line too long!\n", stderr);
1391 + } /* end of else */
1392 nmstr[yyleng - 2] = '\0'; /* chop trailing brace */
1394 if ( (nmdefptr = ndlookup( nmstr )) == 0 )