Use lightgrey for the prolog tags, as they normally are unimportant
boiler-plate stuff. Comments are likely to be more relevant.
Any /> is part of the tag itself, not of the attributes.
The file contained two syntaxes (each of them fairly large) that are
useful only for Gentoo users. I don't think the file should have been
distributed with nano ever, as the syntaxes are just a dead weight for
the users of all other distributions.
That is: colorize text after a blank-plus-hash as a comment when there
is at least one non-hexadecimal character among the first three.
This relaxes the demand that a trailing comment should have a blank
after the hash too, as implemented by commit 90946c5e two weeks ago.
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
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.
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.
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.
The path after 'include' is not a regex and does not need to be quoted;
when it's unquoted, colorize it specially, instead of leaving it red.
The syntax name after 'extendsyntax' should be brightgreen, like after
'syntax', but it's better that the subsequent commands have their own
special color.
In UTF-8 locales, the ranges A-F and a-f include several accented
characters beyond "ABCDEF" and "abcdef", such as the Croat č and ć.
This fixes https://savannah.gnu.org/bugs/?61487.
Bug existed since the beginning of each of the syntaxes,
for the C syntax since version 1.3.6, commit 159bdfdc.
Also, drop the unneeded and mistaken 'end=' in the first regex, as
a coloring rule with just end="something" is not valid. And drop
the requirement for having trailing whitespace or nothing at all,
as it does not constitute a useful restriction.
Also, fold two regexes together, for economy.
The coloring rule for 'unbind' still checked for the old 'extcmd' and
'externalcmd' menu names. And not coloring binds and unbinds as valid
when followed by something other than a comment was overrestrictive,
because the bind or unbind command would work just fine.
(Nano silently allows trailing garbage on any line without a regex.)
Also, take the opportunity to order the menu names in the bind and
unbind rules in the same way.
This fixes https://savannah.gnu.org/bugs/?61419,
and fixes https://savannah.gnu.org/bugs/?61420.
First bug existed since version 5.0, commit d9106abf.
Second bug existed since version 2.3.3, commit 9c11ba93.
(It would be much better if the build rules automatically included
any *.nanorc files in the syntax/ directory into the tarball...)
This fixes https://savannah.gnu.org/bugs/?61391.
Reported-by: John Prokos <jprokos@gmail.com>
Bug existed since version 5.9, commit c2790a8a.
Also, trim some whitespace and group one rule better.
Also, fix a stray closing parenthesis in the JSON syntax,
and add the missing slash to the possible escaped characters.
(Reference: https://www.json.org/json-en.html.)
Also, improve the ending of multiline strings in the Rust syntax.
A backslash should not be allowed inside a quoted string unless
it is used to escape another character.
This fixes https://savannah.gnu.org/bugs/?61389.
Bug existed since each of these syntaxes was introduced.
(Awk and Fortran do not know include files with names between
angled brackets, so those regexes are dropped in the bargain.)
Quoted strings cannot start within another quoted string and end after
that other string has ended. Therefore single-quoted and double-quoted
strings should (as much as possible) be colorized by a single rule, so
that overlapping colorations are avoided.
(This also fixes a double typo in the PHP syntax (\. --> \\.) that has
been there since the PHP syntax was added in 2008, commit 90ee8ee4.)
This fixes https://savannah.gnu.org/bugs/?61387.
Bug existed since each of these syntaxes was introduced,
the oldest ones around 2006, a few others around 2015.
The one that got it right was the Lua syntax from 2011.
The "\.?" part was pointless. It says that the string "nanorc"
*might* be preceded with a period. Sure, but if the period is
absent, then anything else may be there too, so the optional
period gives zero restriction.
The restriction should be: either the filename has the extension
".nanorc" OR the full filename is "nanorc". So the "nanorc" part
must be preceded by either a period or a slash.
(However, in the times of commits 3dc0e23e and dc9c40a5, fifteen
and eighteen years ago, it was still the user-provided filename
that was matched against the regex, not the full-path filename.
The latter method arrived in commit ec8d51be, six years ago.)
Strings may not contain a double quote unless it is escaped.
Reference:
https://doc.rust-lang.org/reference/tokens.html#string-literals
(This will still not colorize multi-line strings with an unescaped
newline, will still colorize "this\" as if it were a valid string,
and will still miscolor things when there is another string after
the closing quote of a two-line string. But those things can't
be helped -- line-based regexes cannot emulate a full parser.)
This fixes https://savannah.gnu.org/bugs/?61361.
Reported-by: Elias Jonsson <e@ejon.eu>
Bug existed since version 2.6.1, since the Rust syntax was introduced.
Within a bracket expression, the backslash is not special,
so it does not need to be escaped.
The double backslashes within brackets were found with:
grep -o '\[[^][]*\\\\[^][]*\]' syntax{,/extra}/*rc
Also, incorporate the square brackets into some bracket expressions
by listing the closing bracket first, saving a separate regex for
those two brackets.
An @command must either start at the beginning of the line and be
followed by whitespace or EOL, or it must be followed by a brace.
Colorizing just any "@text" string colored too much.
Also, allow an @} and another @command{} within a pair of braces,
colorize only the valid @-commands with uppercase in their names,
unbold enclosed command arguments, colorize the directory entries
for the manual, and properly colorize also the comments that use
the full @comment command.
Reference:
https://www.gnu.org/software/texinfo/manual/texinfo/html_node/Command-List.html
Testing was done with:
info texinfo @-C "Command List" --output=list
sed -i -e "s/^'//" -e "s/'$//" list
nano list -Ytexinfo
Some Yaml files use path names and sometimes version numbers as keys,
even though / and . are not officially in the character set allowed
for key names (just like underscore is not), as far as I understand.
Also, do not colorize any backslash escapes as invalid
because some of them occur sometimes in value strings.
Also, colorize only the valid double-exclamation tags.