fixup c-comments

This commit is contained in:
Daniel Stenberg 2026-08-07 11:25:15 +02:00
parent a385dd06c3
commit 656e371fcd
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -20,6 +20,7 @@
# 6 - #include line
# 7 - backslash in a string
# 8 - backslash in plain code
# 9 - single quote in plain code
#
## Flags
#
@ -123,12 +124,34 @@ sub scanline {
# switch back to plain code
$state = 0;
}
elsif($state == 9) {
# the prev was a single quote in code
if($c eq "\n") {
$line .= $c;
# switch back to plain code
$state = 0;
}
elsif($c eq "\\") {
# a backslash followed the quote
$line .= " ";
$state = 8;
}
else {
# switch back to plain code
$state = 0;
}
}
else {
if($c eq "\\") {
# got a backslash
$line .= " ";
$state = 8
}
elsif($c eq "\'") {
# got a single quote
$line .= " ";
$state = 9
}
if($c eq "/") {
$state = 1; # got a slash
}