nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit f757c4a5122776d8af11d432f065cd54049eec3e
parent 06ad77895ff14b0c12a073b5c64a392cab65791b
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Mon, 15 Nov 2021 15:56:11 +0100

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.

Diffstat:
Msyntax/c.nanorc | 2+-
Msyntax/go.nanorc | 2+-
Msyntax/javascript.nanorc | 2+-
Msyntax/json.nanorc | 4++--
Msyntax/lua.nanorc | 2+-
Msyntax/objc.nanorc | 2+-
Msyntax/po.nanorc | 2+-
7 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/syntax/c.nanorc b/syntax/c.nanorc @@ -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)__" diff --git a/syntax/go.nanorc b/syntax/go.nanorc @@ -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?\>" diff --git a/syntax/javascript.nanorc b/syntax/javascript.nanorc @@ -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)\>" diff --git a/syntax/json.nanorc b/syntax/json.nanorc @@ -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)\>" diff --git a/syntax/lua.nanorc b/syntax/lua.nanorc @@ -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 "\(|\)|\[|\]|\{|\}" diff --git a/syntax/objc.nanorc b/syntax/objc.nanorc @@ -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 "@"([^"\]|\\.)*"" diff --git a/syntax/po.nanorc b/syntax/po.nanorc @@ -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.