
20 Apr
2010
20 Apr
'10
5:14 a.m.
On Mon, Apr 19, 2010 at 8:22 AM, Lars Rohwedder
EricB schrieb:
is there any way to manage this with 1.6.4
If only need to checked whether the string contains the same number of '(' and ')' what about
int counter=0;
rule<> r = ch_p('(')[increment_a(counter)] >> ~ch_p(')') >> ch_p(')')[decrement_a(counter)]
if(counter!=0) { // unbalanced! }
Unnecessary, slower, and error-prone. There is still a 'raw' equivalent in Spirit1 as I recall, but I do not know the syntax, you might be better off to ask on the Spirit mailing list (just be sure to mention that you are using a broken compiler, else you will be inundated with posts saying to stop using the ancient and slow Spirit1 :) ).