Package io.github.qishr.cascara.common.diagnostic.report
Interface Reporter
java.lang.Object
io.github.qishr.cascara.common.diagnostic.report.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 io.github.qishr.cascara.common.diagnostic.report.@io.github.qishr.cascara.common.annotation.Experimental Reporter | setLineConsumer(Consumer<String> logger) | |
| public abstract io.github.qishr.cascara.common.diagnostic.report.@io.github.qishr.cascara.common.annotation.Experimental Reporter | setDiagnosticConsumer(Consumer<Diagnostic> consumer) | Registers a consumer to receive all diagnostics processed by this reporter. |
| public abstract io.github.qishr.cascara.common.diagnostic.report.@io.github.qishr.cascara.common.annotation.Experimental Reporter | setProblemConsumer(Consumer<Diagnostic> consumer) | Registers a consumer to receive only problem-level diagnostics. |
| public abstract boolean | collectsProblems() | Checks whether any active consumer is collecting problems. |
| public abstract boolean | isSilent() | |
| public abstract boolean | reportsDebug() | |
| public abstract boolean | reportsTrace() | |
| public abstract Level | getLevel() | |
| public abstract ReportWriter | getWriter(Level level) | |
| public abstract void | error(Exception exception) | Reports an Exception |
| 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(DiagnosticMessage message, Object[] details) | Reports an informational message through the reporter. |
| public abstract void | warn(DiagnosticMessage message, Object[] details) | Reports a warning message including location information. |
| public abstract void | error(DiagnosticMessage message, Object[] details) | Reports an error message including location information. |
| public abstract void | error(Throwable cause, DiagnosticMessage message, Object[] details) | Reports an error message including location information. |
| public abstract void | infoAt(int line, int column, DiagnosticMessage message, Object[] details) | Reports an informational message anchored to a resource location by line and column. |
| public abstract void | warnAt(int line, int column, DiagnosticMessage message, Object[] details) | Reports a warning anchored to a resource location by line and column. |
| public abstract void | errorAt(int line, int column, DiagnosticMessage message, Object[] details) | Reports an error anchored to a resource location by line and column. |
| public abstract void | errorAt(int line, int column, Throwable cause, DiagnosticMessage message, 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, DiagnosticMessage message, 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, DiagnosticMessage message, 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, DiagnosticMessage message, 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, DiagnosticMessage message, Object[] details) | Reports an error anchored to a precise character span within a resource. |
| public abstract void | infoAt(Token token, DiagnosticMessage message, Object[] details) | Reports an informational message derived from the location attributes of a structural token. |
| public abstract void | warnAt(Token token, DiagnosticMessage message, Object[] details) | Reports a warning derived from the location attributes of a structural token. |
| public abstract void | errorAt(Token token, DiagnosticMessage message, Object[] details) | Reports an error derived from the location attributes of a structural token. |
| public abstract void | errorAt(Token token, Throwable cause, DiagnosticMessage message, Object[] details) | Reports an error derived from the location attributes of a structural token. |
| public abstract void | warnAt(URI uri, int line, int column, DiagnosticMessage message, Object[] details) | |
| public abstract void | errorAt(URI uri, int line, int column, DiagnosticMessage message, Object[] details) | |
| public abstract void | warnAt(URI uri, Token token, DiagnosticMessage message, Object[] details) | |
| public abstract void | errorAt(URI uri, Token token, DiagnosticMessage message, Object[] details) | |
| public abstract void | errorAt(URI uri, Token token, Throwable t, DiagnosticMessage message, Object[] details) |
Method Details
setLevel
public abstract Reporter setLevel(Level level)
Sets the level of output when logging directly to the console.
setLineConsumer
@io.github.qishr.cascara.common.annotation.Experimental
public abstract io.github.qishr.cascara.common.diagnostic.report.@io.github.qishr.cascara.common.annotation.Experimental Reporter setLineConsumer(Consumer<String> logger)
setDiagnosticConsumer
@io.github.qishr.cascara.common.annotation.Experimental
public abstract io.github.qishr.cascara.common.diagnostic.report.@io.github.qishr.cascara.common.annotation.Experimental Reporter setDiagnosticConsumer(Consumer<Diagnostic> consumer)
Registers a consumer to receive all diagnostics processed by this reporter.This includes debugging info, trace states, warnings, and error diagnostics.
setProblemConsumer
@io.github.qishr.cascara.common.annotation.Experimental
public abstract io.github.qishr.cascara.common.diagnostic.report.@io.github.qishr.cascara.common.annotation.Experimental Reporter setProblemConsumer(Consumer<Diagnostic> consumer)
Registers a consumer to receive only problem-level diagnostics.This collector is filtered to intercept only Level.WARN and Level.ERROR items.
Parameters:
consumer - The consumer that processes problem Diagnostic objects.
collectsProblems
public abstract boolean collectsProblems()
Checks whether any active consumer is collecting 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.
isSilent
public abstract boolean isSilent()
reportsDebug
public abstract boolean reportsDebug()
reportsTrace
public abstract boolean reportsTrace()
getLevel
public abstract Level getLevel()
getWriter
public abstract ReportWriter getWriter(Level level)
error
public abstract void error(Exception exception)
Reports an Exception
Parameters:
exception - The exception to report.
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(DiagnosticMessage message, Object[] details)
Reports an informational message through the reporter.
Parameters:
message - The code of this warning.
details - Arguments referenced by the format specifiers in the DiagnosticMessage's localized format string.
warn
public abstract void warn(DiagnosticMessage message, Object[] details)
Reports a warning message including location information.
Parameters:
message - The code of this warning.
details - Arguments referenced by the format specifiers in the DiagnosticMessage's localized format string.
error
public abstract void error(DiagnosticMessage message, Object[] details)
Reports an error message including location information.
Parameters:
message - The code of this error.
details - Arguments referenced by the format specifiers in the DiagnosticMessage's localized format string.
error
public abstract void error(Throwable cause, DiagnosticMessage message, Object[] details)
Reports an error message including location information.
Parameters:
cause - The cause of this report.
message - The code of this error.
details - Arguments referenced by the format specifiers in the DiagnosticMessage's localized format string.
infoAt
public abstract void infoAt(int line, int column, DiagnosticMessage message, 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.
message - The semantic classification code for this warning.
details - Arguments referenced by the format specifiers in the DiagnosticMessage's localized format string.
warnAt
public abstract void warnAt(int line, int column, DiagnosticMessage message, 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.
message - The semantic classification code for this warning.
details - Arguments referenced by the format specifiers in the DiagnosticMessage's localized format string.
errorAt
public abstract void errorAt(int line, int column, DiagnosticMessage message, 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.
message - The semantic classification code for this error.
details - Arguments referenced by the format specifiers in the DiagnosticMessage's localized format string.
errorAt
public abstract void errorAt(int line, int column, Throwable cause, DiagnosticMessage message, 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.
message - The semantic classification code for this error.
details - Arguments referenced by the format specifiers in the DiagnosticMessage's localized format string.
infoAt
public abstract void infoAt(int line, int column, int start, int end, DiagnosticMessage message, 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).
message - The semantic classification code for this error.
details - Arguments referenced by the format specifiers in the DiagnosticMessage's localized format string.
warnAt
public abstract void warnAt(int line, int column, int start, int end, DiagnosticMessage message, 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).
message - The semantic classification code for this warning.
details - Arguments referenced by the format specifiers in the DiagnosticMessage's localized format string.
errorAt
public abstract void errorAt(int line, int column, int start, int end, DiagnosticMessage message, 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).
message - The semantic classification code for this error.
details - Arguments referenced by the format specifiers in the DiagnosticMessage's localized format string.
errorAt
public abstract void errorAt(int line, int column, int start, int end, Throwable cause, DiagnosticMessage message, 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.
message - The semantic classification code for this error.
details - Arguments referenced by the format specifiers in the DiagnosticMessage's localized format string.
infoAt
public abstract void infoAt(Token token, DiagnosticMessage message, Object[] details)
Reports an informational message derived from the location attributes of a structural token.
Parameters:
token - The syntactic Token supplying the positional bounds.
message - The semantic classification code for this error.
details - Arguments referenced by the format specifiers in the DiagnosticMessage's localized format string.
warnAt
public abstract void warnAt(Token token, DiagnosticMessage message, Object[] details)
Reports a warning derived from the location attributes of a structural token.
Parameters:
token - The syntactic Token supplying the positional bounds.
message - The semantic classification code for this warning.
details - Arguments referenced by the format specifiers in the DiagnosticMessage's localized format string.
errorAt
public abstract void errorAt(Token token, DiagnosticMessage message, Object[] details)
Reports an error derived from the location attributes of a structural token.
Parameters:
token - The syntactic Token supplying the positional bounds.
message - The semantic classification code for this error.
details - Arguments referenced by the format specifiers in the DiagnosticMessage's localized format string.
errorAt
public abstract void errorAt(Token token, Throwable cause, DiagnosticMessage message, 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.
message - The semantic classification code for this error.
details - Arguments referenced by the format specifiers in the DiagnosticMessage's localized format string.
warnAt
@io.github.qishr.cascara.common.annotation.Experimental
public abstract void warnAt(URI uri, int line, int column, DiagnosticMessage message, Object[] details)
errorAt
@io.github.qishr.cascara.common.annotation.Experimental
public abstract void errorAt(URI uri, int line, int column, DiagnosticMessage message, Object[] details)
warnAt
@io.github.qishr.cascara.common.annotation.Experimental
public abstract void warnAt(URI uri, Token token, DiagnosticMessage message, Object[] details)
errorAt
@io.github.qishr.cascara.common.annotation.Experimental
public abstract void errorAt(URI uri, Token token, DiagnosticMessage message, Object[] details)
errorAt
@io.github.qishr.cascara.common.annotation.Experimental
public abstract void errorAt(URI uri, Token token, Throwable t, DiagnosticMessage message, Object[] details)