diff options
author | Kenneth Graunke <[email protected]> | 2010-11-13 23:09:43 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2010-11-15 13:33:58 -0800 |
commit | 7279feeb19485a62ebf820858a549c87891935c7 (patch) | |
tree | 7060d4c37ddb2d9eb88915e00c9d8bfbd67f8fc3 /src/glsl | |
parent | 2b6c1a0b7cf60040ace0294ee0111de01187837a (diff) |
glsl: Add support for the 'u' and 'U' unsigned integer suffixes.
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]? { |