|
Boost : |
From: Eric Niebler (eric_at_[hidden])
Date: 2005-09-18 13:46:51
John Maddock wrote:
> there is one complicated
> expression that xpressive didn't compile, but which Boost.Regex and PCRE
> did handle OK.
I've tracked this down. xpressive is rejecting this regex because it is
invalid according to the TR1 spec. It begins:
const char* highlight_expression =
"(^[ \t]*#(?:[^\\\\\\n]|"
"\\\\[^\\n_[:punct:][:alnum:]]*[\\n[:punct:][:word:]])*)|"
----------------------------------------------^^^^^^^^
The problem is [:word:]. "word" is not a valid char-class-name,
according to the TR1 spec:
"Expressions of the form [[:class-name:]] are recognized, and are
sensitive to the locale encapsulated by the traits class. The range of
values for class-name is determined by the traits class, but at least
the following names are recognized: alnum, alpha, blank, cntrl, digit,
graph, lower, print, punct, space, upper, xdigit."
If you change your regex to use "\\w" instead of "[:word:]", xpressive
compiles it fine.
(xpressive sure could give a better error in this case, though. :-/)
-- Eric Niebler Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk