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”.
| Code | Kind | Meaning |
|---|---|---|
| 1 | syntax | U+0000 is not allowed anywhere in a message |
| 2 | syntax | } in text must be escaped as \} |
| 3 | syntax | \ must be followed by \, {, | or } |
| 4 | syntax | a placeholder is missing its closing } |
| 5 | syntax | a placeholder is empty ({}) |
| 6 | syntax | a character that cannot appear here |
| 7 | syntax | whitespace is required here |
| 8 | syntax | a name must start here |
| 9 | syntax | = expected (option; .local declaration) |
| 10 | syntax | an option needs a value: a literal or a variable |
| 11 | syntax | an attribute’s value must be a literal |
| 12 | syntax | a quoted literal is missing its closing | |
| 13 | syntax | not a keyword (.input, .local, .match) |
| 14 | syntax | an expression {…} expected |
| 15 | syntax | .input needs a variable expression {$name …} |
| 16 | syntax | .local needs a variable $name |
| 17 | syntax | a complex message needs a body: {{…}} or .match |
| 18 | syntax | nothing may follow the body of a complex message |
| 19 | syntax | a quoted pattern is missing its closing }} |
| 20 | syntax | .match needs at least one selector $name |
| 21 | syntax | .match needs at least one variant |
| 22 | syntax | a variant needs at least one key |
| 23 | syntax | a variant needs a quoted pattern {{…}} |
| 24 | syntax | markup is not allowed in a declaration |
| 25 | syntax | an expression needs an operand or a function before attributes |
| 26 | syntax | the source is longer than u32::MAX bytes |
| 101 | variant-key-mismatch | a variant’s key count differs from the selector count |
| 102 | missing-fallback-variant | no variant has only catch-all keys |
| 103 | missing-selector-annotation | the selector does not (directly or indirectly) reference a declaration with a function |
| 104 | duplicate-declaration | the variable was declared, or used, in a previous declaration |
| 105 | duplicate-declaration | the declaration’s own expression uses the variable it binds |
| 106 | duplicate-option-name | two options of one function or markup have the same name (under NFC) |
| 107 | duplicate-variant | two 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;.localdeclaration).- 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 .matchneeds at least one selector$name.- EXPECTED_
VARIABLE .localneeds a variable$name.- EXPECTED_
VARIABLE_ EXPRESSION .inputneeds a variable expression{$name …}.- EXPECTED_
VARIANT .matchneeds 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::MAXbytes. - 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, orNonefor an unknown code.