pub struct SyntaxDiagnostic {
pub kind: DiagnosticKind,
pub span: Span,
pub message: String,
}Expand description
A single syntax-level diagnostic produced by tolerant parsing.
Diagnostics are purely syntactic: they do not reference pactole-core domain
concepts and only describe where the concrete syntax tree deviates from a
fully valid parse.
Fields§
§kind: DiagnosticKindWhether this diagnostic reports an ERROR node or a MISSING node.
span: SpanThe span in the source text this diagnostic refers to.
message: StringA human-readable description of the diagnostic (e.g. “missing an
account name in an open directive”, or “unexpected syntax after a
date: foo bar”), derived from the tree-sitter node’s kind and its
surrounding context (parent node kind) rather than a raw
tree-sitter S-expression.
Implementations§
Source§impl SyntaxDiagnostic
impl SyntaxDiagnostic
Sourcepub fn new(kind: DiagnosticKind, span: Span, message: impl Into<String>) -> Self
pub fn new(kind: DiagnosticKind, span: Span, message: impl Into<String>) -> Self
Builds a new SyntaxDiagnostic.
Trait Implementations§
Source§impl Clone for SyntaxDiagnostic
impl Clone for SyntaxDiagnostic
Source§impl Debug for SyntaxDiagnostic
impl Debug for SyntaxDiagnostic
impl Eq for SyntaxDiagnostic
Source§impl PartialEq for SyntaxDiagnostic
impl PartialEq for SyntaxDiagnostic
impl StructuralPartialEq for SyntaxDiagnostic
Auto Trait Implementations§
impl Freeze for SyntaxDiagnostic
impl RefUnwindSafe for SyntaxDiagnostic
impl Send for SyntaxDiagnostic
impl Sync for SyntaxDiagnostic
impl Unpin for SyntaxDiagnostic
impl UnsafeUnpin for SyntaxDiagnostic
impl UnwindSafe for SyntaxDiagnostic
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more