Skip to content

Commit

Permalink
Fix char literal parsing
Browse files Browse the repository at this point in the history
When creating a char literal token, its end pointed one character after its actual end.
  • Loading branch information
Wonshtrum committed Sep 12, 2024
1 parent f75e8d1 commit c682194
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion stb_c_lexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
// Arpad Goretity (bugfix)
// Alan Hickman (hex floats)
// github:mundusnine (bugfix)
// Wonshtrum (bugfix)
//
// LICENSE
//
Expand Down Expand Up @@ -672,7 +673,7 @@ int stb_c_lexer_get_token(stb_lexer *lexer)
return stb__clex_token(lexer, CLEX_parse_error, start,start);
if (p == lexer->eof || *p != '\'')
return stb__clex_token(lexer, CLEX_parse_error, start,p);
return stb__clex_token(lexer, CLEX_charlit, start, p+1);
return stb__clex_token(lexer, CLEX_charlit, start, p);
})
goto single_char;

Expand Down

0 comments on commit c682194

Please sign in to comment.