syntax: python: do not highlight 'print' and 'exec' in Python 3

Assume that 'print' and 'exec' are statements when they are followed
by whitespace, and are functions otherwise.  This does not highlight
"print'x'" nor "print{x}", but these statements are poor style.

Signed-off-by: Benjamin Mintz <bmintz@protonmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
This commit is contained in:
Benjamin Mintz 2018-09-18 20:21:00 +00:00 committed by Benno Schulenberg
parent d718ed4fc3
commit 790f98560b

View File

@ -10,9 +10,14 @@ 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)\>"
# These two are keywords in Python 2, but functions in Python 3,
# so only color them when they are followed by whitespace, assuming
# 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)\>"