#[non_exhaustive]pub enum DiagnosticCode {
Show 25 variants
Syntax,
UnterminatedString,
BadEscape,
ReservedName,
DuplicateName,
DeclarationIncomplete,
LiteralRequired,
LimitDeclarations,
DuplicateProp,
DuplicateKey,
MismatchedClose,
UnclosedTag,
ReplyForbidden,
LimitTags,
Nesting,
NonAssoc,
MixedCoalesce,
NumberLiteral,
ParseWork,
LimitAst,
LimitBlocks,
LimitText,
SourceTooLarge,
ReferenceLimit,
Encoding,
}Expand description
A diagnostic’s stable code. New codes may be added in minor releases, so
a match needs a wildcard arm; DiagnosticCode::as_str gives the code
as it is written in documentation and logs, such as E_SYNTAX.
Naming every code without a wildcard arm does not compile outside this crate:
use cortexkit_rich_ui_syntax::DiagnosticCode as C;
fn rank(code: C) -> u8 {
match code {
C::Syntax => 0,
C::UnterminatedString => 1,
C::BadEscape => 2,
C::ReservedName => 3,
C::DuplicateName => 4,
C::DeclarationIncomplete => 5,
C::LiteralRequired => 6,
C::LimitDeclarations => 7,
C::DuplicateProp => 8,
C::DuplicateKey => 9,
C::MismatchedClose => 10,
C::UnclosedTag => 11,
C::ReplyForbidden => 12,
C::LimitTags => 13,
C::Nesting => 14,
C::NonAssoc => 15,
C::MixedCoalesce => 16,
C::NumberLiteral => 17,
C::ParseWork => 18,
C::LimitAst => 19,
C::LimitBlocks => 20,
C::LimitText => 21,
C::SourceTooLarge => 22,
C::ReferenceLimit => 23,
C::Encoding => 24,
}
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Syntax
E_SYNTAX: source that fits no rule of the grammar.
UnterminatedString
E_UNTERMINATED_STRING: a string literal that reaches a raw line
break, or the end of its construct, before its closing quote.
BadEscape
E_BAD_ESCAPE: an unknown escape in a string literal, or a \u{…}
escape that is malformed or names no Unicode scalar value.
ReservedName
E_RESERVED_NAME: a declaration whose name is reserved.
DuplicateName
E_DUPLICATE_NAME: a second declaration of the same name.
DeclarationIncomplete
E_DECLARATION_INCOMPLETE: a declaration whose value expression is
missing or cut short.
LiteralRequired
E_LITERAL_REQUIRED: a state initializer or handle path that is not
a literal.
LimitDeclarations
E_LIMIT_DECLARATIONS: more than DECLARATIONS declarations.
DuplicateProp
E_DUPLICATE_PROP: a tag that sets the same prop twice.
DuplicateKey
E_DUPLICATE_KEY: a record literal that repeats a key.
MismatchedClose
E_MISMATCHED_CLOSE: a closing tag that does not close the open tag.
UnclosedTag
E_UNCLOSED_TAG: a paired tag without its closing tag.
ReplyForbidden
E_REPLY_FORBIDDEN: a reply tag prop outside the reply-value grammar.
LimitTags
E_LIMIT_TAGS: more than 64 tags in a reply.
Nesting
E_NESTING: a nesting limit was exceeded.
NonAssoc
E_NONASSOC: chained comparison or equality operators.
MixedCoalesce
E_MIXED_COALESCE: ?? mixed with && or || without grouping.
NumberLiteral
E_NUMBER_LITERAL: a number outside the exact decimal grammar.
ParseWork
E_PARSE_WORK: the deterministic parsing work allowance ran out.
LimitAst
E_LIMIT_AST: more than AST_NODES syntax nodes.
LimitBlocks
E_LIMIT_BLOCKS: more than BLOCKS Markdown blocks.
LimitText
E_LIMIT_TEXT: more than OUTPUT_SCALARS text scalars in a reply.
SourceTooLarge
E_SOURCE_TOO_LARGE: a program longer than PROGRAM_BYTES.
ReferenceLimit
E_REFERENCE_LIMIT: more than REFERENCES references or
HANDLES handles.
Encoding
W_ENCODING: invalid UTF-8 was replaced before parsing.