commit 38a10a62d0b156a808fc7f8bb63d9076d5828248
parent 091e8faf6da2a9f90ae83d7f0ae3945552011e4a
Author: Tom Levy <tomlevy93@gmail.com>
Date: Sun, 31 Dec 2017 03:54:01 +0000
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>
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/syntax/lua.nanorc b/syntax/lua.nanorc
@@ -42,7 +42,7 @@ color brightmagenta "\<(false|nil|true)\>"
color brightgreen "\<(dofile|require)\>"
# Numbers
-color red "\<([0-9]+)\>"
+color red "\<[0-9]+(\.[0-9]*)?([Ee][+-]?[0-9]+)?\>"
# Symbols
color brightmagenta "(\(|\)|\[|\]|\{|\})"
@@ -61,4 +61,4 @@ color red ""(\\.|[^"\])*"|'(\\.|[^'\])*'"
##color red start="\[\[" end="\]\]"
# Hex literals
-color red "\<0x[0-9a-fA-F]+\>"
+icolor red "\<0x[0-9a-f]+(\.[0-9a-f]*)?(p[+-]?[0-9]+)?\>"