syntax: c: require a preceding blank when a line comment contains a quote

This avoids miscolorizing part of a string when it contains a URL.

This fixes https://savannah.gnu.org/bugs/?64340.
Reported-by: Yonut Smith <deanlast3@gmail.com>

Problem has existed for more than twenty years, at least since support
for multine-line regexes was added in commit 6c1e6612 in 2002.
This commit is contained in:
Benno Schulenberg 2024-01-08 11:40:49 +01:00
parent f0e69b4a51
commit 7c174a1a25

View File

@ -36,7 +36,7 @@ color brightcyan start="^[[:blank:]]*#[[:blank:]]*(if(n?def)?|elif|warning|error
color brightcyan "^[[:blank:]]*#[[:blank:]]*((define|else|endif|include(_next)?|line|undef)\>|$)"
# Comments.
color brightblue "//.*"
color brightblue "//[^"]*$|(^|[[:blank:]])//.*"
color brightblue start="/\*" end="\*/"
# Reminders.