Package io.github.qishr.cascara.common.diagnostic
Interface Reporter
java.lang.Object
io.github.qishr.cascara.common.diagnostic.Reporter
All Known Implementing Classes:
NoOpReporter, AbstractReporter
public interface Reporter
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
| public abstract Reporter | setLevel(Level level) | Sets the level of output when logging directly to the console. |
| public abstract Reporter | setDiagnosticCollector(Consumer<Diagnostic> collector) | Registers a collector to receive all diagnostics processed by this reporter. |
| public abstract Reporter | setProblemCollector(Consumer<Diagnostic> collector) | Registers a specialized collector to receive only problem-level diagnostics. |
| public abstract boolean | collectsProblems() | Checks whether any active listener or collector is tracking problems. |
| public abstract Level | getLevel() | |
| public abstract boolean | isSilent() | |
| public abstract void | trace(String format, Object[] details) | Reports a trace message through the reporter. |
| public abstract void | debug(String format, Object[] details) | Reports a debug message through the reporter. |
| public abstract void | info(DiagnosticCode code, Object[] details) | Reports an informational message through the reporter. |
| public abstract void | warn(DiagnosticCode code, Object[] details) | Reports a warning message including location information. |
| public abstract void | error(DiagnosticCode code, Object[] details) | Reports an error message including location information. |
| public abstract void | error(Throwable cause, DiagnosticCode code, Object[] details) | Reports an error message including location information. |
| public abstract void | infoAt(int line, int column, DiagnosticCode code, Object[] details) | Reports an informational message anchored to a resource location by line and column. |
| public abstract void | warnAt(int line, int column, DiagnosticCode code, Object[] details) | Reports a warning anchored to a resource location by line and column. |
| public abstract void | errorAt(int line, int column, DiagnosticCode code, Object[] details) | Reports an error anchored to a resource location by line and column. |
| public abstract void | errorAt(URI uri, int line, int column, DiagnosticCode code, Object[] details) | |
| public abstract void | errorAt(int line, int column, Throwable cause, DiagnosticCode code, Object[] details) | Reports an error anchored to a resource location by line and column. |
| public abstract void | infoAt(int line, int column, int start, int end, DiagnosticCode code, Object[] details) | Reports an informational message anchored to a precise character span within a resource. |
| public abstract void | warnAt(int line, int column, int start, int end, DiagnosticCode code, Object[] details) | Reports a warning anchored to a precise character span within a resource. |
| public abstract void | errorAt(int line, int column, int start, int end, DiagnosticCode code, Object[] details) | Reports an error anchored to a precise character span within a resource. |
| public abstract void | errorAt(int line, int column, int start, int end, Throwable cause, DiagnosticCode code, Object[] details) | Reports an error anchored to a precise character span within a resource. |
| public abstract void | infoAt(Token token, DiagnosticCode code, Object[] details) | Reports an informational message derived from the location attributes of a structural token. |
| public abstract void | warnAt(Token token, DiagnosticCode code, Object[] details) | Reports a warning derived from the location attributes of a structural token. |
| public abstract void | errorAt(Token token, DiagnosticCode code, Object[] details) | Reports an error derived from the location attributes of a structural token. |
| public abstract void | errorAt(Token token, Throwable cause, DiagnosticCode code, Object[] details) | Reports an error derived from the location attributes of a structural token. |
| public abstract void | error(LocalizableException exception) | Reports a LocalizableException |
| public abstract void | error(LocalizableRuntimeException exception) | Reports a LocalizableRuntimeException |
Method Details
setLevel
public abstract Reporter setLevel(Level level)
Sets the level of output when logging directly to the console.
setDiagnosticCollector
public abstract Reporter setDiagnosticCollector(Consumer<Diagnostic> collector)
Registers a collector to receive all diagnostics processed by this reporter.This includes debugging info, trace states, warnings, and error diagnostics.
Parameters:
collector - The consumer that processes each produced Diagnostic.
setProblemCollector
public abstract Reporter setProblemCollector(Consumer<Diagnostic> collector)
Registers a specialized collector to receive only problem-level diagnostics.This collector is filtered to intercept only Level.WARN and Level.ERROR items.
Parameters:
collector - The consumer that processes problem Diagnostic objects.
collectsProblems
public abstract boolean collectsProblems()
Checks whether any active listener or collector is tracking problems.This can be used as an optimization flag by sub-parsers or AST-walkers to skip expensive location token captures or contextual allocations if nobody is actively listening for error diagnostics.
Returns:
true if warnings or errors are being collected, otherwise false.
getLevel
public abstract Level getLevel()
isSilent
public abstract boolean isSilent()
trace
public abstract void trace(String format, Object[] details)
Reports a trace message through the reporter.
Parameters:
format - The format of the message to report.
details - Arguments referenced by the format specifiers in the format string.
debug
public abstract void debug(String format, Object[] details)
Reports a debug message through the reporter.
Parameters:
format - The format of the message to report.
details - Arguments referenced by the format specifiers in the format string.
info
public abstract void info(DiagnosticCode code, Object[] details)
Reports an informational message through the reporter.
Parameters:
code - The code of this warning.
details - Arguments referenced by the format specifiers in the DiagnosticCode's localized format string.
warn
public abstract void warn(DiagnosticCode code, Object[] details)
Reports a warning message including location information.
Parameters:
code - The code of this warning.
details - Arguments referenced by the format specifiers in the DiagnosticCode's localized format string.
error
public abstract void error(DiagnosticCode code, Object[] details)
Reports an error message including location information.
Parameters:
code - The code of this error.
details - Arguments referenced by the format specifiers in the DiagnosticCode's localized format string.
error
public abstract void error(Throwable cause, DiagnosticCode code, Object[] details)
Reports an error message including location information.
Parameters:
cause - The cause of this report.
code - The code of this error.
details - Arguments referenced by the format specifiers in the DiagnosticCode's localized format string.
infoAt
public abstract void infoAt(int line, int column, DiagnosticCode code, Object[] details)
Reports an informational message anchored to a resource location by line and column.Useful when text stream indices are unavailable.
Parameters:
line - The 1-based line number of the diagnostic.
column - The 1-based column number of the diagnostic.
code - The semantic classification code for this warning.
details - Arguments referenced by the format specifiers in the DiagnosticCode's localized format string.
warnAt
public abstract void warnAt(int line, int column, DiagnosticCode code, Object[] details)
Reports a warning anchored to a resource location by line and column.Useful when text stream indices are unavailable.
Parameters:
line - The 1-based line number of the diagnostic.
column - The 1-based column number of the diagnostic.
code - The semantic classification code for this warning.
details - Arguments referenced by the format specifiers in the DiagnosticCode's localized format string.
errorAt
public abstract void errorAt(int line, int column, DiagnosticCode code, Object[] details)
Reports an error anchored to a resource location by line and column.Useful when text stream indices are unavailable.
Parameters:
line - The 1-based line number of the diagnostic.
column - The 1-based column number of the diagnostic.
code - The semantic classification code for this error.
details - Arguments referenced by the format specifiers in the DiagnosticCode's localized format string.
errorAt
@io.github.qishr.cascara.common.lang.annotation.Experimental
public abstract void errorAt(URI uri, int line, int column, DiagnosticCode code, Object[] details)
errorAt
public abstract void errorAt(int line, int column, Throwable cause, DiagnosticCode code, Object[] details)
Reports an error anchored to a resource location by line and column.Useful when text stream indices are unavailable.
Parameters:
line - The 1-based line number of the diagnostic.
column - The 1-based column number of the diagnostic.
cause - The cause of this report.
code - The semantic classification code for this error.
details - Arguments referenced by the format specifiers in the DiagnosticCode's localized format string.
infoAt
public abstract void infoAt(int line, int column, int start, int end, DiagnosticCode code, Object[] details)
Reports an informational message anchored to a precise character span within a resource.
Parameters:
line - The 1-based line number of the diagnostic.
column - The 1-based column number of the diagnostic.
start - The 0-based absolute character index indicating the start of the span.
end - The 0-based absolute character index indicating the end of the span (exclusive).
code - The semantic classification code for this error.
details - Arguments referenced by the format specifiers in the DiagnosticCode's localized format string.
warnAt
public abstract void warnAt(int line, int column, int start, int end, DiagnosticCode code, Object[] details)
Reports a warning anchored to a precise character span within a resource.
Parameters:
line - The 1-based line number of the diagnostic.
column - The 1-based column number of the diagnostic.
start - The 0-based absolute character index indicating the start of the span.
end - The 0-based absolute character index indicating the end of the span (exclusive).
code - The semantic classification code for this warning.
details - Arguments referenced by the format specifiers in the DiagnosticCode's localized format string.
errorAt
public abstract void errorAt(int line, int column, int start, int end, DiagnosticCode code, Object[] details)
Reports an error anchored to a precise character span within a resource.
Parameters:
line - The 1-based line number of the diagnostic.
column - The 1-based column number of the diagnostic.
start - The 0-based absolute character index indicating the start of the span.
end - The 0-based absolute character index indicating the end of the span (exclusive).
code - The semantic classification code for this error.
details - Arguments referenced by the format specifiers in the DiagnosticCode's localized format string.
errorAt
public abstract void errorAt(int line, int column, int start, int end, Throwable cause, DiagnosticCode code, Object[] details)
Reports an error anchored to a precise character span within a resource.
Parameters:
line - The 1-based line number of the diagnostic.
column - The 1-based column number of the diagnostic.
start - The 0-based absolute character index indicating the start of the span.
end - The 0-based absolute character index indicating the end of the span (exclusive).
cause - The cause of this report.
code - The semantic classification code for this error.
details - Arguments referenced by the format specifiers in the DiagnosticCode's localized format string.
infoAt
public abstract void infoAt(Token token, DiagnosticCode code, Object[] details)
Reports an informational message derived from the location attributes of a structural token.
Parameters:
token - The syntactic Token supplying the positional bounds.
code - The semantic classification code for this error.
details - Arguments referenced by the format specifiers in the DiagnosticCode's localized format string.
warnAt
public abstract void warnAt(Token token, DiagnosticCode code, Object[] details)
Reports a warning derived from the location attributes of a structural token.
Parameters:
token - The syntactic Token supplying the positional bounds.
code - The semantic classification code for this warning.
details - Arguments referenced by the format specifiers in the DiagnosticCode's localized format string.
errorAt
public abstract void errorAt(Token token, DiagnosticCode code, Object[] details)
Reports an error derived from the location attributes of a structural token.
Parameters:
token - The syntactic Token supplying the positional bounds.
code - The semantic classification code for this error.
details - Arguments referenced by the format specifiers in the DiagnosticCode's localized format string.
errorAt
public abstract void errorAt(Token token, Throwable cause, DiagnosticCode code, Object[] details)
Reports an error derived from the location attributes of a structural token.
Parameters:
token - The syntactic Token supplying the positional bounds.
cause - The cause of this report.
code - The semantic classification code for this error.
details - Arguments referenced by the format specifiers in the DiagnosticCode's localized format string.
error
public abstract void error(LocalizableException exception)
Reports a LocalizableException
Parameters:
exception - The exception to report.
error
public abstract void error(LocalizableRuntimeException exception)
Reports a LocalizableRuntimeException
Parameters:
exception - The exception to report.