Skip to main content

Module text

Module text 

Source
Expand description

The text syntax: JSON, plus // and /* */ comments, trailing commas and unquoted keys (the part of JSON5 editors already understand).

parse keeps where every value is (Spans), so a schema error at entries[2].pages[0].item can point at its line. Typed values stay strings here — the schema decides what a string means.

Structs§

Doc
A parsed document: the value and where each of its parts is.
LineCol
A 1-based line and column (in characters).
Span
A byte range of the source.
Spans
Where each value of a parsed document is: the value’s span, its key’s (map entries), and its children’s, in the same order as the value’s.
SyntaxError
A syntax error.

Constants§

MAX_DEPTH
Deeper than this is an error, not a stack overflow.

Functions§

parse
Parses Yog Data text.
parse_value
Parses Yog Data text, without the positions (faster).
to_string
value as compact text (typed values in their string forms).
to_string_pretty
value as text indented by two spaces, one entry per line.
write_string
s as a JSON string literal.