bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#57004: [PATCH] Fontify Escape Sequences in Python String and Byte Li


From: Laurence Warne
Subject: bug#57004: [PATCH] Fontify Escape Sequences in Python String and Byte Literals
Date: Fri, 5 Aug 2022 14:06:33 +0100

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

Attachment: 0001-Fontify-python-escape-sequences-in-literals.patch
Description: Text Data


reply via email to

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