syntax: sql: colorize strings differently than types

Also, colorize comments more readably (on a dark background), and
schemas less yelling, and languages more distinct from keywords.

And add a few more keywords, like IS and NULL.
This commit is contained in:
Benno Schulenberg 2021-12-04 12:05:58 +01:00
parent 5dc48d54f2
commit 350cdd9827
1 changed files with 10 additions and 11 deletions

View File

@ -15,15 +15,15 @@ color green "\<(date|int[48]|num|ts|tstz)range\>"
color lagoon "\<(ABORT|AGGREGATE|ALL|ALTER|ANALYZE|AND|ANY|AS|BEGIN|BETWEEN|CAST|CHECKPOINT)\>"
color lagoon "\<(CLOSE|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( BY)?|HAVING|IN|INDEX|INSERT|INTO)\>"
color lagoon "\<(END|EXCEPT|EXECUTE|EXISTS|EXPLAIN|EXTENSION|FETCH|FOREIGN (DATA WRAPPER|SCHEMA|TABLE))\>"
color lagoon "\<(FROM|FUNCTION|GRANT|GROUP( BY)?|HAVING|IN|INDEX|INSERT|INTERSECT|INTO|IS)\>"
color lagoon "\<(NATURAL )?(INNER |OUTER |CROSS |(LEFT|RIGHT|FULL)( OUTER)? )?JOIN\>"
color lagoon "\<((PRIMARY|FOREIGN) KEY|LANGUAGE|LOAD|LOCK|MOVE|NOT|NOTIFY)\>"
color lagoon "\<((PRIMARY|FOREIGN) KEY|LANGUAGE|LOAD|LIKE|LOCK|MOVE|NOT|NOTIFY|NULL)\>"
color lagoon "\<(ON|ONLY|OPERATOR( CLASS| FAMILY)?|OR|ORDER BY|PREPARED?|PRIVILEGES)\>"
color lagoon "\<(RELEASE|RESET|RETURNING|REVOKE|ROLE|ROLLBACK|RULE|SAVEPOINT|SCHEMA)\>"
color lagoon "\<(RELEASE|RESET|RETURN(S|ING)|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)?|USING)\>"
color lagoon "\<(TO|TRANSACTION|(EVENT )?TRIGGER|TYPE|UNION|UPDATE|USER( MAPPING)?|USING)\>"
color lagoon "\<(VACUUM|VALUES|((REFRESH )?MATERIALIZED )?VIEW|WHERE|WITH)\>"
# Flow control.
@ -36,18 +36,17 @@ color ,red ""[^"]+""
color normal ""[[:alpha:]_][[:alnum:]_$]*""
# Strings.
color green "'([^']|\\')*'"
color lime "'([^']|\\')*'"
# Trailing whitespace.
color ,green "[[:space:]]+$"
# Comments.
color red "--.*"
color brightblue "//.*"
color brightblue start="/\*" end="\*/"
color pink "(--|//).*"
color pink start="/\*" end="\*/"
# PostgreSQL default schemas.
color brightred "\<(pg_catalog|public)\>"
color grey "\<(pg_catalog|public)\>"
# PostgreSQL PLs.
color brightblue "\<pl(java|perlu?|pgsql|py|pythonu?|r|ruby|scheme|sh|tcl)\>"
color mauve "\<(SQL|pl(java|perlu?|pgsql|py|pythonu?|r|ruby|scheme|sh|tcl))\>"