diff options
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/glsl_lexer.lpp | 14 |
1 files 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]? { |