diff --git a/res/curly_action.grammar b/res/curly_action.grammar index 28ee21e..d851351 100644 --- a/res/curly_action.grammar +++ b/res/curly_action.grammar @@ -3,6 +3,6 @@ start = Word+ id word = nil; while (!EMPTY()) { word = POP_STR(); - \} + } PUSH(word); }; \ No newline at end of file diff --git a/res/grammar_actions.grammar b/res/grammar_actions.grammar index 0e32f0f..1212b97 100644 --- a/res/grammar_actions.grammar +++ b/res/grammar_actions.grammar @@ -23,7 +23,7 @@ @implementation { - (NSString *)bar { return @"bar"; -\} +} } @before { NSAssert([self.foo isEqualToString:@"hello world"], @""); diff --git a/res/javascript.grammar b/res/javascript.grammar index 6c812ba..e39156b 100644 --- a/res/javascript.grammar +++ b/res/javascript.grammar @@ -8,7 +8,7 @@ self.silentlyConsumesWhitespace = YES; self.tokenizer.whitespaceState.reportsWhitespaceTokens = YES; self.assembly.preservesWhitespaceTokens = YES; -\} +} } @before { PKTokenizer *t = self.tokenizer; diff --git a/res/quote_symbol.grammar b/res/quote_symbol.grammar index 27b33b5..031a294 100644 --- a/res/quote_symbol.grammar +++ b/res/quote_symbol.grammar @@ -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+; diff --git a/src/PKDelimitState.m b/src/PKDelimitState.m index 668a680..7f7b15a 100644 --- a/src/PKDelimitState.m +++ b/src/PKDelimitState.m @@ -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; } @@ -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) { @@ -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];