From 8f1cd50f1ed6d47a3c2d3c94b484d26a35b82929 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 11 May 2019 17:52:41 +0200 Subject: [PATCH] syntax: python: avoid miscoloring stuff between two empty strings The quotes of an empty string ('' or "") should be colored just like those of a non-empty string, because otherwise the text *between* two empty strings on the same line gets colored. Add an extra rule to discolor triple quotes again to not make them look like valid by themselves. Also, remove six superfluous backslashes. This addresses https://savannah.gnu.org/patch/?9801. Reported-by: Ryan Westlund --- syntax/python.nanorc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/syntax/python.nanorc b/syntax/python.nanorc index 53643afe..0c60bb76 100644 --- a/syntax/python.nanorc +++ b/syntax/python.nanorc @@ -22,14 +22,15 @@ color brightcyan "\<(exec|print)([[:blank:]]|$)" # Special values. color brightmagenta "\<(False|None|True)\>" -# Single-quoted strings. -color brightgreen "'([^'\]|\\.)+'" -color brightgreen ""([^"\]|\\.)+"" +# Mono-quoted strings. +color brightgreen "'([^'\]|\\.)*'|'''" +color brightgreen ""([^"\]|\\.)*"|"""" +color normal "'''|"""" # Comments. color brightred "(^|[[:blank:]])#.*" # Triple-quoted strings. color brightgreen start="'''([^'),]|$)" end="(^|[^(\])'''" -color brightgreen start="\"\"\"([^"),]|$)" end="(^|[^(\])\"\"\"" +color brightgreen start=""""([^"),]|$)" end="(^|[^(\])"""" # Reminders. color brightwhite,yellow "(FIXME|TODO|XXX)"