Skip to content
This repository
Newer
Older
100644 50 lines (38 sloc) 1.3 kb
05eedb5e »
2010-01-25 initial add
1 // Copyright 2010 Todd Ditchendorf
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #import <ParseKit/TDReservedWord.h>
16 #import <ParseKit/PKToken.h>
17
18 static NSArray *sTDReservedWords = nil;
19
20 @interface TDReservedWord ()
21 + (NSArray *)reservedWords;
22 @end
23
24 @implementation TDReservedWord
25
26 + (NSArray *)reservedWords {
27 return [[sTDReservedWords retain] autorelease];
28 }
29
30
31 + (void)setReservedWords:(NSArray *)inWords {
32 if (inWords != sTDReservedWords) {
33 [sTDReservedWords autorelease];
34 sTDReservedWords = [inWords copy];
35 }
36 }
37
38
39 - (BOOL)qualifies:(id)obj {
40 PKToken *tok = (PKToken *)obj;
41 if (!tok.isWord) {
42 return NO;
43 }
44
45 NSString *s = tok.stringValue;
46 return [s length] && [[TDReservedWord reservedWords] containsObject:s];
47 }
48
49 @end
Something went wrong with that request. Please try again.