Browse files

Update GRMustache to v7.0.3

  • Loading branch information...
1 parent 2893533 commit baa210159e00f7eb6dfaa77d6aafa77e9169c926 Stephen Tramer committed Jul 21, 2014
Showing with 2,976 additions and 3,482 deletions.
  1. +1 −0 .gitignore
  2. +0 −122 Common/ThirdParty/GRMustache/GRBoolean.m
  3. +0 −75 Common/ThirdParty/GRMustache/GRMustache.h
  4. +0 −55 Common/ThirdParty/GRMustache/GRMustache.m
  5. +0 −47 Common/ThirdParty/GRMustache/GRMustacheBundleTemplateLoader.m
  6. +0 −31 Common/ThirdParty/GRMustache/GRMustacheBundleTemplateLoader_private.h
  7. +0 −170 Common/ThirdParty/GRMustache/GRMustacheCompiler.m
  8. +0 −41 Common/ThirdParty/GRMustache/GRMustacheCompiler_private.h
  9. +0 −226 Common/ThirdParty/GRMustache/GRMustacheContext.m
  10. +0 −32 Common/ThirdParty/GRMustache/GRMustacheContext_private.h
  11. +0 −67 Common/ThirdParty/GRMustache/GRMustacheDirectoryTemplateLoader.m
  12. +0 −32 Common/ThirdParty/GRMustache/GRMustacheDirectoryTemplateLoader_private.h
  13. +0 −31 Common/ThirdParty/GRMustache/GRMustacheElement_private.h
  14. +0 −27 Common/ThirdParty/GRMustache/GRMustacheError.m
  15. +0 −30 Common/ThirdParty/GRMustache/GRMustacheLambda.h
  16. +0 −67 Common/ThirdParty/GRMustache/GRMustacheLambda.m
  17. +0 −31 Common/ThirdParty/GRMustache/GRMustacheLambda_private.h
  18. +0 −140 Common/ThirdParty/GRMustache/GRMustacheSectionElement.m
  19. +0 −35 Common/ThirdParty/GRMustache/GRMustacheSectionElement_private.h
  20. +0 −198 Common/ThirdParty/GRMustache/GRMustacheTemplate.h
  21. +0 −178 Common/ThirdParty/GRMustache/GRMustacheTemplate.m
  22. +0 −147 Common/ThirdParty/GRMustache/GRMustacheTemplateLoader.h
  23. +0 −168 Common/ThirdParty/GRMustache/GRMustacheTemplateLoader.m
  24. +0 −30 Common/ThirdParty/GRMustache/GRMustacheTemplateLoader_private.h
  25. +0 −119 Common/ThirdParty/GRMustache/GRMustacheTemplateLoader_protected.h
  26. +0 −32 Common/ThirdParty/GRMustache/GRMustacheTemplate_private.h
  27. +0 −56 Common/ThirdParty/GRMustache/GRMustacheTextElement.m
  28. +0 −57 Common/ThirdParty/GRMustache/GRMustacheToken.m
  29. +0 −63 Common/ThirdParty/GRMustache/GRMustacheToken_private.h
  30. +0 −333 Common/ThirdParty/GRMustache/GRMustacheTokenizer.m
  31. +0 −33 Common/ThirdParty/GRMustache/GRMustacheTokenizer_private.h
  32. +0 −35 Common/ThirdParty/GRMustache/GRMustacheURLTemplateLoader.m
  33. +0 −27 Common/ThirdParty/GRMustache/GRMustacheURLTemplateLoader_private.h
  34. +0 −80 Common/ThirdParty/GRMustache/GRMustacheVariableElement.m
  35. +0 −32 Common/ThirdParty/GRMustache/GRMustacheVariableElement_private.h
  36. +0 −76 Common/ThirdParty/GRMustache/GRMustacheVersion.h
  37. +0 −34 Common/ThirdParty/GRMustache/GRMustacheVersion.m
  38. +0 −37 Common/ThirdParty/GRMustache/GRMustache_private.h
  39. +0 −38 Generating/GBDictionaryTemplateLoader.h
  40. +0 −41 Generating/GBDictionaryTemplateLoader.m
  41. +9 −4 Generating/GBTemplateHandler.m
  42. +174 −0 Libraries/GRMustache/GRMustache.h
  43. +93 −0 Libraries/GRMustache/GRMustacheAvailabilityMacros.h
  44. +295 −0 Libraries/GRMustache/GRMustacheConfiguration.h
  45. +32 −42 Common/ThirdParty/GRMustache/GRMustacheError.h → Libraries/GRMustache/GRMustacheContentType.h
  46. +482 −0 Libraries/GRMustache/GRMustacheContext.h
  47. +42 −48 Common/ThirdParty/GRMustache/GRBoolean.h → Libraries/GRMustache/GRMustacheError.h
  48. +125 −0 Libraries/GRMustache/GRMustacheFilter.h
  49. +107 −0 Libraries/GRMustache/GRMustacheLocalizer.h
  50. +129 −0 Libraries/GRMustache/GRMustacheRendering.h
  51. +32 −12 ...Party/GRMustache/GRMustacheTextElement_private.h → Libraries/GRMustache/GRMustacheSafeKeyAccess.h
  52. +153 −0 Libraries/GRMustache/GRMustacheTag.h
  53. +84 −0 Libraries/GRMustache/GRMustacheTagDelegate.h
  54. +382 −0 Libraries/GRMustache/GRMustacheTemplate.h
  55. +577 −0 Libraries/GRMustache/GRMustacheTemplateRepository.h
  56. +19 −9 Common/ThirdParty/GRMustache/GRMustacheElement.m → Libraries/GRMustache/GRMustacheVersion.h
  57. +70 −0 Libraries/GRMustache/NSFormatter+GRMustache.h
  58. +12 −12 .../ThirdParty/GRMustache/GRMustacheElement.h → Libraries/GRMustache/NSValueTransformer+GRMustache.h
  59. BIN Libraries/libGRMustache7-iOS.a
  60. +6 −6 Templates/docset/Contents/Resources/nodes-template.xml
  61. +10 −10 Templates/html/document-template.html
  62. +12 −12 Templates/html/hierarchy-template.html
  63. +13 −13 Templates/html/index-template.html
  64. +75 −75 Templates/html/object-template.html
  65. +42 −166 appledoc.xcodeproj/project.pbxproj
