-
-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
I'm implementing Cucumber Expressions
parser in Rust: WIP. And grammar described in the ARCHITECTURE.md
really bothers me for couple of reasons.
- Lookbehind and lookahead in
alternation
definition
EBNF describes context-free grammars and (correct me if I'm wrong) shouldn't have lookaheads and lookbehinds. This also means that described grammar may have non-linear complexity. - Provided grammar describes superset of
Cucumber Expressions
and I don't really see reasons to do it.
So implementing Cucumber Expression
parser according to the docs leads to unnecessary performance overhead for no obvious reasons.
Can't we just provide exact grammar for Cucumber Expressions
without Note:
section?
If I didn't miss anything provided grammar should be exact Cucumber Expressions
cucumber-expression = (alternation
| optional
| parameter
| text)*
text = (- text-to-escape) | ('\', text-to-escape)
text-to-escape = '(' | '{' | '/' | '\'
alternation = single-alternation, ('/', single_alternation)+
single-alternation = ((text-in-alternative+, optional*)
| (optional+, text-in-alternative+))+
text-in-alternative = (- alternative-to-escape) | ('\', alternative-to-escape)
alternative-to-escape = ' ' | '(' | '{' | '/' | '\'
optional = '(', text-in-optional+, ')'
text-in-optional = (- optional-to-escape) | ('\', optional-to-escape)
optional-to-escape = '(' | ')' | '{' | '/' | '\'
parameter = '{', name*, '}'
name = (- name_to_escape) | ('\', name-to-escape)
name-to-escape = '{' | '}' | '(' | '/' | '\'
olleolleolle and aurelien-reeves
Metadata
Metadata
Assignees
Labels
No labels