Module: Mesa Branch: master Commit: 7279feeb19485a62ebf820858a549c87891935c7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7279feeb19485a62ebf820858a549c87891935c7
Author: Kenneth Graunke <kenn...@whitecape.org> Date: Sat Nov 13 23:09:43 2010 -0800 glsl: Add support for the 'u' and 'U' unsigned integer suffixes. --- 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 26cf305..7a3f1a6 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]? { _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit