Commit Graph

310 Commits

Author SHA1 Message Date
LIU Hao 07a92c3988 syntax: asm: add end-of-word anchors to the keywords
Previously some of these regexes could color part of a directive;
for example, the `.int` part of `.intel_syntax`.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-11-05 17:12:25 +01:00
Benno Schulenberg 2fca581095 syntax: groff: correct the mistaken .rof extension to .roff
Buglet existed since version 2.9.8, commit cdd637d6.
2024-10-23 11:14:48 +02:00
Benno Schulenberg 53afd90ad4 syntax: groff: recognize also the .mom extension
This addresses https://savannah.gnu.org/bugs/?66369.
Reported-by: Elfener <elfenermarcell@gmail.com>
2024-10-23 11:07:05 +02:00
Benno Schulenberg 1862995aab syntax: spec: colorize all canonical architecture names
The list of canonical names was found in:
  https://github.com/rpm-software-management/rpm/blob/master/rpmrc.in

The canonical names were extracted with:

  grep arch_canon rpmrc.in | sed 's/^.*:\s*//' | sed 's/\s*..\?$//'

and then sorted and condensed into a regular expression.

Inspired-by: Funda Wang <fundawang@gmail.com>
2024-09-22 12:34:28 +02:00
Benno Schulenberg 468613c9db syntax: makefile: colorize also multiple targets
Multiple targets are separated by spaces.  Furthermore, there
may be spaces before the first target and before the colon.
2024-09-06 13:56:56 +02:00
Benno Schulenberg 7e8ee46c09 syntax: autoconf: colorize the keywords 'case', 'esac', and 'ifelse' too
Case statements occur a lot in gnulib's m4 files,
and 'ifelse' is simply part of the m4 language.
2024-08-28 17:12:17 +02:00
Benno Schulenberg 109386dfe8 syntax: nanorc: an unquoted argument of 'include' may not contain blanks
Anything after the first "word" after 'include' will be ignored
and should thus remain colorized in bright red.
2024-08-16 15:49:28 +02:00
Benno Schulenberg c5a0e6b60c syntax: awk: colorize escape sequences specially 2024-07-21 14:32:56 +02:00
Benno Schulenberg d7e8665782 syntax: awk: rewrite a regex more densely, and add the missing ~ operator
Also, improve the comment.
2024-07-18 16:14:25 +02:00
Benno Schulenberg 7c86c1a185 syntax: awk: add a missing "|" between "\?" and ":"
The "\?" and ":" are meant to match the ? and : in this construct:

    condition ? thenthis : otherwisethis

The missing "|" seems to have been a typo.
2024-07-18 13:02:54 +02:00
Benno Schulenberg f69a08fc63 syntax: man: colorize also the .MT .ME .EX .EE .SY .OP and .YS macros
Furthermore, colorize .LP .P and .PP like .TP, as paragraph macros,
instead of inconsistenly as if they specified type faces.
2024-07-15 07:48:14 +02:00
Benno Schulenberg 34dda64610 docs: explain the behavior of the new function `cycle`
Also colorize {cycle} when found in a nanorc file.
2024-06-15 09:57:06 +02:00
Benno Schulenberg c70e6919c2 syntaxes: mention the original author of most of the syntax files
The names of the authors were retrieved from:

  git log -p --follow  syntax/<name>.nanorc

and from:

  git log -p --follow --all --  doc/nanorc.sample

For some files the original author is unclear, or
the file is/was too small to mention an author for.
2024-06-08 12:10:25 +02:00
Jaroslav Fowkes abdf069ce3 syntax: fortran: fix a typo (a missing backslash)
The typo prevented several keywords from getting colorized.

This addresses https://savannah.gnu.org/patch/?10459.

Bug existed since version 2.1.6, commit 513157df,
since the Fortran syntax was introduced.
2024-06-07 15:34:03 +02:00
Benno Schulenberg a1159ff484 syntax: man: colorize some of the things that manipulate hyphenation
Reference:
  https://www.gnu.org/software/groff/manual/groff.html.node/Manipulating-Hyphenation.html
2024-06-06 13:29:01 +02:00
Benno Schulenberg 05602e29cd syntax: patch: recognize also the .rej extension
The addition was inspired by `davidhcefx`.
2024-06-02 17:16:22 +02:00
Benno Schulenberg 02dd0b4ed5 options: require --colonparsing/-@ to parse colon+number after a filename
Stop doing colon parsing by default, to avoid surprises and frustration
for users that have filenames that end in a colon plus digits.

The equivalent rcfile option is, of course, 'set colonparsing'.

Using +1, or similar, before the filename disables any colon parsing
and the filename is taken as is.
2024-05-25 16:48:35 +02:00
Benno Schulenberg ce5513b009 bump version numbers and add a news item for the 8.0 release 2024-05-01 10:10:15 +02:00
Benno Schulenberg d53521a631 syntax: sh: recognize more shells than `sh` on a shebang line for busybox
Also, elide an unneeded pair of parentheses.

Original-patch-by: Sertonix <sertonix@posteo.net>
  https://lists.gnu.org/archive/html/nano-devel/2024-04/msg00026.html
2024-04-22 10:29:02 +02:00
Benno Schulenberg c02aec557c syntax: makefile, sh: recognize also a fresh Makefile and fresh .profile
When opening a nonexistent file with nano, it likely consists of only a
name without any path component, and thus without any slash.  So when a
file regex checks for a slash, it should check also for start-of-string.

This fixes https://savannah.gnu.org/bugs/?65591.

Problem existed for the Makefile since version 2.9.8, commit 22663f8a,
and for .profile since version 3.0, commit 4a268678 (but earlier, nano
did not recognize .profile files at all).
2024-04-14 12:09:36 +02:00
Benno Schulenberg 829ab5e72d syntax: nanorc: colorize {toprow} and {bottomrow} for string binds 2024-04-07 15:55:38 +02:00
Benno Schulenberg f1a04f780a syntax: javascript: recognize also the .mjs extension
The V8 JavaScript-engine developers recommend using this extension:
  https://v8.dev/features/modules#mjs

Also, add the fairly new "JavaScript source" as magic description.

This fulfills https://savannah.gnu.org/bugs/?65334.
Requested-by: Matt Whitlock <gnu@mattwhitlock.name>
2024-02-20 17:00:48 +01:00
Benno Schulenberg cdaa43b396 syntax: makefile: ensure that the <Tab> key always produces a tab
Making it independent from the `tabstospaces` setting.

And remove the now-redundant suggestion from the sample nanorc.
2024-02-05 17:17:37 +01:00
Benno Schulenberg 7c174a1a25 syntax: c: require a preceding blank when a line comment contains a quote
This avoids miscolorizing part of a string when it contains a URL.

This fixes https://savannah.gnu.org/bugs/?64340.
Reported-by: Yonut Smith <deanlast3@gmail.com>

Problem has existed for more than twenty years, at least since support
for multine-line regexes was added in commit 6c1e6612 in 2002.
2024-01-09 10:20:50 +01:00
Matteo Raso c374c773ad syntax: python: colorize decorators specially
Decorators are documented at https://peps.python.org/pep-0318/.

