forked from pmougin/F-Script
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathFSIdentifierFormatter.m
35 lines (24 loc) · 991 Bytes
/
FSIdentifierFormatter.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* FSIdentifierFormatter.m Copyright (c) 2002-2009 Philippe Mougin. */
/* This software is open source. See the license. */
#import "FSIdentifierFormatter.h"
#import "FSCompiler.h"
@implementation FSIdentifierFormatter
- (NSString *)stringForObjectValue:(id)anObject
{
return anObject;
}
- (BOOL)getObjectValue:(id *)anObject forString:(NSString *)string errorDescription:(NSString **)error
{
//NSLog(@"getObjectValue:");
//NSLog(string);
*anObject = [string copy];
if ([FSCompiler isValidIdentifier:string] || [string length] == 0) return YES;
else return NO;
}
- (BOOL)isPartialStringValid:(NSString **)partialStringPtr proposedSelectedRange:(NSRangePointer)proposedSelRangePtr originalString:(NSString *)origString originalSelectedRange:(NSRange)origSelRange errorDescription:(NSString **)error
{
//NSLog(*partialStringPtr);
if ([FSCompiler isValidIdentifier:*partialStringPtr] || [*partialStringPtr length] == 0) return YES;
else return NO;
}
@end