feat(value): value model, structured diagnostics and wire format

Implements the shared data contract from blueprint sections 3.4, 7.2 and 10.3:

- Value: Unit/None/Bool/Int(BigInt)/Float/Text/List/Map/Table/Formula/Code/
  FunctionRef/PluginHandle; Unit and None stay distinct and there is no
  implicit string/number coercion.
- Diagnostic with stable machine-readable codes (markdown.invalid_construct,
  expr.parse, symbol.unknown, permission.denied, ...) and span/related/hints.
- RuntimeError with category codes and call frames; renders to a Diagnostic.
- Versioned, type-tagged JSON wire format (wire_version = 1) that keeps
  arbitrary-precision integers as decimal strings, tags NaN/Infinity, enforces
  depth/size limits on untrusted input and never trusts JSON numbers for Int.
- Byte spans and line/column mapping live in the new marqdo-span crate.
This commit is contained in:
cflmy committed 2026-11-20 10:24:13 +08:00
1 parent df878b434a
commit 1520244923
6 files changed
+1968

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
//! Marqdo language values, diagnostics and errors.
//!
//! This crate is the shared data contract between the frontend, the IR, the
//! runtime and the host boundary. It has no dependency on Markdown parsing,
//! process execution or the CLI so that every layer can agree on values and
//! structured failures without creating dependency cycles.
pub mod diagnostic;
pub mod error;
pub mod value;
pub mod wire;
pub use diagnostic::{codes, Diagnostic, Related, Severity};
pub use error::{CallFrame, ErrorCategory, RuntimeError};
pub use marqdo_span::{LineCol, Span};
pub use value::{CodeValue, FormulaValue, FunctionRef, Table, Value};
pub use wire::{from_wire, to_wire, WireError, WIRE_VERSION};