Make C++ source compatible with older standards (#7)

This commit is contained in:
Jonatan Kłosko 2021-10-13 16:04:04 +02:00 committed by GitHub
parent 24a9eaeaa9
commit dda17b01c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -104,11 +104,13 @@ const char token_terminators[] = {
'#' '#'
}; };
const uint8_t token_terminators_length = sizeof(token_terminators) / sizeof(char);
// Note: this is a heuristic as we only use this to distinguish word // Note: this is a heuristic as we only use this to distinguish word
// operators and we don't want to include complex Unicode ranges // operators and we don't want to include complex Unicode ranges
bool is_token_end(int32_t c) { bool is_token_end(int32_t c) {
for (const char& terminator : token_terminators) { for (uint8_t i = 0; i < token_terminators_length; i++) {
if (c == terminator) { if (c == token_terminators[i]) {
return true; return true;
} }
} }
@ -598,7 +600,7 @@ bool scan(TSLexer* lexer, const bool* valid_symbols) {
extern "C" { extern "C" {
void* tree_sitter_elixir_external_scanner_create() { void* tree_sitter_elixir_external_scanner_create() {
return nullptr; return NULL;
} }
bool tree_sitter_elixir_external_scanner_scan(void* payload, TSLexer* lexer, const bool* valid_symbols) { bool tree_sitter_elixir_external_scanner_scan(void* payload, TSLexer* lexer, const bool* valid_symbols) {