From 38a10a62d0b156a808fc7f8bb63d9076d5828248 Mon Sep 17 00:00:00 2001 From: Tom Levy Date: Sun, 31 Dec 2017 03:54:01 +0000 Subject: [PATCH] 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 --- syntax/lua.nanorc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax/lua.nanorc b/syntax/lua.nanorc index 28d922a8..7f0a4e50 100644 --- 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]+)?\>"