/* */
/* */
/* */
-/* (C) 2000-2004 Ullrich von Bassewitz */
-/* Römerstraße 52 */
-/* D-70794 Filderstadt */
-/* EMail: uz@cc65.org */
+/* (C) 2000-2010, Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
+/* D-70794 Filderstadt */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
D = AllocIf (".IFDEF", 1);
NextTok ();
if (IfCond) {
- SymEntry* Sym = ParseScopedSymName (SYM_FIND_EXISTING);
+ SymEntry* Sym = ParseAnySymName (SYM_FIND_EXISTING);
SetIfCond (D, Sym != 0 && SymIsDef (Sym));
}
IfCond = GetCurrentIfCond ();
D = AllocIf (".IFNDEF", 1);
NextTok ();
if (IfCond) {
- SymEntry* Sym = ParseScopedSymName (SYM_FIND_EXISTING);
+ SymEntry* Sym = ParseAnySymName (SYM_FIND_EXISTING);
SetIfCond (D, Sym == 0 || !SymIsDef (Sym));
ExpectSep ();
}
D = AllocIf (".IFNREF", 1);
NextTok ();
if (IfCond) {
- SymEntry* Sym = ParseScopedSymName (SYM_FIND_EXISTING);
+ SymEntry* Sym = ParseAnySymName (SYM_FIND_EXISTING);
SetIfCond (D, Sym == 0 || !SymIsRef (Sym));
ExpectSep ();
}
D = AllocIf (".IFREF", 1);
NextTok ();
if (IfCond) {
- SymEntry* Sym = ParseScopedSymName (SYM_FIND_EXISTING);
+ SymEntry* Sym = ParseAnySymName (SYM_FIND_EXISTING);
SetIfCond (D, Sym != 0 && SymIsRef (Sym));
ExpectSep ();
}
/* Handle the .DEFINED builtin function */
{
/* Parse the symbol name and search for the symbol */
- SymEntry* Sym = ParseScopedSymName (SYM_FIND_EXISTING);
+ SymEntry* Sym = ParseAnySymName (SYM_FIND_EXISTING);
/* Check if the symbol is defined */
return GenLiteralExpr (Sym != 0 && SymIsDef (Sym));
/* Handle the .REFERENCED builtin function */
{
/* Parse the symbol name and search for the symbol */
- SymEntry* Sym = ParseScopedSymName (SYM_FIND_EXISTING);
+ SymEntry* Sym = ParseAnySymName (SYM_FIND_EXISTING);
/* Check if the symbol is referenced */
return GenLiteralExpr (Sym != 0 && SymIsRef (Sym));
case TOK_NAMESPACE:
case TOK_IDENT:
- N = Symbol (ParseScopedSymName (SYM_ALLOC_NEW));
- break;
-
case TOK_LOCAL_IDENT:
- N = Symbol (SymFindLocal (SymLast, &SVal, SYM_ALLOC_NEW));
- NextTok ();
- break;
+ N = Symbol (ParseAnySymName (SYM_ALLOC_NEW));
+ break;
case TOK_ULABEL:
N = ULabRef (IVal);
static void OptBinIncludeDir (const char* Opt attribute ((unused)), const char* Arg)
/* Add an include search path for binaries */
-{
+{
AddSearchPath (BinSearchPath, Arg);
}
int HadWS = WS;
/* Generate the symbol table entry, then skip the name */
- if (Tok == TOK_LOCAL_IDENT) {
- Sym = SymFindLocal (SymLast, &SVal, SYM_ALLOC_NEW);
- NextTok ();
- } else {
- Sym = ParseScopedSymName (SYM_ALLOC_NEW);
- }
+ Sym = ParseAnySymName (SYM_ALLOC_NEW);
/* If a colon follows, this is a label definition. If there
* is no colon, it's an assignment.
/* */
/* */
/* */
-/* (C) 1998-2008 Ullrich von Bassewitz */
-/* Roemerstrasse 52 */
-/* D-70794 Filderstadt */
-/* EMail: uz@cc65.org */
+/* (C) 1998-2010, Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
+/* D-70794 Filderstadt */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
+SymEntry* ParseAnySymName (int AllocNew)
+/* Parse a cheap local symbol or a a (possibly scoped) symbol name, search
+ * for it in the symbol table and return the symbol table entry.
+ */
+{
+ SymEntry* Sym;
+
+ /* Distinguish cheap locals and other symbols */
+ if (Tok == TOK_LOCAL_IDENT) {
+ Sym = SymFindLocal (SymLast, &SVal, AllocNew);
+ NextTok ();
+ } else {
+ Sym = ParseScopedSymName (AllocNew);
+ }
+
+ /* Return the symbol found */
+ return Sym;
+}
+
+
+
/* */
/* */
/* */
-/* (C) 1998-2008 Ullrich von Bassewitz */
-/* Roemerstrasse 52 */
-/* D-70794 Filderstadt */
-/* EMail: uz@cc65.org */
+/* (C) 1998-2010, Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
+/* D-70794 Filderstadt */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
* symbol space and return the symbol table struct.
*/
+struct SymEntry* ParseAnySymName (int AllocNew);
+/* Parse a cheap local symbol or a a (possibly scoped) symbol name, search
+ * for it in the symbol table and return the symbol table entry.
+ */
+
/* End of symbol.h */