Skip to content

Commit

Permalink
chore: apply clang-tidy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Jun 20, 2023
1 parent 3fefc6b commit 387a6fd
Showing 1 changed file with 33 additions and 27 deletions.
60 changes: 33 additions & 27 deletions src/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@
#include <wctype.h>

enum TokenType {
VERBATIM_STRING,
VERBATIM_STRING,
};

void *tree_sitter_squirrel_external_scanner_create() { return NULL; }

void tree_sitter_squirrel_external_scanner_destroy(void *payload) {}

void tree_sitter_squirrel_external_scanner_reset(void *payload) {}

unsigned tree_sitter_squirrel_external_scanner_serialize(void *payload,
char *buffer) {
return 0;
return 0;
}

void tree_sitter_squirrel_external_scanner_deserialize(void *payload,
const char *buffer,
unsigned length) {}
Expand All @@ -20,35 +24,37 @@ static void advance(TSLexer *lexer) { lexer->advance(lexer, false); }

bool tree_sitter_squirrel_external_scanner_scan(void *payload, TSLexer *lexer,
const bool *valid_symbols) {
while (iswspace(lexer->lookahead)) {
lexer->advance(lexer, true);
}

while (iswspace(lexer->lookahead))
lexer->advance(lexer, true);

if (valid_symbols[VERBATIM_STRING] && lexer->lookahead == '@') {
lexer->result_symbol = VERBATIM_STRING;
advance(lexer);

if (lexer->lookahead != '"')
return false;
advance(lexer);

for (;;) {
if (lexer->lookahead == 0) {
return false;
} else if (lexer->lookahead == '"') {
if (valid_symbols[VERBATIM_STRING] && lexer->lookahead == '@') {
lexer->result_symbol = VERBATIM_STRING;
advance(lexer);
// so in Squirrel two quotes is a normal quote
if (lexer->lookahead == '"') {
advance(lexer);
} else {
lexer->mark_end(lexer);
return true;

if (lexer->lookahead != '"') {
return false;
}
} else {
advance(lexer);
}

for (;;) {
if (lexer->lookahead == 0) {
return false;
}
if (lexer->lookahead == '"') {
advance(lexer);
// so in Squirrel two quotes is a normal quote
if (lexer->lookahead == '"') {
advance(lexer);
} else {
lexer->mark_end(lexer);
return true;
}
} else {
advance(lexer);
}
}
}
}

return false;
return false;
}

0 comments on commit 387a6fd

Please sign in to comment.