From d96e4c18732c6597c0449ccd5ac77d3fcb11a4c6 Mon Sep 17 00:00:00 2001 From: Benjamin Mintz Date: Tue, 18 Sep 2018 20:21:00 +0000 Subject: [PATCH] syntax/python: do not highlight print and exec in python 3 Assumes that print(x) is a function invocation and print x is a statement. Does not highlight "print'x'" or "print{x}", but this is poor style. Original regex by Benjamin Mintz and improved by Benno Schulenberg. Signed-off-by: Benjamin Mintz --- syntax/python.nanorc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/syntax/python.nanorc b/syntax/python.nanorc index 671cda80..2cbcda1b 100644 --- a/syntax/python.nanorc +++ b/syntax/python.nanorc @@ -10,9 +10,13 @@ comment "#" icolor brightblue "def [0-9A-Z_]+" # Keywords. color brightcyan "\<(and|as|assert|async|await|break|class|continue)\>" -color brightcyan "\<(def|del|elif|else|except|exec|finally|for|from)\>" +color brightcyan "\<(def|del|elif|else|except|finally|for|from)\>" color brightcyan "\<(global|if|import|in|is|lambda|nonlocal|not|or)\>" -color brightcyan "\<(pass|print|raise|return|try|while|with|yield)\>" +color brightcyan "\<(pass|raise|return|try|while|with|yield)\>" + +# Keywords in python 2, but functions in python 3 +# assume that print(x) is a function invocation and print (x) is a statement +color brightcyan "\<(exec|print)([[:blank:]]|$)" # Special values. color brightmagenta "\<(False|None|True)\>" -- 2.17.1