Spirit Parser Framework - Operators

Operators

Because of limitations of the C++ language, the syntax of Spirit has been designed around the operator precedences of C++, while bearing resemblance to both EBNF and regular expressions.

syntax explanation
x >> y Match x followed by y.
x > y After matching x, expect y.
*x Match x repeated zero or more times. (This is representing the Kleene star; C++ lacks a unary postfix operator *)
x | y Match x. If x does not match, try to match y.
+x Match x repeated one or more times.
-x Match x zero or one time.
x & y Match x and y.
x - y Match x but not y.
x ^ y Match x or y or both in any order.
x || y Match x or y or x followed by y.
x Execute the function/functor returned by function_expression, if x matched.
( x ) Match x (can be used for priority grouping)
x % y Match one or more repetitions of x, separated by occurrences of y.
~x Match anything but x (only with character classes such as ch_p or alnum_p)

Read more about this topic:  Spirit Parser Framework