mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-30 05:53:45 +00:00
widl: Use struct integer for the aNUM and aHEXNUM tokens.
This commit is contained in:
parent
22929dd8af
commit
e261f187ad
|
@ -154,10 +154,11 @@ static int token_str( int token, const char *str, YYSTYPE *yylval )
|
|||
return token;
|
||||
}
|
||||
|
||||
static int token_num( int token, const char *yytext, YYSTYPE *yylval )
|
||||
static int token_num( const char *yytext, YYSTYPE *yylval, int is_hex )
|
||||
{
|
||||
yylval->num = xstrtoul( yytext, NULL, 0 );
|
||||
return token;
|
||||
yylval->integer.value = xstrtoul( yytext, NULL, 0 );
|
||||
yylval->integer.is_hex = is_hex;
|
||||
return is_hex ? aHEXNUM : aNUM;
|
||||
}
|
||||
|
||||
static int token_ident( const char *str, YYSTYPE *yylval )
|
||||
|
@ -431,8 +432,8 @@ SAFEARRAY{ws}*/\( return tSAFEARRAY;
|
|||
|
||||
[a-zA-Z_][0-9a-zA-Z_]* { return token_ident( yytext, yylval ); }
|
||||
|
||||
0[xX]{hd}+[uU]?[lL]? { return token_num( aHEXNUM, yytext, yylval ); }
|
||||
[0-9]+[uU]?[lL]? { return token_num( aNUM, yytext, yylval ); }
|
||||
0[xX]{hd}+[uU]?[lL]? { return token_num( yytext, yylval, TRUE ); }
|
||||
[0-9]+[uU]?[lL]? { return token_num( yytext, yylval, FALSE ); }
|
||||
|
||||
L\"(\\.|[^"\\])*\" { return token_str( aWSTRING, yytext + 1, yylval ); }
|
||||
\"(\\.|[^"\\])*\" { return token_str( aSTRING, yytext, yylval ); }
|
||||
|
|
|
@ -151,6 +151,7 @@ PARSER_LTYPE pop_import(void);
|
|||
char *str;
|
||||
struct uuid *uuid;
|
||||
unsigned int num;
|
||||
struct integer integer;
|
||||
double dbl;
|
||||
typelib_t *typelib;
|
||||
struct _import_t *import;
|
||||
|
@ -163,7 +164,7 @@ PARSER_LTYPE pop_import(void);
|
|||
|
||||
%token <str> aIDENTIFIER aPRAGMA
|
||||
%token <str> aKNOWNTYPE
|
||||
%token <num> aNUM aHEXNUM
|
||||
%token <integer> aNUM aHEXNUM
|
||||
%token <dbl> aDOUBLE
|
||||
%token <str> aSTRING aWSTRING aSQSTRING
|
||||
%token <str> tCDECL
|
||||
|
@ -494,8 +495,8 @@ pragma_warning: tPRAGMA_WARNING '(' aIDENTIFIER ':' warnings ')'
|
|||
;
|
||||
|
||||
warnings:
|
||||
aNUM { $$ = append_warning(NULL, $1); }
|
||||
| warnings aNUM { $$ = append_warning($1, $2); }
|
||||
aNUM { $$ = append_warning(NULL, $1.value); }
|
||||
| warnings aNUM { $$ = append_warning($1, $2.value); }
|
||||
;
|
||||
|
||||
typedecl:
|
||||
|
@ -591,8 +592,8 @@ marshaling_behavior:
|
|||
;
|
||||
|
||||
contract_ver:
|
||||
aNUM { $$ = MAKEVERSION(0, $1); }
|
||||
| aNUM '.' aNUM { $$ = MAKEVERSION($3, $1); }
|
||||
aNUM { $$ = MAKEVERSION(0, $1.value); }
|
||||
| aNUM '.' aNUM { $$ = MAKEVERSION($3.value, $1.value); }
|
||||
;
|
||||
|
||||
contract_req
|
||||
|
@ -844,10 +845,8 @@ m_expr
|
|||
| expr
|
||||
;
|
||||
|
||||
expr: aNUM { struct integer integer = {.value = $1};
|
||||
$$ = make_exprl(EXPR_NUM, &integer); }
|
||||
| aHEXNUM { struct integer integer = {.value = $1, .is_hex = TRUE};
|
||||
$$ = make_exprl(EXPR_NUM, &integer); }
|
||||
expr: aNUM { $$ = make_exprl(EXPR_NUM, &$1); }
|
||||
| aHEXNUM { $$ = make_exprl(EXPR_NUM, &$1); }
|
||||
| aDOUBLE { $$ = make_exprd(EXPR_DOUBLE, $1); }
|
||||
| tFALSE { struct integer integer = {.value = 0};
|
||||
$$ = make_exprl(EXPR_TRUEFALSE, &integer); }
|
||||
|
@ -1385,9 +1384,9 @@ uniondef: tUNION m_typename '{' ne_union_fields '}'
|
|||
;
|
||||
|
||||
version:
|
||||
aNUM { $$ = MAKEVERSION($1, 0); }
|
||||
| aNUM '.' aNUM { $$ = MAKEVERSION($1, $3); }
|
||||
| aHEXNUM { $$ = $1; }
|
||||
aNUM { $$ = MAKEVERSION($1.value, 0); }
|
||||
| aNUM '.' aNUM { $$ = MAKEVERSION($1.value, $3.value); }
|
||||
| aHEXNUM { $$ = $1.value; }
|
||||
;
|
||||
|
||||
acf_statements
|
||||
|
|
Loading…
Reference in a new issue