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

Shigio YAMAGUCHI <[email protected]> Wed, 5 Jun 2024 14:38:53 +0900
Newsgroups gmane.comp.gnu.global.bugs
Message-ID <CADJmJYr2umr5AJPzJwKJ-wgBOqtB8FmswuWXznaaWv9gBV11vg@mail.gmail.com>
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=E2=80=AFPM daniel watson <[email protected]> wrote=
:
>
>
> not sure how to submit patches. open to redoing if you want.
>
> here's the disclaim,
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
>     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
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> 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
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
>
> 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/pygmen=
ts_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 ord=
er
>                      while self.lines_index[cur_line] <=3D index:
>                          cur_line +=3D 1
> -                    tag =3D re.sub('\s+', '', tag)    # remove newline a=
nd spaces
> +                    tag =3D re.sub(r'\s+', '', tag)    # remove newline =
and spaces
>                      if self.options.strip_punctuation:
>                          tag =3D tag.strip(PUNCTUATION_CHARACTERS)
>                      if tag:
> @@ -158,7 +158,10 @@ class CtagsParser:
>              line =3D self.child_stdout.readline()
>              if not line or line.startswith(TERMINATOR):
>                  break
> -            match =3D re.search(r'(\S+)\s+(\d+)\s+' + re.escape(path) + =
'\s+(.*)$', line)
> +            match =3D re.search(r'(\S+)\s+(\d+)\s+'
> +                              + re.escape(path)
> +                              + r'\s+(.*)$',
> +                              line)
>              if match:
>                  (tag, lnum, image) =3D match.groups()
>                  if self.options.strip_punctuation:
>


--=20
Shigio YAMAGUCHI <[email protected]>
PGP fingerprint:
26F6 31B4 3D62 4A92 7E6F  1C33 969C 3BE3 89DD A6EB