Commit Graph

17 Commits (master)

Author SHA1 Message Date
Benno Schulenberg f757c4a512 syntaxes: colorize hex more strictly by using character class [:xdigit:]
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.
2021-11-15 16:17:31 +01:00
Benno Schulenberg 1cd92458e9 tweaks: swap two parts of specific regexes, for consistency with others
This order makes more sense to me: first the part that allows
almost everything, and then the special case.
2021-10-27 11:20:07 +02:00
Benno Schulenberg 544351f3be syntaxes: replace [[:space:]] with [[:blank:]] to exclude carriage return
In many places a carriage return is not valid whitespace and should
thus not be colored as such.  In some of these places a vertical tab
or form feed is maybe valid whitespace, but it would be ugly or even
wrong to color them because they are not part of the subsequent
comment or keyword.

This fixes https://savannah.gnu.org/bugs/?60456.
2021-04-27 11:18:41 +02:00
Benno Schulenberg fea5d7c612 syntaxes: uniformize the initial comment 2020-04-20 19:21:56 +02:00
Benno Schulenberg 302ea79d1c syntaxes: put the 'linter' and 'formatter' commands on a separate line
To show that they are a different class of thing than the file-matching
regexes and the comment thing, which all kind of "describe" the file.
2019-11-04 20:56:41 +02:00
Benno Schulenberg f2f367ba9c syntaxes: change some unneeded 'icolor' commands to 'color' commands 2019-08-17 17:01:19 +02:00
Mark-Weston bf5949395d syntax: lua: do not color strings inside comments, and add a linter
Also, don't partially color "..." as an operator, because it isn't,
and color also the unary operator "#".

Signed-off-by: Mark-Weston <markweston@cock.li>
2018-08-28 20:16:16 +02:00
Benno Schulenberg 3e1fc6385b syntaxes: remove quotes from each syntax name, and color it differently
The different color will make the name stand out, as it should, instead
of looking the same as all the regex strings.
2018-02-14 17:36:50 +01:00
Benno Schulenberg c6f367268b syntax: lua: do not color debug.setinfo as it doesn't exist
Reported-by: Tom Levy <tomlevy93@gmail.com>
2018-01-06 17:59:28 +01:00
Benno Schulenberg 21cd953e85 syntax: lua: condense some regexes, tweak comments, reorder things
Also remove some redundant backslashes and parentheses.
2018-01-01 14:59:00 +01:00
Tom Levy 058b9da9b9 syntax: lua: add new and missing standard library functions
The list now includes all the Lua 5.3 functions listed on
https://www.lua.org/manual/5.3/#index.

Also, remove the coloring of just the library name, so that
only known library functions get highlighted.

Signed-off-by: Tom Levy <tomlevy93@gmail.com>
2018-01-01 14:35:19 +01:00
Tom Levy 38a10a62d0 syntax: lua: support fractional part and exponent for decimal and hex
As of Lua 5.2: "Hexadecimal constants also accept an optional fractional
part plus an optional binary exponent, marked by a letter 'p' or 'P'"
(see at the end of https://www.lua.org/manual/5.2/manual.html#3.1).

The new regexes do not match a leading nor a trailing dot, but they
are good enough.  Discussion on the mailing list:
https://lists.gnu.org/archive/html/nano-devel/2017-12/msg00121.html

Signed-off-by: Tom Levy <tomlevy93@gmail.com>
2018-01-01 14:15:14 +01:00
Tom Levy 091e8faf6d syntax: lua: require at least one digit for hexadecimal numbers
Since a "0x" by itself is invalid.  Also add word boundaries, so that
e.g. "00x1" (which is invalid) does not get partial highlighting.

Also remove some redundant backslashes from the strings regex.

Signed-off-by: Tom Levy <tomlevy93@gmail.com>
2018-01-01 13:51:10 +01:00
Benno Schulenberg 1f48ed0412 syntaxes: remove redundant word-boundary markers 2017-12-30 17:32:15 +01:00
Tom Levy 4f2b01c7e5 syntax: lua: correct the word boundaries on standard library functions
Functions such as "io.close" should only be highlighted when the
package name ("io") is a word by itself, otherwise code such as
"fooio.close" gets unexpected partial highlighting.

Signed-off-by: Tom Levy <tomlevy93@gmail.com>
2017-12-28 21:46:26 +01:00
Benno Schulenberg bacb0f717d syntax: adjust the magic strings for the changes since file-5.10
Since file-5.10 (end of 2011), libmagic identifies a C file in most
cases as "C source" instead of as "C program".  Nano's magic strings
for some other files didn't match any more what file-5.32 currently
produces, either.  So, they have been adjusted, new ones added, and
old ones deleted.

This fixes https://savannah.gnu.org/bugs/?52445.
2017-11-19 11:24:30 +01:00
Benno Schulenberg b0ef2e2803 build: move the syntax files out of the doc/ directory
They are not documentation, they are functional elements of nano.
2016-12-30 22:05:01 +01:00