fleshed out GetVar, added Token stack collection, started printing module
This commit is contained in:
parent
516fda54b3
commit
84013cb4a0
6 changed files with 89 additions and 2 deletions
|
|
@ -13,5 +13,13 @@ var (
|
|||
// Library represents variables defined in inner scope
|
||||
// It is assumed library is ordered from innermost scope to outermost scope
|
||||
func GetVar(arg string, library []VarTable) *Token {
|
||||
|
||||
for dict, scope := library {
|
||||
val, ok := dict[arg]
|
||||
if ok {
|
||||
// TODO: maybe log which scope it was found in?
|
||||
return val
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue