diff --git a/tools/qfcc/include/symtab.h b/tools/qfcc/include/symtab.h index 179259c81..c8c831203 100644 --- a/tools/qfcc/include/symtab.h +++ b/tools/qfcc/include/symtab.h @@ -94,6 +94,8 @@ typedef struct symtab_s { struct defspace_s *space; ///< storage for vars in scope symtabs } symtab_t; +const char *symtype_str (sy_type_e type); + /** Create a new, empty named symbol. Only the symbol name field will be filled in. \a name will be copied diff --git a/tools/qfcc/source/symtab.c b/tools/qfcc/source/symtab.c index 4c39e03f7..c729a064f 100644 --- a/tools/qfcc/source/symtab.c +++ b/tools/qfcc/source/symtab.c @@ -50,6 +50,23 @@ static symtab_t *free_symtabs; static symbol_t *free_symbols; +static const char *sy_type_names[] = { + "sy_var", + "sy_const", + "sy_type", + "sy_expr", + "sy_func", + "sy_class", +}; + +const char * +symtype_str (sy_type_e type) +{ + if (type < 0 || type > sy_class) + return ""; + return sy_type_names[type]; +} + symbol_t * new_symbol (const char *name) {