mirror of
git://git.sv.gnu.org/nano.git
synced 2024-12-28 05:09:49 +03:00
syntax: rust: do not colorize as string the text between two strings
Strings may not contain a double quote unless it is escaped. Reference: https://doc.rust-lang.org/reference/tokens.html#string-literals (This will still not colorize multi-line strings with an unescaped newline, will still colorize "this\" as if it were a valid string, and will still miscolor things when there is another string after the closing quote of a two-line string. But those things can't be helped -- line-based regexes cannot emulate a full parser.) This fixes https://savannah.gnu.org/bugs/?61361. Reported-by: Elias Jonsson <e@ejon.eu> Bug existed since version 2.6.1, since the Rust syntax was introduced.
This commit is contained in:
parent
918ce1afa3
commit
d57bfc057f
@ -22,8 +22,8 @@ color magenta "[A-Z][A-Z_0-9]+"
|
||||
color magenta "[A-Z][A-Za-z0-9]+"
|
||||
|
||||
# Strings
|
||||
color green "".*""
|
||||
color green start="".*\\$" end=".*""
|
||||
color green ""([^"]|\\")*""
|
||||
color green start=""([^"]|\\")*\\$" end=".*""
|
||||
## NOTE: This isn't accurate, but matching "#{0,} for the end of the string is too liberal.
|
||||
color green start="r#+"" end=""#+"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user