syntaxes: use one regex for coloring quoted strings, to avoid overlap
Quoted strings cannot start within another quoted string and end after that other string has ended. Therefore single-quoted and double-quoted strings should (as much as possible) be colorized by a single rule, so that overlapping colorations are avoided. (This also fixes a double typo in the PHP syntax (\. --> \\.) that has been there since the PHP syntax was added in 2008, commit 90ee8ee4.) This fixes https://savannah.gnu.org/bugs/?61387. Bug existed since each of these syntaxes was introduced, the oldest ones around 2006, a few others around 2015. The one that got it right was the Lua syntax from 2011.
This commit is contained in:
@@ -17,7 +17,7 @@ color cyan "\<([0-9]+|0x[0-9A-Fa-f]+)\>"
|
||||
color cyan "\<(true|false|null|undefined)\>"
|
||||
|
||||
# Strings.
|
||||
color brightmagenta ""(\\.|[^"])*"" "'(\\.|[^'])*'" "`(\\.|[^`])*`"
|
||||
color brightmagenta ""(\\.|[^"])*"|'(\\.|[^'])*'|`(\\.|[^`])*`"
|
||||
# Comments.
|
||||
color brightblue "(^|[[:blank:]])//.*"
|
||||
color brightblue start="/\*" end="\*/"
|
||||
|
||||
Reference in New Issue
Block a user