From: Kenneth Graunke Date: Mon, 16 Aug 2010 20:43:10 +0000 (-0700) Subject: glcpp: Refresh autogenerated lexer and parser. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2e2614586225b3fff3c21f37817064a90dd320ad;p=mesa.git glcpp: Refresh autogenerated lexer and parser. --- diff --git a/src/glsl/glcpp/glcpp-lex.c b/src/glsl/glcpp/glcpp-lex.c index 6b6aa12d8f7..de37c11be8b 100644 --- a/src/glsl/glcpp/glcpp-lex.c +++ b/src/glsl/glcpp/glcpp-lex.c @@ -54,6 +54,7 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -84,8 +85,6 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! C99 */ - #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -159,15 +158,7 @@ typedef void* yyscan_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else #define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -691,7 +682,7 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner); } while(0); #define YY_USER_INIT yylineno = 1; yycolumn = 1; -#line 695 "glcpp/glcpp-lex.c" +#line 686 "glcpp/glcpp-lex.c" #define INITIAL 0 #define DONE 1 @@ -838,12 +829,7 @@ static int input (yyscan_t yyscanner ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else #define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -851,7 +837,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -862,7 +848,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -954,7 +940,7 @@ YY_DECL /* Single-line comments */ -#line 958 "glcpp/glcpp-lex.c" +#line 944 "glcpp/glcpp-lex.c" yylval = yylval_param; @@ -1126,8 +1112,6 @@ YY_RULE_SETUP #line 91 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); - yylineno++; - yycolumn = 0; yyextra->space_tokens = 0; return HASH_VERSION; } @@ -1136,7 +1120,7 @@ YY_RULE_SETUP * Simply pass them through to the main compiler's lexer/parser. */ case 9: YY_RULE_SETUP -#line 101 "glcpp/glcpp-lex.l" +#line 99 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); yylineno++; @@ -1147,7 +1131,7 @@ YY_RULE_SETUP case 10: /* rule 10 can match eol */ YY_RULE_SETUP -#line 108 "glcpp/glcpp-lex.l" +#line 106 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1157,7 +1141,7 @@ YY_RULE_SETUP case 11: /* rule 11 can match eol */ YY_RULE_SETUP -#line 114 "glcpp/glcpp-lex.l" +#line 112 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1167,7 +1151,7 @@ YY_RULE_SETUP case 12: /* rule 12 can match eol */ YY_RULE_SETUP -#line 120 "glcpp/glcpp-lex.l" +#line 118 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1177,7 +1161,7 @@ YY_RULE_SETUP case 13: /* rule 13 can match eol */ YY_RULE_SETUP -#line 126 "glcpp/glcpp-lex.l" +#line 124 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1187,7 +1171,7 @@ YY_RULE_SETUP case 14: /* rule 14 can match eol */ YY_RULE_SETUP -#line 132 "glcpp/glcpp-lex.l" +#line 130 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_ELSE; @@ -1196,7 +1180,7 @@ YY_RULE_SETUP case 15: /* rule 15 can match eol */ YY_RULE_SETUP -#line 137 "glcpp/glcpp-lex.l" +#line 135 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_ENDIF; @@ -1216,7 +1200,7 @@ case 16: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 150 "glcpp/glcpp-lex.l" +#line 148 "glcpp/glcpp-lex.l" { /* Since this rule always matches, YY_USER_ACTION gets called for it, * wrongly incrementing yycolumn. We undo that effect here. */ @@ -1231,7 +1215,7 @@ YY_RULE_SETUP YY_BREAK case 17: YY_RULE_SETUP -#line 162 "glcpp/glcpp-lex.l" +#line 160 "glcpp/glcpp-lex.l" { char *p; for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */ @@ -1241,7 +1225,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 169 "glcpp/glcpp-lex.l" +#line 167 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_DEFINE_FUNC; @@ -1249,7 +1233,7 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 174 "glcpp/glcpp-lex.l" +#line 172 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_DEFINE_OBJ; @@ -1257,7 +1241,7 @@ YY_RULE_SETUP YY_BREAK case 20: YY_RULE_SETUP -#line 179 "glcpp/glcpp-lex.l" +#line 177 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_UNDEF; @@ -1265,7 +1249,7 @@ YY_RULE_SETUP YY_BREAK case 21: YY_RULE_SETUP -#line 184 "glcpp/glcpp-lex.l" +#line 182 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH; @@ -1273,7 +1257,7 @@ YY_RULE_SETUP YY_BREAK case 22: YY_RULE_SETUP -#line 189 "glcpp/glcpp-lex.l" +#line 187 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; @@ -1281,7 +1265,7 @@ YY_RULE_SETUP YY_BREAK case 23: YY_RULE_SETUP -#line 194 "glcpp/glcpp-lex.l" +#line 192 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; @@ -1289,7 +1273,7 @@ YY_RULE_SETUP YY_BREAK case 24: YY_RULE_SETUP -#line 199 "glcpp/glcpp-lex.l" +#line 197 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; @@ -1297,77 +1281,77 @@ YY_RULE_SETUP YY_BREAK case 25: YY_RULE_SETUP -#line 204 "glcpp/glcpp-lex.l" +#line 202 "glcpp/glcpp-lex.l" { return LEFT_SHIFT; } YY_BREAK case 26: YY_RULE_SETUP -#line 208 "glcpp/glcpp-lex.l" +#line 206 "glcpp/glcpp-lex.l" { return RIGHT_SHIFT; } YY_BREAK case 27: YY_RULE_SETUP -#line 212 "glcpp/glcpp-lex.l" +#line 210 "glcpp/glcpp-lex.l" { return LESS_OR_EQUAL; } YY_BREAK case 28: YY_RULE_SETUP -#line 216 "glcpp/glcpp-lex.l" +#line 214 "glcpp/glcpp-lex.l" { return GREATER_OR_EQUAL; } YY_BREAK case 29: YY_RULE_SETUP -#line 220 "glcpp/glcpp-lex.l" +#line 218 "glcpp/glcpp-lex.l" { return EQUAL; } YY_BREAK case 30: YY_RULE_SETUP -#line 224 "glcpp/glcpp-lex.l" +#line 222 "glcpp/glcpp-lex.l" { return NOT_EQUAL; } YY_BREAK case 31: YY_RULE_SETUP -#line 228 "glcpp/glcpp-lex.l" +#line 226 "glcpp/glcpp-lex.l" { return AND; } YY_BREAK case 32: YY_RULE_SETUP -#line 232 "glcpp/glcpp-lex.l" +#line 230 "glcpp/glcpp-lex.l" { return OR; } YY_BREAK case 33: YY_RULE_SETUP -#line 236 "glcpp/glcpp-lex.l" +#line 234 "glcpp/glcpp-lex.l" { return PASTE; } YY_BREAK case 34: YY_RULE_SETUP -#line 240 "glcpp/glcpp-lex.l" +#line 238 "glcpp/glcpp-lex.l" { return DEFINED; } YY_BREAK case 35: YY_RULE_SETUP -#line 244 "glcpp/glcpp-lex.l" +#line 242 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return IDENTIFIER; @@ -1375,14 +1359,14 @@ YY_RULE_SETUP YY_BREAK case 36: YY_RULE_SETUP -#line 249 "glcpp/glcpp-lex.l" +#line 247 "glcpp/glcpp-lex.l" { return yytext[0]; } YY_BREAK case 37: YY_RULE_SETUP -#line 253 "glcpp/glcpp-lex.l" +#line 251 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return OTHER; @@ -1390,7 +1374,7 @@ YY_RULE_SETUP YY_BREAK case 38: YY_RULE_SETUP -#line 258 "glcpp/glcpp-lex.l" +#line 256 "glcpp/glcpp-lex.l" { if (yyextra->space_tokens) { return SPACE; @@ -1400,7 +1384,7 @@ YY_RULE_SETUP case 39: /* rule 39 can match eol */ YY_RULE_SETUP -#line 264 "glcpp/glcpp-lex.l" +#line 262 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 0; yylineno++; @@ -1410,7 +1394,7 @@ YY_RULE_SETUP YY_BREAK /* Handle missing newline at EOF. */ case YY_STATE_EOF(INITIAL): -#line 272 "glcpp/glcpp-lex.l" +#line 270 "glcpp/glcpp-lex.l" { BEGIN DONE; /* Don't keep matching this rule forever. */ yyextra->lexing_if = 0; @@ -1423,7 +1407,7 @@ case YY_STATE_EOF(INITIAL): warnings. */ case 40: YY_RULE_SETUP -#line 282 "glcpp/glcpp-lex.l" +#line 280 "glcpp/glcpp-lex.l" { unput('.'); yy_top_state(yyextra); @@ -1431,10 +1415,10 @@ YY_RULE_SETUP YY_BREAK case 41: YY_RULE_SETUP -#line 287 "glcpp/glcpp-lex.l" +#line 285 "glcpp/glcpp-lex.l" ECHO; YY_BREAK -#line 1438 "glcpp/glcpp-lex.c" +#line 1422 "glcpp/glcpp-lex.c" case YY_STATE_EOF(DONE): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(UNREACHABLE): @@ -2173,8 +2157,8 @@ YY_BUFFER_STATE glcpp__scan_string (yyconst char * yystr , yyscan_t yyscanner) /** Setup the input buffer state to scan the given bytes. The next call to glcpp_lex() will * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ @@ -2628,7 +2612,7 @@ void glcpp_free (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 287 "glcpp/glcpp-lex.l" +#line 285 "glcpp/glcpp-lex.l" diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index bd0fbc4fcf2..a19a02a867d 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -2016,7 +2016,7 @@ yyreduce: talloc_free (macro); } add_builtin_define (parser, "__VERSION__", (yyvsp[(2) - (3)].ival)); - glcpp_printf(parser->output, "#version %" PRIiMAX "\n", (yyvsp[(2) - (3)].ival)); + glcpp_printf(parser->output, "#version %" PRIiMAX, (yyvsp[(2) - (3)].ival)); ;} break;