Skip to content

Commit dda17b0

Browse files
Make C++ source compatible with older standards (#7)
1 parent 24a9eae commit dda17b0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/scanner.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,13 @@ const char token_terminators[] = {
104104
'#'
105105
};
106106

107+
const uint8_t token_terminators_length = sizeof(token_terminators) / sizeof(char);
108+
107109
// Note: this is a heuristic as we only use this to distinguish word
108110
// operators and we don't want to include complex Unicode ranges
109111
bool is_token_end(int32_t c) {
110-
for (const char& terminator : token_terminators) {
111-
if (c == terminator) {
112+
for (uint8_t i = 0; i < token_terminators_length; i++) {
113+
if (c == token_terminators[i]) {
112114
return true;
113115
}
114116
}
@@ -598,7 +600,7 @@ bool scan(TSLexer* lexer, const bool* valid_symbols) {
598600

599601
extern "C" {
600602
void* tree_sitter_elixir_external_scanner_create() {
601-
return nullptr;
603+
return NULL;
602604
}
603605

604606
bool tree_sitter_elixir_external_scanner_scan(void* payload, TSLexer* lexer, const bool* valid_symbols) {

0 commit comments

Comments
 (0)