mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-25 22:29:42 +03:00
41975265bf
Also, combine some keywords that can only occur together. And drop a few that are probably rare, like LARGE OBJECT. Reference: https://www.postgresql.org/docs/14/bookindex.html And use a more readable color -- blue is too dark on a black base.
53 lines
2.2 KiB
Plaintext
53 lines
2.2 KiB
Plaintext
## Syntax highlighting for (Postgres) SQL scripts.
|
|
|
|
syntax sql "\.sql$"
|
|
comment "-- "
|
|
|
|
# Types.
|
|
color green "\<(integer|int[248]|(big|small)?(int|serial)|decimal|numeric|real|double precision)\>"
|
|
color green "\<(bit( varying)?|boolean|bytea|enum|money|tsquery|tsvector|uuid|xml)\>"
|
|
color green "\<(char|varchar|character( varying)?|text)\>"
|
|
color green "\<(date|interval|time(stamp)?( with(out)? time zone)?)\>"
|
|
color green "\<(box|circle|line|lseg|path|point|polygon)\>"
|
|
color green "\<(cidr|inet|macaddr8?)\>"
|
|
color green "\<(date|int[48]|num|ts|tstz)range\>"
|
|
|
|
# SQL keywords.
|
|
color lagoon "\<(ABORT|AGGREGATE|ALL|ALTER|ANALYZE|AND|ANY|AS|BEGIN|CAST|CHECKPOINT|CLOSE)\>"
|
|
color lagoon "\<(CLUSTER|COLLATION|COMMENT|COMMIT|CONSTRAINTS|CONVERSION|COPY|CREATE)\>"
|
|
color lagoon "\<(DATABASE|DEALLOCATE|DECLARE|DEFAULT|DELETE|DISCARD|DISTINCT|DO|DOMAIN|DROP)\>"
|
|
color lagoon "\<(END|EXECUTE|EXISTS|EXPLAIN|EXTENSION|FETCH|FOREIGN (DATA WRAPPER|SCHEMA|TABLE))\>"
|
|
color lagoon "\<(FROM|FUNCTION|GRANT|GROUP|IN|INDEX|INSERT|INTO|LANGUAGE|LOAD|LOCK|MOVE)\>"
|
|
color lagoon "\<(NOT|NOTIFY|ONLY|OPERATOR( CLASS| FAMILY)?|OR|ORDER BY|PREPARED?|PRIVILEGES)\>"
|
|
color lagoon "\<(RELEASE|RESET|RETURNING|REVOKE|ROLE|ROLLBACK|RULE|SAVEPOINT|SCHEMA)\>"
|
|
color lagoon "\<(SELECT|SEQUENCE|SERVER|SESSION AUTHORIZATION|SET|SHOW|START|SYSTEM)\>"
|
|
color lagoon "\<(TABLE(SPACE)?|TEXT SEARCH (CONFIGURATION|DICTIONARY|PARSER|TEMPLATE))\>"
|
|
color lagoon "\<(TO|TRANSACTION|(EVENT )?TRIGGER|TYPE|UPDATE|USER( MAPPING)?)\>"
|
|
color lagoon "\<(VACUUM|VALUES|((REFRESH )?MATERIALIZED )?VIEW|WHERE|WITH)\>"
|
|
|
|
# Flow control.
|
|
color brightyellow "\<(CASE|WHEN|IF|THEN|ELSE|ELSE?IF|LOOP|CONTINUE|EXIT)\>"
|
|
color brightyellow "\<(FOR|FOREACH|IN|WHILE|END (CASE|IF|LOOP))\>"
|
|
color magenta "\<(RAISE|EXCEPTION|NOTICE|RETURN)\>"
|
|
|
|
# Quoted identifiers. (First scare-color all, then uncolor what is valid.)
|
|
color ,red ""[^"]+""
|
|
color normal ""[[:alpha:]_][[:alnum:]_$]*""
|
|
|
|
# Strings.
|
|
color green "'([^']|\\')*'"
|
|
|
|
# Trailing whitespace.
|
|
color ,green "[[:space:]]+$"
|
|
|
|
# Comments.
|
|
color red "--.*"
|
|
color brightblue "//.*"
|
|
color brightblue start="/\*" end="\*/"
|
|
|
|
# PostgreSQL default schemas.
|
|
color brightred "\<(pg_catalog|public)\>"
|
|
|
|
# PostgreSQL PLs.
|
|
color brightblue "\<pl(java|perlu?|pgsql|py|pythonu?|r|ruby|scheme|sh|tcl)\>"
|