commit 8f1cd50f1ed6d47a3c2d3c94b484d26a35b82929
parent 4fb9f298c970efb92b7d5f8c5c8d165f8982e8f4
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 11 May 2019 17:52:41 +0200
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 <rlwestlund@gmail.com>
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git 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)"