Commit Graph

199 Commits (d0bceb14493ea099d37610a689ca8bdc8992e659)

Author SHA1 Message Date
Benno Schulenberg a91bc04e04 docs: update the form of an option, --suspendable / 'set suspendable' 2020-03-13 15:58:56 +01:00
Benno Schulenberg e09ed765a1 syntax: nanorc: colorize 'rawsequences', not the obsolete 'rebindkeypad'
Bug existed since version 4.0, commit b596639f.
2020-03-10 16:21:02 +01:00
Benno Schulenberg 9c70fdaef9 syntax: spec: drop invalid parentheses after "Summary"
Also, add the missing "RemovePathPostfixes", add extra word boundaries,
and reshuffle and regroup some things.
2020-02-25 11:47:11 +01:00
Benno Schulenberg 6c6a3f6bd3 syntax: spec: colorize the date and author of changelog items differently
Also, remove superfluous parentheses, add missing edge-of-word markers,
correct the "ppciseries" keyword, and fold some regexes (or elements of
them) together.
2020-02-23 20:02:48 +01:00
Benno Schulenberg e873121372 syntax: spec: add two missing % signs, and colorize also "%triggerprein"
Furthermore, actually colorize the header line of a %changelog entry,
and remove two redundant fragments and simplify their overrides.
2020-02-23 19:38:54 +01:00
Neal Gompa ad52830fb8 syntax: spec: add some keywords that were added in RPM 4.15 and 4.13
In RPM 4.15, a number of new spec section features were introduced:

* %dnl                       - macro-engine level comments
* %elif, %elifos, %elifarch  - 'else if' stanzas for conditionals
* %sourcelist                - section for listing sources line by line
* %patchlist                 - section for listing patches line by line
* %generate_buildrequires    - script section after %prep for
                               generating build dependencies

