Skip to content

Commit

Permalink
Razor files fixed for objective-c (parser was outdated, so not regene…
Browse files Browse the repository at this point in the history
…rated)
  • Loading branch information
gasparnagy committed May 19, 2021
1 parent ab09086 commit f6a18ce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
9 changes: 5 additions & 4 deletions objective-c/gherkin-objective-c-header.razor
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ typedef enum GHTokenType
{
GHTokenTypeNone,
@foreach(var rule in Model.RuleSet.TokenRules)
{<text> GHTokenType@(rule.Name.Replace("#", "")),
{<text> GHTokenType</text>@rule.Name.Replace("#", "")<text>,
</text>}
} GHTokenType;

typedef enum GHRuleType
{
GHRuleTypeNone,
@foreach(var rule in Model.RuleSet.Where(r => !r.TempRule))
{<text> GHRuleType@(rule.Name.Replace("#", "_")), // @rule.ToString(true)
{<text> GHRuleType</text>@rule.Name.Replace("#", "_")<text>, // @rule.ToString(true)
</text>}
} GHRuleType;

Expand All @@ -48,7 +48,8 @@ typedef enum GHRuleType

@foreach(var rule in Model.RuleSet.TokenRules)
{
@:- (BOOL)match@(rule.Name.Replace("#", ""))WithToken:(GHToken *)theToken;
<text>- (BOOL)match</text>@rule.Name.Replace("#", "")<text>WithToken:(GHToken *)theToken;
</text>
}
- (void)reset;

Expand All @@ -67,7 +68,7 @@ typedef enum GHRuleType

@@end

@@interface GH@(Model.ParserClassName) : NSObject
@@interface @{ Write("GH"); }@Model.ParserClassName : NSObject

@@property (nonatomic, assign) BOOL stopAtFirstError;

Expand Down
10 changes: 5 additions & 5 deletions objective-c/gherkin-objective-c-implementation.razor
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@
@@throw [[GHCompositeParserException alloc] initWithErrors: [theContext errors]];
}

- (void)handleAstErrorWithContext:(GHParserContext *)theContext actionBlock:(void (^)())theActionBlock
- (void)handleAstErrorWithContext:(GHParserContext *)theContext actionBlock:(void (^)(void))theActionBlock
{
[self handleExternalErrorWithContext: theContext actionBlock: ^() { theActionBlock(); return YES; } defaultValue: NO];
}

- (BOOL)handleExternalErrorWithContext:(GHParserContext *)theContext actionBlock:(BOOL (^)())theActionBlock defaultValue:(BOOL)theDefaultValue
- (BOOL)handleExternalErrorWithContext:(GHParserContext *)theContext actionBlock:(BOOL (^)(void))theActionBlock defaultValue:(BOOL)theDefaultValue
{
if (stopAtFirstError)
{
Expand All @@ -149,17 +149,17 @@

- (void)buildWithContext:(GHParserContext *)theContext token:(GHToken *)theToken
{
[self handleAstErrorWithContext: theContext actionBlock: ^() { [astBuilder buildWithToken: theToken]; }];
[self handleAstErrorWithContext: theContext actionBlock: ^() { [self->astBuilder buildWithToken: theToken]; }];
}

- (void)startRuleWithContext:(GHParserContext *)theContext ruleType:(GHRuleType)theRuleType
{
[self handleAstErrorWithContext: theContext actionBlock: ^() { [astBuilder startRuleWithType: theRuleType]; }];
[self handleAstErrorWithContext: theContext actionBlock: ^() { [self->astBuilder startRuleWithType: theRuleType]; }];
}

- (void)endRuleWithContext:(GHParserContext *)theContext ruleType:(GHRuleType)theRuleType
{
[self handleAstErrorWithContext: theContext actionBlock: ^() { [astBuilder endRuleWithType: theRuleType]; }];
[self handleAstErrorWithContext: theContext actionBlock: ^() { [self->astBuilder endRuleWithType: theRuleType]; }];
}

- (id)resultWithContext:(GHParserContext *)theContext
Expand Down

0 comments on commit f6a18ce

Please sign in to comment.