commit eb8960812d92714eb568df36e09d8c76af5cd46c
parent 9057ad5dbe07ea11e717cc08f69a26bd7e6abc60
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Mon, 7 Oct 2024 17:12:58 +0200
cc1: Fix lexer for strings
There were some leftovers from older versions of the code and
the logic was inverted, making that escape sequences were wrongly
processed.
Diffstat:
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/src/cmd/cc/cc1/lex.c b/src/cmd/cc/cc1/lex.c
@@ -649,14 +649,13 @@ static int
string(void)
{
char *bp = yytext;
- int c, esc;
+ int c;
*bp++ = '"';
- esc = 0;
for (++input->p; ; ++input->p) {
c = *input->p;
- if (c == '"' && !esc)
+ if (c == '"')
break;
if (c == '\0') {
@@ -664,12 +663,7 @@ string(void)
break;
}
- if (c == '\\' && !esc && disescape)
- esc = 1;
- else
- esc = 0;
-
- if (c == '\\' && !esc)
+ if (c == '\\' && !disescape)
c = escape();
if (bp == &yytext[STRINGSIZ+1]) {