commit f2c9aed16cdb153b4127b00ea389e1d2ef722e3a
parent 7c6d3942c495461a9f22a4c4552b338c41b57dfc
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Mon, 25 Oct 2021 17:40:24 +0200
syntax: sql: remove alien stuff -- it was copied mostly from ruby syntax
Regular expressions in SQL are not written between // or %r{},
strings are not written between <> or %Q{} or anything similar,
and comments do not start with # -- and officially not with //
either, but some dialects seem to allow it.
This fixes https://savannah.gnu.org/bugs/?61381.
Bug existed since version 2.4.2, since the SQL syntax was included.
Diffstat:
1 file changed, 4 insertions(+), 28 deletions(-)
diff --git a/syntax/sql.nanorc b/syntax/sql.nanorc
@@ -1,11 +1,8 @@
## Syntax highlighting for (Postgres) SQL scripts.
-syntax sql "\.sql[2345s~]?$"
+syntax sql "\.sql$"
comment "-- "
-# Functions.
-color white "\<[a-z_]*\("
-
# Types.
color green "\<(int2|smallint|int4|int|integer|int8|bigint|decimal|numeric|real|double precision|(small|big)?serial)\>"
color green "\<(bit( varying)?|boolean|bytea|enum|money|tsvector|uuid)\>"
@@ -33,38 +30,17 @@ 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)\>"
-# Strings.
-color brightyellow "<[^= ]*>" ""(\.|[^"])*""
-
# Trailing whitespace.
color ,green "[[:space:]]+$"
-# Regular expressions.
-color brightmagenta "/([^/]|(\\/))*/[iomx]*" "%r\{([^}]|(\\}))*\}[iomx]*"
-
-# Shell command expansion, between `backticks` or like %x{this}.
-color brightblue "`[^`]*`" "%x\{[^}]*\}"
-
-# Strings, double-quoted.
-color green ""([^"]|(\\"))*"" "%[QW]?(![^!]*!|\$[^$]*\$|\^[^^]*\^)"
-color green "%[QW]?(\([^)]*\)|<[^>]*>|\[[^]]*\]|\{[^}]*\})"
-
-# Expression substitution for inside double-quoted strings, "like #{this}".
-color brightgreen "#\{[^}]*\}"
-
-# Strings, single-quoted.
-color green "'([^']|(\\'))*'" "%[qw](![^!]*!|\$[^$]*\$|\^[^^]*\^)"
-color green "%[qw](\([^)]*\)|<[^>]*>|\[[^]]*\]|\{[^}]*\})"
+# Strings, double-quoted and single-quoted.
+color green ""([^"]|\\")*"|'([^']|\\')*'"
# Comments.
-color red "##?([^{].*|$)"
-color red "--([^{].*|$)"
+color red "--.*"
color brightblue "//.*"
color brightblue start="/\*" end="\*/"
-# PostgreSQL markings.
-color red "--"
-
# PostgreSQL default schemas.
color brightred "\<(pg_catalog|public)\>"