Skip to content

Commit

Permalink
* no longer need \}. yay.
Browse files Browse the repository at this point in the history
  • Loading branch information
itod committed Apr 17, 2014
1 parent 9e14a7f commit 9d48fa6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion res/curly_action.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ start = Word+
id word = nil;
while (!EMPTY()) {
word = POP_STR();
\}
}
PUSH(word);
};
2 changes: 1 addition & 1 deletion res/grammar_actions.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
@implementation {
- (NSString *)bar {
return @"bar";
\}
}
}
@before {
NSAssert([self.foo isEqualToString:@"hello world"], @"");
Expand Down
2 changes: 1 addition & 1 deletion res/javascript.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
self.silentlyConsumesWhitespace = YES;
self.tokenizer.whitespaceState.reportsWhitespaceTokens = YES;
self.assembly.preservesWhitespaceTokens = YES;
\}
}
}
@before {
PKTokenizer *t = self.tokenizer;
Expand Down
2 changes: 1 addition & 1 deletion res/quote_symbol.grammar
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@before {
PKTokenizer *t = self.tokenizer;
[t setTokenizerState:t.symbolState from:'"' to:'"'];
[t setTokenizerState:t.symbolState from:'\\'' to:'\\''];
[t setTokenizerState:t.symbolState from:'\'' to:'\''];
}

start = sym+;
Expand Down
13 changes: 8 additions & 5 deletions src/PKDelimitState.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ - (id)init {
self.rootNode = [[[PKSymbolRootNode alloc] init] autorelease];
_rootNode.reportsAddedSymbolsOnly = YES;
self.collection = [[[PKDelimitDescriptorCollection alloc] init] autorelease];
self.allowsNestedMarkers = YES;
}
return self;
}
Expand Down Expand Up @@ -133,11 +134,11 @@ - (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin token

for (;;) {
c = [r read];
if ('\\' == c) {
c = [r read];
[self append:c];
continue;
}
// if ('\\' == c) {
// c = [r read];
// [self append:c];
// continue;
// }

if (PKEOF == c) {
if (!_balancesEOFTerminatedStrings) {
Expand All @@ -155,9 +156,11 @@ - (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin token
for (PKDelimitDescriptor *desc in matchingDescs) {
if (_allowsNestedMarkers && [marker isEqualToString:desc.startMarker]) {
++stackCount;
break;
} else if ([marker isEqualToString:desc.endMarker]) {
if (_allowsNestedMarkers && stackCount > 0) {
--stackCount;
break;
} else {
matchedDesc = desc;
[self appendString:desc.endMarker];
Expand Down

0 comments on commit 9d48fa6

Please sign in to comment.