Rémi Bernon : widl: Introduce a new helper to produce num tokens.
Module: wine Branch: master Commit: baa3680f2e72fc3b86770ca462e7321485f48a89 URL: https://gitlab.winehq.org/wine/wine/-/commit/baa3680f2e72fc3b86770ca462e7321... Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Jan 24 22:19:45 2023 +0100 widl: Introduce a new helper to produce num tokens. --- tools/widl/parser.l | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/widl/parser.l b/tools/widl/parser.l index 02db1cfeeb1..539e6f381ed 100644 --- a/tools/widl/parser.l +++ b/tools/widl/parser.l @@ -131,6 +131,12 @@ struct uuid *parse_uuid(const char *u) return uuid; } +static int token_num( int token, const char *yytext, YYSTYPE *yylval ) +{ + yylval->num = xstrtoul( yytext, NULL, 0 ); + return token; +} + %} /* @@ -227,14 +233,8 @@ SAFEARRAY{ws}*/\( return tSAFEARRAY; ^{ws}*\#{ws}* { yy_push_state(PP_LINE); } \[ { yy_push_state(ATTR); return '['; } - {hex} { - yylval->num = xstrtoul(yytext, NULL, 0); - return aHEXNUM; - } - {int} { - yylval->num = xstrtoul(yytext, NULL, 0); - return aNUM; - } + {hex} { return token_num( aHEXNUM, yytext, yylval ); } + {int} { return token_num( aNUM, yytext, yylval ); } \n { line_number++; } {ws} {}
participants (1)
-
Alexandre Julliard