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