Expand description
Tolerant syntax analysis for .pactole source text.
pactole-syntax sits between the raw tree-sitter grammar
(tree-sitter-pactole) and higher-level consumers such as pactole-storage-fs
or a future language server. It exposes:
span: byte-offset and row/column positions (span::Point,span::Span).diagnostics: syntax-level diagnostics (diagnostics::SyntaxDiagnostic,diagnostics::DiagnosticKind) that do not referencepactole-core.document: tolerant parsing entry points (document::parse_document,document::analyze) producing adocument::ParsedDocument, plusdocument::collect_error_nodes/document::collect_error_nodes_with_sourceto walk a tree-sittertree_sitter::TreeforERROR/MISSINGnodes. Diagnostic messages are contextual human-readable phrases (e.g. “missing an account name in anopendirective”) rather than raw tree-sitter S-expressions.document::ParsedDocument::into_resultoffers a strict conversion toResultfor consumers (e.g.pactole-storage-fs) that only want to proceed on a syntactically clean document.
This crate performs no I/O and has no dependency on pactole-core: it only
deals with the concrete syntax tree and its diagnostics.
Re-exports§
pub use diagnostics::DiagnosticKind;pub use diagnostics::SyntaxDiagnostic;pub use document::ParsedDocument;pub use document::analyze;pub use document::collect_error_nodes;pub use document::collect_error_nodes_with_source;pub use document::parse_document;pub use span::Point;pub use span::Span;
Modules§
- diagnostics
- Diagnostics reported while tolerantly parsing a
.pactolesource text. - document
- Tolerant parsing of
.pactolesource text into a concrete syntax tree. - span
- Byte-offset and row/column spans for syntax nodes.