diff options
-rw-r--r-- | MLKPackage.m | 23 | ||||
-rw-r--r-- | MLKReader.m | 10 |
2 files changed, 25 insertions, 8 deletions
diff --git a/MLKPackage.m b/MLKPackage.m index 2757455..3153b74 100644 --- a/MLKPackage.m +++ b/MLKPackage.m @@ -16,6 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#import "MLKDynamicContext.h" #import "MLKPackage.h" #import "MLKSymbol.h" #import "NSObject-MLKPrinting.h" @@ -267,6 +268,17 @@ static NSMutableDictionary *packages = nil; [_accessible_symbols setObject:symbol forKey:name]; [_present_symbols addObject:symbol]; + + if ([_name isEqual:@"KEYWORD"]) + { + // Make keyword symbols self-evaluate. + [[MLKDynamicContext globalContext] addValue:symbol forSymbol:symbol]; + + // Make them external as well. + [self export:symbol]; + + // FIXME: Should finally make them constant, see CLHS 10.2, Type KEYWORD. + } } -(void) inherit:(MLKSymbol *)symbol @@ -290,6 +302,17 @@ static NSMutableDictionary *packages = nil; [self descriptionForLisp]]; [_accessible_symbols setObject:symbol forKey:name]; + + if ([_name isEqual:@"KEYWORD"]) + { + // Make keyword symbols self-evaluate. + [[MLKDynamicContext globalContext] addValue:symbol forSymbol:symbol]; + + // Make them external as well. + [self export:symbol]; + + // FIXME: Should finally make them constant, see CLHS 10.2, Type KEYWORD. + } } -(void) uninherit:(MLKSymbol *)symbol diff --git a/MLKReader.m b/MLKReader.m index a6f11c1..abd8a43 100644 --- a/MLKReader.m +++ b/MLKReader.m @@ -522,20 +522,14 @@ readingUninternedSymbol:(BOOL)readingUninternedSymbol else symbol = [MLKSymbol symbolWithName:symbolName package:nil]; - if (packageMarker == 0) - { - // Make keyword symbols self-evaluate. - [[MLKDynamicContext globalContext] addValue:symbol forSymbol:symbol]; - } - return symbol; } } +(id) readFromString:(NSString *)string { - return [self readFromStream:[[MLKStringInputStream alloc] - initWithString:string] + return [self readFromStream:AUTORELEASE([[MLKStringInputStream alloc] + initWithString:string]) eofError:YES eofValue:nil recursive:NO |