berp icon indicating copy to clipboard operation
berp copied to clipboard

Parser errors

Open Uncommon opened this issue 4 years ago • 1 comments

I'm getting this output when I try to re-generate the Objective-C files for Gherkin:

Berp 1.0.0 Copyright (C) 2014-2020, Gaspar Nagy (Spec Solutions) Licensed under the Apache License, Version 2.0 (the "License") http://www.apache.org/licenses/LICENSE-2.0

Generating parser for grammar 'GherkinGrammar.berp' using template 'gherkin-objective-c-implementation.razor'. Loading grammar...

Generation failed. Parser errors: (21:22): expected: #AnyMultiplier, #OneOrMoreMultiplier, #OneOrZeroMultiplier, #LParen, #Token, #Rule, #EOL, got '[' (21:29): expected: #AnyMultiplier, #OneOrMoreMultiplier, #OneOrZeroMultiplier, #LParen, #Token, #Rule, #EOL, got '|' (21:38): expected: #AnyMultiplier, #OneOrMoreMultiplier, #OneOrZeroMultiplier, #LParen, #Token, #Rule, #EOL, got '|' (21:47): expected: #AnyMultiplier, #OneOrMoreMultiplier, #OneOrZeroMultiplier, #LParen, #Token, #Rule, #EOL, got '->' (21:58): expected: #AnyMultiplier, #OneOrMoreMultiplier, #OneOrZeroMultiplier, #LParen, #Token, #Rule, #EOL, got ']'

So it looks like it's having trouble with this line from GherkinGrammar.berp:

Examples! := #TagLine[#Empty|#Comment|#TagLine->#Examples]* #Examples Examples_Description Examples_Table

Uncommon avatar Nov 12 '20 17:11 Uncommon

Comparing that line to the berp grammar, I can see why it doesn't work. AFAICT the lookahead hint somehow got moved to the wrong part of the line. Changing that line to this seems to fix it:

Examples! [#Empty|#Comment|#TagLine->#Examples]:= #TagLine* #Examples Examples_Description Examples_Table

Uncommon avatar Nov 17 '20 18:11 Uncommon

Please note that this is not the official Gherkin grammar though, which is in https://github.com/cucumber/gherkin/blob/main/gherkin.berp

gasparnagy avatar May 02 '23 08:05 gasparnagy