Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 50 lines (39 sloc) 1.016 kB
ee99867 @ccgus oh geeze
authored
1 //
2 // TDQuoteState.m
3 // TDParseKit
4 //
5 // Created by Todd Ditchendorf on 1/20/06.
6 // Copyright 2008 Todd Ditchendorf. All rights reserved.
7 //
8
9 #import "TDQuoteState.h"
10 #import "TDReader.h"
11 #import "TDToken.h"
12
13 @interface TDTokenizerState ()
14 - (void)reset;
15 - (void)append:(NSInteger)c;
16 - (NSString *)bufferedString;
17 @end
18
19 @implementation TDQuoteState
20
21 - (void)dealloc {
22 [super dealloc];
23 }
24
25
26 - (TDToken *)nextTokenFromReader:(TDReader *)r startingWith:(NSInteger)cin tokenizer:(TDTokenizer *)t {
27 NSParameterAssert(r);
28 [self reset];
29
30 [self append:cin];
31 NSInteger c;
32 do {
33 c = [r read];
34 if (-1 == c) {
35 c = cin;
36 if (balancesEOFTerminatedQuotes) {
37 [self append:c];
38 }
39 } else {
40 [self append:c];
41 }
42
43 } while (c != cin);
44
45 return [TDToken tokenWithTokenType:TDTokenTypeQuotedString stringValue:[self bufferedString] floatValue:0.0];
46 }
47
48 @synthesize balancesEOFTerminatedQuotes;
49 @end
Something went wrong with that request. Please try again.