pub trait AliasResolver {
// Required methods
fn lookup_alias(&self, name: &str) -> Option<AliasInfo>;
fn lookup_suffix_alias(&self, suffix: &str) -> Option<AliasInfo>;
fn lookup_reswd(&self, name: &str) -> Option<LexTok>;
fn mark_in_use(&mut self, name: &str, in_use: bool);
}Expand description
Trait the lexer uses to look up aliases and reserved words during
exalias. Implementors typically delegate to the executor’s
alias/reswd hash tables. Defining the trait here keeps lexer.rs
free of executor-specific types — same pattern zsh uses with the
hashtable.h opaque-handle approach against aliastab/reswdtab/
sufaliastab.
Required Methods§
Sourcefn lookup_alias(&self, name: &str) -> Option<AliasInfo>
fn lookup_alias(&self, name: &str) -> Option<AliasInfo>
Look up an alias by name. Returns None if not found, or the
alias body + flags otherwise.
Sourcefn lookup_suffix_alias(&self, suffix: &str) -> Option<AliasInfo>
fn lookup_suffix_alias(&self, suffix: &str) -> Option<AliasInfo>
Look up a suffix alias (e.g. .txt → less) by suffix only.
Sourcefn lookup_reswd(&self, name: &str) -> Option<LexTok>
fn lookup_reswd(&self, name: &str) -> Option<LexTok>
Resolve a reserved word. Returns the LexTok the word should promote to (e.g. “if” → IF), or None if not a reswd.
Sourcefn mark_in_use(&mut self, name: &str, in_use: bool)
fn mark_in_use(&mut self, name: &str, in_use: bool)
Mark an alias as in-use (recursion guard). Called when an alias is about to be expanded; the matching unmark happens when the alias text has been fully consumed by the lexer.