-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Open
Description
The stb C lexer consumes one extra character when parsing a char literal.
This can be demonstrated with this code:
stb_lexer l = {0};
char source[] = "char lit = 'A';";
char store[1024];
stb_c_lexer_init(&l, source, source+sizeof(source)-1, store, sizeof(store));
while (stb_c_lexer_get_token(&l)) {
printf("%d: %.*s\n", l.token, l.where_lastchar-l.where_firstchar+1, l.where_firstchar);
}
which outputs:
260: char
260: lit
61: =
263: 'A';
when we expected:
260: char
260: lit
61: =
263: 'A'
59: ;
Metadata
Metadata
Assignees
Labels
No labels