View
1 .gitignore
@@ -2,3 +2,4 @@
build
xcuserdata
project.xcworkspace
+xcshareddata
View
122 Common/ThirdParty/GRMustache/GRBoolean.m
@@ -1,122 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRBoolean.h"
-
-
-static GRYes *yes = nil;
-
-@implementation GRYes
-
-+ (GRYes *)yes {
- if (yes == nil) {
- yes = [[super allocWithZone:NULL] init];
- }
- return yes;
-}
-
-+ (id)allocWithZone:(NSZone *)zone {
- return [[self yes] retain];
-}
-
-- (id)copyWithZone:(NSZone *)zone {
- return self;
-}
-
-- (id)retain {
- return self;
-}
-
-- (NSUInteger)retainCount {
- return NSUIntegerMax; //denotes an object that cannot be released
-}
-
-- (oneway void)release {
- //do nothing
-}
-
-- (id)autorelease {
- return self;
-}
-
-- (id)valueForKey:(NSString *)key {
- return nil;
-}
-
-- (BOOL)boolValue {
- return YES;
-}
-
-- (NSString *)description {
- return @"(yes)";
-}
-
-@end
-
-static GRNo *no = nil;
-
-@implementation GRNo
-
-+ (GRNo *)no {
- if (no == nil) {
- no = [[super allocWithZone:NULL] init];
- }
- return no;
-}
-
-+ (id)allocWithZone:(NSZone *)zone {
- return [[self no] retain];
-}
-
-- (id)copyWithZone:(NSZone *)zone {
- return self;
-}
-
-- (id)retain {
- return self;
-}
-
-- (NSUInteger)retainCount {
- return NSUIntegerMax; //denotes an object that cannot be released
-}
-
-- (oneway void)release {
- //do nothing
-}
-
-- (id)autorelease {
- return self;
-}
-
-- (id)valueForKey:(NSString *)key {
- return nil;
-}
-
-- (BOOL)boolValue {
- return NO;
-}
-
-- (NSString *)description {
- return @"(no)";
-}
-
-@end
View
75 Common/ThirdParty/GRMustache/GRMustache.h
@@ -1,75 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import <Foundation/Foundation.h>
-
-/**
- The GRMustache class provides with global-level information and configuration
- of the GRMustache library.
- @since v1.0.0
- */
-@interface GRMustache: NSObject
-
-//////////////////////////////////////////////////////////////////////////////////////////
-/// @name Handling of boolean properties
-//////////////////////////////////////////////////////////////////////////////////////////
-
-/**
- A Boolean value that determines whether GRMustache renders templates in strict
- boolean mode.
-
- @returns YES if GRMustache renders templates in strict boolean mode,
- NO otherwise. The default value is NO.
-
- In strict boolean mode, properties of context objects that are declared as BOOL
- are interpreted as numbers, and can not be used for controlling Mustache
- boolean sections.
-
- In non-strict boolean mode, all properties declared as signed char (including
- those declared as BOOL), are interpreted as booleans, and can be used for
- controlling Mustache boolean sections.
-
- @see GRMustache#setStrictBooleanMode:
- @see GRYes
- @see GRNo
- @since v1.0.0
- */
-+ (BOOL)strictBooleanMode;
-
-/**
- Sets the strict boolean mode of GMustache.
-
- @param aBool YES if GRMustache should render templates in strict boolean mode,
- NO otherwise.
-
- @see GRMustache#strictBooleanMode
- @since v1.0.0
- */
-+ (void)setStrictBooleanMode:(BOOL)aBool;
-@end
-
-#import "GRMustacheVersion.h"
-#import "GRBoolean.h"
-#import "GRMustacheError.h"
-#import "GRMustacheLambda.h"
-#import "GRMustacheTemplateLoader.h"
-#import "GRMustacheTemplate.h"
View
55 Common/ThirdParty/GRMustache/GRMustache.m
@@ -1,55 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRMustache_private.h"
-#import "GRMustacheLambda_private.h"
-
-
-static BOOL strictBooleanMode = NO;
-
-@implementation GRMustache
-
-+ (BOOL)strictBooleanMode {
- return strictBooleanMode;
-}
-
-+ (void)setStrictBooleanMode:(BOOL)aBool {
- strictBooleanMode = aBool;
-}
-
-+ (GRMustacheObjectKind)objectKind:(id)object {
- if (object == nil || object == [NSNull null] || object == [GRNo no] || ([object isKindOfClass:[NSString class]] && ((NSString*)object).length == 0)) {
- return GRMustacheObjectKindFalseValue;
- }
- if ([object isKindOfClass:[NSDictionary class]]) {
- return GRMustacheObjectKindTrueValue;
- }
- if ([object conformsToProtocol:@protocol(NSFastEnumeration)]) {
- return GRMustacheObjectKindEnumerable;
- }
- if ([object isKindOfClass:[GRMustacheLambdaBlockWrapper class]]) {
- return GRMustacheObjectKindLambda;
- }
- return GRMustacheObjectKindTrueValue;
-}
-
-@end
View
47 Common/ThirdParty/GRMustache/GRMustacheBundleTemplateLoader.m
@@ -1,47 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRMustacheBundleTemplateLoader_private.h"
-
-
-@implementation GRMustacheBundleTemplateLoader
-
-- (id)initWithBundle:(NSBundle *)theBundle extension:(NSString *)ext encoding:(NSStringEncoding)encoding {
- if ((self = [self initWithExtension:ext encoding:encoding])) {
- if (theBundle == nil) {
- theBundle = [NSBundle mainBundle];
- }
- bundle = [theBundle retain];
- }
- return self;
-}
-
-- (id)templateIdForTemplateNamed:(NSString *)name relativeToTemplateId:(id)baseTemplateId {
- return [bundle URLForResource:name withExtension:self.extension];
-}
-
-- (void)dealloc {
- [bundle release];
- [super dealloc];
-}
-
-@end
View
31 Common/ThirdParty/GRMustache/GRMustacheBundleTemplateLoader_private.h
@@ -1,31 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRMustacheURLTemplateLoader_private.h"
-
-
-@interface GRMustacheBundleTemplateLoader: GRMustacheURLTemplateLoader {
-@private
- NSBundle *bundle;
-}
-- (id)initWithBundle:(NSBundle *)bundle extension:(NSString *)ext encoding:(NSStringEncoding)encoding;
-@end
View
170 Common/ThirdParty/GRMustache/GRMustacheCompiler.m
@@ -1,170 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRMustacheCompiler_private.h"
-#import "GRMustacheTemplateLoader_private.h"
-#import "GRMustacheTextElement_private.h"
-#import "GRMustacheVariableElement_private.h"
-#import "GRMustacheSectionElement_private.h"
-#import "GRBoolean.h"
-#import "GRMustacheError.h"
-
-@interface GRMustacheCompiler()
-@property (nonatomic, retain) NSError *error;
-@property (nonatomic, retain) GRMustacheToken *currentSectionOpeningToken;
-- (NSError *)parseErrorAtLine:(NSInteger)line description:(NSString *)description;
-@end
-
-@implementation GRMustacheCompiler
-@synthesize error;
-@synthesize currentSectionOpeningToken;
-
-- (NSArray *)parseString:(NSString *)theTemplateString withTokenProducer:(id<GRMustacheTokenProducer>)tokenProducer templateLoader:(GRMustacheTemplateLoader *)theTemplateLoader templateId:(id)theTemplateId error:(NSError **)outError {
- templateString = theTemplateString;
- templateId = theTemplateId;
- templateLoader = theTemplateLoader;
-
- currentElements = [NSMutableArray arrayWithCapacity:20];
- elementsStack = [[NSMutableArray alloc] initWithCapacity:20];
- [elementsStack addObject:currentElements];
- sectionOpeningTokenStack = [[NSMutableArray alloc] initWithCapacity:20];
-
- [tokenProducer parseTemplateString:templateString forTokenConsumer:self];
-
- if (error == nil && currentSectionOpeningToken) {
- self.error = [self parseErrorAtLine:currentSectionOpeningToken.line
- description:[NSString stringWithFormat:@"Unclosed `%@` section", currentSectionOpeningToken.content]];
- }
-
- if (error) {
- if (outError != NULL) {
- *outError = error;
- }
- return nil;
- }
-
- [currentElements retain];
- [elementsStack release];
- [sectionOpeningTokenStack release];
- return [currentElements autorelease];
-}
-
-- (void)dealloc {
- [error release];
- [currentSectionOpeningToken release];
- [super dealloc];
-}
-
-#pragma mark GRMustacheTokenConsumer
-
-- (BOOL)tokenProducer:(id<GRMustacheTokenProducer>)tokenProducer shouldContinueParsingAfterReadingToken:(GRMustacheToken *)token {
- switch (token.type) {
- case GRMustacheTokenTypeText:
- [currentElements addObject:[GRMustacheTextElement textElementWithString:token.content]];
- break;
-
- case GRMustacheTokenTypeComment:
- break;
-
- case GRMustacheTokenTypeEscapedVariable:
- [currentElements addObject:[GRMustacheVariableElement variableElementWithName:token.content raw:NO]];
- break;
-
- case GRMustacheTokenTypeUnescapedVariable:
- [currentElements addObject:[GRMustacheVariableElement variableElementWithName:token.content raw:YES]];
- break;
-
- case GRMustacheTokenTypeSectionOpening:
- case GRMustacheTokenTypeInvertedSectionOpening:
- self.currentSectionOpeningToken = token;
- [sectionOpeningTokenStack addObject:token];
-
- currentElements = [NSMutableArray array];
- [elementsStack addObject:currentElements];
- break;
-
- case GRMustacheTokenTypeSectionClosing:
- if ([token.content isEqualToString:currentSectionOpeningToken.content]) {
- NSRange currentSectionOpeningTokenRange = currentSectionOpeningToken.range;
- GRMustacheSectionElement *section = [GRMustacheSectionElement sectionElementWithName:currentSectionOpeningToken.content
- string:[templateString substringWithRange:NSMakeRange(currentSectionOpeningTokenRange.location + currentSectionOpeningTokenRange.length, token.range.location - currentSectionOpeningTokenRange.location - currentSectionOpeningTokenRange.length)]
- inverted:currentSectionOpeningToken.type == GRMustacheTokenTypeInvertedSectionOpening
- elements:currentElements];
- [sectionOpeningTokenStack removeLastObject];
- self.currentSectionOpeningToken = [sectionOpeningTokenStack lastObject];
-
- [elementsStack removeLastObject];
- currentElements = [elementsStack lastObject];
-
- [currentElements addObject:section];
- } else {
- self.error = [self parseErrorAtLine:token.line description:[NSString stringWithFormat:@"Unexpected `%@` section closing tag", token.content]];
- return NO;
- }
- break;
-
- case GRMustacheTokenTypePartial: {
- NSError *partialError;
- GRMustacheTemplate *partialTemplate = [templateLoader parseTemplateNamed:token.content
- relativeToTemplateId:templateId
- error:&partialError];
- if (partialTemplate == nil) {
- self.error = partialError;
- return NO;
- } else {
- [currentElements addObject:partialTemplate];
- }
- } break;
-
- case GRMustacheTokenTypeSetDelimiter:
- // ignore
- break;
-
- default:
- NSAssert(NO, nil);
- break;
-
- }
- return YES;
-}
-
-- (void)tokenProducerDidStart:(id<GRMustacheTokenProducer>)tokenProducer {
-}
-
-- (void)tokenProducerDidFinish:(id<GRMustacheTokenProducer>)tokenProducer withError:(NSError *)theError {
- self.error = theError;
-}
-
-#pragma mark Private
-
-- (NSError *)parseErrorAtLine:(NSInteger)line description:(NSString *)description {
- NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithCapacity:3];
- [userInfo setObject:[NSString stringWithFormat:@"Parse error at line %ld: %@", line, description]
- forKey:NSLocalizedDescriptionKey];
- [userInfo setObject:[NSNumber numberWithInteger:line]
- forKey:GRMustacheErrorLine];
- return [NSError errorWithDomain:GRMustacheErrorDomain
- code:GRMustacheErrorCodeParseError
- userInfo:userInfo];
-}
-
-@end
View
41 Common/ThirdParty/GRMustache/GRMustacheCompiler_private.h
@@ -1,41 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import <Foundation/Foundation.h>
-#import "GRMustacheToken_private.h"
-
-
-@class GRMustacheTemplateLoader;
-
-@interface GRMustacheCompiler : NSObject<GRMustacheTokenConsumer> {
-@private
- NSError *error;
- NSString *templateString;
- GRMustacheTemplateLoader *templateLoader;
- id templateId;
- NSMutableArray *elementsStack;
- NSMutableArray *sectionOpeningTokenStack;
- NSMutableArray *currentElements;
- GRMustacheToken *currentSectionOpeningToken;
-}
-- (NSArray *)parseString:(NSString *)templateString withTokenProducer:(id<GRMustacheTokenProducer>)tokenProducer templateLoader:(GRMustacheTemplateLoader *)templateLoader templateId:(id)templateId error:(NSError **)outError;
-@end
View
226 Common/ThirdParty/GRMustache/GRMustacheContext.m
@@ -1,226 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#if (TARGET_OS_IPHONE)
-// http://iphonedevelopment.blogspot.com/2008/10/device-vs-simulator.html
-#import <objc/runtime.h>
-#import <objc/message.h>
-#else
-#import <objc/objc-runtime.h>
-#endif
-
-#import "GRMustache_private.h"
-#import "GRMustacheContext_private.h"
-
-
-static NSInteger BOOLPropertyType = NSNotFound;
-
-@interface GRMustacheProperty: NSObject
-@property BOOL BOOLProperty;
-+ (BOOL)class:(Class)class hasBOOLPropertyNamed:(NSString *)propertyName;
-@end
-
-@implementation GRMustacheProperty
-@dynamic BOOLProperty;
-
-+ (NSInteger)typeForPropertyNamed:(NSString *)propertyName ofClass:(Class)class {
- objc_property_t property = class_getProperty(class, [propertyName cStringUsingEncoding:NSUTF8StringEncoding]);
- if (property != NULL) {
- const char *attributesCString = property_getAttributes(property);
- while (attributesCString) {
- if (attributesCString[0] == 'T') {
- return attributesCString[1];
- }
- attributesCString = strchr(attributesCString, ',');
- if (attributesCString) {
- attributesCString++;
- }
- }
- }
- return NSNotFound;
-}
-
-+ (BOOL)class:(Class)class hasBOOLPropertyNamed:(NSString *)propertyName {
- static NSMutableDictionary *classes = nil;
-
- if (classes == nil) {
- classes = [[NSMutableDictionary dictionaryWithCapacity:12] retain];
- }
-
- NSMutableDictionary *propertyNames = [classes objectForKey:NSStringFromClass(class)];
- if (propertyNames == nil) {
- propertyNames = [[NSMutableDictionary dictionaryWithCapacity:4] retain];
- [classes setObject:propertyNames forKey:NSStringFromClass(class)];
- }
-
- NSNumber *boolNumber = [propertyNames objectForKey:propertyName];
- if (boolNumber == nil) {
- if (BOOLPropertyType == NSNotFound) {
- BOOLPropertyType = [self typeForPropertyNamed:@"BOOLProperty" ofClass:self];
- }
- BOOL booleanProperty = ([self typeForPropertyNamed:propertyName ofClass:class] == BOOLPropertyType);
- [propertyNames setObject:[NSNumber numberWithBool:booleanProperty] forKey:propertyName];
- return booleanProperty;
- }
-
- return [boolNumber boolValue];
-
-}
-
-@end
-
-
-@interface GRMustacheContext()
-@property (nonatomic, retain) id object;
-@property (nonatomic, retain) GRMustacheContext *parent;
-- (id)initWithObject:(id)object parent:(GRMustacheContext *)parent;
-- (BOOL)shouldConsiderObjectValue:(id)value forKey:(NSString *)key asBoolean:(BOOL *)outBool;
-- (id)valueForKeyComponent:(NSString *)key foundInContext:(GRMustacheContext **)outContext;
-@end
-
-
-@implementation GRMustacheContext
-@synthesize object;
-@synthesize parent;
-
-+ (id)contextWithObject:(id)object {
- return [self contextWithObject:object parent:nil];
-}
-
-+ (id)contextWithObject:(id)object parent:(GRMustacheContext *)parent {
- return [[[self alloc] initWithObject:object parent:parent] autorelease];
-}
-
-- (id)initWithObject:(id)theObject parent:(GRMustacheContext *)theParent {
- if ((self = [self init])) {
- object = [theObject retain];
- parent = [theParent retain];
- }
- return self;
-}
-
-- (id)valueForKey:(NSString *)key {
- NSArray *components = [key componentsSeparatedByString:@"/"];
-
- if (components.count == 1) {
- if ([key isEqualToString:@"."]) {
- return object;
- }
- if ([key isEqualToString:@".."]) {
- if (parent == nil) {
- // went too far
- return nil;
- }
- return parent.object;
- }
- return [self valueForKeyComponent:key foundInContext:nil];
- }
-
- GRMustacheContext *context = self;
- for (NSString *component in components) {
- if (component.length == 0) {
- continue;
- }
- if ([component isEqualToString:@"."]) {
- continue;
- }
- if ([component isEqualToString:@".."]) {
- context = context.parent;
- if (context == nil) {
- // went too far
- return nil;
- }
- continue;
- }
- GRMustacheContext *valueContext = nil;
- id value = [context valueForKeyComponent:component foundInContext:&valueContext];
- if (value == nil) {
- return nil;
- }
- context = [GRMustacheContext contextWithObject:value parent:valueContext];
- }
- return context.object;
-}
-
-- (void)dealloc {
- [object release];
- [parent release];
- [super dealloc];
-}
-
-- (id)valueForKeyComponent:(NSString *)key foundInContext:(GRMustacheContext **)outContext {
- id value = nil;
- @try {
- value = [object valueForKey:key];
- }
- @catch (NSException *exception) {
- if (![[exception name] isEqualToString:NSUndefinedKeyException] ||
- [[exception userInfo] objectForKey:@"NSTargetObjectUserInfoKey"] != object ||
- ![[[exception userInfo] objectForKey:@"NSUnknownUserInfoKey"] isEqualToString:key])
- {
- // that's some exception we are not related to
- @throw;
- }
- }
-
- if (value != nil) {
- if (outContext != NULL) {
- *outContext = self;
- }
- BOOL boolValue;
- if ([self shouldConsiderObjectValue:value forKey:key asBoolean:&boolValue]) {
- if (boolValue) {
- return [GRYes yes];
- } else {
- return [GRNo no];
- }
- }
- return value;
- }
-
- if (parent == nil) {
- return nil;
- }
-
- return [parent valueForKeyComponent:key foundInContext:outContext];
-}
-
-- (BOOL)shouldConsiderObjectValue:(id)value forKey:(NSString *)key asBoolean:(BOOL *)outBool {
- // C99 bool type
- if (CFBooleanGetTypeID() == CFGetTypeID(value)) {
- if (outBool) {
- *outBool = CFBooleanGetValue((CFBooleanRef)value);
- }
- return YES;
- }
-
- if (![GRMustache strictBooleanMode] && [value isKindOfClass:[NSNumber class]] && [GRMustacheProperty class:[object class] hasBOOLPropertyNamed:key]) {
- if (outBool) {
- *outBool = [(NSNumber *)value boolValue];
- }
- return YES;
- }
-
- return NO;
-}
-
-@end
View
32 Common/ThirdParty/GRMustache/GRMustacheContext_private.h
@@ -1,32 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-
-@interface GRMustacheContext: NSObject {
-@private
- id object;
- GRMustacheContext *parent;
-}
-+ (id)contextWithObject:(id)object;
-+ (id)contextWithObject:(id)object parent:(GRMustacheContext *)parent;
-- (id)valueForKey:(NSString *)key;
-@end
View
67 Common/ThirdParty/GRMustache/GRMustacheDirectoryTemplateLoader.m
@@ -1,67 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRMustacheDirectoryTemplateLoader_private.h"
-
-
-@implementation GRMustacheDirectoryTemplateLoader
-
-- (id)initWithURL:(NSURL *)theURL extension:(NSString *)ext encoding:(NSStringEncoding)encoding {
- if ((self = [super initWithExtension:ext encoding:encoding])) {
- url = [theURL retain];
- }
- return self;
-}
-
-- (id)templateIdForTemplateNamed:(NSString *)name relativeToTemplateId:(id)baseTemplateId {
- if (baseTemplateId) {
- NSAssert([baseTemplateId isKindOfClass:[NSURL class]], nil);
- if (self.extension.length == 0) {
- return [[NSURL URLWithString:name relativeToURL:(NSURL *)baseTemplateId] URLByStandardizingPath];
- }
- return [[NSURL URLWithString:[name stringByAppendingPathExtension:self.extension] relativeToURL:(NSURL *)baseTemplateId] URLByStandardizingPath];
- }
- if (self.extension.length == 0) {
- return [[url URLByAppendingPathComponent:name] URLByStandardizingPath];
- }
- return [[[url URLByAppendingPathComponent:name] URLByAppendingPathExtension:self.extension] URLByStandardizingPath];
-}
-
-- (GRMustacheTemplate *)parseContentsOfURL:(NSURL *)templateURL error:(NSError **)outError {
- NSString *templateString = [NSString stringWithContentsOfURL:templateURL encoding:self.encoding error:outError];
- if (!templateString) {
- return nil;
- }
- GRMustacheTemplate *template = [self parseString:templateString error:outError];
- if (!template) {
- return nil;
- }
- [self setTemplate:template forTemplateId:templateURL];
- return template;
-}
-
-- (void)dealloc {
- [url release];
- [super dealloc];
-}
-
-@end
View
32 Common/ThirdParty/GRMustache/GRMustacheDirectoryTemplateLoader_private.h
@@ -1,32 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRMustacheURLTemplateLoader_private.h"
-
-
-@interface GRMustacheDirectoryTemplateLoader: GRMustacheURLTemplateLoader {
-@private
- NSURL *url;
-}
-- (id)initWithURL:(NSURL *)url extension:(NSString *)ext encoding:(NSStringEncoding)encoding;
-- (GRMustacheTemplate *)parseContentsOfURL:(NSURL *)templateURL error:(NSError **)outError;
-@end
View
31 Common/ThirdParty/GRMustache/GRMustacheElement_private.h
@@ -1,31 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import <Foundation/Foundation.h>
-
-
-@class GRMustacheContext;
-
-@protocol GRMustacheElement
-@required
-- (NSString *)renderContext:(GRMustacheContext *)context;
-@end
View
27 Common/ThirdParty/GRMustache/GRMustacheError.m
@@ -1,27 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRMustacheError.h"
-
-
-NSString* const GRMustacheErrorDomain = @"GRMustacheErrorDomain";
-NSString* const GRMustacheErrorLine = @"GRMustacheErrorLine";
View
30 Common/ThirdParty/GRMustache/GRMustacheLambda.h
@@ -1,30 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import <Foundation/Foundation.h>
-
-
-typedef NSString *(^GRMustacheRenderer)(id object);
-typedef NSString *(^GRMustacheLambdaBlock)(GRMustacheRenderer, id, NSString *);
-typedef id GRMustacheLambda;
-
-GRMustacheLambda GRMustacheLambdaMake(GRMustacheLambdaBlock block);
View
67 Common/ThirdParty/GRMustache/GRMustacheLambda.m
@@ -1,67 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRMustacheLambda_private.h"
-
-
-@interface GRMustacheLambdaBlockWrapper()
-+ (id)lambdaWithBlock:(GRMustacheLambdaBlock)block;
-- (id)initWithBlock:(GRMustacheLambdaBlock)block;
-@end
-
-
-@implementation GRMustacheLambdaBlockWrapper
-
-+ (id)lambdaWithBlock:(GRMustacheLambdaBlock)block {
- return [[[self alloc] initWithBlock:block] autorelease];
-}
-
-- (id)initWithBlock:(GRMustacheLambdaBlock)theBlock {
- if ((self = [self init])) {
- block = [theBlock copy];
- }
- return self;
-}
-
-- (NSString *)renderObject:(id)object fromString:(NSString *)templateString renderer:(GRMustacheRenderer)renderer {
- NSString *result = block(renderer, object, templateString);
- if (result == nil) {
- return @"";
- }
- return result;
-}
-
-- (NSString *)description {
- return @"<GRMustacheLambda>";
-}
-
-- (void)dealloc {
- [block release];
- [super dealloc];
-}
-
-@end
-
-
-GRMustacheLambda GRMustacheLambdaMake(GRMustacheLambdaBlock block) {
- return [GRMustacheLambdaBlockWrapper lambdaWithBlock:block];
-}
View
31 Common/ThirdParty/GRMustache/GRMustacheLambda_private.h
@@ -1,31 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRMustacheLambda.h"
-
-
-@interface GRMustacheLambdaBlockWrapper: NSObject {
-@private
- GRMustacheLambdaBlock block;
-}
-- (NSString *)renderObject:(id)object fromString:(NSString *)templateString renderer:(GRMustacheRenderer)renderer;
-@end
View
140 Common/ThirdParty/GRMustache/GRMustacheSectionElement.m
@@ -1,140 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRMustache_private.h"
-#import "GRMustacheContext_private.h"
-#import "GRMustacheTemplate_private.h"
-#import "GRMustacheLambda_private.h"
-#import "GRMustacheSectionElement_private.h"
-
-
-@interface GRMustacheSectionElement()
-@property (nonatomic, retain) NSString *name;
-@property (nonatomic, retain) NSString *templateString;
-@property (nonatomic) BOOL inverted;
-@property (nonatomic, retain) NSArray *elems;
-- (id)initWithName:(NSString *)name string:(NSString *)templateString inverted:(BOOL)inverted elements:(NSArray *)elems;
-@end
-
-
-@implementation GRMustacheSectionElement
-@synthesize templateString;
-@synthesize name;
-@synthesize inverted;
-@synthesize elems;
-
-+ (id)sectionElementWithName:(NSString *)name string:(NSString *)templateString inverted:(BOOL)inverted elements:(NSArray *)elems {
- return [[[self alloc] initWithName:name string:templateString inverted:inverted elements:elems] autorelease];
-}
-
-- (id)initWithName:(NSString *)theName string:(NSString *)theTemplateString inverted:(BOOL)theInverted elements:(NSArray *)theElems {
- if ((self = [self init])) {
- self.name = theName;
- self.templateString = theTemplateString;
- self.inverted = theInverted;
- self.elems = theElems;
- }
- return self;
-}
-
-- (NSString *)renderContext:(GRMustacheContext *)context {
- id value = [context valueForKey:name];
- NSMutableString *buffer= [NSMutableString stringWithCapacity:1024];
-
- switch([GRMustache objectKind:value]) {
- case GRMustacheObjectKindFalseValue:
- if (inverted) {
- for (NSObject<GRMustacheElement> *elem in elems) {
- [buffer appendString:[elem renderContext:context]];
- }
- }
- break;
-
- case GRMustacheObjectKindTrueValue:
- if (!inverted) {
- GRMustacheContext *innerContext = [GRMustacheContext contextWithObject:value parent:context];
- for (NSObject<GRMustacheElement> *elem in elems) {
- [buffer appendString:[elem renderContext:innerContext]];
- }
- }
- break;
-
- case GRMustacheObjectKindEnumerable:
- if (inverted) {
- BOOL empty = YES;
- for (id object in value) {
- empty = NO;
- break;
- }
- if (empty) {
- for (NSObject<GRMustacheElement> *elem in elems) {
- [buffer appendString:[elem renderContext:context]];
- }
- }
- } else {
- for (id object in value) {
- GRMustacheContext *innerContext = [GRMustacheContext contextWithObject:object parent:context];
- for (NSObject<GRMustacheElement> *elem in elems) {
- [buffer appendString:[elem renderContext:innerContext]];
- }
- }
- }
- break;
-
- case GRMustacheObjectKindLambda:
- if (!inverted) {
- GRMustacheRenderer renderer = ^(id object){
- GRMustacheContext *renderedContext;
- if ([object isKindOfClass:[GRMustacheContext class]]) {
- renderedContext = object;
- } else {
- renderedContext = [GRMustacheContext contextWithObject:object parent:context];
- }
- NSMutableString *result = [NSMutableString stringWithCapacity:1024];
- for (NSObject<GRMustacheElement> *elem in elems) {
- [result appendString:[elem renderContext:renderedContext]];
- }
- return (NSString *)result;
- };
- [buffer appendString:[(GRMustacheLambdaBlockWrapper *)value renderObject:context
- fromString:templateString
- renderer:renderer]];
- }
- break;
-
- default:
- // should not be here
- NSAssert(NO, nil);
- }
-
- return buffer;
-}
-
-- (void)dealloc {
- [name release];
- [templateString release];
- [elems release];
- [super dealloc];
-}
-
-
-@end
View
35 Common/ThirdParty/GRMustache/GRMustacheSectionElement_private.h
@@ -1,35 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import <Foundation/Foundation.h>
-#import "GRMustacheElement_private.h"
-
-
-@interface GRMustacheSectionElement: NSObject<GRMustacheElement> {
-@private
- NSString *name;
- NSString *templateString;
- BOOL inverted;
- NSArray *elems;
-}
-+ (id)sectionElementWithName:(NSString *)name string:(NSString *)templateString inverted:(BOOL)inverted elements:(NSArray *)elems;
-@end
View
198 Common/ThirdParty/GRMustache/GRMustacheTemplate.h
@@ -1,198 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRMustacheElement_private.h"
-
-
-@class GRMustacheTemplateLoader;
-
-
-/**
- The GRMustacheTemplate class provides with Mustache template rendering services.
-
- @since v1.0.0
- */
-@interface GRMustacheTemplate: NSObject<GRMustacheElement> {
-@private
- GRMustacheTemplateLoader *templateLoader;
- NSString *templateId;
- NSString *templateString;
- NSString *otag;
- NSString *ctag;
- NSInteger p;
- NSInteger curline;
- NSMutableArray *elems;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////
-/// @name Rendering
-//////////////////////////////////////////////////////////////////////////////////////////
-
-/**
- Renders a context object from a template string
-
- @returns A string containing the rendered template
- @param object A context object used for interpreting Mustache tags
- @param templateString The template string
- @param outError If there is an error loading or parsing template and partials, upon return
- contains an NSError object that describes the problem.
-
- @since v1.0.0
- */
-+ (NSString *)renderObject:(id)object fromString:(NSString *)templateString error:(NSError **)outError;
-
-/**
- Renders a context object from a file template.
-
- @returns A string containing the rendered template
- @param object A context object used for interpreting Mustache tags
- @param url The URL of the template
- @param outError If there is an error loading or parsing template and partials, upon return
- contains an NSError object that describes the problem.
-
- The template at url must be encoded in UTF8. See the GRMustacheTemplateLoader class for more encoding options.
-
- @since v1.0.0
- */
-+ (NSString *)renderObject:(id)object fromContentsOfURL:(NSURL *)url error:(NSError **)outError;
-
-/**
- Renders a context object from a bundle resource template.
-
- @returns A string containing the rendered template
- @param object A context object used for interpreting Mustache tags
- @param name The name of a bundle resource of extension "mustache"
- @param bundle The bundle where to look for the template resource
- @param outError If there is an error loading or parsing template and partials, upon return
- contains an NSError object that describes the problem.
-
- If you provide nil as a bundle, the resource will be looked in the main bundle.
-
- The template resource must be encoded in UTF8. See the GRMustacheTemplateLoader class for more encoding options.
-
- @since v1.0.0
- */
-+ (NSString *)renderObject:(id)object fromResource:(NSString *)name bundle:(NSBundle *)bundle error:(NSError **)outError;
-
-/**
- Renders a context object from a bundle resource template.
-
- @returns A string containing the rendered template
- @param object A context object used for interpreting Mustache tags
- @param name The name of a bundle resource
- @param ext The extension of the bundle resource
- @param bundle The bundle where to look for the template resource.
- @param outError If there is an error loading or parsing template and partials, upon return
- contains an NSError object that describes the problem.
-
- If you provide nil as a bundle, the resource will be looked in the main bundle.
-
- The template resource must be encoded in UTF8. See the GRMustacheTemplateLoader class for more encoding options.
-
- @since v1.0.0
- */
-+ (NSString *)renderObject:(id)object fromResource:(NSString *)name withExtension:(NSString *)ext bundle:(NSBundle *)bundle error:(NSError **)outError;
-
-/**
- Renders a template with a context object.
-
- @returns A string containing the rendered template
- @param object A context object used for interpreting Mustache tags
-
- @since v1.0.0
- */
-- (NSString *)renderObject:(id)object;
-
-/**
- Renders a template without any context object for interpreting Mustache tags.
-
- @returns A string containing the rendered template
-
- @since v1.0.0
- */
-- (NSString *)render;
-
-//////////////////////////////////////////////////////////////////////////////////////////
-/// @name Parsing
-//////////////////////////////////////////////////////////////////////////////////////////
-
-/**
- Parses a template string, and returns a compiled template.
-
- @returns A GRMustacheTemplate instance
- @param templateString The template string
- @param outError If there is an error loading or parsing template and partials, upon return
- contains an NSError object that describes the problem.
-
- @since v1.0.0
- */
-+ (id)parseString:(NSString *)templateString error:(NSError **)outError;
-
-/**
- Parses a template file, and returns a compiled template.
-
- @returns A GRMustacheTemplate instance
- @param url The URL of the template
- @param outError If there is an error loading or parsing template and partials, upon return
- contains an NSError object that describes the problem.
-
- The template at url must be encoded in UTF8. See the GRMustacheTemplateLoader class for more encoding options.
-
- @since v1.0.0
- */
-+ (id)parseContentsOfURL:(NSURL *)url error:(NSError **)outError;
-
-/**
- Parses a bundle resource template, and returns a compiled template.
-
- @returns A GRMustacheTemplate instance
- @param name The name of a bundle resource of extension "mustache"
- @param bundle The bundle where to look for the template resource
- @param outError If there is an error loading or parsing template and partials, upon return
- contains an NSError object that describes the problem.
-
- If you provide nil as a bundle, the resource will be looked in the main bundle.
-
- The template resource must be encoded in UTF8. See the GRMustacheTemplateLoader class for more encoding options.
-
- @since v1.0.0
- */
-+ (id)parseResource:(NSString *)name bundle:(NSBundle *)bundle error:(NSError **)outError;
-
-/**
- Parses a bundle resource template, and returns a compiled template.
-
- @returns A GRMustacheTemplate instance
- @param name The name of a bundle resource
- @param ext The extension of the bundle resource
- @param bundle The bundle where to look for the template resource
- @param outError If there is an error loading or parsing template and partials, upon return
- contains an NSError object that describes the problem.
-
- If you provide nil as a bundle, the resource will be looked in the main bundle.
-
- The template resource must be encoded in UTF8. See the GRMustacheTemplateLoader class for more encoding options.
-
- @since v1.0.0
- */
-+ (id)parseResource:(NSString *)name withExtension:(NSString *)ext bundle:(NSBundle *)bundle error:(NSError **)outError;
-@end
View
178 Common/ThirdParty/GRMustache/GRMustacheTemplate.m
@@ -1,178 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRMustache_private.h"
-#import "GRMustacheTemplate_private.h"
-#import "GRMustacheTemplateLoader_private.h"
-#import "GRMustacheDirectoryTemplateLoader_private.h"
-#import "GRMustacheContext_private.h"
-#import "GRMustacheCompiler_private.h"
-#import "GRMustacheTokenizer_private.h"
-
-
-@interface GRMustacheTemplate()
-@property (nonatomic, retain) GRMustacheTemplateLoader *templateLoader;
-@property (nonatomic, retain) NSString *templateString;
-@property (nonatomic, retain) NSString *otag;
-@property (nonatomic, retain) NSString *ctag;
-@property (nonatomic) NSInteger p;
-@property (nonatomic) NSInteger curline;
-@property (nonatomic, retain) NSMutableArray *elems;
-- (id)initWithString:(NSString *)templateString templateId:(id)templateId templateLoader:(GRMustacheTemplateLoader *)templateLoader;
-@end
-
-
-@implementation GRMustacheTemplate
-@synthesize templateId;
-@synthesize templateLoader;
-@synthesize templateString;
-@synthesize otag;
-@synthesize ctag;
-@synthesize p;
-@synthesize curline;
-@synthesize elems;
-
-
-+ (NSString *)renderObject:(id)object fromString:(NSString *)templateString error:(NSError **)outError {
- GRMustacheTemplate *template = [GRMustacheTemplate parseString:templateString error:outError];
- if (template == nil) {
- return nil;
- }
- return [template renderObject:object];
-}
-
-+ (NSString *)renderObject:(id)object fromContentsOfURL:(NSURL *)url error:(NSError **)outError {
- GRMustacheTemplate *template = [GRMustacheTemplate parseContentsOfURL:url error:outError];
- if (template == nil) {
- return nil;
- }
- return [template renderObject:object];
-}
-
-+ (NSString *)renderObject:(id)object fromResource:(NSString *)name bundle:(NSBundle *)bundle error:(NSError **)outError {
- GRMustacheTemplate *template = [GRMustacheTemplate parseResource:name bundle:bundle error:outError];
- if (template == nil) {
- return nil;
- }
- return [template renderObject:object];
-}
-
-+ (NSString *)renderObject:(id)object fromResource:(NSString *)name withExtension:(NSString *)ext bundle:(NSBundle *)bundle error:(NSError **)outError {
- GRMustacheTemplate *template = [GRMustacheTemplate parseResource:name withExtension:ext bundle:bundle error:outError];
- if (template == nil) {
- return nil;
- }
- return [template renderObject:object];
-}
-
-+ (id)parseString:(NSString *)templateString error:(NSError **)outError {
- return [[GRMustacheTemplateLoader templateLoaderWithBundle:[NSBundle mainBundle]]
- parseString:templateString
- error:outError];
-}
-
-+ (id)parseContentsOfURL:(NSURL *)url error:(NSError **)outError {
- id loader = [GRMustacheTemplateLoader templateLoaderWithBaseURL:[url URLByDeletingLastPathComponent] extension:[url pathExtension]];
- NSAssert([loader isKindOfClass:[GRMustacheDirectoryTemplateLoader class]], nil);
- return [(GRMustacheDirectoryTemplateLoader *)loader parseContentsOfURL:url error:outError];
-}
-
-+ (id)parseResource:(NSString *)name bundle:(NSBundle *)bundle error:(NSError **)outError {
- return [[GRMustacheTemplateLoader templateLoaderWithBundle:bundle]
- parseTemplateNamed:name
- error:outError];
-}
-
-+ (id)parseResource:(NSString *)name withExtension:(NSString *)ext bundle:(NSBundle *)bundle error:(NSError **)outError {
- return [[GRMustacheTemplateLoader templateLoaderWithBundle:bundle extension:ext]
- parseTemplateNamed:name
- error:outError];
-}
-
-- (void)dealloc {
- [templateId release];
- [templateLoader release];
- [templateString release];
- [otag release];
- [ctag release];
- [elems release];
- [super dealloc];
-}
-
-- (NSString *)render {
- return [self renderObject:nil];
-}
-
-- (NSString *)renderObject:(id)object {
- return [self renderContext:[GRMustacheContext contextWithObject:object]];
-}
-
-- (NSString *)renderContext:(GRMustacheContext *)context {
- NSMutableString *buffer = [NSMutableString stringWithCapacity:templateString.length];
- for (NSObject<GRMustacheElement> *elem in elems) {
- [buffer appendString:[elem renderContext:context]];
- }
- return buffer;
-}
-
-
-+ (id)templateWithString:(NSString *)templateString templateId:(id)templateId templateLoader:(GRMustacheTemplateLoader *)templateLoader {
- return [[[self alloc] initWithString:templateString templateId:templateId templateLoader:templateLoader] autorelease];
-}
-
-- (id)initWithString:(NSString *)theTemplateString templateId:(id)theTemplateId templateLoader:(GRMustacheTemplateLoader *)theTemplateLoader {
- NSAssert(theTemplateLoader, @"Can't init GRMustacheTemplate with nil template loader");
- NSAssert(theTemplateString, @"Can't init GRMustacheTemplate with nil template string");
-
- self = [super init];
- if (self) {
- self.templateId = theTemplateId;
- self.templateLoader = theTemplateLoader;
- self.templateString = theTemplateString;
- self.otag = @"{{";
- self.ctag = @"}}";
- self.p = 0;
- self.curline = 1;
- self.elems = [NSMutableArray arrayWithCapacity:4];
- }
- return self;
-}
-
-- (BOOL)parseAndReturnError:(NSError **)outError {
- GRMustacheTokenizer *tokenProducer = [[GRMustacheTokenizer alloc] init];
- GRMustacheCompiler *compiler = [[GRMustacheCompiler alloc] init];
- NSArray *elements = [compiler parseString:templateString
- withTokenProducer:tokenProducer
- templateLoader:templateLoader
- templateId:templateId
- error:outError];
- [compiler release];
- [tokenProducer release];
-
- if (elements == nil) {
- return NO;
- }
- self.elems = (NSMutableArray *)elements;
- return YES;
-}
-
-@end
View
147 Common/ThirdParty/GRMustache/GRMustacheTemplateLoader.h
@@ -1,147 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import <Foundation/Foundation.h>
-
-
-@class GRMustacheTemplate;
-
-/**
- The GRMustacheTemplateLoader provides with template loading services.
-
- @since v1.0.0
- */
-@interface GRMustacheTemplateLoader: NSObject {
-@private
- NSString *extension;
- NSStringEncoding encoding;
- NSMutableDictionary *templatesById;
-}
-
-/**
- @returns A GRMustacheTemplateLoader instance
- @param url The url of a directory
-
- The returned template loader will load templates and partials from the provided directory url,
- with extension "mustache", encoded in UTF8.
-
- @since v1.0.0
-*/
-+ (id)templateLoaderWithBaseURL:(NSURL *)url;
-
-/**
- @returns A GRMustacheTemplateLoader instance
- @param url The url of a directory
- @param ext The file name extension of loaded templates.
-
- The returned template loader will load templates and partials from the provided directory url,
- with provided extension, encoded in UTF8.
-
- If the ext parameter is nil, the "mustache" extension will be assumed.
-
- If the ext parameter is the empty string, loaded partials won't have any extension.
-
- @since v1.0.0
-*/
-+ (id)templateLoaderWithBaseURL:(NSURL *)url extension:(NSString *)ext;
-
-/**
- @returns A GRMustacheTemplateLoader instance
- @param url The url of a directory
- @param ext The file name extension of loaded templates.
- @param encoding The encoding of template files.
-
- The returned template loader will load templates and partials from the provided directory url,
- with provided extension, encoded in provided encoding.
-
- If the ext parameter is nil, the "mustache" extension will be assumed.
-
- If the ext parameter is the empty string, loaded partials won't have any extension.
-
- @since v1.0.0
-*/
-+ (id)templateLoaderWithBaseURL:(NSURL *)url extension:(NSString *)ext encoding:(NSStringEncoding)encoding;
-
-/**
- @returns A GRMustacheTemplateLoader instance
- @param bundle A bundle
-
- The returned template loader will load templates and partials from the provided bundle,
- with extension "mustache", encoded in UTF8.
-
- @since v1.0.0
-*/
-+ (id)templateLoaderWithBundle:(NSBundle *)bundle;
-
-/**
- @returns A GRMustacheTemplateLoader instance
- @param bundle A bundle
- @param ext The extension of loaded templates.
-
- The returned template loader will load templates and partials from the provided bundle,
- with provided extension, encoded in UTF8.
-
- If the ext parameter is nil, the "mustache" extension will be assumed.
-
- @since v1.0.0
-*/
-+ (id)templateLoaderWithBundle:(NSBundle *)bundle extension:(NSString *)ext;
-
-/**
- @returns A GRMustacheTemplateLoader instance
- @param bundle A bundle
- @param ext The extension of loaded templates.
- @param encoding The encoding of template resources.
-
- The returned template loader will load templates and partials from the provided bundle,
- with provided extension, encoded in the provided encoding.
-
- If the ext parameter is nil, the "mustache" extension will be assumed.
-
- @since v1.0.0
-*/
-+ (id)templateLoaderWithBundle:(NSBundle *)bundle extension:(NSString *)ext encoding:(NSStringEncoding)encoding;
-
-/**
- @returns a GRMustacheTemplate instance
- @param name The name of the template
- @param outError If there is an error loading or parsing the template, upon return
- contains an NSError object that describes the problem.
-
- Loads, parses, and returns the template of provided name.
-
- @since v1.0.0
- */
-- (GRMustacheTemplate *)parseTemplateNamed:(NSString *)name error:(NSError **)outError;
-
-/**
- @returns a GRMustacheTemplate instance
- @param templateString The template string
- @param outError If there is an error parsing the template string or loading a partial, upon return
- contains an NSError object that describes the problem.
-
- Parses the template string, and returns a GRMustacheTemplate instance.
-
- @since v1.0.0
- */
-- (GRMustacheTemplate *)parseString:(NSString *)templateString error:(NSError **)outError;
-@end
View
168 Common/ThirdParty/GRMustache/GRMustacheTemplateLoader.m
@@ -1,168 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRMustache_private.h"
-#import "GRMustacheTemplateLoader_private.h"
-#import "GRMustacheTemplate_private.h"
-#import "GRMustacheDirectoryTemplateLoader_private.h"
-#import "GRMustacheBundleTemplateLoader_private.h"
-
-
-NSString* const GRMustacheDefaultExtension = @"mustache";
-
-
-@interface GRMustacheTemplateLoader()
-@end
-
-@implementation GRMustacheTemplateLoader
-@synthesize extension;
-@synthesize encoding;
-
-+ (id)templateLoaderWithCurrentWorkingDirectory {
- return [self templateLoaderWithBaseURL:[NSURL fileURLWithPath:[[NSFileManager defaultManager] currentDirectoryPath] isDirectory:YES]];
-}
-
-+ (id)templateLoaderWithBaseURL:(NSURL *)url {
- return [[[GRMustacheDirectoryTemplateLoader alloc] initWithURL:url extension:nil encoding:NSUTF8StringEncoding] autorelease];
-}
-
-+ (id)templateLoaderWithBaseURL:(NSURL *)url extension:(NSString *)ext {
- return [[[GRMustacheDirectoryTemplateLoader alloc] initWithURL:url extension:ext encoding:NSUTF8StringEncoding] autorelease];
-}
-
-+ (id)templateLoaderWithBaseURL:(NSURL *)url extension:(NSString *)ext encoding:(NSStringEncoding)encoding {
- return [[[GRMustacheDirectoryTemplateLoader alloc] initWithURL:url extension:ext encoding:encoding] autorelease];
-}
-
-+ (id)templateLoaderWithBundle:(NSBundle *)bundle {
- return [[[GRMustacheBundleTemplateLoader alloc] initWithBundle:bundle extension:nil encoding:NSUTF8StringEncoding] autorelease];
-}
-
-+ (id)templateLoaderWithBundle:(NSBundle *)bundle extension:(NSString *)ext {
- return [[[GRMustacheBundleTemplateLoader alloc] initWithBundle:bundle extension:ext encoding:NSUTF8StringEncoding] autorelease];
-}
-
-+ (id)templateLoaderWithBundle:(NSBundle *)bundle extension:(NSString *)ext encoding:(NSStringEncoding)encoding {
- return [[[GRMustacheBundleTemplateLoader alloc] initWithBundle:bundle extension:ext encoding:encoding] autorelease];
-}
-
-- (id)initWithExtension:(NSString *)theExtension encoding:(NSStringEncoding)theEncoding {
- if ((self = [self init])) {
- if (theExtension == nil) {
- theExtension = GRMustacheDefaultExtension;
- }
- extension = [theExtension retain];
- encoding = theEncoding;
- templatesById = [[NSMutableDictionary dictionaryWithCapacity:4] retain];
- }
- return self;
-}
-
-- (GRMustacheTemplate *)parseTemplateNamed:(NSString *)name relativeToTemplateId:(id)baseTemplateId error:(NSError **)outError {
- id templateId = [self templateIdForTemplateNamed:name relativeToTemplateId:baseTemplateId];
- if (templateId == nil) {
- if (outError != NULL) {
- *outError = [NSError errorWithDomain:GRMustacheErrorDomain
- code:GRMustacheErrorCodeTemplateNotFound
- userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"No such template: %@", name, nil]
- forKey:NSLocalizedDescriptionKey]];
- }
- return nil;
- }
-
- GRMustacheTemplate *template = [templatesById objectForKey:templateId];
-
- if (template == nil) {
- // templateStringForTemplateId is a method that GRMustache users may implement.
- // We have to take extra care of error handling here.
- if (outError != NULL) {
- *outError = nil;
- }
- NSString *templateString = [self templateStringForTemplateId:templateId error:outError];
- if (!templateString) {
- if (outError != NULL) {
- // make sure we return an error
- if (*outError == nil) {
- *outError = [NSError errorWithDomain:GRMustacheErrorDomain
- code:GRMustacheErrorCodeTemplateNotFound
- userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"No such template: %@", name, nil]
- forKey:NSLocalizedDescriptionKey]];
- }
- }
- return nil;
- }
-
- template = [GRMustacheTemplate templateWithString:templateString templateId:templateId templateLoader:self];
-
- // store template before parsing, so that we support recursive templates
- [self setTemplate:template forTemplateId:templateId];
-
- if (![template parseAndReturnError:outError]) {
- // remove template if parsing fails
- [self setTemplate:nil forTemplateId:templateId];
- return nil;
- }
- }
-
- return template;
-}
-
-- (GRMustacheTemplate *)parseTemplateNamed:(NSString *)name error:(NSError **)outError {
- return [self parseTemplateNamed:name relativeToTemplateId:nil error:outError];
-}
-
-- (GRMustacheTemplate *)parseString:(NSString *)templateString error:(NSError **)outError {
- GRMustacheTemplate *template = [GRMustacheTemplate templateWithString:templateString templateId:nil templateLoader:self];
- if (![template parseAndReturnError:outError]) {
- return nil;
- }
- return template;
-}
-
-- (void)setTemplate:(GRMustacheTemplate *)template forTemplateId:(id)templateId {
- if (template) {
- [templatesById setObject:template forKey:templateId];
- } else {
- [templatesById removeObjectForKey:templateId];
- }
-}
-
-- (id)templateIdForTemplateNamed:(NSString *)name relativeToTemplateId:(id)baseTemplateId {
- NSAssert(NO, @"abstract method");
- return nil;
-}
-
-- (NSString *)templateStringForTemplateId:(id)templateId error:(NSError **)outError {
- NSAssert(NO, @"abstract method");
- return nil;
-}
-
-- (void)dealloc {
- [extension release];
- [templatesById release];
- [super dealloc];
-}
-
-@end
-
-
-
View
30 Common/ThirdParty/GRMustache/GRMustacheTemplateLoader_private.h
@@ -1,30 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRMustacheTemplateLoader_protected.h"
-
-
-@interface GRMustacheTemplateLoader()
-+ (id)templateLoaderWithCurrentWorkingDirectory;
-- (GRMustacheTemplate *)parseTemplateNamed:(NSString *)name relativeToTemplateId:(id)templateId error:(NSError **)outError;
-- (void)setTemplate:(GRMustacheTemplate *)template forTemplateId:(id)templateId;
-@end
View
119 Common/ThirdParty/GRMustache/GRMustacheTemplateLoader_protected.h
@@ -1,119 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import <Foundation/Foundation.h>
-#import "GRMustacheTemplateLoader.h"
-
-
-/**
- Class extension exposed to the subclasses of GRMustacheTemplateLoader.
-
- @since v1.0.0
- */
-@interface GRMustacheTemplateLoader()
-
-/**
- The extension of loaded templates (if applicable).
-
- This property is never nil, but may contain an empty NSString.
-
- @see GRMustacheTemplateLoader#initWithExtension:encoding:
- @since v1.0.0
- */
-@property (nonatomic, readonly, retain) NSString *extension;
-
-/**
- The encoding of data containing templates (if applicable)
-
- @see GRMustacheTemplateLoader#initWithExtension:encoding:
- @since v1.0.0
- */
-@property (nonatomic, readonly) NSStringEncoding encoding;
-
-/**
- The designated GRMustacheTemplateLoader initializer.
-
- Don't use this method unless you implement a GRMustacheTemplateLoader subclass.
-
- @returns a GRMustacheTemplateLoader instance.
- @param ext The file name extension of loaded templates.
- @param encoding The encoding of data containing templates.
-
- The returned template loader will load templates with the provided file
- name extension, and interpret any template data with the provided encoding.
-
- If the ext parameter is nil, the "mustache" extension will be assumed.
-
- If the ext parameter is the empty string, loaded partials won't have any extension.
-
- For initializing GRMustacheTemplateLoader subclasses which ignore extensions or
- encoding, you may pass any value in those parameters.
-
- @see GRMustacheTemplateLoader#templateStringForTemplateId:error:
- @since v1.0.0
- */
-- (id)initWithExtension:(NSString *)ext encoding:(NSStringEncoding)encoding;
-
-/**
- Don't use this method.
-
- Subclasses must override it.
-
- @returns a template identifier
- @param name The name of a partial or a template
- @param baseTemplateId The identifier of the template refering to the name
-
- Your subclass will return a template identifier, that is to say an object which
- uniquely identifies a template. There must not be two identifiers for a single
- template.
-
- If the baseTemplateId parameter is nil, then the name parameter refers to a
- "root template". Otherwise, the name parameter refers to the name of a partial
- loaded from the template identified by baseTemplateId.
-
- @since v1.0.0
-*/
-- (id)templateIdForTemplateNamed:(NSString *)name relativeToTemplateId:(id)baseTemplateId;
-
-/**
- Don't use this method.
-
- Subclasses must override it.
-
- @returns A template string
- @param templateId A template identifier
- @param outError If there is an error building the template string, upon return
- contains an NSError object that describes the problem.
-
- Your subclass will return the string of the template identified by templateId.
-
- If applicable, your implementation will use the extension and encoding properties.
-
- @see GRMustacheTemplateLoader#extension
- @see GRMustacheTemplateLoader#encoding
-
- @since v1.0.0
- */
-// Override this method, and return a template string.
-// If applicable, it is your responsability to use the extension property in order to load the correct template.
-- (NSString *)templateStringForTemplateId:(id)templateId error:(NSError **)outError;
-@end
View
32 Common/ThirdParty/GRMustache/GRMustacheTemplate_private.h
@@ -1,32 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRMustacheTemplate.h"
-
-
-@class GRMustacheSectionElement;
-
-@interface GRMustacheTemplate()
-@property (nonatomic, retain) NSString *templateId;
-+ (id)templateWithString:(NSString *)templateString templateId:(id)templateId templateLoader:(GRMustacheTemplateLoader *)templateLoader;
-- (BOOL)parseAndReturnError:(NSError **)outError;
-@end
View
56 Common/ThirdParty/GRMustache/GRMustacheTextElement.m
@@ -1,56 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRMustacheTextElement_private.h"
-
-
-@interface GRMustacheTextElement()
-@property (nonatomic, retain) NSString *text;
-- (id)initWithString:(NSString *)theText;
-@end
-
-
-@implementation GRMustacheTextElement
-@synthesize text;
-
-+ (id)textElementWithString:(NSString *)text {
- return [[[self alloc] initWithString:text] autorelease];
-}
-
-- (id)initWithString:(NSString *)theText {
- if ((self = [self init])) {
- self.text = theText;
- }
- return self;
-}
-
-- (NSString *)renderContext:(GRMustacheContext *)context {
- return text;
-}
-
-- (void)dealloc {
- [text release];
- [super dealloc];
-}
-@end
-
-
View
57 Common/ThirdParty/GRMustache/GRMustacheToken.m
@@ -1,57 +0,0 @@
-// The MIT License
-//
-// Copyright (c) 2010 Gwendal Roué
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#import "GRMustacheToken_private.h"
-
-
-@interface GRMustacheToken()
-@property (nonatomic, retain) NSString *content;
-- (id)initWithType:(GRMustacheTokenType)type content:(NSString *)content line:(NSUInteger)line range:(NSRange)range;
-@end
-
-@implementation GRMustacheToken
-@synthesize type;
-@synthesize content;
-@synthesize line;
-@synthesize range;
-
-+ (id)tokenWithType:(GRMustacheTokenType)type content:(NSString *)content line:(NSUInteger)line range:(NSRange)range {
- return [[[self alloc] initWithType:type content:content line:line range:range] autorelease];
-}
-
-- (id)initWithType:(GRMustacheTokenType)theType content:(NSString *)theContent line:(NSUInteger)theLine range:(NSRange)theRange {
- if ((self = [self init])) {
- type = theType;
- content = [theContent retain];
- line = theLine;
- range = theRange;
- }
- return self;
-}
-
-- (void)dealloc {
- [content release]; <