commit e62a6964f731a1dda1db313f3e20e2dcc87e56bf
parent fd70c25d2173aeb2c68d08c60c6f4b4fd4283c87
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 26 Apr 2020 17:21:32 +0200
syntax: sql: condense some regexes, and reduce their number
Diffstat:
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/syntax/postgresql.nanorc b/syntax/postgresql.nanorc
@@ -1,4 +1,4 @@
-## Syntax highlighting for Postgres SQL scripts.
+## Syntax highlighting for (Postgres) SQL scripts.
syntax sql "\.sql[2345s~]?$"
comment "-- "
@@ -42,33 +42,31 @@ color ,green "[[:space:]]+$"
# Regular expressions.
color brightmagenta "/([^/]|(\\/))*/[iomx]*" "%r\{([^}]|(\\}))*\}[iomx]*"
-# Shell command expansion is in `backticks` or like %x{this}. These are
-# "double-quotish" (to use a perlism).
+# Shell command expansion, between `backticks` or like %x{this}.
color brightblue "`[^`]*`" "%x\{[^}]*\}"
# Strings, double-quoted.
-color green ""([^"]|(\\"))*"" "%[QW]?\{[^}]*\}" "%[QW]?\([^)]*\)" "%[QW]?<[^>]*>"
-color green "%[QW]?\[[^]]*\]" "%[QW]?\$[^$]*\$" "%[QW]?\^[^^]*\^" "%[QW]?![^!]*!"
+color green ""([^"]|(\\"))*"" "%[QW]?(![^!]*!|\$[^$]*\$|\^[^^]*\^)"
+color green "%[QW]?(\([^)]*\)|<[^>]*>|\[[^]]*\]|\{[^}]*\})"
-# Expression substitution. These go inside double-quoted strings,
-# "like #{this}".
+# Expression substitution for inside double-quoted strings, "like #{this}".
color brightgreen "#\{[^}]*\}"
# Strings, single-quoted.
-color green "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>"
-color green "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!"
+color green "'([^']|(\\'))*'" "%[qw](![^!]*!|\$[^$]*\$|\^[^^]*\^)"
+color green "%[qw](\([^)]*\)|<[^>]*>|\[[^]]*\]|\{[^}]*\})"
# Comments.
-color red "##?[^{].*" "##?$"
-color red "--[^{].*" "--$"
+color red "##?([^{].*|$)"
+color red "--([^{].*|$)"
color brightblue "//.*"
color brightblue start="/\*" end="\*/"
# PostgreSQL markings.
-color red "(--)"
+color red "--"
# PostgreSQL default schemas.
-color brightred "(pg_catalog|public)"
+color brightred "\<(pg_catalog|public)\>"
# PostgreSQL PLs.
-color brightblue "(pljava|plperlu?|plpgsql|plpy|plpythonu?|plr|plruby|plsh|pltcl|plscheme)"
+color brightblue "\<pl(java|perlu?|pgsql|py|pythonu?|r|ruby|scheme|sh|tcl)\>"