fleshed out GetVar, added Token stack collection, started printing module

This commit is contained in:
Aidan Hahn 2019-11-28 08:57:12 -08:00
parent 516fda54b3
commit 84013cb4a0
No known key found for this signature in database
GPG key ID: 327711E983899316
6 changed files with 89 additions and 2 deletions

View file

@ -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
}