public final class FormatDiagnostic extends Object
Immutable. Carries the byte-span on the original input that the
diagnostic refers to, a FormatDiagnostic.Severity, a human-readable message, and
(optionally) the underlying TSyntaxError from the parser when the
diagnostic was triggered by a parse failure.
Severity policy follows plan §12. Briefly: INFO for routine
notes (e.g., region too large to parse), WARNING for recovered
conditions (e.g., AST delegate guard fell through), ERROR for
parse failures and renderer fall-throughs, FATAL for invariant
violations that should never occur in practice.
| Modifier and Type | Class and Description |
|---|---|
static class |
FormatDiagnostic.Severity
Severity level.
|
| Constructor and Description |
|---|
FormatDiagnostic(FormatDiagnostic.Severity severity,
int startOffset,
int endOffset,
String message) |
FormatDiagnostic(FormatDiagnostic.Severity severity,
int startOffset,
int endOffset,
String message,
TSyntaxError parserError) |
| Modifier and Type | Method and Description |
|---|---|
int |
getEndOffset() |
String |
getMessage() |
TSyntaxError |
getParserError()
May be
null if the diagnostic did not originate from a parser failure. |
FormatDiagnostic.Severity |
getSeverity() |
int |
getStartOffset() |
String |
toString() |
public FormatDiagnostic(FormatDiagnostic.Severity severity, int startOffset, int endOffset, String message)
public FormatDiagnostic(FormatDiagnostic.Severity severity, int startOffset, int endOffset, String message, TSyntaxError parserError)
public FormatDiagnostic.Severity getSeverity()
public int getStartOffset()
public int getEndOffset()
public String getMessage()
public TSyntaxError getParserError()
null if the diagnostic did not originate from a parser failure.