bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] handling of quotation marks


From: Hideki IWAMOTO
Subject: Re: [PATCH] handling of quotation marks
Date: Sun, 02 Mar 2003 03:35:56 +0900

Ignore my previous post. I am changing htags.in again.

On Sat, 01 Mar 2003 01:53:40 +0900, Hideki IWAMOTO wrote...
> htags cannot parse the following code correctly.
> 
>       if (f("'") && g('"'))
>               return 1;
>       else if (f("'\
> f()\
> g()") && g('\
> \
> "'))
>               return 2;
> 
> 
> 
> ? htags/Makefile
> ? htags/Makefile.in
> ? htags/const.pl
> ? htags/htags
> ? htags/htags.1
> Index: htags/htags.in
> ===================================================================
> RCS file: /cvsroot/global/global/htags/htags.in,v
> retrieving revision 1.95
> diff -u -r1.95 htags.in
> --- htags/htags.in    24 Feb 2003 13:37:07 -0000      1.95
> +++ htags/htags.in    28 Feb 2003 16:36:08 -0000
> @@ -2051,6 +2051,7 @@
>               #
>               print "<PRE>\n";
>               $INCOMMENT = 0;                 # initial status is out of 
> comment
> +             $quote = '';
>               local($LNO, $TAG, $TYPE) = &anchor'first();
>               while (<SRC>) {
>                       local($converted);
> @@ -2257,8 +2258,7 @@
>  #    io)     $_      source line
>  #
>  #    \001    quoted(\) char
> -#    \002    quoted('') char
> -#    \003    quoted string
> +#    \003    quoted string, quoted('') char
>  #    \004    comment
>  #    \005    line comment
>  #    \032    temporary mark
> @@ -2268,13 +2268,33 @@
>       while (s/(\\.)/\001/) {
>               push(@quoted_char1, $1);
>       }
> -     @quoted_char2 = ();
> -     while (s/('[^']*')/\002/) {
> -             push(@quoted_char2, $1);
> -     }
>       @quoted_strings = ();
> -     while (s/("[^"]*")/\003/) {
> -             push(@quoted_strings, $1);
> +     if ($quote) {
> +             if (s/^([^$quote]*$quote)/\003/) {
> +                     push(@quoted_strings, $1);
> +                     $quote = '';
> +             }
> +             elsif (s/^(.*\\)$/\003/) {
> +                     push(@quoted_strings, $1);
> +             }
> +             else {
> +                     $quote = '';
> +             }
> +     }
> +     while (s/('|")/\032$1/) {
> +             $quote = $1;
> +             if (s/\032($quote[^$quote]*$quote)/\003/) {
> +                     $quote = '';
> +                     push(@quoted_strings, $1);
> +             }
> +             elsif (s/\032($quote.*\\)$/\003/) {
> +                     push(@quoted_strings, $1);
> +             }
> +             else {
> +                     s/\032($quote)/\003/;
> +                     push(@quoted_strings, $1);
> +                     $quote = '';
> +             }
>       }
>       @comments = ();
>       s/^/\032/ if ($INCOMMENT);
> @@ -2325,10 +2345,6 @@
>       while (@quoted_strings) {
>               $s = shift @quoted_strings;
>               s/\003/$s/;
> -     }
> -     while (@quoted_char2) {
> -             $s = shift @quoted_char2;
> -             s/\002/$s/;
>       }
>       while (@quoted_char1) {
>               $s = shift @quoted_char1;
> 
> ----
> Hideki IWAMOTO  address@hidden
> 
> 
> _______________________________________________
> Bug-global mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-global

----
Hideki IWAMOTO  address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]