bug-global
[Top][All Lists]
Advanced

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

Re: make string raw so escape sequence r'\s' is valid


From: Shigio YAMAGUCHI
Subject: Re: make string raw so escape sequence r'\s' is valid
Date: Wed, 5 Jun 2024 14:38:53 +0900

Hello,
> here's the disclaim,

This is only in the case of copyright issues.

> these two strings had the escape sequence r'\s', and were not prefixed
> with 'r'.  this patch adds the 'r' prefix, making the sequence valid.

Though these strings does not include escape sequences, it seems that
it is recommended to use 'r' prefix for all regular expressions.
I will incorporate your patch into the repository.

Thank you.

Regards,
Shigio

On Tue, Jun 4, 2024 at 2:11 PM daniel watson <ozzloy@each.do> wrote:
>
>
> not sure how to submit patches. open to redoing if you want.
>
> here's the disclaim,
> ======================================================================
>
>     I, Daniel Watson, hereby disclaim all copyright interest in my
>     changes and enhancements to Global (herein called
>     the "Program").
>
>     I affirm that I have no other intellectual property interest that
>     would undermine this release, or the use of the Program, and will
>     do nothing to undermine it in the future.  I represent that the
>     changes and enhancements are my own and not a copy of someone
>     else's work.
>
>     Daniel Watson, 2024-06-03 21:05:55 -0700
>
> ======================================================================
>
> do you want me to print a piece of paper with this on it and sign it,
> scan it, and send the result?
>
>
> commit message and patch below the line
>
> ======================================================================
>
>
> these two strings had the escape sequence r'\s', and were not prefixed
> with 'r'.  this patch adds the 'r' prefix, making the sequence valid.
>
>
> diff --git a/plugin-factory/pygments_parser.py.in 
> b/plugin-factory/pygments_parser.py.in
> index 6017d4b..9c35951 100644
> --- a/plugin-factory/pygments_parser.py.in
> +++ b/plugin-factory/pygments_parser.py.in
> @@ -89,7 +89,7 @@ class PygmentsParser:
>                      # we can assume index are delivered in ascending order
>                      while self.lines_index[cur_line] <= index:
>                          cur_line += 1
> -                    tag = re.sub('\s+', '', tag)    # remove newline and 
> spaces
> +                    tag = re.sub(r'\s+', '', tag)    # remove newline and 
> spaces
>                      if self.options.strip_punctuation:
>                          tag = tag.strip(PUNCTUATION_CHARACTERS)
>                      if tag:
> @@ -158,7 +158,10 @@ class CtagsParser:
>              line = self.child_stdout.readline()
>              if not line or line.startswith(TERMINATOR):
>                  break
> -            match = re.search(r'(\S+)\s+(\d+)\s+' + re.escape(path) + 
> '\s+(.*)$', line)
> +            match = re.search(r'(\S+)\s+(\d+)\s+'
> +                              + re.escape(path)
> +                              + r'\s+(.*)$',
> +                              line)
>              if match:
>                  (tag, lnum, image) = match.groups()
>                  if self.options.strip_punctuation:
>


-- 
Shigio YAMAGUCHI <shigio@gnu.org>
PGP fingerprint:
26F6 31B4 3D62 4A92 7E6F  1C33 969C 3BE3 89DD A6EB



reply via email to

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