diff --git a/usr.bin/lex/initscan.c b/usr.bin/lex/initscan.c index f3a06e1b000c..ae0e2d4d438d 100644 --- a/usr.bin/lex/initscan.c +++ b/usr.bin/lex/initscan.c @@ -2,7 +2,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $NetBSD: initscan.c,v 1.13 1999/01/18 22:18:17 christos Exp $ + * $NetBSD: initscan.c,v 1.14 2001/10/04 17:12:27 tv Exp $ */ #define FLEX_SCANNER @@ -238,11 +238,7 @@ void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); 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 )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, yy_size_t len )); #define yy_new_buffer yy_create_buffer @@ -268,6 +264,12 @@ typedef int yy_state_type; extern char *yytext; #define yytext_ptr yytext +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +#ifndef YY_USES_REJECT +static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +#endif +static void yy_flex_free YY_PROTO(( void * )); + static yy_state_type yy_get_previous_state YY_PROTO(( void )); static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); static int yy_get_next_buffer YY_PROTO(( void )); @@ -1270,7 +1272,7 @@ char *yytext; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -/* $Header: /cvsroot/src/usr.bin/lex/Attic/initscan.c,v 1.13 1999/01/18 22:18:17 christos Exp $ */ +/* $NetBSD: initscan.c,v 1.14 2001/10/04 17:12:27 tv Exp $ */ #include "flexdef.h" #include "parse.h" @@ -1329,7 +1331,7 @@ char *yytext; #define OPTION 17 #define LINEDIR 18 -#line 1333 "scan.c" +#line 1335 "scan.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1344,15 +1346,19 @@ extern int yywrap YY_PROTO(( void )); #endif #ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); +static void yyunput YY_PROTO(( int c, char *buf_ptr )) +#ifdef __GNUC__ + __attribute__ ((unused)) +#endif +; #endif #ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, yy_size_t )); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); +static yy_size_t yy_flex_strlen YY_PROTO(( yyconst char * )); #endif #ifndef YY_NO_INPUT @@ -1409,7 +1415,7 @@ YY_MALLOC_DECL /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#define ECHO (void) fwrite( yytext, (size_t)yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1468,7 +1474,7 @@ YY_MALLOC_DECL /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -1491,11 +1497,16 @@ YY_DECL int doing_codeblock = false; int i; - Char nmdef[MAXLINE], myesc(); + Char nmdef[MAXLINE]; -#line 1498 "scan.c" +#line 1504 "scan.c" +#if defined(YY_USES_REJECT) && (defined(__GNUC__) || defined(lint)) + /* XXX: shut up `unused label' warning with %options yylineno */ + if (/*CONSTCOND*/0 && yy_full_match) + goto find_rule; +#endif if ( yy_init ) { yy_init = 0; @@ -1520,7 +1531,7 @@ YY_DECL yy_load_buffer_state(); } - while ( 1 ) /* loops until end-of-file is reached */ + while (/*CONSTCOND*/ 1 ) /* loops until end-of-file is reached */ { yy_cp = yy_c_buf_p; @@ -2291,7 +2302,6 @@ YY_RULE_SETUP #line 435 "scan.l" { register Char *nmdefptr; - Char *ndlookup(); strcpy( nmstr, yytext + 1 ); nmstr[yyleng - 2] = '\0'; /* chop trailing brace */ @@ -2325,24 +2335,24 @@ YY_RULE_SETUP YY_BREAK case 107: YY_RULE_SETUP -#line 469 "scan.l" +#line 468 "scan.l" return (unsigned char) yytext[0]; YY_BREAK case 108: YY_RULE_SETUP -#line 470 "scan.l" +#line 469 "scan.l" RETURNCHAR; YY_BREAK case 109: YY_RULE_SETUP -#line 475 "scan.l" +#line 474 "scan.l" return (unsigned char) yytext[0]; YY_BREAK case 110: YY_RULE_SETUP -#line 476 "scan.l" +#line 475 "scan.l" BEGIN(SECT2); return '>'; YY_BREAK case 111: @@ -2350,17 +2360,17 @@ case 111: yy_c_buf_p = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 477 "scan.l" +#line 476 "scan.l" BEGIN(CARETISBOL); return '>'; YY_BREAK case 112: YY_RULE_SETUP -#line 478 "scan.l" +#line 477 "scan.l" RETURNNAME; YY_BREAK case 113: YY_RULE_SETUP -#line 479 "scan.l" +#line 478 "scan.l" { format_synerr( _( "bad : %s" ), yytext ); @@ -2369,23 +2379,23 @@ YY_RULE_SETUP case 114: YY_RULE_SETUP -#line 485 "scan.l" +#line 484 "scan.l" BEGIN(SECT2); return '^'; YY_BREAK case 115: YY_RULE_SETUP -#line 489 "scan.l" +#line 488 "scan.l" RETURNCHAR; YY_BREAK case 116: YY_RULE_SETUP -#line 490 "scan.l" +#line 489 "scan.l" BEGIN(SECT2); return '"'; YY_BREAK case 117: YY_RULE_SETUP -#line 492 "scan.l" +#line 491 "scan.l" { synerr( _( "missing quote" ) ); BEGIN(SECT2); @@ -2400,7 +2410,7 @@ case 118: yy_c_buf_p = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 502 "scan.l" +#line 501 "scan.l" BEGIN(CCL); return '^'; YY_BREAK case 119: @@ -2408,12 +2418,12 @@ case 119: yy_c_buf_p = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 503 "scan.l" +#line 502 "scan.l" return '^'; YY_BREAK case 120: YY_RULE_SETUP -#line 504 "scan.l" +#line 503 "scan.l" BEGIN(CCL); RETURNCHAR; YY_BREAK @@ -2423,22 +2433,22 @@ case 121: yy_c_buf_p = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 508 "scan.l" +#line 507 "scan.l" return '-'; YY_BREAK case 122: YY_RULE_SETUP -#line 509 "scan.l" +#line 508 "scan.l" RETURNCHAR; YY_BREAK case 123: YY_RULE_SETUP -#line 510 "scan.l" +#line 509 "scan.l" BEGIN(SECT2); return ']'; YY_BREAK case 124: YY_RULE_SETUP -#line 511 "scan.l" +#line 510 "scan.l" { synerr( _( "bad character class" ) ); BEGIN(SECT2); @@ -2449,67 +2459,67 @@ YY_RULE_SETUP case 125: YY_RULE_SETUP -#line 519 "scan.l" +#line 518 "scan.l" BEGIN(CCL); return CCE_ALNUM; YY_BREAK case 126: YY_RULE_SETUP -#line 520 "scan.l" +#line 519 "scan.l" BEGIN(CCL); return CCE_ALPHA; YY_BREAK case 127: YY_RULE_SETUP -#line 521 "scan.l" +#line 520 "scan.l" BEGIN(CCL); return CCE_BLANK; YY_BREAK case 128: YY_RULE_SETUP -#line 522 "scan.l" +#line 521 "scan.l" BEGIN(CCL); return CCE_CNTRL; YY_BREAK case 129: YY_RULE_SETUP -#line 523 "scan.l" +#line 522 "scan.l" BEGIN(CCL); return CCE_DIGIT; YY_BREAK case 130: YY_RULE_SETUP -#line 524 "scan.l" +#line 523 "scan.l" BEGIN(CCL); return CCE_GRAPH; YY_BREAK case 131: YY_RULE_SETUP -#line 525 "scan.l" +#line 524 "scan.l" BEGIN(CCL); return CCE_LOWER; YY_BREAK case 132: YY_RULE_SETUP -#line 526 "scan.l" +#line 525 "scan.l" BEGIN(CCL); return CCE_PRINT; YY_BREAK case 133: YY_RULE_SETUP -#line 527 "scan.l" +#line 526 "scan.l" BEGIN(CCL); return CCE_PUNCT; YY_BREAK case 134: YY_RULE_SETUP -#line 528 "scan.l" +#line 527 "scan.l" BEGIN(CCL); return CCE_SPACE; YY_BREAK case 135: YY_RULE_SETUP -#line 529 "scan.l" +#line 528 "scan.l" BEGIN(CCL); return CCE_UPPER; YY_BREAK case 136: YY_RULE_SETUP -#line 530 "scan.l" +#line 529 "scan.l" BEGIN(CCL); return CCE_XDIGIT; YY_BREAK case 137: YY_RULE_SETUP -#line 531 "scan.l" +#line 530 "scan.l" { format_synerr( _( "bad character class expression: %s" ), @@ -2521,7 +2531,7 @@ YY_RULE_SETUP case 138: YY_RULE_SETUP -#line 540 "scan.l" +#line 539 "scan.l" { yylval = myctoi( yytext ); return NUMBER; @@ -2529,17 +2539,17 @@ YY_RULE_SETUP YY_BREAK case 139: YY_RULE_SETUP -#line 545 "scan.l" +#line 544 "scan.l" return ','; YY_BREAK case 140: YY_RULE_SETUP -#line 546 "scan.l" +#line 545 "scan.l" BEGIN(SECT2); return '}'; YY_BREAK case 141: YY_RULE_SETUP -#line 548 "scan.l" +#line 547 "scan.l" { synerr( _( "bad character inside {}'s" ) ); BEGIN(SECT2); @@ -2548,7 +2558,7 @@ YY_RULE_SETUP YY_BREAK case 142: YY_RULE_SETUP -#line 554 "scan.l" +#line 553 "scan.l" { synerr( _( "missing }" ) ); BEGIN(SECT2); @@ -2560,18 +2570,18 @@ YY_RULE_SETUP case 143: YY_RULE_SETUP -#line 564 "scan.l" +#line 563 "scan.l" bracelevel = 0; YY_BREAK case 144: YY_RULE_SETUP -#line 566 "scan.l" +#line 565 "scan.l" ACTION_ECHO; yy_push_state( COMMENT ); YY_BREAK case 145: YY_RULE_SETUP -#line 569 "scan.l" +#line 568 "scan.l" { ACTION_ECHO; CHECK_REJECT(yytext); @@ -2579,7 +2589,7 @@ YY_RULE_SETUP YY_BREAK case 146: YY_RULE_SETUP -#line 573 "scan.l" +#line 572 "scan.l" { ACTION_ECHO; CHECK_YYMORE(yytext); @@ -2588,12 +2598,12 @@ YY_RULE_SETUP case 147: YY_RULE_SETUP -#line 579 "scan.l" +#line 578 "scan.l" ACTION_ECHO; YY_BREAK case 148: YY_RULE_SETUP -#line 580 "scan.l" +#line 579 "scan.l" { ++linenum; ACTION_ECHO; @@ -2613,37 +2623,37 @@ YY_RULE_SETUP case 149: YY_RULE_SETUP -#line 598 "scan.l" +#line 597 "scan.l" ACTION_ECHO; ++bracelevel; YY_BREAK case 150: YY_RULE_SETUP -#line 599 "scan.l" +#line 598 "scan.l" ACTION_ECHO; --bracelevel; YY_BREAK case 151: YY_RULE_SETUP -#line 600 "scan.l" +#line 599 "scan.l" ACTION_ECHO; YY_BREAK case 152: YY_RULE_SETUP -#line 601 "scan.l" +#line 600 "scan.l" ACTION_ECHO; YY_BREAK case 153: YY_RULE_SETUP -#line 602 "scan.l" +#line 601 "scan.l" ACTION_ECHO; /* character constant */ YY_BREAK case 154: YY_RULE_SETUP -#line 603 "scan.l" +#line 602 "scan.l" ACTION_ECHO; BEGIN(ACTION_STRING); YY_BREAK case 155: YY_RULE_SETUP -#line 604 "scan.l" +#line 603 "scan.l" { ++linenum; ACTION_ECHO; @@ -2659,41 +2669,41 @@ YY_RULE_SETUP YY_BREAK case 156: YY_RULE_SETUP -#line 616 "scan.l" +#line 615 "scan.l" ACTION_ECHO; YY_BREAK case 157: YY_RULE_SETUP -#line 620 "scan.l" +#line 619 "scan.l" ACTION_ECHO; YY_BREAK case 158: YY_RULE_SETUP -#line 621 "scan.l" +#line 620 "scan.l" ACTION_ECHO; YY_BREAK case 159: YY_RULE_SETUP -#line 622 "scan.l" +#line 621 "scan.l" ++linenum; ACTION_ECHO; YY_BREAK case 160: YY_RULE_SETUP -#line 623 "scan.l" +#line 622 "scan.l" ACTION_ECHO; BEGIN(ACTION); YY_BREAK case 161: YY_RULE_SETUP -#line 624 "scan.l" +#line 623 "scan.l" ACTION_ECHO; YY_BREAK case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(ACTION): case YY_STATE_EOF(ACTION_STRING): -#line 627 "scan.l" +#line 626 "scan.l" { synerr( _( "EOF encountered inside an action" ) ); yyterminate(); @@ -2701,7 +2711,7 @@ case YY_STATE_EOF(ACTION_STRING): YY_BREAK case 162: YY_RULE_SETUP -#line 633 "scan.l" +#line 632 "scan.l" { yylval = myesc( (Char *) yytext ); @@ -2714,25 +2724,25 @@ YY_RULE_SETUP case 163: YY_RULE_SETUP -#line 644 "scan.l" +#line 643 "scan.l" ECHO; YY_BREAK case YY_STATE_EOF(SECT3): -#line 645 "scan.l" +#line 644 "scan.l" sectnum = 0; yyterminate(); YY_BREAK case 164: YY_RULE_SETUP -#line 648 "scan.l" +#line 647 "scan.l" format_synerr( _( "bad character: %s" ), yytext ); YY_BREAK case 165: YY_RULE_SETUP -#line 650 "scan.l" +#line 649 "scan.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 2736 "scan.c" +#line 2746 "scan.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(SECT2): case YY_STATE_EOF(CODEBLOCK): @@ -3169,7 +3179,7 @@ static int input() /* Reset buffer status. */ yyrestart( yyin ); - /* fall through */ + /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { @@ -3313,7 +3323,7 @@ YY_BUFFER_STATE b; #ifndef YY_ALWAYS_INTERACTIVE #ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); +#include #endif #endif @@ -3420,7 +3430,7 @@ YY_BUFFER_STATE yy_scan_string( yy_str ) yyconst char *yy_str; #endif { - int len; + yy_size_t len; for ( len = 0; yy_str[len]; ++len ) ; @@ -3431,17 +3441,16 @@ yyconst char *yy_str; #ifndef YY_NO_SCAN_BYTES #ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, yy_size_t len ) #else YY_BUFFER_STATE yy_scan_bytes( bytes, len ) yyconst char *bytes; -int len; +yy_size_t len; #endif { YY_BUFFER_STATE b; char *buf; - yy_size_t n; - int i; + yy_size_t n, i; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; @@ -3557,15 +3566,15 @@ char msg[]; #ifndef yytext_ptr #ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +static void yy_flex_strncpy( char *s1, yyconst char *s2, yy_size_t n ) #else static void yy_flex_strncpy( s1, s2, n ) char *s1; yyconst char *s2; -int n; +yy_size_t n; #endif { - register int i; + register yy_size_t i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -3573,13 +3582,13 @@ int n; #ifdef YY_NEED_STRLEN #ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) +static yy_size_t yy_flex_strlen( yyconst char *s ) #else -static int yy_flex_strlen( s ) +static yy_size_t yy_flex_strlen( s ) yyconst char *s; #endif { - register int n; + register yy_size_t n; for ( n = 0; s[n]; ++n ) ; @@ -3598,6 +3607,7 @@ yy_size_t size; return (void *) malloc( size ); } +#ifndef YY_USES_REJECT #ifdef YY_USE_PROTOS static void *yy_flex_realloc( void *ptr, yy_size_t size ) #else @@ -3615,6 +3625,7 @@ yy_size_t size; */ return (void *) realloc( (char *) ptr, size ); } +#endif #ifdef YY_USE_PROTOS static void yy_flex_free( void *ptr ) @@ -3633,7 +3644,7 @@ int main() return 0; } #endif -#line 650 "scan.l" +#line 649 "scan.l"