tiny.preserves.ParseError
Defined in parse_error.
The errors parse returns: one tag per kind of malformed text, plus running out of nesting depth or memory.
API (21)
Fields and members
Public fields and members.
DuplicateDictionaryKeyDuplicateSetElementInvalidHexDoubleInvalidHexEscapeInvalidUnicodeEscapeInvalidUtf8NestingLimitExceededOutOfMemoryTrailingContentUnexpectedCharUnexpectedEndUnknownEscapeUnknownHashFormUnterminatedByteStringUnterminatedDictionaryUnterminatedEscapeUnterminatedHexDoubleUnterminatedRecordUnterminatedSequenceUnterminatedSetUnterminatedString
Source
Source: lib/preserves/src/error.zig:9
zig
/// The errors `parse` returns: one tag per kind of malformed text, plus running out of nesting/// depth or memory. Code that calls `parse` switches on these tags, for a report of the input the/// parser rejected. The set lists every error `parse` can return, so a switch over it is/// exhaustive. On any error `parse` frees everything it allocated. `json.ParseError` names the same/// set, and no JSON function returns it.pub const ParseError = error{ /// Input that ends before a value starts: empty or blank text, text that ends right after `#` /// or `#x`, or a record, dictionary or annotation cut off before its next value. UnexpectedEnd, /// A character such as `>`, `:` or `;` at the start of a value, or a dictionary key followed by /// something other than `:`. `#xd` followed by something other than `"`. UnexpectedChar, /// A string or quoted symbol that reaches the end of the input before its closing quote. UnterminatedString, /// A record that reaches the end of the input before its closing `>`. UnterminatedRecord, /// A sequence that reaches the end of the input before its closing `]`. UnterminatedSequence, /// A dictionary that reaches the end of the input before its closing `}`. UnterminatedDictionary, /// A set, written `#{`, that reaches the end of the input before its closing `}`. UnterminatedSet, /// Input that ends right after a backslash in a string, a quoted symbol or a `#"` byte string. UnterminatedEscape, /// A byte string written `#"`, `#x"` or `#[` that reaches the end of the input before its /// closing `"` or `]`. UnterminatedByteString, /// A double written `#xd"` that reaches the end of the input before its closing `"`. UnterminatedHexDouble, /// In a string or quoted symbol, a backslash followed by a character other than `"`, `\`, `/`, /// `'`, `n`, `r`, `t`, `b`, `f` or `u`. In a `#"` byte string, a backslash followed by a /// character other than `x`, `\`, `"`, `n`, `r` or `t`. The text writer writes `\'` inside /// quoted symbols, so `parse` accepts that output. UnknownEscape, /// A string, quoted symbol, or bare symbol has invalid UTF-8. InvalidUtf8, /// A `#` followed by a character other than `t`, `f`, `{`, `:`, `"`, `x`, `[`, space or tab. /// `#x` followed by a character other than `"` or `d`. UnknownHashForm, /// A double written `#xd"…"` whose digits, ignoring whitespace, are not exactly 16 hexadecimal /// digits. InvalidHexDouble, /// Anything other than whitespace, commas and comments after the first complete value. TrailingContent, /// In a `#"` byte string, `\x` not followed by two hexadecimal digits. A `#x"…"` byte string /// with an odd number of digits or a character other than a hexadecimal digit. Also a `#[…]` /// byte string with invalid base64. InvalidHexEscape, /// In a string or quoted symbol, `\u` not followed by four hexadecimal digits, or naming a lone /// surrogate, which UTF-8 leaves unencoded. InvalidUnicodeEscape, /// A set, written `#{…}`, that holds two equal elements. DuplicateSetElement, /// A dictionary that holds two equal keys. DuplicateDictionaryKey, /// Values nested more than 256 levels deep. Each record, sequence, dictionary, set, annotation /// and `#:` embedded value adds a level. `text.decode` returns the same tag at the same depth. NestingLimitExceeded, /// An allocation that fails while `parse` builds the value. OutOfMemory,};Source: lib/preserves/src/root.zig:163
zig
pub const ParseError = parse_error.ParseError;Also reachable as
json.ParseError, text.ParseError.
Audit
| Definitions | 1 |
|---|---|
| Public names | 4 |
| Members | 21 |
| Version | 26.7.0 |
| Revision | daab053ee433 |