jryan (via RT) <[EMAIL PROTECTED]> writes:

> --- assemble_old.pl   2002-08-04 21:00:02.000000000 -0400
> +++ assemble.pl       2002-08-12 00:03:56.000000000 -0400
> @@ -263,8 +263,8 @@ sub preprocess {
>      }
>      elsif(/^\.constant \s+
>            ($label_re)  \s+
> -          (\"(?:[^\\\"]*(?:\\.[^\\\"]*)*)\" |
> -           \'(?:[^\\\']*(?:\\.[^\\\']*)*)\'
> +           ( " (?: \\. | [^\\"]* ) " |
> +             ' (?: \\. | [^\\"]* ) '
>            )/x) {                               # .constant {name} {string}
>        $self->{constants}{$1} = $2;
>      }

Sorry, but I don't think the path does the right thing.
I just did a simple test: (leaving out the unintresting part)

$_           $2 old regexp      $2 new regexp
"test"       "test"             "test"
"\""         "\""               "\""
"\"test"     "\"test"           failed
"te"st"      "te"               "te"
'te'st'      'te'               'te'st'

A corrected version of the patch is:
--- assemble_old.pl     2002-08-04 21:00:02.000000000 -0400
+++ assemble.pl 2002-08-12 00:03:56.000000000 -0400
@@ -263,8 +263,8 @@ sub preprocess {
     }
     elsif(/^\.constant \s+
           ($label_re)  \s+
-          (\"(?:[^\\\"]*(?:\\.[^\\\"]*)*)\" |
-           \'(?:[^\\\']*(?:\\.[^\\\']*)*)\'
+           ( " (?: \\. | [^\\"]* )* " |
+             ' (?: \\. | [^\\']* )* '
           )/x) {                               # .constant {name} {string}
       $self->{constants}{$1} = $2;
     }

I did not checked the speed gain of this patch, but I checked the
corner cases I can think of.

by
juergen

Reply via email to