Is the example for '-' difference parser wrong?

Phil Endecott via Spirit-general <[email protected]> Mon, 22 Nov 2021 15:55:02 +0000
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
Dear Experts,

The documentation for the difference parser at
https://www.boost.org/doc/libs/1_77_0/libs/spirit/doc/html/spirit/qi/reference/operator/difference.html
gives this example:

   Parse a C/C++ style comment:
   test_parser("/*A Comment*/", "/*" >> *(char_ - "*/") >> "*/");

Is that correct?

My understanding is that char_ matches any single character.
So (char_ - "*/") will match any single character that does not
also match "*/". Since "*/" is two characters, no single character
can ever match "*/". So (char_ - "*/") is surely the same as
just char_.

I was wondering if it were just a case of a misplaced paren, but
I don't think it's that simple.

Have I misunderstood something?


Thanks, Phil.