summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Benkard <mulk@minimulk.mst-plus>2008-08-11 12:16:44 +0200
committerMatthias Benkard <mulk@minimulk.mst-plus>2008-08-11 12:16:44 +0200
commitf784dcad0bda2c518cc21df24180019263915da5 (patch)
treefe19873ae10c7da6f4eb5ce393cb45c2cef2341a
parentab43577a31b56bb451d1abc3eb9da2e8afc12509 (diff)
MLKForm: Add method -subforms.
-rw-r--r--MLKForm.h2
-rw-r--r--MLKForm.m99
2 files changed, 99 insertions, 2 deletions
diff --git a/MLKForm.h b/MLKForm.h
index 4fcccf9..29483ef 100644
--- a/MLKForm.h
+++ b/MLKForm.h
@@ -41,6 +41,8 @@
+(id) formWithObject:(id)object
inContext:(MLKLexicalContext *)context
forCompiler:(id)compiler;
+
+-(NSArray *) subforms;
@end
diff --git a/MLKForm.m b/MLKForm.m
index c453ada..34d0b1f 100644
--- a/MLKForm.m
+++ b/MLKForm.m
@@ -78,6 +78,11 @@
inContext:context
forCompiler:compiler]);
}
+
+-(NSArray *) subforms
+{
+ return [NSArray array];
+}
@end
@@ -93,8 +98,6 @@
@implementation MLKSelfEvaluatingForm
-// FIXME
-
+(Class) dispatchClassForObject:(id)object
{
return self;
@@ -246,6 +249,11 @@
{
[self processBody:object inContext:_context];
}
+
+-(NSArray *) subforms
+{
+ return _bodyForms;
+}
@end
@@ -260,6 +268,11 @@
[self splitDeclarationsAndBody:object];
return _declarations;
}
+
+-(NSArray *) subforms
+{
+ return [[super subforms] arrayByAddingObjectsFromArray:_declarationForms];
+}
@end
@@ -278,6 +291,11 @@
LASSIGN (_argumentForms, [_tail array]);
return self;
}
+
+-(NSArray *) subforms
+{
+ return [[super subforms] arrayByAddingObjectsFromArray:_argumentForms];
+}
@end
@@ -289,6 +307,12 @@
LASSIGN (_bodyForms, [[_tail cdr] array]);
return self;
}
+
+-(NSArray *) subforms
+{
+ return [[[super subforms] arrayByAddingObject:_tagForm]
+ arrayByAddingObjectsFromArray:_bodyForms];
+}
@end
@@ -400,6 +424,11 @@
LASSIGN (_lambdaForm, MAKE_FORM ([_tail car]));
return self;
}
+
+-(NSArray *) subforms
+{
+ return [[super subforms] arrayByAddingObject:_lambdaForm];
+}
@end
@@ -422,6 +451,13 @@
LASSIGN (_alternativeForm, MAKE_FORM ([[[_tail cdr] cdr] car]));
return self;
}
+
+-(NSArray *) subforms
+{
+ return [[[[super subforms] arrayByAddingObject:_conditionForm]
+ arrayByAddingObject:_consequentForm]
+ arrayByAddingObject:_alternativeForm];
+}
@end
@@ -539,6 +575,11 @@
inContext:newContext];
return self;
}
+
+-(NSArray *) subforms
+{
+ return [[super subforms] arrayByAddingObjectsFromArray:_functionBindingForms];
+}
@end
@@ -579,6 +620,11 @@
inContext:newContext];
return self;
}
+
+-(NSArray *) subforms
+{
+ return [[super subforms] arrayByAddingObjectsFromArray:_variableBindingForms];
+}
@end
@@ -621,6 +667,11 @@
[self processBody:[_tail cdr]];
return self;
}
+
+-(NSArray *) subforms
+{
+ return [[super subforms] arrayByAddingObject:_functionForm];
+}
@end
@@ -643,6 +694,12 @@
[self processBody:[[_tail cdr] cdr]];
return self;
}
+
+-(NSArray *) subforms
+{
+ return [[[super subforms] arrayByAddingObject:_variableListForm]
+ arrayByAddingObject:_valueListForm];
+}
@end
@@ -677,6 +734,11 @@
LASSIGN (_valueForms, valueForms);
return self;
}
+
+-(NSArray *) subforms
+{
+ return [[super subforms] arrayByAddingObjectsFromArray:_valueForms];
+}
@end
@@ -701,6 +763,11 @@
LASSIGN (_valueForms, valueForms);
return self;
}
+
+-(NSArray *) subforms
+{
+ return [[super subforms] arrayByAddingObjectsFromArray:_valueForms];
+}
@end
@@ -712,6 +779,12 @@
LASSIGN (_valueForm, MAKE_FORM ([[_tail cdr] car]));
return self;
}
+
+-(NSArray *) subforms
+{
+ return [[[super subforms] arrayByAddingObject:_variableForm]
+ arrayByAddingObject:_valueForm];
+}
@end
@@ -723,6 +796,12 @@
LASSIGN (_valueForm, MAKE_FORM ([[_tail cdr] car]));
return self;
}
+
+-(NSArray *) subforms
+{
+ return [[[super subforms] arrayByAddingObject:_functionNameForm]
+ arrayByAddingObject:_valueForm];
+}
@end
@@ -734,6 +813,12 @@
LASSIGN (_valueForm, MAKE_FORM ([[_tail cdr] car]));
return self;
}
+
+-(NSArray *) subforms
+{
+ return [[[super subforms] arrayByAddingObject:_tagForm]
+ arrayByAddingObject:_valueForm];
+}
@end
@@ -745,6 +830,11 @@
[self processBody:[_tail cdr]];
return self;
}
+
+-(NSArray *) subforms
+{
+ return [[super subforms] arrayByAddingObject:_protectedForm];
+}
@end
@@ -804,6 +894,11 @@
return self;
}
+
+-(NSArray *) subforms
+{
+ return [[super subforms] arrayByAddingObject:_valueForm];
+}
@end