diff --git a/src/snc/expr.c b/src/snc/expr.c index 3afefea48cceb951a7d5dd1e57de25b60f53cf45..170130f60fd3428f87e560f78649cd88f2d5f984 100644 --- a/src/snc/expr.c +++ b/src/snc/expr.c @@ -121,3 +121,12 @@ uint strtoui( *pnumber = result; return TRUE; } + +Token token_from_expr(Expr *e) +{ + Token t; + t.str = e->value; + t.line = e->line_num; + t.file = e->src_file; + return t; +} diff --git a/src/snc/expr.h b/src/snc/expr.h index 67431a2a811f2fbd8d2e41e61e54257d080e3803..71e1211f3f67bdd8ab4849d73e3a48acbf7331d6 100644 --- a/src/snc/expr.h +++ b/src/snc/expr.h @@ -38,6 +38,8 @@ uint strtoui( uint *pnumber /* location for result if successful */ ); +Token token_from_expr(Expr *e); + /* defined in var_types.c */ Expr *decl_add_base_type(Expr *ds, Type t); Expr *decl_add_init(Expr *d, Expr *init);