mirror of
https://github.com/cc65/cc65.git
synced 2025-01-27 09:33:42 +00:00
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
This commit is contained in:
parent
5304a8149e
commit
07e629a342
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user