Boost logo

Boost Users :

Subject: Re: [Boost-users] Spirit Newbie (balanced parentheses)
From: Lars Rohwedder (L.Rohwedder_at_[hidden])
Date: 2010-04-19 10:22:14


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!
}

L.R.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net