GNU bug report logs - #57004
[PATCH] Fontify Escape Sequences in Python String and Byte Literals

Previous Next

Package: emacs;

Reported by: Laurence Warne <laurencewarne <at> gmail.com>

Date: Fri, 5 Aug 2022 13:08:01 UTC

Severity: normal

Tags: patch

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Laurence Warne <laurencewarne <at> gmail.com>
To: 57004 <at> debbugs.gnu.org
Subject: bug#57004: [PATCH] Fontify Escape Sequences in Python String and Byte Literals
Date: Fri, 5 Aug 2022 14:06:33 +0100
[Message part 1 (text/plain, inline)]
Hi, this patch implements escape code syntax highlighting within string an
bytes literals for python-mode (described at
https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals)
similar to how they are highlighted by https://pygments.org.

I've written a few tests (which should probably be expanded on (: ), an
example based on one of the test samples:

b'example 1: \n \\ \u1234 \U00010348 \N{Plus-Minus Sign}'
'example 2:  \n \\ \u1234 \U00010348 \N{Plus-Minus Sign}'

e.g. in the above we see "\n", "\\" highlighted on the first line, but not
"\u1234", "\U00010348" "\N{Plus-Minus Sign}" since these items aren't valid
escape sequences in byte literals.  The second line however is a string
literal, so all of the preceding items are highlighted.

Thanks, Laurence
[Message part 2 (text/html, inline)]
[0001-Fontify-python-escape-sequences-in-literals.patch (text/x-patch, attachment)]

This bug report was last modified 2 years and 284 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.