Dear all,
I would like to use boost.xpressive to parse some string like a+b:c, and I wrote the following snippet:
sregex reOp = as_xpr('+') | '-' | '*' | '/';
sregex reDelim = as_xpr(':');
sregex reSimpleToken = reOp | reDelim | reField;
sregex_token_iterator cur(str.begin(), str.end(), reSimpleToken), end;
for (; cur != end; ++cur) {
which will print:
a
+
b
:
c
but I would also want to know which rule is matched for the sequent operations, for example a, b and c' are matched by reField, and + is matched by reOp. I am very new to boost.xpressive, so if this is not the good way, correct me please. Any help is appreciated!
Best,
Li