Skip to content

Commit

Permalink
syntax error inference todo
Browse files Browse the repository at this point in the history
  • Loading branch information
SpontanCombust committed Jan 18, 2024
1 parent 7f15778 commit 699252a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/analyzer/src/jobs/syntax_analysis/error_inference.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//! Tree-sitter is an error-tolerant parser. Whenever it stumbles upon a sequence of tokens it is not able to parse into a valid node
//! it creates an ERROR node that encompasses these invalid tokens. This is however the full extent of what it does.
//! By itself it does not provide any concrete means as to **why** exactly it created an ERROR node.
//! This is why these nodes have to be poked around by hand and have useful information extracted from them.
//TODO implement syntax error node inference, use it when checking SyntaxError::Invalid in SyntaxErrorVisitor::check_errors
// Possible solution: flatten the error node into a vector of tokens or leaf node kinds.
// Go over over the elements until you encounter the first truly unexpected token and create a MissingElement or UnexpectedElement diagnostic
2 changes: 2 additions & 0 deletions crates/analyzer/src/jobs/syntax_analysis/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
mod syntax_error_visitor;
mod error_inference;

pub use syntax_error_visitor::*;

0 comments on commit 699252a

Please sign in to comment.