Skip to content

Commit e9e85d8

Browse files
committed
lex: handle incomplete terminal escape
1 parent 9c309e5 commit e9e85d8

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/lex/lex.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,8 +1313,8 @@ css_error String(css_lexer *lexer, css_token **token)
13131313

13141314
/* EOF will be reprocessed in Start() */
13151315
return emitToken(lexer,
1316-
error == CSS_INVALID ? CSS_TOKEN_INVALID_STRING
1317-
: CSS_TOKEN_STRING,
1316+
error == CSS_OK ? CSS_TOKEN_STRING
1317+
: CSS_TOKEN_INVALID_STRING,
13181318
token);
13191319
}
13201320

@@ -1936,16 +1936,11 @@ css_error consumeStringChars(css_lexer *lexer)
19361936

19371937
error = consumeEscape(lexer, true);
19381938
if (error != CSS_OK) {
1939-
/* Rewind '\\', so we do the
1940-
* right thing next time. */
1941-
lexer->bytesReadForToken -= clen;
1942-
1943-
/* Convert EOF to OK. This causes the caller
1944-
* to believe that all StringChars have been
1945-
* processed. Eventually, the '\\' will be
1946-
* output as a CHAR. */
1947-
if (error == CSS_EOF)
1948-
return CSS_OK;
1939+
if (error != CSS_EOF) {
1940+
/* Rewind '\\', so we do the
1941+
* right thing next time. */
1942+
lexer->bytesReadForToken -= clen;
1943+
}
19491944

19501945
return error;
19511946
}

0 commit comments

Comments
 (0)