Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Spirit] Skippers for sub-grammars
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-11-01 00:20:05


On Fri, Oct 22, 2010 at 6:58 AM, Vitaly Budovski
<vbudovski+news_at_[hidden]> wrote:
> On 22 October 2010 23:06, Hartmut Kaiser <hartmut.kaiser_at_[hidden]> wrote:
>>> I've decided to break up my parser into sub-grammars to improve both the
>>> readability and compile time. I'm now trying to specify a skip parser for
>>> one of the sub-grammars, but I don't know how to do it. I'm familiar with
>>> specifying a skip parser in the parse functions, but not in the grammar
>>> itself. Could somebody please provide an example?
>>> Thanks.
>>
>> You need to pass the skipper type to the subgrammar (see attached).
>> Additionally you need to utilize phrase_parse() instead of parse to hand
>> down a skipper instance.
>>
>> Regards Hartmut
>> ---------------
>> http://boost-spirit.com
>
> Hi Hartmut,
>
> Thank you very much for the reply. I do have another question though:
> Is it possible for the top level grammar to have its own skipper? If
> there are multiple sub-grammars, can they also have a different
> skipper each? If not, I guess I would have to put all the possible
> alternatives into the one skipper grammar, right?

They can, that is what the skip()[] directive is for (see docs).


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