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>
master
Tom Levy 2017-12-31 03:54:01 +00:00 committed by Benno Schulenberg
parent 091e8faf6d
commit 38a10a62d0
1 changed files with 2 additions and 2 deletions

View File

@ -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]+)?\>"