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
.
master
parent
06ad77895f
commit
f757c4a512
|
@ -23,7 +23,7 @@ color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
|
||||||
color magenta "\<(break|continue|goto|return)\>"
|
color magenta "\<(break|continue|goto|return)\>"
|
||||||
|
|
||||||
# Single-quoted stuff (characters, backslash escapes, hex and octal byte codes).
|
# 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.
|
# GCC builtins.
|
||||||
color cyan "__attribute__[[:blank:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
|
color cyan "__attribute__[[:blank:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
|
||||||
|
|
|
@ -27,7 +27,7 @@ color brightcyan "\<(package|import)\>"
|
||||||
|
|
||||||
# Literals.
|
# Literals.
|
||||||
color red "\<(true|false|nil|iota|_)\>"
|
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]+\.[0-9]*([eE][+-]?[0-9]+)?i?\>"
|
||||||
color red "\<[0-9]+[eE][+-]?[0-9]+i?\>"
|
color red "\<[0-9]+[eE][+-]?[0-9]+i?\>"
|
||||||
color red "\B\.[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)\>"
|
color magenta "\<(break|continue|return|yield)\>"
|
||||||
|
|
||||||
# Octal/decimal and hexadecimal numbers.
|
# Octal/decimal and hexadecimal numbers.
|
||||||
color cyan "\<([0-9]+|0x[0-9A-Fa-f]+)\>"
|
color cyan "\<([0-9]+|0x[[:xdigit:]]+)\>"
|
||||||
# Special values.
|
# Special values.
|
||||||
color cyan "\<(true|false|null|undefined)\>"
|
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).
|
# Values (well, any string).
|
||||||
color brightmagenta "".+""
|
color brightmagenta "".+""
|
||||||
# Hex numbers (used as value).
|
# Hex numbers (used as value).
|
||||||
color green ":[[:blank:]]*"#[0-9abcdefABCDEF]+""
|
color green ":[[:blank:]]*"#[[:xdigit:]]+""
|
||||||
# Escapes.
|
# Escapes.
|
||||||
color green "\\["\/bfnrt]" "\\u[0-9abcdefABCDEF]{4}"
|
color green "\\(["\/bfnrt]|u[[:xdigit:]]{4})"
|
||||||
# Special words.
|
# Special words.
|
||||||
color green "\<(true|false|null)\>"
|
color green "\<(true|false|null)\>"
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ color brightmagenta "\<(false|nil|true)\>"
|
||||||
|
|
||||||
# Decimal and hexadecimal numbers
|
# Decimal and hexadecimal numbers
|
||||||
color red "\<[0-9]+(\.[0-9]*)?([Ee][+-]?[0-9]+)?\>"
|
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
|
# Brackets
|
||||||
color brightmagenta "\(|\)|\[|\]|\{|\}"
|
color brightmagenta "\(|\)|\[|\]|\{|\}"
|
||||||
|
|
|
@ -24,7 +24,7 @@ color magenta "[[:alnum:]]*:"
|
||||||
color white "\[[^][:blank:]]*\]"
|
color white "\[[^][:blank:]]*\]"
|
||||||
|
|
||||||
# Strings.
|
# 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 brightblack "<[^= ]*>|"([^"\]|\\.)*""
|
||||||
color brightblue "@"([^"\]|\\.)*""
|
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%]"
|
color brightmagenta "%([1-9]\$)?[#0 +'I-]?(\*([1-9]\$)?|[1-9](\.[0-9]?)?)?[hlLjzt]?[diouxXeEfFgGaAcspnm%]"
|
||||||
# Quotes and escaped characters.
|
# Quotes and escaped characters.
|
||||||
color yellow """
|
color yellow """
|
||||||
color cyan "\\([abcefnrtv"\]|x[0-9abcdefABCDEF]{2}|[0-7]{3})"
|
color cyan "\\([abcefnrtv"\]|x[[:xdigit:]]{2}|[0-7]{3})"
|
||||||
# Reminders.
|
# Reminders.
|
||||||
color brightwhite,yellow "\<(FIXME|TODO|XXX)\>"
|
color brightwhite,yellow "\<(FIXME|TODO|XXX)\>"
|
||||||
# Obsolete strings.
|
# Obsolete strings.
|
||||||
|
|
Loading…
Reference in New Issue