summaryrefslogtreecommitdiff
path: root/MLKLexicalContext.m
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-06-27 12:44:25 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-06-27 12:44:25 +0200
commitcb23a76bbd3b7b1ccf4a5ec8894437e449a9047d (patch)
treec3a2a88747a51bf02a4ca028b9a12462eb549ec7 /MLKLexicalContext.m
parent01703b9a42e4dac6ae83127ba8fc224e6f581c92 (diff)
MLKInterpreter: Implement the %LAMBDA operator.
Diffstat (limited to 'MLKLexicalContext.m')
-rw-r--r--MLKLexicalContext.m27
1 files changed, 25 insertions, 2 deletions
diff --git a/MLKLexicalContext.m b/MLKLexicalContext.m
index 85539f1..32c1bf2 100644
--- a/MLKLexicalContext.m
+++ b/MLKLexicalContext.m
@@ -101,6 +101,24 @@ static MLKSymbol *LEXICAL;
return self;
}
++(MLKLexicalContext *) contextWithParent:(MLKLexicalContext *)context
+ variables:(NSSet *)vars
+ functions:(NSSet *)functions
+ goTags:(NSDictionary *)goTags
+ macros:(NSDictionary *)macros
+ symbolMacros:(NSDictionary *)symbolMacros
+ declarations:(id)declarations
+{
+ return AUTORELEASE ([[self alloc]
+ initWithParent:context
+ variables:vars
+ functions:functions
+ goTags:goTags
+ macros:macros
+ symbolMacros:symbolMacros
+ declarations:declarations]);
+}
+
+(MLKLexicalContext *) globalContext
{
return global_context;
@@ -111,7 +129,12 @@ static MLKSymbol *LEXICAL;
return [_macros valueForSymbol:symbol];
}
--(void) setMacro:(MLKFuncallable *)value forSymbol:(MLKSymbol *)symbol
+-(void) addMacro:(id <MLKFuncallable>)value forSymbol:(MLKSymbol *)symbol
+{
+ [_symbolMacros addValue:value forSymbol:symbol];
+}
+
+-(void) setMacro:(id <MLKFuncallable>)value forSymbol:(MLKSymbol *)symbol
{
[_symbolMacros setValue:value forSymbol:symbol];
}
@@ -121,7 +144,7 @@ static MLKSymbol *LEXICAL;
return [_symbolMacros valueForSymbol:symbol];
}
--(void) setSymbolMacro:(MLKFuncallable *)value forSymbol:(MLKSymbol *)symbol
+-(void) setSymbolMacro:(id <MLKFuncallable>)value forSymbol:(MLKSymbol *)symbol
{
[_symbolMacros setValue:value forSymbol:symbol];
}