From 7279feeb19485a62ebf820858a549c87891935c7 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 13 Nov 2010 23:09:43 -0800 Subject: [PATCH] glsl: Add support for the 'u' and 'U' unsigned integer suffixes. --- src/glsl/glsl_lexer.lpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp index 26cf30581c1..7a3f1a67e66 100644 --- a/src/glsl/glsl_lexer.lpp +++ b/src/glsl/glsl_lexer.lpp @@ -36,6 +36,8 @@ #define YY_USER_INIT yylineno = 0; yycolumn = 0; +#define IS_UINT (yytext[yyleng - 1] == 'u' || yytext[yyleng - 1] == 'U') + /* A macro for handling reserved words and keywords across language versions. * * Certain words start out as identifiers, become reserved words in @@ -277,17 +279,17 @@ layout { \|= return OR_ASSIGN; -= return SUB_ASSIGN; -[1-9][0-9]* { +[1-9][0-9]*[uU]? { yylval->n = strtol(yytext, NULL, 10); - return INTCONSTANT; + return IS_UINT ? UINTCONSTANT : INTCONSTANT; } -0[xX][0-9a-fA-F]+ { +0[xX][0-9a-fA-F]+[uU]? { yylval->n = strtol(yytext + 2, NULL, 16); - return INTCONSTANT; + return IS_UINT ? UINTCONSTANT : INTCONSTANT; } -0[0-7]* { +0[0-7]*[uU]? { yylval->n = strtol(yytext, NULL, 8); - return INTCONSTANT; + return IS_UINT ? UINTCONSTANT : INTCONSTANT; } [0-9]+\.[0-9]+([eE][+-]?[0-9]+)?[fF]? { -- 2.30.2