Signed-off-by: Matteo Raso <matteo_luigi_raso@protonmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2023-01-22 12:31:45 +01:00
Benno Schulenberg 298447e22d syntax: html: colorize specially the other two emphasizing tags too
In most cases, <em> behaves like <i> and <strong> behaves like <b>,
so it makes sense to treat all of them in the same manner.
2023-01-05 17:01:20 +01:00
Benno Schulenberg 7f772693eb tweaks: wrap overlong lines in the Tcl syntax, to make them manageable
(And also to stay within the theoretical 256-byte POSIX limit.)
2022-12-11 12:40:22 +01:00
Benno Schulenberg 972be2df04 bump version numbers and add a news item for the 7.0 release 2022-11-15 11:17:34 +01:00
Benno Schulenberg 3785f762fc syntax: nanorc: colorize valid function names plus surrounding braces 2022-08-18 09:11:49 +02:00
Benno Schulenberg 1d10ee71bf syntax: python: mention an alternative linter in a comment 2022-07-26 12:28:49 +02:00
Benno Schulenberg 0520cbdccb syntax: perl: add missing keywords, and reduce the length of some lines
Also, compact the keywords less, so that things are easier to read.
2022-07-25 15:53:03 +02:00
Benno Schulenberg 3d3270c1b2 tweaks: put each regex on separate line, to better show many keywords
(The long list of keywords was divided over five separate regexes to
avoid exceeding the possible limit of 256 bytes/characters per regex.)
2022-07-25 14:48:40 +02:00
Benno Schulenberg 1de47610f4 syntax: default: do not colorize a square or angle bracket after a URL
Sometimes a URL is wrapped in [] or <> brackets -- the closing ] or >
is not part of the URL and should not be colored.
2022-06-07 17:24:23 +02:00
Benno Schulenberg 81e5b57d74 syntax: xml: colorize user-defined entities differently
Also improve two comments.
2022-04-04 12:08:23 +02:00
Benno Schulenberg b568705eec syntax: xml: colorize /> properly, and colorize prolog tags differently
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.
2022-04-04 10:01:49 +02:00
Benno Schulenberg 89bb88e4f5 syntaxes: fold a couple of regexes together, and improve a few comments 2022-02-16 13:07:11 +01:00
Benno Schulenberg bdf8e41a72 syntax: nanorc: colorize each of the fourteen new color names as valid 2021-12-12 12:01:45 +01:00
Benno Schulenberg 7ab903f072 syntax: debian: remove file -- Debian itself will have to handle it
The syntax is useful only for users of Debian and its derivatives.
2021-12-12 11:45:21 +01:00
Benno Schulenberg 266ed0612f syntax: gentoo: remove file -- Gentoo itself will have to handle it
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.
2021-12-12 11:34:19 +01:00
Benno Schulenberg 27af34a853 syntax: default: colorize comments as one of the last things
So that URLs in comments don't get specially colored.
2021-12-10 12:32:17 +01:00
Benno Schulenberg 44836e77be syntax: nanorc: colorize a trailing comment when it begins with non-hex
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.
2021-12-07 16:51:35 +01:00
Benno Schulenberg 5cec57719b syntax: sql: add a few more missing keywords, like TRUE and FALSE
Also, don't first scare-color stuff between double quotes, as it
seems some dialects put certain calculations between them too.
2021-12-07 12:27:11 +01:00
Benno Schulenberg d6f101daef syntax: sql: colorize keywords regardless of case, and tweak the colors
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
2021-12-07 10:21:23 +01:00
Benno Schulenberg 350cdd9827 syntax: sql: colorize strings differently than types
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.
2021-12-04 12:13:19 +01:00
Benno Schulenberg 5dc48d54f2 syntax: sql: add more missing keywords, like INNER and OUTER JOIN
Also, fold two other regexes together, for conciseness.
2021-12-03 12:52:05 +01:00
Benno Schulenberg 41975265bf syntax: sql: add some missing keywords, like ALL and ANY and OR
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.
2021-12-03 12:21:17 +01:00
Benno Schulenberg 598f13107d syntax: sql: add two missing data types -- xml and tsquery
References:
  https://www.postgresql.org/docs/14/datatype-xml.html
  https://www.postgresql.org/docs/14/datatype-textsearch.html#DATATYPE-TSQUERY
2021-12-03 12:21:17 +01:00
Benno Schulenberg 248ebf9117 syntax: sql: colorize only single-quoted things as strings
SQL does not know double-quoted strings.  Double quotes can be used
around identifiers, to prevent them being interpreted as keywords.

References:
  https://www.postgresql.org/docs/14/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS
  https://www.postgresql.org/docs/14/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
2021-12-03 12:21:17 +01:00
Benno Schulenberg 8aaa57a573 syntax: default: colorize dates, URLs, and nano's release motto
And change the color for control codes, to be more visible.
2021-11-30 10:32:08 +01:00
Benno Schulenberg 19e743c7e4 tweaks: condense the regexes for Types in the SQL syntax 2021-11-30 10:11:21 +01:00