ReadonlynameAlways "DcborPatternError"; the cross-copy identity DcborPatternError.isDcborPatternError checks.
ReadonlycodeThe discriminant; equals details.code.
ReadonlydetailsThe structured payload, discriminated by code.
The span, if the error has one.
StaticisType guard for a DcborPatternError, including one from another copy of this package.
The message with the source line and a caret under the span.
Internal
The same error with its span moved by offset.
StaticemptyThe source is empty.
Readonlycode: "EmptyInput"The discriminant.
Readonlydetails: { code: "EmptyInput" }The payload of code.
Readonlycode: "EmptyInput"The discriminant.
StaticunexpectedThe source ended inside a pattern.
Readonlycode: "UnexpectedEndOfInput"The discriminant.
Readonlydetails: { code: "UnexpectedEndOfInput" }The payload of code.
Readonlycode: "UnexpectedEndOfInput"The discriminant.
StaticextraText follows the pattern.
StaticunexpectedA token that cannot start or continue a pattern here.
StaticunrecognizedText no token matches.
Readonlycode: "UnrecognizedToken"The discriminant.
Readonlydetails: { code: "UnrecognizedToken"; span: Span }The payload of code.
Readonlycode: "UnrecognizedToken"The discriminant.
Readonlyspan: SpanWhat a single-pass scanner reads before giving up: a keyword's prefix, a bare @, or one code point.
StaticinvalidA regex the dialect does not accept.
StaticunterminatedA /regex/ without its closing slash.
StaticunterminatedA string literal without its closing quote.
StaticinvalidA {n,m} range that is not one, or with n above m.
StaticinvalidA hex literal that is not even-length hex.
StaticunterminatedAn h'…' literal without its closing quote.
StaticinvalidA date'…' body that is not a date, a range of dates, or a regex.
StaticinvalidA number literal dCBOR does not read.
StaticinvalidA digest'ur:…' body the UR decoder rejects.
StaticexpectedAn opening parenthesis was required.
StaticexpectedA closing parenthesis was required.
StaticexpectedA closing bracket was required.
StaticexpectedA closing brace was required.
StaticexpectedA colon was required between a map key and its value.
StaticexpectedA pattern was required after an operator.
StaticunmatchedParentheses that do not pair.
StaticunmatchedBraces that do not pair.
StaticinvalidA capture name that is not an identifier.
StaticinvalidA digest'…' body that is neither a UR, a regex nor a hex prefix.
Readonlycode: "InvalidDigestPattern"The discriminant.
Readonlydetails: { code: "InvalidDigestPattern"; span: Span; reason: string }The payload of code.
Readonlycode: "InvalidDigestPattern"The discriminant.
Readonlyspan: SpanThe literal.
Readonlyreason: stringThe body as written, or empty content.
StaticunterminatedA digest'…' literal without its closing quote.
StaticunterminatedA date'…' literal without its closing quote.
StaticnestingA pattern nested deeper than a given maxDepth.
Thrown by
parsePatternandparsePatternPartial(and carried by thetry…forms) for text that does not parse.codesays why;detailscarries the span and the code-specific fields;fullMessage(source)renders the message with the source line and a caret. Instances come from the static factories only.Example