From: uz Date: Thu, 29 Oct 2009 20:30:41 +0000 (+0000) Subject: Allow fully scoped labels and constants instead of normal ones. This breaks X-Git-Tag: V2.13.1~132 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=07e629a342b38797506a517b6fb314d0bf1ab252;p=cc65 Allow fully scoped labels and constants instead of normal ones. This breaks the barrier between scopes: It is now possible to introduce symbols into a foreign scope, provided that it's name is known. git-svn-id: svn://svn.cc65.org/cc65/trunk@4397 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/ca65/main.c b/src/ca65/main.c index 54575937a..63891bbf6 100644 --- a/src/ca65/main.c +++ b/src/ca65/main.c @@ -72,6 +72,7 @@ #include "segment.h" #include "sizeof.h" #include "spool.h" +#include "symbol.h" #include "symtab.h" #include "ulabel.h" @@ -577,19 +578,24 @@ static void OneLine (void) } } - /* Handle an identifier */ - if (Tok == TOK_LOCAL_IDENT || (Tok == TOK_IDENT && Instr < 0 && !Macro)) { + /* Handle an identifier. This may be a cheap local symbol, or a fully + * scoped identifier which may start with a namespace token (for global + * namespace) + */ + if (Tok == TOK_LOCAL_IDENT || + Tok == TOK_NAMESPACE || + (Tok == TOK_IDENT && Instr < 0 && !Macro)) { /* Did we have whitespace before the ident? */ int HadWS = WS; /* Generate the symbol table entry, then skip the name */ - if (Tok == TOK_IDENT) { - Sym = SymFind (CurrentScope, &SVal, SYM_ALLOC_NEW); - } else { + if (Tok == TOK_LOCAL_IDENT) { Sym = SymFindLocal (SymLast, &SVal, SYM_ALLOC_NEW); + NextTok (); + } else { + Sym = ParseScopedSymName (SYM_ALLOC_NEW); } - NextTok (); /* If a colon follows, this is a label definition. If there * is no colon, it's an assignment.