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.master
parent
7c6d3942c4
commit
f2c9aed16c
|
@ -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)\>"
|
||||
|
||||
|
|
Loading…
Reference in New Issue