Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 70 lines (54 sloc) 1.302 kB
7aa6b9d The remaining "core" files OBJJified (with probable errors)
Ross Boucher authored
1
2 @import "TDTokenizerState.j"
3 @import "TDCommentState.j"
4 @import "TDToken.j"
5 @import "TDReader.j"
6
7 @implementation TDSingleLineCommentState : TDTokenizerState
8 {
9 CPArray startSymbols;
10 CPString currentStartSymbol;
11 }
12
13 - (id)init
14 {
15 if (self = [super init]) {
16 startSymbols = [];
17 }
18
19 return self;
20 }
21
22 - (void)addStartSymbol:(CPString)start
23 {
24 [startSymbols addObject:start];
25 }
26
27
28 - (void)removeStartSymbol:(CPString)start
29 {
30 [startSymbols removeObject:start];
31 }
32
33
34 - (TDToken)nextTokenFromReader:(TDReader)r startingWith:(int)cin tokenizer:(TDTokenizer)t
35 {
36 var reportTokens = t.commentState.reportsCommentTokens;
37
38 if (reportTokens) {
39 [self reset];
40 if (currentStartSymbol.length > 1) {
41 [self appendString:currentStartSymbol];
42 }
43 }
44
45 var c;
46 while (1) {
47 c = [r read];
48 if ('\n' == c || '\r' == c || -1 == c) {
49 break;
50 }
51 if (reportTokens) {
52 [self append:c];
53 }
54 }
55
56 if (-1 != c) {
57 [r unread];
58 }
59
60 currentStartSymbol = nil;
61
62 if (reportTokens) {
63 return [TDToken tokenWithTokenType:TDTokenTypeComment stringValue:[self bufferedString] floatValue:0.0];
64 } else {
65 return [t nextToken];
66 }
67 }
68
69 @end
Something went wrong with that request. Please try again.