ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
Re: [boost] spirit: character set complement (for lexers)
by Joel de Guzman other posts by this author
Oct 23 2002 5:57AM messages near this date
RE: [boost] spirit: character set complement (for lexers) | Re:[boost] Serialization: problem with multi-inheritance
----- Original Message -----
From: "Petr Kocmid" <pkocmid@[...].cz> 


>  > Perhaps  ~ch_p('x') and ~digit_p will both result to a chset as well.
>  > However, there's a problem. Character sets can support 8/16/32
>  > bits. While it is clear that ~ch_p('x') is chset<char> with everything
>  > on except 'x', and ~ch_p(L'x') will be chset<wchar_t>, what will be
>  > the type of ~digit_p? Shall it be hardcoded to  chset<char>?
> 
>  Perhaps using a chset seems to be a little overkill in certain cases.
> 
>  I have this idea, resulted from closer look in primitives.hpp: for all single character pa
rsers
which are using locale-style check call in their test function, the most efficient way to ma
ke a
complementar parser would be to add a completely new little parser, such as not_digit_p, hav
ing
return !impl::isdigit_ in underlying test().
> 
>  Then ~digit_p could map to not_digit_p and vice versa, making such complement operation na
turally
symmetric. And honoring locale, too. More, no need to hardcode anything to chset<char> .

Hmmm. Nice idea. I think this is practical (and fast!)
If there are no objections, I think I like this :-)

Cheers,
--Joel

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Petr Kocmid
Joel de Guzman
Petr Kocmid
Joel de Guzman

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved