Skip to content

Instantly share code, notes, and snippets.

@beelsebob
Created October 31, 2011 20:39
Show Gist options
  • Select an option

  • Save beelsebob/1328840 to your computer and use it in GitHub Desktop.

Select an option

Save beelsebob/1328840 to your computer and use it in GitHub Desktop.
@implementation MapCSSSpecifier
- (id)initWithSyntaxTree:(CPSyntaxTree *)syntaxTree
{
self = [super init];
if ([self class] == [MapCSSSpecifier class])
{
id item = [[syntaxTree children] objectAtIndex:0];
if ([item isKindOfClass:[MapCSSNamed class]])
{
return [[MapCSSNamedSpecifier alloc] initWithSyntaxTree:syntaxTree];
}
else if ([item isKindOfClass:[MapCSSSize class]])
{
return [[MapCSSSizeListSpecifier alloc] initWithSyntaxTree:syntaxTree];
}
else if ([item isKindOfClass:[UIColor class]])
{
return [[MapCSSColourSpecifier alloc] initWithSyntaxTree:syntaxTree];
}
else if ([item isKindOfClass:[MapCSSURL class]])
{
return [[MapCSSURLSpecifier alloc] initWithSyntaxTree:syntaxTree];
}
else
{
return [[MapCSSEvalSpecifier alloc] initWithSyntaxTree:syntaxTree];
}
}
return self;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment