Open deanebarker opened 2 years ago
I would say that Separated
is not the best construct here, and you'd better use filterClause.And(ZeroOrMany(booleanDelimiter.And(filterClause)))
Note that this will result in left-precedence for and/or, meaning there won't be a priority on either of them (like +
vs *
) because you are reading from left to right. Usual grammars use a recursive approach when you get a tree-like structure to define precedence of operators. Liquid for instance does the same thing you are doing here (which is uncommon).
So yeah, Separated is more a "forget about me" thing for the separator.
Say I do this:
Then I use that parser as the delimiter for a
Separated
parser:As part of the filter, I want to know if it was prefaced by an
and
or anor
. To do this, I need to read from thebooleanDelimiter
.Is this possible? Or is there a better way?