[cfe-commits] [libcxx] r109711 - /libcxx/trunk/include/regex
Howard Hinnant
hhinnant at apple.com
Wed Jul 28 17:36:01 PDT 2010
Author: hhinnant
Date: Wed Jul 28 19:36:00 2010
New Revision: 109711
URL: http://llvm.org/viewvc/llvm-project?rev=109711&view=rev
Log:
fix parse bug in ecma non-greedy loop
Modified:
libcxx/trunk/include/regex
Modified: libcxx/trunk/include/regex
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=109711&r1=109710&r2=109711&view=diff
==============================================================================
--- libcxx/trunk/include/regex (original)
+++ libcxx/trunk/include/regex Wed Jul 28 19:36:00 2010
@@ -3423,11 +3423,12 @@
{
if (__first != __last)
{
+ unsigned __grammar = __flags_ & 0x1F0;
switch (*__first)
{
case '*':
++__first;
- if ((__flags_ & ECMAScript) && __first != __last && *__first == '?')
+ if (__grammar == ECMAScript && __first != __last && *__first == '?')
{
++__first;
__push_nongreedy_inf_repeat(0, __s, __mexp_begin, __mexp_end);
@@ -3437,7 +3438,7 @@
break;
case '+':
++__first;
- if ((__flags_ & ECMAScript) && __first != __last && *__first == '?')
+ if (__grammar == ECMAScript && __first != __last && *__first == '?')
{
++__first;
__push_nongreedy_inf_repeat(1, __s, __mexp_begin, __mexp_end);
@@ -3447,7 +3448,7 @@
break;
case '?':
++__first;
- if ((__flags_ & ECMAScript) && __first != __last && *__first == '?')
+ if (__grammar == ECMAScript && __first != __last && *__first == '?')
{
++__first;
__push_loop(0, 1, __s, __mexp_begin, __mexp_end, false);
@@ -3468,7 +3469,7 @@
{
case '}':
++__first;
- if ((__flags_ & ECMAScript) && __first != __last && *__first == '?')
+ if (__grammar == ECMAScript && __first != __last && *__first == '?')
{
++__first;
__push_loop(__min, __min, __s, __mexp_begin, __mexp_end, false);
@@ -3482,7 +3483,7 @@
if (*__first == '}')
{
++__first;
- if ((__flags_ & ECMAScript) && __first != __last && *__first == '?')
+ if (__grammar == ECMAScript && __first != __last && *__first == '?')
{
++__first;
__push_nongreedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
@@ -3502,7 +3503,7 @@
++__first;
if (__max < __min)
throw regex_error(regex_constants::error_badbrace);
- if ((__flags_ & ECMAScript) && __first != __last && *__first == '?')
+ if (__grammar == ECMAScript && __first != __last && *__first == '?')
{
++__first;
__push_loop(__min, __max, __s, __mexp_begin, __mexp_end, false);
More information about the cfe-commits
mailing list