mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 21:20:33 +00:00
[util] Support size_t constants
Much like 1u and 1l, 1z is for size_t.
This commit is contained in:
parent
df82cb88ee
commit
0622a24380
1 changed files with 13 additions and 0 deletions
|
@ -71,6 +71,7 @@ FILE *cexpr_yyget_in (yyscan_t yyscanner) __attribute__((pure));
|
|||
|
||||
static exprval_t *parse_int (const char *str, exprctx_t *context);
|
||||
static exprval_t *parse_uint (const char *str, exprctx_t *context);
|
||||
static exprval_t *parse_size_t (const char *str, exprctx_t *context);
|
||||
static exprval_t *parse_float (const char *str, exprctx_t *context);
|
||||
static exprval_t *parse_double (const char *str, exprctx_t *context);
|
||||
static exprsym_t *parse_name (const char *str, exprctx_t *context);
|
||||
|
@ -127,6 +128,11 @@ STRING \"(\\.|[^"\\])*\"
|
|||
return VALUE;
|
||||
}
|
||||
|
||||
{INT}+[zZ] {
|
||||
yylval->value = parse_size_t (yytext, context);
|
||||
return VALUE;
|
||||
}
|
||||
|
||||
{FLOAT} {
|
||||
yylval->value = parse_double (yytext, context);
|
||||
return VALUE;
|
||||
|
@ -239,6 +245,13 @@ static exprval_t *parse_uint (const char *str, exprctx_t *context)
|
|||
return val;
|
||||
}
|
||||
|
||||
static exprval_t *parse_size_t (const char *str, exprctx_t *context)
|
||||
{
|
||||
exprval_t *val = cexpr_value (&cexpr_size_t, context);
|
||||
*(unsigned *) val->value = strtoumax (str, 0, 0);
|
||||
return val;
|
||||
}
|
||||
|
||||
static exprval_t *parse_float (const char *str, exprctx_t *context)
|
||||
{
|
||||
exprval_t *val = cexpr_value (&cexpr_float, context);
|
||||
|
|
Loading…
Reference in a new issue