pub struct SymbolTable { /* private fields */ }
Expand description
A symbol table that maps identifiers to information about the values they represent.
This is used to store information about variables and functions that are defined in the program.
Implementations§
Source§impl SymbolTable
impl SymbolTable
Sourcepub fn is_global_scope(&self) -> bool
pub fn is_global_scope(&self) -> bool
Returns true if the symbol table is in the global scope.
Sourcepub fn enter_scope(&mut self)
pub fn enter_scope(&mut self)
Creates a new scope and makes it the active scope.
Sourcepub fn exit_scope(&mut self)
pub fn exit_scope(&mut self)
Exits the current scope and makes the parent scope the active scope.
If the current scope has no symbols declared in it when it is exited, it will not be added to the symbol table.
Sourcepub fn active_scope(&self) -> &Scope
pub fn active_scope(&self) -> &Scope
Returns a reference to the active scope.
Sourcepub fn active_scope_mut(&mut self) -> &mut Scope
pub fn active_scope_mut(&mut self) -> &mut Scope
Returns a mutable reference to the active scope.
Sourcepub fn resolve_item(&self, name: &str) -> Option<&Item>
pub fn resolve_item(&self, name: &str) -> Option<&Item>
Resolves the item with the given name if it exists in the current scope.
Sourcepub fn resolve_item_mark_capture(&mut self, name: &str) -> Option<Symbol>
pub fn resolve_item_mark_capture(&mut self, name: &str) -> Option<Symbol>
Resolves the item with the given name if it exists in the current scope.
If the item was declared in a parent scope, it is added to the set of captures for the current scope.
Sourcepub fn resolve_symbol(&self, name: &str) -> Option<SymbolDecl>
pub fn resolve_symbol(&self, name: &str) -> Option<SymbolDecl>
Resolves an Item::Symbol
with the given name if it exists in the current scope.
Trait Implementations§
Source§impl Clone for SymbolTable
impl Clone for SymbolTable
Source§fn clone(&self) -> SymbolTable
fn clone(&self) -> SymbolTable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more