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

daniel watson <[email protected]> Tue, 04 Jun 2024 23:21:26 -0700
Newsgroups gmane.comp.gnu.global.bugs
Message-ID <871q5brir7.fsf@trent-reznor>
> Thank you.
you're welcome!


> I will incorporate your patch into the repository.
glad it is helpful.



Shigio YAMAGUCHI <[email protected]> writes:

> 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]> wro=
te:
>>
>>
>> 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/pygme=
nts_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 or=
der
>>                      while self.lines_index[cur_line] <=3D index:
>>                          cur_line +=3D 1
>> -                    tag =3D re.sub('\s+', '', tag)    # remove newline =
and 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:
>>