Closed DaOnlyOwner closed 2 years ago
Yes, the separator can be used just as a normal rule. However, in the current implementation setting a separator will transform any following rules to R -> S* R S*
, meaning that the separator will be implicitly parsed zero or more times before and after each rule. In other words, adding the separator rule as an actual rule in parsing will not parse anything.
However, you can change or deactivate the separator at any point, by calling setSeparator
again before adding new rules. ~To deactivate the separator, call setSeparator
with and empty pointer, e.g. g.setSeparator(std::shared_ptr<peg_parser::grammar::Rule>())
.~
Hello and thank you again ;) if I call setSeparator with an empty pointer, I get a nullptr exception because rule->hidden is accessed.
Oh I should have tested or looked at the code before saying that, sorry!😅
You should be able to use g.unsetSeparatorRule()
instead.
Hello a third question today :D
Is it possible to use the separator in the grammar too? For example like this: