syntax: sql: colorize as flow control only keywords that clearly are such

Drop things that were recolored afterward (like CLASS and DEFAULT).
Also, move these coloring rules to after the other keywords so that
things like "END IF" will stay colored as a whole.

Reference:
  https://www.postgresql.org/docs/current/plpgsql-control-structures.html
master
Benno Schulenberg 2021-10-26 15:48:51 +02:00
parent f2c9aed16c
commit 56aacb3e32
1 changed files with 5 additions and 7 deletions

View File

@ -12,13 +12,6 @@ color green "\<(point|line|lseg|path|box|polygon|circle)\>"
color green "\<(cidr|inet|macaddr)\>"
color green "\<(daterange|int4range|int8range|numrange|tsrange|tstzrange)\>"
# Structure.
color brightyellow "\<(CASE|CLASS|DEFAULT|DO|ELSE|ELSEIF|FOR|FOREACH|FUNCTION|IF|IS NULL)\>"
color brightyellow "\<(NEW|PRIVATE|PUBLIC|RETURN|RETURNS|SETOF|SWITCH|THEN|WHEN|WHILE)>"
# Control flow.
color magenta "\<(EXCEPTION|NOTICE|RAISE|RETURN)\>"
# SQL keywords.
color blue "\<(ABORT|AGGREGATE|ALTER|ANALYZE|AND|AS|AUTHORIZATION|BEGIN|CAST|CHECKPOINT|CLASS|CLOSE)\>"
color blue "\<(CLUSTER|COLLATION|COMMENT|COMMIT|CONFIGURATION|CONSTRAINTS|CONVERSION|COPY|CREATE)\>"
@ -30,6 +23,11 @@ color blue "\<(PARSER|PREPARED?|PRIVILEGES|REASSIGN|REFRESH|RELEASE|RESET|REVOKE
color blue "\<(SAVEPOINT|SCHEMA|SEARCH|SECURITY|SELECT|SEQUENCE|SERVER|SESSION|SET|SHOW|SPACE|START|SYSTEM)\>"
color blue "\<(TABLE|TEXT|TO|TRANSACTION|TYPE|UPDATE|USER|VACUUM|VALUES|VIEW|WHERE|WITH|WRAPPER)\>"
# 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)\>"
# Trailing whitespace.
color ,green "[[:space:]]+$"