mirror of
https://github.com/RustPython/Parser.git
synced 2025-08-31 23:57:57 +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 compile;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
mod symboltable;
|
pub mod symboltable;
|
||||||
|
|
|
@ -36,7 +36,7 @@ pub fn statements_to_symbol_table(
|
||||||
Ok(symbol_table)
|
Ok(symbol_table)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum SymbolRole {
|
pub enum SymbolRole {
|
||||||
Global,
|
Global,
|
||||||
Nonlocal,
|
Nonlocal,
|
||||||
|
@ -45,6 +45,7 @@ pub enum SymbolRole {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Captures all symbols in the current scope, and has a list of subscopes in this scope.
|
/// Captures all symbols in the current scope, and has a list of subscopes in this scope.
|
||||||
|
#[derive(Clone)]
|
||||||
pub struct SymbolScope {
|
pub struct SymbolScope {
|
||||||
/// A set of symbols present on this scope level.
|
/// A set of symbols present on this scope level.
|
||||||
pub symbols: HashMap<String, SymbolRole>,
|
pub symbols: HashMap<String, SymbolRole>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue