First alternatives cannot be tagged and repeated without additional grouping
drmfinlay opened this issue · comments
Dane Finlay commented
There is a parser bug where the first alternative of a set cannot be weighted and repeated simultaneously. A GrammarError
will be raised if this is attempted. For example:
parse_expansion_string("/10/a+|/20/b")
This also applies to the kleene star operator (*
). This doesn't occur with subsequent weighted alternatives such as /10/a|/20/b+
or /10/a|/20/b|/30/c+
because of how rule expansion parsing is done.
The problem can be sidestepped by wrapping the repetition in a required or optional grouping: /10/(a+)|/20/b
or /10/[a+]|/20/b
. This is not required though; I will shortly be releasing a new version that fixes this.