This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, libstdc++/63775] Fix regex bracket expression parsing
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Tim Shen <timshen91 at gmail dot com>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 10 Nov 2014 18:32:46 +0000
- Subject: Re: [Patch, libstdc++/63775] Fix regex bracket expression parsing
- Authentication-results: sourceware.org; auth=none
- References: <CAPrifDnmuZRTV-Z5tpa=tr=RfBMkyPL4nXjr7C9EFef_WiJ_aA at mail dot gmail dot com>
On 09/11/14 10:17 -0800, Tim Shen wrote:
__matcher._M_add_equivalence_class(_M_value);
else if (_M_match_token(_ScannerT::_S_token_char_class_name))
__matcher._M_add_character_class(_M_value, false);
- else if (_M_try_char()) // [a
+ // POSIX doesn't permit '-' as a start-range char (say [a-z--0]),
+ // except that the '-' is the first character in the bracket expression
Should be "except when" in this comment
+ // ([--0]). ECMAScript treats all '-' after a range as a normal character.
+ // Also see above, where _M_expression_term gets called.
+ //
+ // As a result, POSIX rejects [-----], but ECMAScript doesn't.
+ // Boost (1.57.0) always uses POSIX style even in its ECMAScript syntax.
+ // Clang (3.5) always uses ECMAScript style even in its POSIX syntax.
+ //
+ // It turns out that no one reads BNFs ;)
Ha :-)
OK for trunk with the small change above - thanks!