mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-08 05:35:22 +00:00
Add initial draft of symtable module.
This commit is contained in:
parent
69c4d0b240
commit
de2e496e1f
2 changed files with 3 additions and 2 deletions
|
@ -8,4 +8,4 @@ extern crate log;
|
|||
|
||||
pub mod compile;
|
||||
pub mod error;
|
||||
mod symboltable;
|
||||
pub mod symboltable;
|
||||
|
|
|
@ -36,7 +36,7 @@ pub fn statements_to_symbol_table(
|
|||
Ok(symbol_table)
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum SymbolRole {
|
||||
Global,
|
||||
Nonlocal,
|
||||
|
@ -45,6 +45,7 @@ pub enum SymbolRole {
|
|||
}
|
||||
|
||||
/// Captures all symbols in the current scope, and has a list of subscopes in this scope.
|
||||
#[derive(Clone)]
|
||||
pub struct SymbolScope {
|
||||
/// A set of symbols present on this scope level.
|
||||
pub symbols: HashMap<String, SymbolRole>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue