core/scope.nim
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import critbits, strutils import types proc lookupSymbol*(scope: ref MinScope, key: string): MinOperator = if scope.symbols.hasKey(key): return scope.symbols[key] elif scope.parent != nil: return scope.parent.lookupSymbol(key) proc lookupSigil*(scope: ref MinScope, key: string): MinOperator = if scope.sigils.hasKey(key): return scope.sigils[key] elif scope.parent != nil: return scope.parent.lookupSigil(key) proc lookupLocal*(scope: ref MinScope, key: string): MinValue = if scope.locals.hasKey(key): return scope.locals[key] |