Commit Graph

11 Commits

Author SHA1 Message Date
Benno Schulenberg
5cec57719b syntax: sql: add a few more missing keywords, like TRUE and FALSE
Also, don't first scare-color stuff between double quotes, as it
seems some dialects put certain calculations between them too.
2021-12-07 12:27:11 +01:00
Benno Schulenberg
d6f101daef syntax: sql: colorize keywords regardless of case, and tweak the colors
Make types a bluish green, for more contrast with strings, so that the
latter can be made greener, for more contrast with the yellow keywords.
Make the main keywords bluer and less bright, and unbold and soften the
yellow ones.  Soften the comments too.

Reference for case-insensitivity:
  https://www.postgresql.org/docs/14/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
2021-12-07 10:21:23 +01:00
Benno Schulenberg
350cdd9827 syntax: sql: colorize strings differently than types
Also, colorize comments more readably (on a dark background), and
schemas less yelling, and languages more distinct from keywords.

And add a few more keywords, like IS and NULL.
2021-12-04 12:13:19 +01:00
Benno Schulenberg
5dc48d54f2 syntax: sql: add more missing keywords, like INNER and OUTER JOIN
Also, fold two other regexes together, for conciseness.
2021-12-03 12:52:05 +01:00
Benno Schulenberg
41975265bf syntax: sql: add some missing keywords, like ALL and ANY and OR
Also, combine some keywords that can only occur together.
And drop a few that are probably rare, like LARGE OBJECT.

Reference:
  https://www.postgresql.org/docs/14/bookindex.html

And use a more readable color -- blue is too dark on a black base.
2021-12-03 12:21:17 +01:00
Benno Schulenberg
598f13107d syntax: sql: add two missing data types -- xml and tsquery
References:
  https://www.postgresql.org/docs/14/datatype-xml.html
  https://www.postgresql.org/docs/14/datatype-textsearch.html#DATATYPE-TSQUERY
2021-12-03 12:21:17 +01:00
Benno Schulenberg
248ebf9117 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-IDENTIFIERS
2021-12-03 12:21:17 +01:00
Benno Schulenberg
19e743c7e4 tweaks: condense the regexes for Types in the SQL syntax 2021-11-30 10:11:21 +01:00
Benno Schulenberg
56aacb3e32 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
2021-11-30 10:11:21 +01:00
Benno Schulenberg
f2c9aed16c 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.
2021-11-30 10:11:21 +01:00
Benno Schulenberg
e998c35c53 syntax: sql: rename the file to match the name of the syntax 2020-06-16 14:44:57 +02:00