2006-06-01 17:23:28 +00:00
|
|
|
## Here is an example for Python.
|
2014-05-16 20:21:34 +00:00
|
|
|
|
2018-02-07 11:25:46 +01:00
|
|
|
syntax python "\.py$"
|
2018-08-28 19:47:40 +02:00
|
|
|
header "^#!.*python"
|
2017-11-19 11:10:53 +01:00
|
|
|
magic "Python script"
|
2015-04-18 11:35:23 +00:00
|
|
|
linter pyflakes
|
2016-05-25 22:13:50 +02:00
|
|
|
comment "#"
|
2014-05-12 16:01:57 +00:00
|
|
|
|
|
|
|
# Function definitions.
|
2006-06-01 17:23:28 +00:00
|
|
|
icolor brightblue "def [0-9A-Z_]+"
|
2014-05-12 16:01:57 +00:00
|
|
|
# Keywords.
|
2017-12-10 01:46:02 -06:00
|
|
|
color brightcyan "\<(and|as|assert|async|await|break|class|continue)\>"
|
2018-09-18 20:21:00 +00:00
|
|
|
color brightcyan "\<(def|del|elif|else|except|finally|for|from)\>"
|
2017-12-10 01:46:02 -06:00
|
|
|
color brightcyan "\<(global|if|import|in|is|lambda|nonlocal|not|or)\>"
|
2018-09-18 20:21:00 +00:00
|
|
|
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:]]|$)"
|
2014-05-12 18:10:08 +00:00
|
|
|
|
2018-08-16 19:55:03 +02:00
|
|
|
# Special values.
|
|
|
|
color brightmagenta "\<(False|None|True)\>"
|
|
|
|
|
2019-05-11 17:52:41 +02:00
|
|
|
# Mono-quoted strings.
|
|
|
|
color brightgreen "'([^'\]|\\.)*'|'''"
|
|
|
|
color brightgreen ""([^"\]|\\.)*"|""""
|
|
|
|
color normal "'''|""""
|
2015-03-25 13:50:12 +00:00
|
|
|
# Comments.
|
2018-11-03 21:12:44 +01:00
|
|
|
color brightred "(^|[[:blank:]])#.*"
|
2015-12-02 10:29:18 +00:00
|
|
|
# Triple-quoted strings.
|
2017-07-22 20:51:17 +02:00
|
|
|
color brightgreen start="'''([^'),]|$)" end="(^|[^(\])'''"
|
2019-05-11 17:52:41 +02:00
|
|
|
color brightgreen start=""""([^"),]|$)" end="(^|[^(\])""""
|
2014-05-12 18:10:08 +00:00
|
|
|
|
|
|
|
# Reminders.
|
2017-12-10 14:27:21 +01:00
|
|
|
color brightwhite,yellow "(FIXME|TODO|XXX)"
|
2014-03-24 12:45:20 +00:00
|
|
|
|
2014-05-12 16:01:57 +00:00
|
|
|
# Trailing whitespace.
|
2014-03-24 12:45:20 +00:00
|
|
|
color ,green "[[:space:]]+$"
|