Skip to content

Commit 9dca2b6

Browse files
authored
fix(scanner): remove unnecessary char casting (#200)
1 parent efb075c commit 9dca2b6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tree-sitter-markdown-inline/src/scanner.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ typedef enum {
2626
} TokenType;
2727

2828
// Determines if a character is punctuation as defined by the markdown spec.
29-
static bool is_punctuation(char chr) {
29+
static bool is_punctuation(int32_t chr) {
3030
return (chr >= '!' && chr <= '/') || (chr >= ':' && chr <= '@') ||
3131
(chr >= '[' && chr <= '`') || (chr >= '{' && chr <= '~');
3232
}
@@ -189,7 +189,7 @@ static bool parse_star(Scanner *s, TSLexer *lexer, const bool *valid_symbols) {
189189
// is whitespace punctuation or other.
190190
bool next_symbol_whitespace =
191191
line_end || lexer->lookahead == ' ' || lexer->lookahead == '\t';
192-
bool next_symbol_punctuation = is_punctuation((char)lexer->lookahead);
192+
bool next_symbol_punctuation = is_punctuation(lexer->lookahead);
193193
// Information about the last token is in valid_symbols. See grammar.js
194194
// for these tokens for how this is done.
195195
if (valid_symbols[EMPHASIS_CLOSE_STAR] &&
@@ -251,7 +251,7 @@ static bool parse_tilde(Scanner *s, TSLexer *lexer, const bool *valid_symbols) {
251251
// is whitespace punctuation or other.
252252
bool next_symbol_whitespace =
253253
line_end || lexer->lookahead == ' ' || lexer->lookahead == '\t';
254-
bool next_symbol_punctuation = is_punctuation((char)lexer->lookahead);
254+
bool next_symbol_punctuation = is_punctuation(lexer->lookahead);
255255
// Information about the last token is in valid_symbols. See grammar.js
256256
// for these tokens for how this is done.
257257
if (valid_symbols[STRIKETHROUGH_CLOSE] &&
@@ -314,7 +314,7 @@ static bool parse_underscore(Scanner *s, TSLexer *lexer,
314314
// is whitespace punctuation or other.
315315
bool next_symbol_whitespace =
316316
line_end || lexer->lookahead == ' ' || lexer->lookahead == '\t';
317-
bool next_symbol_punctuation = is_punctuation((char)lexer->lookahead);
317+
bool next_symbol_punctuation = is_punctuation(lexer->lookahead);
318318
// Information about the last token is in valid_symbols. See grammar.js
319319
// for these tokens for how this is done.
320320
if (valid_symbols[EMPHASIS_CLOSE_UNDERSCORE] &&

0 commit comments

Comments
 (0)