Enum Class RNCErrorCode
java.lang.Object
java.lang.Enum<RNCErrorCode>
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.validator.RNCErrorCode
- All Implemented Interfaces:
Serializable,Comparable<RNCErrorCode>,Constable,IXMLErrorCode
Error codes for RNC (RELAX NG Compact Syntax) diagnostics.
Each error code maps to a specific type of problem detected during parsing or validation of an RNC document. The codes are divided into:
- Parser errors — detected by
RNCParserduring Phase 1 validation (e.g., missing braces, unclosed blocks). - Jing validation errors — detected by Jing during Phase 2 validation (e.g., undefined patterns, duplicate definitions).
Use case: error codes are used to match diagnostics with their
corresponding IRNCCodeActionParticipant
for quick fixes.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionTwo or more defines share the same name without compatible combine modes.Jing expected a specific token (e.g.An included or external file does not exist on disk.An include body overrides a define that does not exist in the included file.Both operands of an interleave (&) containtext.A define is missing its assignment operator (=,|=, or&=).Anelement,attribute, ornamespacekeyword is missing its name.Anelementorattributedefinition is missing the opening{.Anelementorattributeblock is empty (no content pattern).The grammar has defines but nostartdeclaration.Anincludeorexternaldirective is missing the quoted URI.A generic syntax error reported by Jing.A{brace was opened but never closed.A pattern references a define name that is not declared.A define is declared but never referenced (shown withDiagnosticTag.Unnecessary). -
Method Summary
Modifier and TypeMethodDescriptionstatic StringextractName(String message) Extracts the quoted name from a raw error message string.static StringextractName(org.eclipse.lsp4j.Diagnostic diagnostic) Extracts the quoted name from a diagnostic message (e.g. the pattern name from"reference to undefined pattern \"foo\"").static RNCErrorCodeLooks up an error code by its kebab-case string.static RNCErrorCodefromMessage(String message) Determines the error code from a Jing validation error message by matching known message prefixes.getCode()Returns the kebab-case diagnostic code string (e.g.static RNCErrorCodeReturns the enum constant of this class with the specified name.static RNCErrorCode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
MissingName
Anelement,attribute, ornamespacekeyword is missing its name. -
MissingOpenBrace
Anelementorattributedefinition is missing the opening{. -
MissingAssign
A define is missing its assignment operator (=,|=, or&=). -
MissingUri
Anincludeorexternaldirective is missing the quoted URI. -
UnclosedBlock
A{brace was opened but never closed. -
FileNotFound
An included or external file does not exist on disk. -
UndefinedPattern
A pattern references a define name that is not declared. -
DuplicateDefinition
Two or more defines share the same name without compatible combine modes. -
MissingPattern
Anelementorattributeblock is empty (no content pattern). -
MissingStartElement
The grammar has defines but nostartdeclaration. -
SyntaxError
A generic syntax error reported by Jing. -
ExpectedToken
Jing expected a specific token (e.g.""}) but found something else. -
InterleaveContainsText
Both operands of an interleave (&) containtext. -
IncludeNotOverriding
An include body overrides a define that does not exist in the included file. -
UnusedDefine
A define is declared but never referenced (shown withDiagnosticTag.Unnecessary).
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getCode
Returns the kebab-case diagnostic code string (e.g."undefined-pattern").- Specified by:
getCodein interfaceIXMLErrorCode- Returns:
- the code used as the
Diagnostic.codein LSP responses.
-
fromCode
Looks up an error code by its kebab-case string.Use case: when resolving code actions, the diagnostic code is matched to its enum constant to find the corresponding code action participant.
- Parameters:
code- the kebab-case code string.- Returns:
- the matching enum constant, or
nullif not found.
-
fromMessage
Determines the error code from a Jing validation error message by matching known message prefixes.Use case: Jing reports errors as free-text messages. This method maps messages like
"reference to undefined pattern \"foo\""toUndefinedPatternso that diagnostics get structured codes and matching code actions.- Parameters:
message- the Jing error message.- Returns:
- the matching error code, or
nullif the message is not recognized.
-
extractName
Extracts the quoted name from a diagnostic message (e.g. the pattern name from"reference to undefined pattern \"foo\"").Use case: code actions like "Did you mean" and "Create define" need the offending name to generate fix suggestions.
- Parameters:
diagnostic- the LSP diagnostic whose message to parse.- Returns:
- the extracted name, or
nullif the message format is not recognized.
-
extractName
Extracts the quoted name from a raw error message string.- Parameters:
message- the error message text.- Returns:
- the extracted name, or
nullif no known prefix matches.
-