Commit Graph

19 Commits (0e1d45dc365ff481555d8767c3057e693404900e)

Author SHA1 Message Date
Benno Schulenberg 0e1d45dc36 tweaks: fold some regexes together, and trim or improve some comments
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.
2021-10-27 11:25:45 +02: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 208146f2f2 syntax: go: add author and license line
In the original submission (https://savannah.gnu.org/patch/?8189)
the submitter said: "I hereby put it into the public domain."

Public-domain license: https://directory.fsf.org/wiki/License:CC0

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2020-12-10 15:48:28 +01:00
Ryan Westlund 3480518a5c syntax: go: highlight the chan keyword, and the special +build comment
This fixes https://savannah.gnu.org/bugs/?58424
Reported-by: Ryan Westlund <rlwestlund@gmail.com>

Signed-off-by: Ryan Westlund <rlwestlund@gmail.com>
2020-05-26 16:50:31 +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 4281b6becb commands: rename 'fixer' to 'formatter', to be less misleading
The word "fixer" sounds too much as if the command would be able
to fix mistakes or correct errors.  Especially when seen next to
"linter", it sounds as if one does a syntax check and the other
fixes the found mistakes.  (Although the command might in theory
be used for this, it is not its intended purpose.)
2019-10-25 17:24:28 +02:00
Benno Schulenberg 8749ccb469 syntax: nanorc: colorize the 'fixer' command as valid
Also add a default formatting command to the Go syntax.
2019-10-14 10:28:45 +02:00
Benno Schulenberg 2d434f63e2 syntaxes: remove all traces of the 'formatter' command 2018-08-09 21:12:10 +02:00
Tom Levy fef195bce9 syntax: go: highlight also floats with leading zeroes as valid
See the discussion on the mailing list:
https://lists.gnu.org/archive/html/nano-devel/2018-01/msg00022.html
https://lists.gnu.org/archive/html/nano-devel/2018-02/msg00090.html

Signed-off-by: Tom Levy <tomlevy93@gmail.com>
2018-02-20 10:31:38 +01: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 452008c81d syntax: go: colorize only valid octal numbers
Reported-by: Tom Levy <tomlevy93@gmail.com>
2018-01-26 11:15:26 +01:00
Benno Schulenberg 5965e80a38 tweaks: fold some regexes into one another, for conciseness
The anchored "^texture" appears to have been a mistake.

Inspired-by: Tom Levy <tomlevy93@gmail.com>
2018-01-01 16:00:18 +01:00
Tom Levy a794c3318b syntax: go: sign of exponent in number literal is optional
Signed-off-by: Tom Levy <tomlevy93@gmail.com>
2018-01-01 15:27:31 +01:00
Tom Levy d04b0c123e syntax: go: fix word boundary before dot in number literal
The fragment "\<\." can never match anything because \< matches the
beginning of a word but "." is not a word character.

Replace \< with \B (the empty string not at the edge of a word).

Signed-off-by: Tom Levy <tomlevy93@gmail.com>
2018-01-01 15:25:26 +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