Commit Graph

15 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 7bd68365ec syntaxes: avoid coloring "this\" as if it were a valid string
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.)
2021-10-26 14:35:40 +02:00
Benno Schulenberg 485eb18d83 syntaxes: use one regex for coloring quoted strings, to avoid overlap
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.
2021-10-26 13:28:33 +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 ebeed9c013 tweaks: fuse two regexes into one 2019-11-04 20:49:17 +02:00
Benno Schulenberg 75dd9bee38 syntax: javascript: colorize the boolean values 'true' and 'false' too
Original-patch-by: Ryan Westlund <rlwestlund@gmail.com>
2019-11-03 19:50:41 +02:00
Benno Schulenberg aae752912e syntax: javascript: colorize also special values 'null' and 'undefined'
This addresses one half of https://savannah.gnu.org/patch/?9865.
Original-patch-by: Ryan Westlund <rlwestlund@gmail.com>
2019-10-24 17:19:04 +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 bdbd5ff0e7 syntax: javascript: add some comments, and color explicit numbers too 2017-12-25 16:03:05 +01:00
Benno Schulenberg f769465284 syntax: javascript: add some keywords, and sort them more logically
Also, remove angle-bracketed "strings" -- they don't exist.
2017-12-25 15:40:05 +01:00
Benno Schulenberg 1b5b52d2e4 syntax: javascript: color strings differently from major keywords
Also, remove the coloring of special single-quoted strings as they
get recolored by the subsequent general string-coloring command.

And remove the coloring of all-uppercase words, as other editors
do not color those either.
2017-12-25 15:36:35 +01:00
Benno Schulenberg ab62d28817 syntax: javascript: require that a comment is preceded by whitespace
Either by whitespace or by the start of a line.

This avoids treating part of a URL as a comment.
2017-12-25 15:25:04 +01:00
Mike Frysinger 8e0a7ec20d syntax: javascript: add newer keywords and string syntax 2017-12-25 15:08:03 +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