Boost logo

Boost Users :

From: Joel de Guzman (joel_at_[hidden])
Date: 2005-10-13 23:40:02


Aaron Griffin wrote:
> Hi all,
>
> On a side note, if I have a rule similar to (keyword >> identifier),
> the skip_parser will translate "somekeyword a" into "somekeyworda" and
> will parse it fine. However, what is to stop someone from removing
> the whitespace in the original code. With a quick glance, it appears
> the example c grammar from the spirit site will parse "voidfoo()" just
> fine due to this. Is there anyway I can tell the skip grammar to
> force a seperation?

The technique used in QuickBook is:

     keyword >> (eps_p - (alnum_p | '_'))
     ; // make sure we recognize whole words only

(yes, the example C grammar should be fixed)

Oh and BTW, the proper forum for Spirit is:
spirit-general_at_[hidden]
https://lists.sourceforge.net/lists/listinfo/spirit-general

Regards,

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

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