From 56aacb3e326470ecad2696cf11ad043eba302af0 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 26 Oct 2021 15:48:51 +0200 Subject: [PATCH] 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 --- syntax/sql.nanorc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/syntax/sql.nanorc b/syntax/sql.nanorc index f69f762c..b54ddb94 100644 --- 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:]]+$"