fix: freeze on error recovery (#34)
This commit is contained in:
parent
76a70a8b35
commit
698bb1a343
3 changed files with 16 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "tree-sitter-org"
|
||||
description = "org grammar for the tree-sitter parsing library"
|
||||
version = "1.3.0"
|
||||
version = "1.3.1"
|
||||
keywords = ["incremental", "parsing", "org"]
|
||||
categories = ["parsing", "text-editors"]
|
||||
repository = "https://github.com/milisims/tree-sitter-org"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "tree-sitter-org",
|
||||
"version": "1.3.0",
|
||||
"version": "1.3.1",
|
||||
"description": "Org grammar for tree-sitter",
|
||||
"main": "bindings/node",
|
||||
"keywords": [
|
||||
|
|
|
|||
|
|
@ -105,6 +105,16 @@ struct Scanner {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool in_error_recovery(const bool *valid_symbols) {
|
||||
return (valid_symbols[LISTSTART] &&
|
||||
valid_symbols[LISTEND] &&
|
||||
valid_symbols[LISTITEMEND] &&
|
||||
valid_symbols[BULLET] &&
|
||||
valid_symbols[HLSTARS] &&
|
||||
valid_symbols[SECTIONEND] &&
|
||||
valid_symbols[ENDOFFILE]);
|
||||
}
|
||||
|
||||
Bullet getbullet(TSLexer *lexer) {
|
||||
if (lexer->lookahead == '-') {
|
||||
advance(lexer);
|
||||
|
|
@ -150,6 +160,10 @@ struct Scanner {
|
|||
|
||||
bool scan(TSLexer *lexer, const bool *valid_symbols) {
|
||||
|
||||
if (in_error_recovery(valid_symbols))
|
||||
return false;
|
||||
|
||||
|
||||
// - Section ends
|
||||
int16_t indent_length = 0;
|
||||
lexer->mark_end(lexer);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue