X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fca65%2Fenum.c;h=d44dbfd19cd71135fdc5bc66fcab9d9dfa441fe3;hb=115db5974355a73ae486019c78779d24049e6513;hp=87d0380cc3a1ce3cf5fc408021999bda39b25326;hpb=795d9e1a1c37e9d13b0fe807de142920a25808e4;p=cc65 diff --git a/src/ca65/enum.c b/src/ca65/enum.c index 87d0380cc..d44dbfd19 100644 --- a/src/ca65/enum.c +++ b/src/ca65/enum.c @@ -35,12 +35,14 @@ /* common */ #include "addrsize.h" +#include "scopedefs.h" /* ca65 */ #include "condasm.h" #include "enum.h" #include "error.h" #include "expr.h" +#include "macro.h" #include "nexttok.h" #include "scanner.h" #include "symbol.h" @@ -65,7 +67,7 @@ void DoEnum (void) int Anon = (CurTok.Tok != TOK_IDENT); if (!Anon) { /* Enter a new scope, then skip the name */ - SymEnterLevel (&CurTok.SVal, ST_ENUM, ADDR_SIZE_ABS, 0); + SymEnterLevel (&CurTok.SVal, SCOPE_ENUM, ADDR_SIZE_ABS, 0); NextTok (); } @@ -75,6 +77,7 @@ void DoEnum (void) /* Read until end of struct */ while (CurTok.Tok != TOK_ENDENUM && CurTok.Tok != TOK_EOF) { + Macro* M; SymEntry* Sym; ExprNode* EnumExpr; @@ -93,6 +96,12 @@ void DoEnum (void) continue; } + /* We have an identifier. Is it a macro? */ + if ((M = FindMacro (&CurTok.SVal)) != 0) { + MacExpandStart (M); + continue; + } + /* We have an identifier, generate a symbol */ Sym = SymFind (CurrentScope, &CurTok.SVal, SYM_ALLOC_NEW);