Skip to main content

Module code

Module code 

Source
Expand description

The stable diagnostic codes of mf2-syntax (mf2_model::Diagnostic::code).

A code identifies what went wrong more precisely than the mf2_model::ErrorKind. Codes are stable: a code’s meaning never changes, and a retired code is never reused. 0 means “no detail”.

CodeKindMeaning
1syntaxU+0000 is not allowed anywhere in a message
2syntax} in text must be escaped as \}
3syntax\ must be followed by \, {, | or }
4syntaxa placeholder is missing its closing }
5syntaxa placeholder is empty ({})
6syntaxa character that cannot appear here
7syntaxwhitespace is required here
8syntaxa name must start here
9syntax= expected (option; .local declaration)
10syntaxan option needs a value: a literal or a variable
11syntaxan attribute’s value must be a literal
12syntaxa quoted literal is missing its closing |
13syntaxnot a keyword (.input, .local, .match)
14syntaxan expression {…} expected
15syntax.input needs a variable expression {$name …}
16syntax.local needs a variable $name
17syntaxa complex message needs a body: {{…}} or .match
18syntaxnothing may follow the body of a complex message
19syntaxa quoted pattern is missing its closing }}
20syntax.match needs at least one selector $name
21syntax.match needs at least one variant
22syntaxa variant needs at least one key
23syntaxa variant needs a quoted pattern {{…}}
24syntaxmarkup is not allowed in a declaration
25syntaxan expression needs an operand or a function before attributes
26syntaxthe source is longer than u32::MAX bytes
101variant-key-mismatcha variant’s key count differs from the selector count
102missing-fallback-variantno variant has only catch-all keys
103missing-selector-annotationthe selector does not (directly or indirectly) reference a declaration with a function
104duplicate-declarationthe variable was declared, or used, in a previous declaration
105duplicate-declarationthe declaration’s own expression uses the variable it binds
106duplicate-option-nametwo options of one function or markup have the same name (under NFC)
107duplicate-varianttwo variants have the same keys (under NFC)

Constants§

CONTENT_AFTER_BODY
Nothing may follow the body of a complex message.
DUPLICATE_DECLARATION
The variable was declared, or used, in a previous declaration.
DUPLICATE_OPTION_NAME
Two options of one function or markup have the same name (under NFC).
DUPLICATE_VARIANT
Two variants have the same keys (under NFC).
EMPTY_PLACEHOLDER
A placeholder is empty ({}).
EXPECTED_EQUALS
= expected (option; .local declaration).
EXPECTED_EXPRESSION
An expression {…} expected.
EXPECTED_KEY
A variant needs at least one key.
EXPECTED_LITERAL
An attribute’s value must be a literal.
EXPECTED_NAME
A name must start here.
EXPECTED_OPERAND
An expression needs an operand or a function before attributes.
EXPECTED_OPTION_VALUE
An option needs a value: a literal or a variable.
EXPECTED_QUOTED_PATTERN
A variant needs a quoted pattern {{…}}.
EXPECTED_SELECTOR
.match needs at least one selector $name.
EXPECTED_VARIABLE
.local needs a variable $name.
EXPECTED_VARIABLE_EXPRESSION
.input needs a variable expression {$name …}.
EXPECTED_VARIANT
.match needs at least one variant.
INVALID_ESCAPE
\ must be followed by \, {, | or }.
MARKUP_NOT_ALLOWED
Markup is not allowed in a declaration.
MISSING_BODY
A complex message needs a body: {{…}} or .match.
MISSING_FALLBACK_VARIANT
No variant has only catch-all keys.
MISSING_SELECTOR_ANNOTATION
The selector does not (directly or indirectly) reference a declaration with a function.
MISSING_WHITESPACE
Whitespace is required here.
NUL_CHARACTER
U+0000 is not allowed anywhere in a message.
SELF_REFERENCING_DECLARATION
The declaration’s own expression uses the variable it binds.
SOURCE_TOO_LONG
The source is longer than u32::MAX bytes.
UNESCAPED_CLOSE_BRACE
} in text must be escaped as \}.
UNEXPECTED_CHARACTER
A character that cannot appear here.
UNKNOWN_KEYWORD
Not a keyword (.input, .local, .match).
UNTERMINATED_PLACEHOLDER
A placeholder is missing its closing }.
UNTERMINATED_QUOTED_LITERAL
A quoted literal is missing its closing |.
UNTERMINATED_QUOTED_PATTERN
A quoted pattern is missing its closing }}.
VARIANT_KEY_MISMATCH
A variant’s key count differs from the selector count.

Functions§

describe
A one-line description of code, or None for an unknown code.