mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-22 19:22:05 +00:00
Create specialized symbol finder functions
The old "find symbol with auto scope" function is now three: - One finds the exact name passed to it, skipping any checks This is useful e.g. if such checks were already performed. - One checks that the name is not scoped, and calls the first. This is useful for names that cannot be scoped, such as checking for EQUS. Doing this instead of the third should improve performance somehwat, since this specific case is hit by the lexer each time an identifier is read. - The last one checks if the name should be expanded (`.loc` → `Glob.loc`), and that the local part is not scoped. This is essentially the old function.
This commit is contained in:
@@ -46,7 +46,7 @@ static inline bool rpn_isSymbol(const struct Expression *expr)
|
||||
return expr->isSymbol;
|
||||
}
|
||||
|
||||
void rpn_Symbol(struct Expression *expr, char *tzSym);
|
||||
void rpn_Symbol(struct Expression *expr, char const *tzSym);
|
||||
void rpn_Number(struct Expression *expr, uint32_t i);
|
||||
void rpn_LOGNOT(struct Expression *expr, const struct Expression *src);
|
||||
struct Symbol const *rpn_SymbolOf(struct Expression const *expr);
|
||||
|
||||
@@ -121,7 +121,19 @@ struct Symbol *sym_AddSet(char const *symName, int32_t value);
|
||||
uint32_t sym_GetPCValue(void);
|
||||
uint32_t sym_GetConstantSymValue(struct Symbol const *sym);
|
||||
uint32_t sym_GetConstantValue(char const *s);
|
||||
struct Symbol *sym_FindSymbol(char const *symName);
|
||||
/*
|
||||
* Find a symbol by exact name, bypassing expansion checks
|
||||
*/
|
||||
struct Symbol *sym_FindExactSymbol(char const *name);
|
||||
/*
|
||||
* Find a symbol by exact name; may not be scoped, produces an error if it is
|
||||
*/
|
||||
struct Symbol *sym_FindUnscopedSymbol(char const *name);
|
||||
/*
|
||||
* Find a symbol, possibly scoped, by name
|
||||
*/
|
||||
struct Symbol *sym_FindScopedSymbol(char const *name);
|
||||
struct Symbol const *sym_GetPC(void);
|
||||
struct Symbol *sym_AddMacro(char const *symName, int32_t defLineNo, char *body, size_t size);
|
||||
struct Symbol *sym_Ref(char const *symName);
|
||||
struct Symbol *sym_AddString(char const *symName, char const *value);
|
||||
|
||||
Reference in New Issue
Block a user