c++ - boost::spirit::qi difference parser behavior -
i'm trying understand behavior of qi's difference parsers.
with this:
rulea = ruleaa | ruleab | ruleac ; ruleb = rulea - ruleac ; i imagining parser match ruleb iff input matches ruleaa or ruleab. in other words, ruleb subtract 1 alternative (ruleac) rulea. incorrect?
in code, i'm doing above , compiles not seem behave expected. actual use-case involves other factors hard unwind here.
in essence, i'm trying this: have rule rulea, contains set of alternatives. rule gets used in few different places in grammar. in 1 particular use, need avoid evoking 1 of alternatives. seems difference parser intended purpose, maybe i'm misunderstanding?
thanks in advance!
i imagining parser match ruleb iff input matches ruleaa or ruleab. in other words, ruleb subtract 1 alternative (ruleac) rulea. incorrect?
(a|b|c) - c equivalent (a|b) iff c never matches (a|b) match.
a simple example, assume:
a = int_; b = +space; c = char_; because c matches a or b match, clear doing (a|b) - c results in no match. same (a|b|c)-c.
in short a or b also matches c no longer matches something - c.
this rule gets used in few different places in grammar. in 1 particular use, need avoid evoking 1 of alternatives. seems difference parser intended purpose
as you've seen above, not case. difference parser doesn't /modify/ left-hand-side parser @ all. (it discards matches independent of left-hand-side).
the best thing can think of /just use/ (a|b) in 1 place, , (a|b|c) in other. it's simple: say mean.
Comments
Post a Comment