SHS/pkg/shsh/var_table.go
2019-11-28 20:07:28 -08:00

22 lines
509 B
Go

package shsh
type VarTable map[string]*Token
var (
GlobalVarTable *VarTable
)
// 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 scope, dict := range library {
val, ok := dict[arg]
if ok {
scope = scope // TEMP LINE
// TODO: maybe log which scope it was found in?
return val
}
}
return nil
}