commit 56aacb3e326470ecad2696cf11ad043eba302af0
parent f2c9aed16cdb153b4127b00ea389e1d2ef722e3a
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Tue, 26 Oct 2021 15:48:51 +0200
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
Diffstat:
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/syntax/sql.nanorc b/syntax/sql.nanorc
@@ -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:]]+$"