Added structs and unions, more work on scopes and expressions
git-svn-id: svn://svn.cc65.org/cc65/trunk@2662 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -45,13 +45,13 @@
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ SymEntry* ParseScopedSymName (int AllocNew)
|
||||
NextTok ();
|
||||
} else {
|
||||
Scope = CurrentScope;
|
||||
/* ### Need to walk up the tree */
|
||||
}
|
||||
|
||||
/* Resolve scopes */
|
||||
@@ -111,3 +112,61 @@ SymEntry* ParseScopedSymName (int AllocNew)
|
||||
|
||||
|
||||
|
||||
SymTable* ParseScopedSymTable (int AllocNew)
|
||||
/* Parse a (possibly scoped) symbol table (scope) name, search for it in the
|
||||
* symbol space and return the symbol table struct.
|
||||
*/
|
||||
{
|
||||
/* Get the starting table */
|
||||
SymTable* Scope;
|
||||
if (Tok == TOK_NAMESPACE) {
|
||||
Scope = RootScope;
|
||||
NextTok ();
|
||||
} else {
|
||||
Scope = CurrentScope;
|
||||
if (Tok != TOK_IDENT) {
|
||||
Error ("Identifier expected");
|
||||
return Scope;
|
||||
}
|
||||
|
||||
/* If no new scope should be allocated, the scope may specify any
|
||||
* scope in any of the parent scopes, so search for it.
|
||||
*/
|
||||
if (!AllocNew) {
|
||||
Scope = SymFindAnyScope (Scope, SVal);
|
||||
NextTok ();
|
||||
if (Tok != TOK_NAMESPACE) {
|
||||
return Scope;
|
||||
}
|
||||
NextTok ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Resolve scopes. */
|
||||
while (Tok == TOK_IDENT) {
|
||||
|
||||
/* Search for the child scope if we have a valid parent */
|
||||
if (Scope) {
|
||||
Scope = SymFindScope (Scope, SVal, AllocNew);
|
||||
}
|
||||
|
||||
/* Skip the name token */
|
||||
NextTok ();
|
||||
|
||||
/* If a namespace token follows, read on, otherwise bail out */
|
||||
if (Tok == TOK_NAMESPACE) {
|
||||
NextTok ();
|
||||
if (Tok != TOK_IDENT) {
|
||||
Error ("Identifier expected");
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the scope we found or created */
|
||||
return Scope;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user