diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-03 18:58:42 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-03 18:58:42 +0200 |
commit | 172fe17e991e5cdff87a0d794bcb7272e4824c95 (patch) | |
tree | d25055bf520b21a0e40f9e577141b4ed4bcf9d97 | |
parent | 804925fe07251561cfd53e93bece7f3ed259e9cb (diff) |
Make MACROEXPAND-1 aware of symbol macros.
-rw-r--r-- | MLKReadEvalPrintLoop.m | 4 | ||||
-rw-r--r-- | MLKRoot.m | 12 |
2 files changed, 13 insertions, 3 deletions
diff --git a/MLKReadEvalPrintLoop.m b/MLKReadEvalPrintLoop.m index 092c6bd..f2a7803 100644 --- a/MLKReadEvalPrintLoop.m +++ b/MLKReadEvalPrintLoop.m @@ -99,8 +99,6 @@ static const char *prompt (EditLine *e) { } NS_ENDHANDLER; - RELEASE (pool); - printf ("Done.\n\n"); printf ("This is Toilet Lisp, version 0.0.1.\n"); @@ -112,6 +110,8 @@ static const char *prompt (EditLine *e) { forSymbol:[[MLKPackage findPackage:@"TOILET-SYSTEM"] intern:@"*SYSTEM-INITIALISED-P*"]]; + RELEASE (pool); + while (1) { const char *line; @@ -229,12 +229,22 @@ static id truify (BOOL value) id form = [args objectAtIndex:0]; id env = [args count] > 1 ? denullify([args objectAtIndex:1]) : nil; MLKLexicalContext *context = env ? (id)env : (id)[MLKLexicalContext globalContext]; + id <MLKFuncallable> macrofun = nil; if ([form isKindOfClass:[MLKCons class]] && (![form car] || [[form car] isKindOfClass:[MLKSymbol class]]) && [context symbolNamesMacro:[form car]]) { - id <MLKFuncallable> macrofun = [context macroForSymbol:[form car]]; + macrofun = [context macroForSymbol:[form car]]; + } + else if ([form isKindOfClass:[MLKSymbol class]] + && [context symbolNamesSymbolMacro:form]) + { + macrofun = [context symbolMacroForSymbol:[form car]]; + } + + if (macrofun) + { form = denullify ([[macrofun applyToArray: [NSArray arrayWithObjects: form, context, nil]] |