mirror of git://git.sv.gnu.org/nano.git
syntaxes: colorize hex more strictly by using character class [:xdigit:]
In UTF-8 locales, the ranges A-F and a-f include several accented
characters beyond "ABCDEF" and "abcdef", such as the Croat č and ć.
This fixes https://savannah.gnu.org/bugs/?61487.
Bug existed since the beginning of each of the syntaxes,
for the C syntax since version 1.3.6, commit 159bdfdc
.
This commit is contained in:
parent
06ad77895f
commit
f757c4a512
|
@ -23,7 +23,7 @@ color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
|
|||
color magenta "\<(break|continue|goto|return)\>"
|
||||
|
||||
# Single-quoted stuff (characters, backslash escapes, hex and octal byte codes).
|
||||
color brightmagenta "'([^'\]|\\(["'\abfnrtv]|x[0-9A-Fa-f]{1,2}|[0-3]?[0-7]{1,2}))'"
|
||||
color brightmagenta "'([^'\]|\\(["'\abfnrtv]|x[[:xdigit:]]{1,2}|[0-3]?[0-7]{1,2}))'"
|
||||
|
||||
# GCC builtins.
|
||||
color cyan "__attribute__[[:blank:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
|
||||
|
|
|
@ -27,7 +27,7 @@ color brightcyan "\<(package|import)\>"
|
|||
|
||||
# Literals.
|
||||
color red "\<(true|false|nil|iota|_)\>"
|
||||
color red "\<([1-9][0-9]*|0[0-7]*|0[xX][0-9A-Fa-f]+)\>"
|
||||
color red "\<([1-9][0-9]*|0[0-7]*|0[xX][[:xdigit:]]+)\>"
|
||||
color red "\<[0-9]+\.[0-9]*([eE][+-]?[0-9]+)?i?\>"
|
||||
color red "\<[0-9]+[eE][+-]?[0-9]+i?\>"
|
||||
color red "\B\.[0-9]+([eE][+-]?[0-9]+)?i?\>"
|
||||
|
|
|
@ -12,7 +12,7 @@ color brightyellow "\<(await|export|import|throw|try|catch|finally|new|delete)\>
|
|||
color magenta "\<(break|continue|return|yield)\>"
|
||||
|
||||
# Octal/decimal and hexadecimal numbers.
|
||||
color cyan "\<([0-9]+|0x[0-9A-Fa-f]+)\>"
|
||||
color cyan "\<([0-9]+|0x[[:xdigit:]]+)\>"
|
||||
# Special values.
|
||||
color cyan "\<(true|false|null|undefined)\>"
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ color green ":[[:blank:]]*\-?(0|[1-9][0-9]*)(\.[0-9]+)?([Ee]?[-+]?[0-9]+)?"
|
|||
# Values (well, any string).
|
||||
color brightmagenta "".+""
|
||||
# Hex numbers (used as value).
|
||||
color green ":[[:blank:]]*"#[0-9abcdefABCDEF]+""
|
||||
color green ":[[:blank:]]*"#[[:xdigit:]]+""
|
||||
# Escapes.
|
||||
color green "\\["\/bfnrt]" "\\u[0-9abcdefABCDEF]{4}"
|
||||
color green "\\(["\/bfnrt]|u[[:xdigit:]]{4})"
|
||||
# Special words.
|
||||
color green "\<(true|false|null)\>"
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ color brightmagenta "\<(false|nil|true)\>"
|
|||
|
||||
# Decimal and hexadecimal numbers
|
||||
color red "\<[0-9]+(\.[0-9]*)?([Ee][+-]?[0-9]+)?\>"
|
||||
color red "\<0x[0-9A-Fa-f]+(\.[0-9A-Fa-f]*)?([Pp][+-]?[0-9]+)?\>"
|
||||
color red "\<0x[[:xdigit:]]+(\.[[:xdigit:]]*)?([Pp][+-]?[0-9]+)?\>"
|
||||
|
||||
# Brackets
|
||||
color brightmagenta "\(|\)|\[|\]|\{|\}"
|
||||
|
|
|
@ -24,7 +24,7 @@ color magenta "[[:alnum:]]*:"
|
|||
color white "\[[^][:blank:]]*\]"
|
||||
|
||||
# Strings.
|
||||
color brightblack "'([^'\]|\\(["'\abfnrtv]|x[0-9A-Fa-f]{1,2}|[0-3]?[0-7]{1,2}))'"
|
||||
color brightblack "'([^'\]|\\(["'\abfnrtv]|x[[:xdigit:]]{1,2}|[0-3]?[0-7]{1,2}))'"
|
||||
color brightblack "<[^= ]*>|"([^"\]|\\.)*""
|
||||
color brightblue "@"([^"\]|\\.)*""
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ color yellow " (no-)?[-[:alpha:]]+-format(,|$)"
|
|||
color brightmagenta "%([1-9]\$)?[#0 +'I-]?(\*([1-9]\$)?|[1-9](\.[0-9]?)?)?[hlLjzt]?[diouxXeEfFgGaAcspnm%]"
|
||||
# Quotes and escaped characters.
|
||||
color yellow """
|
||||
color cyan "\\([abcefnrtv"\]|x[0-9abcdefABCDEF]{2}|[0-7]{3})"
|
||||
color cyan "\\([abcefnrtv"\]|x[[:xdigit:]]{2}|[0-7]{3})"
|
||||
# Reminders.
|
||||
color brightwhite,yellow "\<(FIXME|TODO|XXX)\>"
|
||||
# Obsolete strings.
|
||||
|
|
Loading…
Reference in New Issue