alpha2-diagnose 0.10.0

Format-neutral document diagnostics for alpha2: a document tree, a JSON reader that recovers, a schema walker, advice and fixes.
Documentation
//! Readers from text to a tree. Each reader is a module; JSON is the first.

mod json;

pub use json::{MAX_DEPTH, json};

use crate::diagnostic::Diagnostic;
use crate::path::Path;
use crate::tree::Node;

/// What a reader answers.
#[derive(Clone, Debug)]
pub struct Read {
    /// The document as read, recovered where the text needed it; `None` when nothing could be
    /// read.
    pub tree: Option<Node>,
    /// One `syntax.*` diagnostic per recovery, in text order.
    pub diagnostics: Vec<Diagnostic>,
    /// Arrays and objects the text ended or broke off inside, closed by the reader; a missing
    /// field there is the cut, not a mistake of its own.
    pub incomplete: Vec<Path>,
}

impl Read {
    /// Whether the text needed any recovery, so the document as written is not valid.
    #[must_use]
    pub fn recovered(&self) -> bool {
        !self.diagnostics.is_empty()
    }
}

#[cfg(test)]
mod tests;