(Reference: https://rpm.org/wiki/Releases/4.15.0.html.)

An enhancement added in RPM 4.13:

* Sections for file trigger stanzas

(Reference: https://rpm.org/user_doc/file_triggers.html.)

As these are being increasingly used in Fedora and other distributions,
it's quite helpful to have syntax highlighting be up to date on handling
them.

Signed-off-by: Neal Gompa <ngompa13@gmail.com>
2020-02-23 15:12:04 +01:00
Benno Schulenberg 2651554721 syntax: nanorc: colorize all-lowercase Meta key binds as valid too
Also, colorize as valid only ASCII letters, not any Unicode letters.
2020-01-23 13:34:37 +01:00
Benno Schulenberg f9baa4de71 syntax: nanohelp, nanorc: colorize the Sh-M-X format as a valid key name 2020-01-23 11:11:34 +01:00
Benno Schulenberg 54b97a6f03 bindings: allow to rebind also ^`, although it is synonymous with ^Space
Since ^@ is rebindable too and also a synonym of ^Space, it makes
more sense to allow the user to specify ^` instead, as it is an
unshifted keystroke on US keyboards.

Also, color ^` as valid in a nanorc file, and color ^` and ^@ in
the help viewer.
2020-01-20 17:19:23 +01:00
Benno Schulenberg 26d88ccbb1 syntax: sh: recognize shell rc files also in dedicated directories
This fulfills https://savannah.gnu.org/bugs/?57411.
2019-12-16 19:09:48 +01:00
Benno Schulenberg 00b0316ab8 syntax: nanohelp: colorize also ^/ as a possible keystroke
(In addition, colorize F20...F24 too.)

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

Bug existed since version 4.6, commit 2a97cb9f.
2019-12-10 15:42:28 +01:00
Benno Schulenberg 2a97cb9f41 bindings: allow to rebind ^/, even though it is synonymous with ^_
This fixes https://savannah.gnu.org/bugs/?57302.
Reported-by: Tiago Almeida <tjamadeira@gmail.com>
2019-11-26 19:25:24 +01: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 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 3f3698640b syntax: ruby: colorize also lowercase global/instance variables
And avoid recoloring the reserved words BEGIN and END as constants.

Inspired-by: Rory Thrasher <thrasher@redhat.com>
2019-10-27 16:34:06 +01:00
Benno Schulenberg b4dbbe3799 syntax: html: add a formatter command, making use of 'tidy' 2019-10-25 17:27:14 +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 34b1824822 syntax: default: don't colorize stuff between two pairs of brackets
That is, don't allow another bracket between the opening and the
closing bracket.
2019-10-25 12:23:40 +02:00
Jeroen Roovers b025f67805 syntax: gentoo: highlight the BDEPEND variable as well
This fixes https://bugs.gentoo.org/698420.
Reported-by: Alessandro Barbieri <lssndrbarbieri@gmail.com>

Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
2019-10-24 17:24:06 +02:00
Benno Schulenberg 40f8ca0d07 syntax: html: colorize only full attributes, and colorize strings later
Attribute names that are a part of another word should not be colored,
nor should attribute names within strings.

This addresses the other 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 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 3d5e51bcd0 syntax: nanorc: colorize in bright red everything that is invalid
Random words or mistyped keywords should not stay uncolored.
2019-10-20 14:47:15 +02:00
Benno Schulenberg 69d2045c9f syntax: nanorc: colorize only lowercase keywords as valid
Nowhere does the manual say that nanorc keywords are case-insensitive,
and none of the examples use uppercase keywords.  So, simply consider
uppercase keywords to be invalid.  This will later allow nano to use
case-sensitive comparisons, which are slightly faster.
2019-10-14 11:45:56 +02:00
Benno Schulenberg b8dc8d4a37 syntax: nanorc: colorize all arguments of 'fixer' and 'linter' as valid 2019-10-14 10:28:45 +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 f813fd0f4d rcfile: allow binding also F17...F24
For historical reasons the rebinding code allows binding F13...F16,
which on most terminals are typable with Shift plus F1...F4.  But,
at least on an Xfce Terminal, Shift plus F1...F12 produce F13...F24.
On a Linux console, Shift plus F1...F8 produce F13...F20.  So: allow
to bind the full shifted F13...F24 range.  It costs no extra code
and makes things more rounded.
2019-10-07 16:23:40 +02:00
Benno Schulenberg 2698a2ba68 syntax: c: recognize some C++ header files by their Emacs modeline
For extensionless files, recognize C/C++ ones from the mode name
between the -*- marks on the first line.

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

Inspired-by: Devin Hussey <husseydevin@gmail.com>
2019-10-06 12:01:02 +02:00
Benno Schulenberg 108a3b0b41 tweaks: sort two keywords strictly alphabetically 2019-09-29 15:11:15 +02:00
Dirkjan Ochtman e9d6ceab0b syntax: rust: add the words reserved in 2018, and remove unreserved ones
See https://doc.rust-lang.org/reference/keywords.html,
and https://rust-lang.github.io/rfcs/2421-unreservations-2018.html.

Signed-off-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2019-09-28 13:29:23 +02:00
Benno Schulenberg 3644d51b97 new feature: a 'tabgives' command to define what the Tab key produces
The 'tabgives' command is syntax-specific and should be followed by a
string containing the character(s) that a single press of the <Tab> key
should produce -- most likely a single TAB or a small bunch of spaces,
but any string is allowed.  This overrides the 'tabstospaces' option.

When one wants to make sure <Tab> inserts always four spaces and never
a TAB when editing a Python file, one could add to one's nanorc:

  extendsyntax python tabgives "    "

where there are four spaces between the quotes.  And when one wants
to ensure, when editing a Makefile, that <Tab> always inserts a TAB
and never spaces, independent of what tabstospaces is set to, one
could add to one's nanorc:

  extendsyntax makefile tabgives "	"

where there is a literal TAB character between the quotes.

This fulfills https://savannah.gnu.org/bugs/?53661,
Requested-by: Andrew Pennebaker <andrew.pennebaker@gmail.com>
And addresses https://savannah.gnu.org/bugs/?54760.
Requested-by: Henry van Megen <hvanmegen@gmail.com>
And addresses part of https://savannah.gnu.org/bugs/?54775.
Requested-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
2019-09-25 19:35:07 +02:00
Benno Schulenberg bdf1a9d4e7 syntax: perl: avoid upsetting older glibcs with crafty range expression
The regcomp() function from glibc-2.27 (and older) considers the
bracket expression ['-.] to be invalid -- mistakenly.  Avoid using
any range expression in the relevant regex and instead enumerate
all acceptable characters.

This avoids https://savannah.gnu.org/bugs/?56766.
2019-08-19 17:15:29 +02:00
Benno Schulenberg f2f367ba9c syntaxes: change some unneeded 'icolor' commands to 'color' commands 2019-08-17 17:01:19 +02:00
Benno Schulenberg cd274a7830 syntax: perl: don't color the character after a variable name
And generally improve the regex for coloring Perl variable names.

This fixes https://savannah.gnu.org/bugs/?56713.
With-help-from: Brand Huntsman <alpha@qzx.com>

Bug existed since the Perl syntax was introduced,
in version 1.2.2, commit 70047eef.
2019-08-14 09:24:32 +02:00
Benno Schulenberg f773fa3968 syntax: default: colorize bracketed section headers in some config files 2019-08-14 09:18:51 +02:00
Benno Schulenberg 288355686b syntax: c: allow an underscore in lowercase type names 2019-08-11 20:06:46 +02:00
Benno Schulenberg ee91c51e09 syntax: perl: avoid recognizing embedded hash signs as a comment starter
Require that a comment starts at the start of a line or is preceded by
whitespace.  This prevents most hash signs used for other purposes (and
what follows them) getting colored as comments.
2019-08-08 12:08:34 +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 3b8847f319 syntax: po: colorize numbers only when they form a self-contained word 2019-07-29 19:12:58 +02:00
Benno Schulenberg 8f1cd50f1e syntax: python: avoid miscoloring stuff between two empty strings
The quotes of an empty string ('' or "") should be colored just like
those of a non-empty string, because otherwise the text *between* two
empty strings on the same line gets colored.

Add an extra rule to discolor triple quotes again to not make them
look like valid by themselves.

Also, remove six superfluous backslashes.

This addresses https://savannah.gnu.org/patch/?9801.
Reported-by: Ryan Westlund <rlwestlund@gmail.com>
2019-05-11 19:05:45 +02:00
Benno Schulenberg dfe87540c6 syntax: po: colorize also escaped hex and octal codes 2019-05-03 12:12:44 +02:00
Liu Hao c9605e7308 syntax: c: change the highlighting of preprocessor directives
Some of these directives are now colored in their entirety, while for
a few others it's still just the keyword itself that is colored.

Signed-off-by: Liu Hao <lh_mouse@126.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2019-04-06 17:51:07 +02:00
Benno Schulenberg 5375403b9d syntax: nanorc: colorize also strings preceded by 'start=' or 'end=' 2019-04-02 12:01:56 +02:00
Benno Schulenberg f8e0320722 syntax: nanorc: require whitespace both before and after a quoted string
This ensures that the keyname M-" is not miscolored.
2019-04-01 17:24:19 +02:00
Benno Schulenberg 85804ec70d syntax: man: require the dot to be at start of line, not the comment 2019-03-31 12:42:53 +02:00
Benno Schulenberg e473ba5e6c syntax: man: anchor macros at start of line, as only then they are valid 2019-03-30 20:54:31 +01:00
Benno Schulenberg 9120a62cdd syntax: man: add comments, and color all the safe lowercase macros 2019-03-30 20:47:45 +01:00
Benno Schulenberg 53ecb3225f syntax: default: color in red also versions 4.x of nano 2019-03-30 19:54:58 +01:00
Benno Schulenberg 92cbc7c426 syntax: c: color as a type any lowercase word that ends with "_t" 2019-03-30 17:48:34 +01:00
Benno Schulenberg 9ad3a17954 syntax: nanorc: stop coloring 'unset fill ...' as if it were valid
The same for 'unset tabsize ...'.

Also, color 'set guidestripe' plus a following number as valid.
2019-03-09 09:27:08 +01:00
Benno Schulenberg 916b4d81d0 rcfile: add 'stripecolor' for changing the color of the guiding stripe
The default is now simply reverse video, which works better than a
"loud" colored bar in an interface that for the rest is monochrome.
2019-03-09 09:27:08 +01:00
Benno Schulenberg 4d40bea58a rcfile: add the options that correspond to -b, -f, -j, and -e 2019-02-18 09:34:18 +01:00
Benno Schulenberg 670dd9bbe0 tweaks: condense two regexes in the Tcl syntax, and add a comment
Also, make a range of characters more explicit.
2018-12-17 16:00:54 +01:00
Benno Schulenberg 9cdc64c97a syntax: tcl: colorize comments normally, not with a background hue
This makes for a less "messy" and more readable appearance.

Suggested-by: Michael Siegel <msi@malbolge.net>
2018-12-17 15:35:56 +01:00
Benno Schulenberg 5acfa5bb7b tweaks: slightly indent warnings and errors during the configure phase
To make them stand out in the waterfall of messages.
2018-12-16 14:41:31 +01:00
Benno Schulenberg e938c24d04 tweaks: renumber a couple of symbols, and reshuffle a bit of code
Also, contract the regex for key strings.
2018-11-07 19:30:04 +01:00
David Lawrence Ramsey f55a3fabef input: recognize some escape sequences for <Shift+Delete>
Also, hard-bind <Shift+Delete> in the same way as <Backspace>.

This fixes https://savannah.gnu.org/bugs/?54948,
and fixes https://savannah.gnu.org/bugs/?54975.
2018-11-07 19:17:16 +01:00
Brand Huntsman ae3ec1784d options: add --zap, that makes <Bsp> and <Del> erase a marked region
Using --zap or -Z on the command line, or 'set zap' in a nanorc file,
makes the <Bsp> and <Del> keys erase selected text (a marked region)
as they do in some other editors, and without affecting the cutbuffer.

This fulfills https://savannah.gnu.org/bugs/?54837.
Requested-by: Liu Hao <lh_mouse@126.com>

Signed-off-by: Brand Huntsman <alpha@qzx.com>
2018-11-04 11:46:57 +01:00
Benno Schulenberg 02eaa4ce6d tweaks: fold a few pairs of regexes into each other 2018-11-03 21:32:07 +01:00
Benno Schulenberg 636e9ac3e8 syntaxes: remove several redundant end-of-line anchors from regexes 2018-11-03 21:12:44 +01:00
Benno Schulenberg af71d44e4e tweaks: snip trailing whitespace that ended with a non-breaking space 2018-11-03 20:41:42 +01:00
David Lawrence Ramsey 5f1b618a5a syntax: nanohelp: properly color the keystroke "Sh-^Del"
This fixes https://savannah.gnu.org/bugs/?54758.
2018-09-30 20:40:20 +02:00
Benjamin Mintz 790f98560b syntax: python: do not highlight 'print' and 'exec' in Python 3
Assume that 'print' and 'exec' are statements when they are followed
by whitespace, and are functions otherwise.  This does not highlight
"print'x'" nor "print{x}", but these statements are poor style.

Signed-off-by: Benjamin Mintz <bmintz@protonmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2018-09-20 20:45:01 +02:00
Benno Schulenberg e2051a61e0 syntax: sh: let the header regex match also busybox shell scripts
And recognize calls via 'env' too.

This addresses https://savannah.gnu.org/bugs/?54674.
Reported-by: Aaron Sears <geodelic@gmail.com>
2018-09-18 19:06:11 +02:00
Benno Schulenberg 921f8ae4c9 syntax: default: colorize also two-digit and capitalized nano versions 2018-08-30 19:46:34 +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 c524fbe6d0 tweaks: remove some ineffectual parts from header-line regexes
Adding "[abc]*" does not restrict the recognized header line in any way.

Also, improve the header-line regex for shell scripts, because it should
not match "barunscript" (for example).
2018-08-28 19:53:36 +02:00
Benno Schulenberg 850e538ff7 syntax: python: avoid coloring the three special values inside strings
Reported-by: Benjamin Mintz <bmintz@protonmail.com>
Suggested-by: Brand Huntsman <alpha@qzx.com>
2018-08-16 19:56:01 +02:00
Benno Schulenberg 18419b5e3f syntax: awk: recognize any {g,m,n,}awk script also by its shebang line
This fulfills https://savannah.gnu.org/bugs/?54516.

Suggested-by: Javier Valencia <javiervalencia80@gmail.com>
2018-08-15 20:20:22 +02:00
Benno Schulenberg 2d434f63e2 syntaxes: remove all traces of the 'formatter' command 2018-08-09 21:12:10 +02:00
Benno Schulenberg db1893ef2d syntax: nanorc: recognize 'yesno' as a valid menu to bind/unbind keys in 2018-08-06 18:05:10 +02:00
Benno Schulenberg ac102a7516 tweaks: show "Space" and "Bsp" in the help text of the browser
These keys make more mnemonic sense for scrolling than F7 and F8.

Also adjust the nanohelp syntax to cover the lone word "Space".
2018-07-31 20:36:32 +02:00
Devin Hussey 4a268678a5 syntax: sh: recognize more file extensions and header lines
Signed-off-by: Devin Hussey <husseydevin@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2018-07-20 19:12:20 +02:00
Benno Schulenberg acadf71b13 syntax: nanorc: show ^@ as validly rebindable, but not any ^digit 2018-07-11 14:14:40 +02:00
Benno Schulenberg 8492de53f7 syntax: makefile: color all keywords that GNU make recognizes
Plus one that automake recognizes: if.  Color them only at the start
of a line.  Also color all possible assignment sequences (surrounded
by spaces to not color the ones in shell fragments), and add some
comments.
2018-05-30 11:29:08 +02:00
Cristian Caloghera 22663f8a2e syntax: makefile: recognize also an all-lowercase makefile name
Recognize not just "Makefile" but also "makefile" and "GNUmakefile".
And recognize these only when they are the full filenames, not when
they are the tail part of a longer name.

Signed-off-by: Cristian Caloghera <cristi.caloghera@gmail.com>
2018-05-22 20:41:43 +02:00
Benno Schulenberg cdd637d69f syntaxes: condense and/or correct some extension regexes 2018-05-18 20:40:08 +02:00
Mark-Weston 858663444e new feature: an option to make the 'nextword' function stop at word ends
When 'afterends' is set and Ctrl+Right or Shift+Ctrl+Right is pressed,
nano will stop at the ends of words instead of their beginnings.

Signed-off-by: Mark-Weston <markweston@cock.li>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2018-05-10 11:32:01 +02:00
Benno Schulenberg 30a984661b syntax: po: highlight also other escaped characters, not just \n
Especially color \a and \t, to make it easier to distinguish them
from contiguous text.
2018-04-17 09:56:19 +02:00
Benno Schulenberg cf1129a8b4 syntax: sh: colorize options only when they are preceded by whitespace
To prevent any filenames containing hyphens getting partially colored.

Reported-by: Brand Huntsman <alpha@qzx.com>
2018-03-30 10:46:56 +02:00
Benno Schulenberg 0bce5ba4d9 syntax: sh: color options distinctively, and color also long options
Also add some comments, and accept hyphens in function names.
2018-03-29 09:51:39 +02:00
Benno Schulenberg 20d1823d90 syntax: sh: uncolor "tar" when it's part of a filename 2018-03-28 14:04:00 +02:00
Benno Schulenberg e01bcddf16 docs: document the newly added color name "normal" 2018-03-28 14:03:52 +02:00
Benno Schulenberg 1de3667555 syntax: sh: color also the 'cut', 'head', 'tail', and 'sort' commands 2018-03-27 14:09:38 +02:00
Benno Schulenberg ae9ec6d4ad syntax: nanorc: color also bindings to a string as valid 2018-03-01 10:09:28 +01:00
Benno Schulenberg 8f1a657a37 bindings: revert the ^/ changes, as ^/ is not always Go-To-Line
On a Linux console, ^/ produces Backspace, making it unrebindable.

This fixes https://savannah.gnu.org/bugs/?53248.
2018-03-01 09:50:54 +01:00
Benno Schulenberg 082e5db4b7 syntax: color also ^/ in nano's help texts and in nanorc files
As of commit c79fe1a1, the more readable ^/ has replaced ^_ as the
advertised shortcut for Go-To-Line -- color it too as valid.
2018-02-27 18:06:33 +01:00
Benno Schulenberg b027263a37 small addition: allow customizing the color of an error message
The new option 'set errorcolor' allows the user to specify the color
combination for the status bar when an error message is displayed.
2018-02-23 12:35:17 +01: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 8067efa6cc syntax: nanohelp: color also the Sh-Tab key combo 2018-01-09 16:34:31 +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 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 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