Package gnu.expr
Class NameLookup
- All Implemented Interfaces:
Map<Object,Declaration>
Manages the set of declarations "currently" in scope.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
Fields inherited from class gnu.kawa.util.AbstractHashTable
DEFAULT_INITIAL_SIZE, mask, num_bindings, table -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhen true, top-level defs should push rather then replace old ones.voidgetCompletingSymbols(String initialPart, int namespace, List<? super String> candidates) static NameLookupgetInstance(Environment env, Language language) Get or create a NameLookup instance for a given Environment.booleanpop(Declaration decl) voidvoidvoidpush(Declaration decl) voidvoidvoidremoveSubsumed(Declaration decl) Remove visible declarations subsumed (hidden) by a given declaration.static voidsetInstance(Environment env, NameLookup instance) voidsetLanguage(Language language) protected booleansubsumedBy(Declaration decl, Declaration other) True if decl subsumes (hides) other.Methods inherited from class gnu.kawa.util.GeneralHashTable
allocEntries, getEntryHashCode, getEntryNext, getNode, makeEntry, setEntryNextMethods inherited from class gnu.kawa.util.AbstractHashTable
clear, entrySet, get, get, getOrDefault, hash, hashToIndex, matches, matches, put, put, rehash, remove, sizeMethods inherited from class java.util.AbstractMap
clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, toString, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
NameLookup
-
-
Method Details
-
getLanguage
-
setLanguage
-
getInstance
Get or create a NameLookup instance for a given Environment. We want the same NameLookup instance to be used for multiple interactive commands in the same "session", to preserve top-level declarations. We do that by registering it in the Environment. -
setInstance
-
doSaveTopLevelRedefs
public boolean doSaveTopLevelRedefs()When true, top-level defs should push rather then replace old ones. Otherwise, a module-level declaration should replace a matching previous declaration, to avoid leaks. However, sometimes we temporarily push new declarations that should not permanently replace old declarations - for example when a hygienic macro changes the current scope. -
pushSaveTopLevelRedefs
public void pushSaveTopLevelRedefs() -
popSaveTopLevelRedefs
public void popSaveTopLevelRedefs() -
push
-
pop
-
push
-
pop
-
removeSubsumed
Remove visible declarations subsumed (hidden) by a given declaration. This is primarily used to avoid memory leaks. -
subsumedBy
True if decl subsumes (hides) other. -
lookup
-
lookup
-
getCompletingSymbols
-