Skip to main content

parse

Function parse 

Source
pub fn parse(src: &str) -> Result<Value, ZonError>
Expand description

Parse a ZON source string with the shared default parser.

The engine is built once, on first use, and reused after that, as the Go Parse does through sync.Once. Reuse is safe: Tabnas::parse takes &self and builds a fresh parse context per call, and Tabnas is Send + Sync, so concurrent callers share one installed grammar.

Use make_with or parse_with when the parser needs options.

let value = tabnas_zon::parse(".{ .paths = .{ \"build.zig\", \"src\" } }")?;
assert_eq!(value.to_string(), r#"{"paths":["build.zig","src"]}"#);
assert_eq!(tabnas_zon::parse("0X2A").unwrap_err().code, "zon_number");