blob: 6dd471d1a4faabe1fdf5d35aeea6ce7473d0516c [file] [log] [blame]
Benno Schulenbergde6da122015-05-20 18:57:18 +00001## Here is an example for PostgreSQL.
2
3syntax "sql" "\.sql[2345s~]?$"
4magic "PostgreSQL script text"
Mike Scalora6a2032f2016-05-25 22:13:50 +02005comment "-- "
Benno Schulenbergde6da122015-05-20 18:57:18 +00006
7# Functions.
8color white "\<[a-z_]*\("
9
10# Types.
11color green "\<(int2|smallint|int4|int|integer|int8|bigint|decimal|numeric|real|double precision|(small|big)?serial)\>"
12color green "\<(bit( varying)?|boolean|bytea|enum|money|tsvector|uuid)\>"
13color green "\<(char|varchar|character( varying)?|text)\>"
14color green "\<(date|interval|time(stamp)?( with time zone| without time zone)?)\>"
15color green "\<(point|line|lseg|path|box|polygon|circle)\>"
16color green "\<(cidr|inet|macaddr)\>"
17color green "\<(daterange|int4range|int8range|numrange|tsrange|tstzrange)\>"
18
19# Structure.
20color brightyellow "\<(CASE|CLASS|DEFAULT|DO|ELSE|ELSEIF|FOR|FOREACH|FUNCTION|IF|IS NULL)\>"
21color brightyellow "\<(NEW|PRIVATE|PUBLIC|RETURN|RETURNS|SETOF|SWITCH|THEN|WHEN|WHILE)>"
22
23# Control flow.
24color magenta "\<(EXCEPTION|NOTICE|RAISE|RETURN)\>"
25
26# SQL keywords.
27color blue "\<(ABORT|AGGREGATE|ALTER|ANALYZE|AND|AS|AUTHORIZATION|BEGIN|CAST|CHECKPOINT|CLASS|CLOSE)\>"
28color blue "\<(CLUSTER|COLLATION|COMMENT|COMMIT|CONFIGURATION|CONSTRAINTS|CONVERSION|COPY|CREATE)\>"
29color blue "\<(DATA|DATABASE|DEALLOCATE|DECLARE|DEFAULT|DELETE|DICTIONARY|DISCARD|DO|DOMAIN|DROP)\>"
30color blue "\<(END|EVENT|EXECUTE|EXPLAIN|EXTENSION|FAMILY|FETCH|FOREIGN|FROM|FUNCTION)\>"
31color blue "\<(GRANT|GROUP|IF NOT EXISTS|IMMUTABLE|INDEX|INSERT|INTO|LABEL|LANGUAGE|LARGE|LOAD|LOCK)\>"
32color blue "\<(MAPPING FOR|MATERIALIZED|MOVE|NOTIFY|OBJECT|OPERATOR|OPTIONS|OWNED|OWNER)\>"
33color blue "\<(PARSER|PREPARED?|PRIVILEGES|REASSIGN|REFRESH|RELEASE|RESET|REVOKE|ROLE|ROLLBACK|RULE)\>"
34color blue "\<(SAVEPOINT|SCHEMA|SEARCH|SECURITY|SELECT|SEQUENCE|SERVER|SESSION|SET|SHOW|SPACE|START|SYSTEM)\>"
35color blue "\<(TABLE|TEXT|TO|TRANSACTION|TYPE|UPDATE|USER|VACUUM|VALUES|VIEW|WHERE|WITH|WRAPPER)\>"
36
37# Strings.
38color brightyellow "<[^= ]*>" ""(\.|[^"])*""
39
40# Trailing whitespace.
41color ,green "[[:space:]]+$"
42
43# Regular expressions.
44color brightmagenta "/([^/]|(\\/))*/[iomx]*" "%r\{([^}]|(\\}))*\}[iomx]*"
45
46# Shell command expansion is in `backticks` or like %x{this}. These are
47# "double-quotish" (to use a perlism).
48color brightblue "`[^`]*`" "%x\{[^}]*\}"
49
50# Strings, double-quoted.
51color green ""([^"]|(\\"))*"" "%[QW]?\{[^}]*\}" "%[QW]?\([^)]*\)" "%[QW]?<[^>]*>"
52color green "%[QW]?\[[^]]*\]" "%[QW]?\$[^$]*\$" "%[QW]?\^[^^]*\^" "%[QW]?![^!]*!"
53
54# Expression substitution. These go inside double-quoted strings,
55# "like #{this}".
56color brightgreen "#\{[^}]*\}"
57
58# Strings, single-quoted.
59color green "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>"
60color green "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!"
61
62# Comments.
63color red "#[^{].*$" "#$"
64color red "--[^{].*$" "#$"
65color red "##[^{].*$" "##$"
66color brightblue "//.*"
67color brightblue start="/\*" end="\*/"
68
69# PostgreSQL markings.
70color red "(--)"
71
72# PostgreSQL default schemas.
73color brightred "(pg_catalog|public)"
74
75# PostgreSQL PLs.
76color brightblue "(pljava|plperlu?|plpgsql|plpy|plpythonu?|plr|plruby|plsh|pltcl|plscheme)"