From de6da120a05513f0784b3eb570411c9036d0d82c Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 20 May 2015 18:57:18 +0000 Subject: [PATCH] =?utf8?q?Adding=20one=20file:=20syntax=20highlighting=20f?= =?utf8?q?or=20PostgreSQL.=20Original=20file=20by=20Devrim=20G=C3=BCnd?= =?utf8?q?=C3=BCz.=20=20(Tweaked=20by=20Benno.)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5226 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 4 ++ doc/syntax/postgresql.nanorc | 75 ++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 doc/syntax/postgresql.nanorc diff --git a/ChangeLog b/ChangeLog index 9eb69f13..5d70dfe4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2015-05-20 Devrim Gündüz + * doc/syntax/postgresql.nanorc: New file -- syntax highlighting for + PostgreSQL, first posted as Savannah patch #8601. Trimmed by Benno. + 2015-05-08 Benno Schulenberg * src/browser.c (browser_refresh): Take the distant possibility of terabyte files into account, and in the bargain get rid of the need diff --git a/doc/syntax/postgresql.nanorc b/doc/syntax/postgresql.nanorc new file mode 100644 index 00000000..cf389c4c --- /dev/null +++ b/doc/syntax/postgresql.nanorc @@ -0,0 +1,75 @@ +## Here is an example for PostgreSQL. + +syntax "sql" "\.sql[2345s~]?$" +magic "PostgreSQL script text" + +# 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)\>" +color green "\<(char|varchar|character( varying)?|text)\>" +color green "\<(date|interval|time(stamp)?( with time zone| without time zone)?)\>" +color green "\<(point|line|lseg|path|box|polygon|circle)\>" +color green "\<(cidr|inet|macaddr)\>" +color green "\<(daterange|int4range|int8range|numrange|tsrange|tstzrange)\>" + +# Structure. +color brightyellow "\<(CASE|CLASS|DEFAULT|DO|ELSE|ELSEIF|FOR|FOREACH|FUNCTION|IF|IS NULL)\>" +color brightyellow "\<(NEW|PRIVATE|PUBLIC|RETURN|RETURNS|SETOF|SWITCH|THEN|WHEN|WHILE)>" + +# Control flow. +color magenta "\<(EXCEPTION|NOTICE|RAISE|RETURN)\>" + +# SQL keywords. +color blue "\<(ABORT|AGGREGATE|ALTER|ANALYZE|AND|AS|AUTHORIZATION|BEGIN|CAST|CHECKPOINT|CLASS|CLOSE)\>" +color blue "\<(CLUSTER|COLLATION|COMMENT|COMMIT|CONFIGURATION|CONSTRAINTS|CONVERSION|COPY|CREATE)\>" +color blue "\<(DATA|DATABASE|DEALLOCATE|DECLARE|DEFAULT|DELETE|DICTIONARY|DISCARD|DO|DOMAIN|DROP)\>" +color blue "\<(END|EVENT|EXECUTE|EXPLAIN|EXTENSION|FAMILY|FETCH|FOREIGN|FROM|FUNCTION)\>" +color blue "\<(GRANT|GROUP|IF NOT EXISTS|IMMUTABLE|INDEX|INSERT|INTO|LABEL|LANGUAGE|LARGE|LOAD|LOCK)\>" +color blue "\<(MAPPING FOR|MATERIALIZED|MOVE|NOTIFY|OBJECT|OPERATOR|OPTIONS|OWNED|OWNER)\>" +color blue "\<(PARSER|PREPARED?|PRIVILEGES|REASSIGN|REFRESH|RELEASE|RESET|REVOKE|ROLE|ROLLBACK|RULE)\>" +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 is in `backticks` or like %x{this}. These are +# "double-quotish" (to use a perlism). +color brightblue "`[^`]*`" "%x\{[^}]*\}" + +# Strings, double-quoted. +color green ""([^"]|(\\"))*"" "%[QW]?\{[^}]*\}" "%[QW]?\([^)]*\)" "%[QW]?<[^>]*>" +color green "%[QW]?\[[^]]*\]" "%[QW]?\$[^$]*\$" "%[QW]?\^[^^]*\^" "%[QW]?![^!]*!" + +# Expression substitution. These go inside double-quoted strings, +# "like #{this}". +color brightgreen "#\{[^}]*\}" + +# Strings, single-quoted. +color green "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>" +color green "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!" + +# 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)" + +# PostgreSQL PLs. +color brightblue "(pljava|plperlu?|plpgsql|plpy|plpythonu?|plr|plruby|plsh|pltcl|plscheme)" -- 2.39.5