syntax: sql: colorize only single-quoted things as strings
SQL does not know double-quoted strings. Double quotes can be used around identifiers, to prevent them being interpreted as keywords. References: https://www.postgresql.org/docs/14/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS https://www.postgresql.org/docs/14/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERSmaster
parent
1c6f6ba212
commit
248ebf9117
|
@ -28,12 +28,16 @@ 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)\>"
|
||||
|
||||
# Quoted identifiers. (First scare-color all, then uncolor what is valid.)
|
||||
color ,red ""[^"]+""
|
||||
color normal ""[[:alpha:]_][[:alnum:]_$]*""
|
||||
|
||||
# Strings.
|
||||
color green "'([^']|\\')*'"
|
||||
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
# Strings, double-quoted and single-quoted.
|
||||
color green ""([^"]|\\")*"|'([^']|\\')*'"
|
||||
|
||||
# Comments.
|
||||
color red "--.*"
|
||||
color brightblue "//.*"
|
||||
|
|
Loading…
Reference in New Issue