The difference operator,
is a binary operator that matches the first (LHS) operand but not the
// forwards to <boost/spirit/home/qi/operator/difference.hpp> #include <boost/spirit/include/qi_difference.hpp>
Also, see Include Structure.
Semantics of an expression is defined only where it differs from, or
is not defined in
a: A, b: B --> (a - b): A a: Unused, b: B --> (a - b): Unused
The complexity of the difference parser is defined by the sum of the complexities of both operands.
The test harness for the example(s) below is presented in the Basics Examples section.
Some using declarations:
Parse a C/C++ style comment:
test_parser("/*A Comment*/", "/*" >> *(char_ - "*/") >> "*/");
Unlike classic Spirit, with Spirit2, the expression will always fail
if the RHS is a successful match regardless if the RHS matches less
characters. For example, the rule
lit("policeman") - "police" will always fail
to match. Spirit2 does not count the matching chars while parsing
and there is no reliable and fast way to check if the LHS matches
more than the RHS.