From 0f7abae8b9525d60685ae3b9ecc2fb4131c766a4 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 26 Jul 2008 19:23:28 +0200 Subject: Reader: Support quasiquotation. --- MLKRoot.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'MLKRoot.m') diff --git a/MLKRoot.m b/MLKRoot.m index dc2560d..d007173 100644 --- a/MLKRoot.m +++ b/MLKRoot.m @@ -225,10 +225,12 @@ static id truify (BOOL value) +(NSArray *) macroexpand_1:(NSArray *)args { id form = [args objectAtIndex:0]; - id env = [args count] > 1 ? [args objectAtIndex:1] : nil; + id env = [args count] > 1 ? denullify([args objectAtIndex:1]) : nil; MLKLexicalContext *context = env ? (id)env : (id)[MLKLexicalContext globalContext]; - if ([context symbolNamesMacro:[form car]]) + if ([form isKindOfClass:[MLKCons class]] + && (![form car] || [[form car] isKindOfClass:[MLKSymbol class]]) + && [context symbolNamesMacro:[form car]]) { id macrofun = [context macroForSymbol:[form car]]; form = denullify ([[macrofun applyToArray: -- cgit v1.2.3