From 07e629a342b38797506a517b6fb314d0bf1ab252 Mon Sep 17 00:00:00 2001 From: uz Date: Thu, 29 Oct 2009 20:30:41 +0000 Subject: [PATCH] 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 --- src/ca65/main.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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. -- 2.39.5