summaryrefslogtreecommitdiff
path: root/MLKInterpreter.m
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-08-07 14:21:27 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-08-07 14:21:27 +0200
commit3329eeafa1f08c5b9d410e57f761011d2e1ac1d6 (patch)
treeeb7fbe019e09e569894f29c37fe9081060ace32c /MLKInterpreter.m
parenta3f6140ef3dde8184ce2b46119e73d9dca63e73f (diff)
Centralise declaration and documentation string handling.
Diffstat (limited to 'MLKInterpreter.m')
-rw-r--r--MLKInterpreter.m48
1 files changed, 9 insertions, 39 deletions
diff --git a/MLKInterpreter.m b/MLKInterpreter.m
index 1dd5e6b..159de2a 100644
--- a/MLKInterpreter.m
+++ b/MLKInterpreter.m
@@ -633,25 +633,14 @@ static MLKSymbol *MULTIPLE_VALUE_CALL;
}
else if (car == _MACROLET)
{
- id declarations;
+ id declarations, doc;
id clauses;
id body;
NSArray *result;
MLKLexicalContext *ctx;
- body = [[program cdr] cdr];
-
- if ([[body car] isKindOfClass:[MLKCons class]]
- && [[body car] car] == DECLARE)
- {
- declarations = [[body car] cdr];
- body = [body cdr];
- }
- else
- {
- declarations = nil;
- }
-
+ MLKSplitDeclarationsDocAndForms (&declarations, &doc, &body,
+ [[program cdr] cdr]);
ctx = LAUTORELEASE ([[MLKLexicalContext alloc]
initWithParent:context
variables:nil
@@ -704,7 +693,7 @@ static MLKSymbol *MULTIPLE_VALUE_CALL;
}
else if (car == _FLET)
{
- id declarations;
+ id declarations, doc;
id clauses;
NSMutableArray *new_clauses;
id body;
@@ -712,18 +701,8 @@ static MLKSymbol *MULTIPLE_VALUE_CALL;
MLKLexicalContext *ctx;
MLKLexicalEnvironment *env;
- body = [[program cdr] cdr];
-
- if ([[body car] isKindOfClass:[MLKCons class]]
- && [[body car] car] == DECLARE)
- {
- declarations = [[body car] cdr];
- body = [body cdr];
- }
- else
- {
- declarations = nil;
- }
+ MLKSplitDeclarationsDocAndForms (&declarations, &doc, &body,
+ [[program cdr] cdr]);
ctx = LAUTORELEASE ([[MLKLexicalContext alloc]
initWithParent:context
@@ -790,7 +769,7 @@ static MLKSymbol *MULTIPLE_VALUE_CALL;
}
else if (car == LET)
{
- id declarations;
+ id declarations, doc;
id clauses;
id body;
NSArray *result;
@@ -799,17 +778,8 @@ static MLKSymbol *MULTIPLE_VALUE_CALL;
MLKLexicalEnvironment *env;
MLKDynamicContext *dynctx;
- body = [[program cdr] cdr];
- if ([[body car] isKindOfClass:[MLKCons class]]
- && [[body car] car] == DECLARE)
- {
- declarations = [[body car] cdr];
- body = [body cdr];
- }
- else
- {
- declarations = nil;
- }
+ MLKSplitDeclarationsDocAndForms (&declarations, &doc, &body,
+ [[program cdr] cdr]);
ctx = LAUTORELEASE ([[MLKLexicalContext alloc]
initWithParent:context