Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

merging fixes from tree-rewrite branch back to trunk

merging fixes from tree-rewrite branch back to trunk:

* whitespace after match constant call
* 2-pass recursion (speculating/non-speculating) in ParserGenVisitor
  • Loading branch information...
commit 07164941754bfd4a830de810fb1b1aca7a899165 1 parent c2e10be
@itod authored
View
4 ParserGenApp/PGDocument.m
@@ -41,6 +41,7 @@ - (id)init {
return self;
}
+
- (void)dealloc {
self.destinationPath = nil;
self.parserName = nil;
@@ -56,6 +57,7 @@ - (void)dealloc {
- (void)awakeFromNib {
+ self.enableHybridDFA = YES;
}
@@ -212,7 +214,7 @@ - (void)generateWithDestinationPath:(NSString *)destPath parserName:(NSString *)
className = [NSString stringWithFormat:@"%@Parser", className];
}
- _root.grammarName = className;
+ _root.grammarName = self.parserName;
self.visitor = [[[PKSParserGenVisitor alloc] init] autorelease];
_visitor.enableARC = _enableARC;
View
2  res/PKSConstantMethodCallTemplate.txt
@@ -1 +1 @@
-{%for 1 to depth %} {%/for%}[self match{{methodName}}:{%if discard %}YES{%else%}NO{%/if%}];
+{%for 1 to depth %} {%/for%}[self match{{methodName}}:{%if discard %}YES{%else%}NO{%/if%}];
View
50 src/PKSParserGenVisitor.m
@@ -157,6 +157,9 @@ - (NSSet *)lookaheadSetForNode:(PKBaseNode *)node {
case PKNodeTypeReference: {
NSString *name = node.token.stringValue;
PKDefinitionNode *defNode = self.symbolTable[name];
+ if (!defNode) {
+ NSLog(@"missing rule named: `%@`", name);
+ }
NSAssert1(defNode, @"missing: %@", name);
[set unionSet:[self lookaheadSetForNode:defNode]];
} break;
@@ -509,9 +512,18 @@ - (void)visitRepetition:(PKCompositeNode *)node {
// rep body is always wrapped in an while AND an IF. so increase depth twice
NSInteger depth = isLL1 ? 1 : 2;
- // recurse
+ // recurse first and get entire child str
self.depth += depth;
+
+ // visit for speculative if test
+ self.isSpeculating = YES;
[child visit:self];
+ self.isSpeculating = NO;
+ NSString *ifTest = [self removeTabsAndNewLines:[self pop]];
+
+ // visit for child body
+ [child visit:self];
+
self.depth -= depth;
// pop
@@ -522,7 +534,7 @@ - (void)visitRepetition:(PKCompositeNode *)node {
if (isLL1) { // ????
templateName = @"PKSRepetitionPredictTemplate";
} else {
- vars[IF_TEST] = [self removeTabsAndNewLines:childStr];
+ vars[IF_TEST] = ifTest;
templateName = @"PKSRepetitionSpeculateTemplate";
}
@@ -814,11 +826,21 @@ - (void)visitOptional:(PKOptionalNode *)node {
PKBaseNode *child = node.children[0];
NSArray *set = [self sortedLookaheadSetForNode:child];
+
+ BOOL isLL1 = _enableHybridDFA && [self isLL1:child];
+ // recurse for speculation
self.depth++;
+ self.isSpeculating = YES;
[child visit:self];
- self.depth--;
+ self.isSpeculating = NO;
+ NSMutableString *ifTest = [self removeTabsAndNewLines:[self pop]];
+
+ // recurse for realz
+ [child visit:self];
+ self.depth--;
+
// pop
NSMutableString *childStr = [self pop];
@@ -827,14 +849,14 @@ - (void)visitOptional:(PKOptionalNode *)node {
vars[DEPTH] = @(_depth);
vars[LOOKAHEAD_SET] = set;
vars[LAST] = @([set count] - 1);
- vars[CHILD_STRING] = [[childStr mutableCopy] autorelease];
- vars[IF_TEST] = [self removeTabsAndNewLines:childStr];
+ vars[CHILD_STRING] = childStr;
+ vars[IF_TEST] = ifTest;
NSMutableString *output = [NSMutableString string];
[output appendString:[self semanticPredicateForNode:node throws:YES]];
NSString *templateName = nil;
- if (_enableHybridDFA && [self isLL1:child]) { // ????
+ if (isLL1) { // ????
templateName = @"PKSOptionalPredictTemplate";
} else {
templateName = @"PKSOptionalSpeculateTemplate";
@@ -896,7 +918,17 @@ - (void)visitMultiple:(PKMultipleNode *)node {
NSArray *set = [self sortedLookaheadSetForNode:child];
+ BOOL isLL1 = _enableHybridDFA && [self isLL1:child];
+
+ // recurse for speculation
self.depth++;
+ self.isSpeculating = YES;
+ [child visit:self];
+ self.isSpeculating = NO;
+
+ NSMutableString *ifTest = [self removeTabsAndNewLines:[self pop]];
+
+ // recurse for realz
[child visit:self];
self.depth--;
@@ -908,14 +940,14 @@ - (void)visitMultiple:(PKMultipleNode *)node {
vars[DEPTH] = @(_depth);
vars[LOOKAHEAD_SET] = set;
vars[LAST] = @([set count] - 1);
- vars[CHILD_STRING] = [[childStr mutableCopy] autorelease];
- vars[IF_TEST] = [self removeTabsAndNewLines:childStr];
+ vars[CHILD_STRING] = childStr;
+ vars[IF_TEST] = ifTest;
NSMutableString *output = [NSMutableString string];
[output appendString:[self semanticPredicateForNode:node throws:YES]];
NSString *templateName = nil;
- if (_enableHybridDFA && [self isLL1:child]) { // ????
+ if (isLL1) { // ????
templateName = @"PKSMultiplePredictTemplate";
} else {
templateName = @"PKSMultipleSpeculateTemplate";
View
18 src/ParseKitParser.m
@@ -325,13 +325,13 @@ - (void)statement {
- (void)__tokenizerDirective {
[self match:PARSEKIT_TOKEN_KIND_AT discard:YES];
- [self matchWord:NO];
+ [self matchWord:NO];
[self match:PARSEKIT_TOKEN_KIND_EQUALS discard:NO];
do {
if ([self predicts:TOKEN_KIND_BUILTIN_WORD, 0]) {
- [self matchWord:NO];
+ [self matchWord:NO];
} else if ([self predicts:TOKEN_KIND_BUILTIN_QUOTEDSTRING, 0]) {
- [self matchQuotedString:NO];
+ [self matchQuotedString:NO];
} else {
[self raise:@"No viable alternative found in rule 'tokenizerDirective'."];
}
@@ -441,7 +441,7 @@ - (void)afterKey {
- (void)__varProduction {
- [self matchWord:NO];
+ [self matchWord:NO];
[self fireAssemblerSelector:@selector(parser:didMatchVarProduction:)];
}
@@ -815,10 +815,10 @@ - (void)patternIgnoreCase {
- (void)__delimitedString {
[self delimOpen];
- [self matchQuotedString:NO];
- if ([self speculate:^{ [self match:PARSEKIT_TOKEN_KIND_COMMA discard:YES]; [self matchQuotedString:NO];}]) {
+ [self matchQuotedString:NO];
+ if ([self speculate:^{ [self match:PARSEKIT_TOKEN_KIND_COMMA discard:YES]; [self matchQuotedString:NO]; }]) {
[self match:PARSEKIT_TOKEN_KIND_COMMA discard:YES];
- [self matchQuotedString:NO];
+ [self matchQuotedString:NO];
}
[self match:PARSEKIT_TOKEN_KIND_CLOSE_CURLY discard:YES];
@@ -831,7 +831,7 @@ - (void)delimitedString {
- (void)__literal {
- [self matchQuotedString:NO];
+ [self matchQuotedString:NO];
[self fireAssemblerSelector:@selector(parser:didMatchLiteral:)];
}
@@ -881,7 +881,7 @@ - (void)constant {
- (void)__variable {
- [self matchWord:NO];
+ [self matchWord:NO];
[self fireAssemblerSelector:@selector(parser:didMatchVariable:)];
}
View
16 test/CSSParser.m
@@ -377,7 +377,7 @@ - (void)selector {
- (void)__selectorWord {
- [self matchWord:NO];
+ [self matchWord:NO];
[self fireAssemblerSelector:@selector(parser:didMatchSelectorWord:)];
}
@@ -388,7 +388,7 @@ - (void)selectorWord {
- (void)__selectorQuotedString {
- [self matchQuotedString:NO];
+ [self matchQuotedString:NO];
[self fireAssemblerSelector:@selector(parser:didMatchSelectorQuotedString:)];
}
@@ -455,7 +455,7 @@ - (void)decl {
- (void)__property {
- [self matchWord:NO];
+ [self matchWord:NO];
[self fireAssemblerSelector:@selector(parser:didMatchProperty:)];
}
@@ -538,7 +538,7 @@ - (void)__nonTerminatingSymbol {
[self testAndThrow:(id)^{ return NE(LS(1), @";") && NE(LS(1), @"!"); }];
[self fwdSlash];
} else if ([self predicts:TOKEN_KIND_BUILTIN_SYMBOL, 0]) {
- [self matchSymbol:NO];
+ [self matchSymbol:NO];
} else {
[self raise:@"No viable alternative found in rule 'nonTerminatingSymbol'."];
}
@@ -552,7 +552,7 @@ - (void)nonTerminatingSymbol {
- (void)__important {
[self bang];
- [self matchWord:NO];
+ [self matchWord:NO];
}
@@ -562,7 +562,7 @@ - (void)important {
- (void)__string {
- [self matchQuotedString:NO];
+ [self matchQuotedString:NO];
[self fireAssemblerSelector:@selector(parser:didMatchString:)];
}
@@ -573,7 +573,7 @@ - (void)string {
- (void)__constant {
- [self matchWord:NO];
+ [self matchWord:NO];
[self fireAssemblerSelector:@selector(parser:didMatchConstant:)];
}
@@ -782,7 +782,7 @@ - (void)bang {
- (void)__num {
- [self matchNumber:NO];
+ [self matchNumber:NO];
[self fireAssemblerSelector:@selector(parser:didMatchNum:)];
}
View
2  test/DotQuestionParser.m
@@ -74,7 +74,7 @@ - (void)_start {
[self a];
if ([self predicts:TOKEN_KIND_BUILTIN_ANY, 0]) {
- [self matchAny:NO];
+ [self matchAny:NO];
}
[self a];
[self matchEOF:YES];
View
2  test/ElementAssignParser.m
@@ -151,7 +151,7 @@ - (void)elements {
- (void)element {
if ([self predicts:TOKEN_KIND_BUILTIN_NUMBER, 0]) {
- [self matchNumber:NO];
+ [self matchNumber:NO];
} else if ([self predicts:ELEMENTASSIGN_TOKEN_KIND_LBRACKET, 0]) {
[self list];
} else {
View
2  test/ElementParser.m
@@ -136,7 +136,7 @@ - (void)elements {
- (void)__element {
if ([self predicts:TOKEN_KIND_BUILTIN_NUMBER, 0]) {
- [self matchNumber:NO];
+ [self matchNumber:NO];
} else if ([self predicts:ELEMENT_TOKEN_KIND_LBRACKET, 0]) {
[self list];
} else {
View
6 test/ExpressionActionsParser.m
@@ -418,7 +418,7 @@ - (void)obj {
- (void)__id {
- [self matchWord:NO];
+ [self matchWord:NO];
[self fireAssemblerSelector:@selector(parser:didMatchId:)];
}
@@ -448,12 +448,12 @@ - (void)__literal {
PUSH_BOOL(EQ_IGNORE_CASE(POP_STR(), @"yes"));
}];
} else if ([self predicts:TOKEN_KIND_BUILTIN_NUMBER, 0]) {
- [self matchNumber:NO];
+ [self matchNumber:NO];
[self execute:(id)^{
PUSH_FLOAT(POP_FLOAT());
}];
} else if ([self predicts:TOKEN_KIND_BUILTIN_QUOTEDSTRING, 0]) {
- [self matchQuotedString:NO];
+ [self matchQuotedString:NO];
[self execute:(id)^{
PUSH(POP_STR());
}];
View
6 test/ExpressionParser.m
@@ -427,7 +427,7 @@ - (void)obj {
- (void)__id {
- [self matchWord:NO];
+ [self matchWord:NO];
[self fireAssemblerSelector:@selector(parser:didMatchId:)];
}
@@ -451,9 +451,9 @@ - (void)member {
- (void)__literal {
if ([self predicts:TOKEN_KIND_BUILTIN_QUOTEDSTRING, 0]) {
- [self matchQuotedString:NO];
+ [self matchQuotedString:NO];
} else if ([self predicts:TOKEN_KIND_BUILTIN_NUMBER, 0]) {
- [self matchNumber:NO];
+ [self matchNumber:NO];
} else if ([self predicts:EXPRESSION_TOKEN_KIND_NO, EXPRESSION_TOKEN_KIND_YES, 0]) {
[self bool];
} else {
View
4 test/GreedParser.m
@@ -81,13 +81,13 @@ - (void)_start {
if ([self predicts:GREED_TOKEN_KIND_A, 0]) {
[self a];
while ([self predicts:TOKEN_KIND_BUILTIN_ANY, 0]) {
- [self matchAny:NO];
+ [self matchAny:NO];
}
[self a];
} else if ([self predicts:GREED_TOKEN_KIND_B, 0]) {
[self b];
do {
- [self matchAny:NO];
+ [self matchAny:NO];
} while ([self predicts:TOKEN_KIND_BUILTIN_ANY, 0]);
[self b];
} else {
View
12 test/HTMLParser.m
@@ -419,7 +419,7 @@ - (void)doctype {
- (void)__text {
- [self matchAny:NO];
+ [self matchAny:NO];
[self fireAssemblerSelector:@selector(parser:didMatchText:)];
}
@@ -500,7 +500,7 @@ - (void)endTag {
- (void)__tagName {
- [self matchWord:NO];
+ [self matchWord:NO];
[self fireAssemblerSelector:@selector(parser:didMatchTagName:)];
}
@@ -527,7 +527,7 @@ - (void)attr {
- (void)__attrName {
- [self matchWord:NO];
+ [self matchWord:NO];
[self fireAssemblerSelector:@selector(parser:didMatchAttrName:)];
}
@@ -539,9 +539,9 @@ - (void)attrName {
- (void)__attrValue {
if ([self predicts:TOKEN_KIND_BUILTIN_WORD, 0]) {
- [self matchWord:NO];
+ [self matchWord:NO];
} else if ([self predicts:TOKEN_KIND_BUILTIN_QUOTEDSTRING, 0]) {
- [self matchQuotedString:NO];
+ [self matchQuotedString:NO];
} else {
[self raise:@"No viable alternative found in rule 'attrValue'."];
}
@@ -598,7 +598,7 @@ - (void)fwdSlash {
- (void)__comment {
- [self matchComment:NO];
+ [self matchComment:NO];
[self fireAssemblerSelector:@selector(parser:didMatchComment:)];
}
View
8 test/JSONParser.m
@@ -160,7 +160,7 @@ - (void)commaProperty {
- (void)propertyName {
- [self matchQuotedString:NO];
+ [self matchQuotedString:NO];
[self fireAssemblerSelector:@selector(parser:didMatchPropertyName:)];
}
@@ -234,21 +234,21 @@ - (void)value {
- (void)comment {
- [self matchComment:NO];
+ [self matchComment:NO];
[self fireAssemblerSelector:@selector(parser:didMatchComment:)];
}
- (void)string {
- [self matchQuotedString:NO];
+ [self matchQuotedString:NO];
[self fireAssemblerSelector:@selector(parser:didMatchString:)];
}
- (void)number {
- [self matchNumber:NO];
+ [self matchNumber:NO];
[self fireAssemblerSelector:@selector(parser:didMatchNumber:)];
}
View
6 test/JavaScriptParser.m
@@ -1775,21 +1775,21 @@ - (void)parenExprParen {
- (void)identifier {
- [self matchWord:NO];
+ [self matchWord:NO];
[self fireAssemblerSelector:@selector(parser:didMatchIdentifier:)];
}
- (void)numLiteral {
- [self matchNumber:NO];
+ [self matchNumber:NO];
[self fireAssemblerSelector:@selector(parser:didMatchNumLiteral:)];
}
- (void)stringLiteral {
- [self matchQuotedString:NO];
+ [self matchQuotedString:NO];
[self fireAssemblerSelector:@selector(parser:didMatchStringLiteral:)];
}
View
10 test/LabelEBNFParser.m
@@ -91,9 +91,9 @@ - (void)_start {
- (void)__s {
- if ([self speculate:^{ [self label]; [self matchWord:NO];[self match:LABELEBNF_TOKEN_KIND_EQUALS discard:NO]; [self expr]; }]) {
+ if ([self speculate:^{ [self label]; [self matchWord:NO]; [self match:LABELEBNF_TOKEN_KIND_EQUALS discard:NO]; [self expr]; }]) {
[self label];
- [self matchWord:NO];
+ [self matchWord:NO];
[self match:LABELEBNF_TOKEN_KIND_EQUALS discard:NO];
[self expr];
} else if ([self speculate:^{ [self label]; [self match:LABELEBNF_TOKEN_KIND_RETURN discard:NO]; [self expr]; }]) {
@@ -114,8 +114,8 @@ - (void)s {
- (void)__label {
while ([self predicts:TOKEN_KIND_BUILTIN_WORD, 0]) {
- if ([self speculate:^{ [self matchWord:NO];[self match:LABELEBNF_TOKEN_KIND_COLON discard:NO]; }]) {
- [self matchWord:NO];
+ if ([self speculate:^{ [self matchWord:NO]; [self match:LABELEBNF_TOKEN_KIND_COLON discard:NO]; }]) {
+ [self matchWord:NO];
[self match:LABELEBNF_TOKEN_KIND_COLON discard:NO];
} else {
break;
@@ -131,7 +131,7 @@ - (void)label {
- (void)__expr {
- [self matchNumber:NO];
+ [self matchNumber:NO];
[self fireAssemblerSelector:@selector(parser:didMatchExpr:)];
}
View
8 test/LabelRecursiveParser.m
@@ -91,9 +91,9 @@ - (void)_start {
- (void)__s {
- if ([self speculate:^{ [self label]; [self matchWord:NO];[self match:LABELRECURSIVE_TOKEN_KIND_EQUALS discard:NO]; [self expr]; }]) {
+ if ([self speculate:^{ [self label]; [self matchWord:NO]; [self match:LABELRECURSIVE_TOKEN_KIND_EQUALS discard:NO]; [self expr]; }]) {
[self label];
- [self matchWord:NO];
+ [self matchWord:NO];
[self match:LABELRECURSIVE_TOKEN_KIND_EQUALS discard:NO];
[self expr];
} else if ([self speculate:^{ [self label]; [self match:LABELRECURSIVE_TOKEN_KIND_RETURN discard:NO]; [self expr]; }]) {
@@ -114,7 +114,7 @@ - (void)s {
- (void)__label {
if ([self predicts:TOKEN_KIND_BUILTIN_WORD, 0]) {
- [self matchWord:NO];
+ [self matchWord:NO];
[self match:LABELRECURSIVE_TOKEN_KIND_COLON discard:NO];
[self label];
}
@@ -128,7 +128,7 @@ - (void)label {
- (void)__expr {
- [self matchNumber:NO];
+ [self matchNumber:NO];
[self fireAssemblerSelector:@selector(parser:didMatchExpr:)];
}
View
4 test/MethodsFactoredParser.m
@@ -108,7 +108,7 @@ - (void)_start {
- (void)__method {
[self type];
- [self matchWord:NO];
+ [self matchWord:NO];
[self match:METHODSFACTORED_TOKEN_KIND_OPEN_PAREN discard:NO];
[self args];
[self match:METHODSFACTORED_TOKEN_KIND_CLOSE_PAREN discard:NO];
@@ -169,7 +169,7 @@ - (void)args {
- (void)__arg {
[self match:METHODSFACTORED_TOKEN_KIND_INT discard:NO];
- [self matchWord:NO];
+ [self matchWord:NO];
[self fireAssemblerSelector:@selector(parser:didMatchArg:)];
}
View
10 test/MethodsParser.m
@@ -107,18 +107,18 @@ - (void)_start {
- (void)__method {
- if ([self speculate:^{ [self testAndThrow:(id)^{ return NO; }]; [self type]; [self matchWord:NO];[self match:METHODS_TOKEN_KIND_OPEN_PAREN discard:NO]; [self args]; [self match:METHODS_TOKEN_KIND_CLOSE_PAREN discard:NO]; [self match:METHODS_TOKEN_KIND_SEMI_COLON discard:NO]; }]) {
+ if ([self speculate:^{ [self testAndThrow:(id)^{ return NO; }]; [self type]; [self matchWord:NO]; [self match:METHODS_TOKEN_KIND_OPEN_PAREN discard:NO]; [self args]; [self match:METHODS_TOKEN_KIND_CLOSE_PAREN discard:NO]; [self match:METHODS_TOKEN_KIND_SEMI_COLON discard:NO]; }]) {
[self testAndThrow:(id)^{ return NO; }];
[self type];
- [self matchWord:NO];
+ [self matchWord:NO];
[self match:METHODS_TOKEN_KIND_OPEN_PAREN discard:NO];
[self args];
[self match:METHODS_TOKEN_KIND_CLOSE_PAREN discard:NO];
[self match:METHODS_TOKEN_KIND_SEMI_COLON discard:NO];
- } else if ([self speculate:^{ [self testAndThrow:(id)^{ return 1; }]; [self type]; [self matchWord:NO];[self match:METHODS_TOKEN_KIND_OPEN_PAREN discard:NO]; [self args]; [self match:METHODS_TOKEN_KIND_CLOSE_PAREN discard:NO]; [self match:METHODS_TOKEN_KIND_OPEN_CURLY discard:NO]; [self match:METHODS_TOKEN_KIND_CLOSE_CURLY discard:NO]; }]) {
+ } else if ([self speculate:^{ [self testAndThrow:(id)^{ return 1; }]; [self type]; [self matchWord:NO]; [self match:METHODS_TOKEN_KIND_OPEN_PAREN discard:NO]; [self args]; [self match:METHODS_TOKEN_KIND_CLOSE_PAREN discard:NO]; [self match:METHODS_TOKEN_KIND_OPEN_CURLY discard:NO]; [self match:METHODS_TOKEN_KIND_CLOSE_CURLY discard:NO]; }]) {
[self testAndThrow:(id)^{ return 1; }];
[self type];
- [self matchWord:NO];
+ [self matchWord:NO];
[self match:METHODS_TOKEN_KIND_OPEN_PAREN discard:NO];
[self args];
[self match:METHODS_TOKEN_KIND_CLOSE_PAREN discard:NO];
@@ -176,7 +176,7 @@ - (void)args {
- (void)__arg {
[self match:METHODS_TOKEN_KIND_INT discard:NO];
- [self matchWord:NO];
+ [self matchWord:NO];
[self fireAssemblerSelector:@selector(parser:didMatchArg:)];
}
View
8 test/MiniMathParser.m
@@ -97,7 +97,7 @@ - (void)__expr {
[self mult];
while ([self predicts:MINIMATH_TOKEN_KIND_PLUS, 0]) {
- if ([self speculate:^{ [self match:MINIMATH_TOKEN_KIND_PLUS discard:YES]; [self mult]; [self execute:(id)^{ PUSH_FLOAT(POP_FLOAT()+POP_FLOAT()); }];}]) {
+ if ([self speculate:^{ [self match:MINIMATH_TOKEN_KIND_PLUS discard:YES]; [self mult]; }]) {
[self match:MINIMATH_TOKEN_KIND_PLUS discard:YES];
[self mult];
[self execute:(id)^{
@@ -119,7 +119,7 @@ - (void)__mult {
[self pow];
while ([self predicts:MINIMATH_TOKEN_KIND_STAR, 0]) {
- if ([self speculate:^{ [self match:MINIMATH_TOKEN_KIND_STAR discard:YES]; [self pow]; [self execute:(id)^{ PUSH_FLOAT(POP_FLOAT()*POP_FLOAT()); }];}]) {
+ if ([self speculate:^{ [self match:MINIMATH_TOKEN_KIND_STAR discard:YES]; [self pow]; }]) {
[self match:MINIMATH_TOKEN_KIND_STAR discard:YES];
[self pow];
[self execute:(id)^{
@@ -140,7 +140,7 @@ - (void)mult {
- (void)__pow {
[self atom];
- if ([self speculate:^{ [self match:MINIMATH_TOKEN_KIND_CARET discard:YES]; [self pow]; [self execute:(id)^{ double exp = POP_FLOAT(); double base = POP_FLOAT(); double result = base; for (NSUInteger i = 1; i < exp; i++) result *= base; PUSH_FLOAT(result); }];}]) {
+ if ([self speculate:^{ [self match:MINIMATH_TOKEN_KIND_CARET discard:YES]; [self pow]; }]) {
[self match:MINIMATH_TOKEN_KIND_CARET discard:YES];
[self pow];
[self execute:(id)^{
@@ -164,7 +164,7 @@ - (void)pow {
- (void)__atom {
- [self matchNumber:NO];
+ [self matchNumber:NO];
[self execute:(id)^{
PUSH_FLOAT(POP_FLOAT());
}];
View
2  test/SemanticPredicateParser.m
@@ -80,7 +80,7 @@ - (void)_start {
- (void)__nonReserved {
[self testAndThrow:(id)^{ return ![@[@"goto", @"const"] containsObject:LS(1)]; }];
- [self matchWord:NO];
+ [self matchWord:NO];
[self fireAssemblerSelector:@selector(parser:didMatchNonReserved:)];
}
View
6 test/TDNSPredicateParser.m
@@ -563,7 +563,7 @@ - (void)value {
- (void)__string {
- [self matchQuotedString:NO];
+ [self matchQuotedString:NO];
[self fireAssemblerSelector:@selector(parser:didMatchString:)];
}
@@ -574,7 +574,7 @@ - (void)string {
- (void)__num {
- [self matchNumber:NO];
+ [self matchNumber:NO];
[self fireAssemblerSelector:@selector(parser:didMatchNum:)];
}
@@ -680,7 +680,7 @@ - (void)commaValue {
- (void)__keyPath {
- [self matchWord:NO];
+ [self matchWord:NO];
[self fireAssemblerSelector:@selector(parser:didMatchKeyPath:)];
}
Please sign in to comment.
Something went wrong with that request. Please try again.