Display characters > 255 as numbers in debug output

This commit is contained in:
Max Brunsfeld 2014-09-27 16:00:27 -07:00
parent 26ac5788b6
commit 444188cb5f

View file

@ -82,16 +82,19 @@ struct TSLanguage {
#define DEBUG_LEX(...) \
if (lexer->debug) { \
fprintf(stderr, "LEX " __VA_ARGS__); \
fprintf(stderr, "LEX "); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
}
#define START_LEXER() \
DEBUG_LEX("START %d", lex_state); \
int32_t lookahead; \
next_state: \
lookahead = ts_lexer_lookahead_char(lexer); \
DEBUG_LEX("CHAR '%c'", lookahead);
#define START_LEXER() \
DEBUG_LEX("START %d", lex_state); \
int32_t lookahead; \
next_state: \
lookahead = ts_lexer_lookahead_char(lexer); \
DEBUG_LEX( \
(0 < lookahead && lookahead <= 255 ? "CHAR '%c'" : "CHAR %d"), \
lookahead);
#define START_TOKEN() ts_lexer_start_token(lexer);