Commit Graph

14 Commits (master)

Author SHA1 Message Date
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 c01b13a32c syntax: php: colorize the full short tag for echo (<?=) 2021-05-05 12:09:17 +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 1e3f3a7511 syntaxes: recognize .ctp extension as a PHP file, and .cu as a C/C++ file
This brings color to CakePHP template files, and to CUDA files.

This addresses https://bugs.debian.org/932192.
Requested-by: Jérôme Bardot <bardot.jerome@gmail.com>
2019-08-08 12:02:07 +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
Michael Francis 53fc9a66a6 syntax: php: function and variable names can contain uppercase and digits
Reference: http://php.net/manual/en/language.variables.basics.php

Also color keywords differently from strings.

Signed-off-by: Michael Francis <mikefrancis95@gmail.com>
2017-12-11 21:02:36 +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 c68398f18f syntax: php: color "static" again as "function", like it used to be 2017-05-21 10:11:42 +02:00
Benno Schulenberg e4775c2060 syntax: php: color also variable names, and color more reserved words
Most of the keywords listed on the following URL are now highlighted:
  http://php.net/manual/en/reserved.keywords.php

Also color single-quoted strings, and require that //-type comments
are preceded by whitespace or are alone on a line.

With-feedback-from: M <taur@mail.com>
2017-05-18 10:03:43 +02:00
Benno Schulenberg c830b8f51c syntax: php: recognize also the .phtml and .php7 extensions
(And in the bargain sort or group some of the keywords.)

This addresses https://savannah.gnu.org/patch/?9342.
Suggested-by: M <taur@mail.com>
2017-05-15 10:57:57 +02: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