Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve segmentation fault parsing let #11

Merged
merged 2 commits into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions corpus/errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
================================================================================
issue 10
================================================================================

let %

--------------------------------------------------------------------------------

(ERROR)
12 changes: 11 additions & 1 deletion src/scanner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,16 @@ struct Scanner {
}

bool scan(TSLexer *lexer, const bool *valid_symbols) {
// During error recovery we don't run the external scanner. This produces
// less accurate results, but avoids a large deal of complexity in this
// scanner.
if (valid_symbols[MULTSTR_START] && valid_symbols[MULTSTR_END] &&
valid_symbols[STR_START] && valid_symbols[STR_END] &&
valid_symbols[INTERPOLATION_START] &&
valid_symbols[INTERPOLATION_END] && valid_symbols[COMMENT]) {
return false;
}

// Skip over all whitespace
while (iswspace(lookahead(lexer))) {
skip(lexer);
Expand Down Expand Up @@ -268,7 +278,7 @@ void tree_sitter_nickel_external_scanner_deserialize(void *payload,
const char *buffer,
unsigned length) {
Scanner *scanner = static_cast<Scanner *>(payload);
uint8_t length_uint8 = (uint8_t) length;
uint8_t length_uint8 = (uint8_t)length;
scanner->deserialize(buffer, length_uint8);
}

Expand Down