@Immutable public class LoggingCSSParseErrorHandler extends Object implements ICSSParseErrorHandler
ICSSParseErrorHandler. So in case a
recoverable error occurs, the details are logged to an SLF4J logger.| Constructor and Description |
|---|
LoggingCSSParseErrorHandler()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
createLoggingStringBrowserCompliantSkip(ParseException ex,
Token aFromToken,
Token aToToken) |
static String |
createLoggingStringDeprecatedProperty(Token aPrefixToken,
Token aIdentifierToken)
Create a common string to be used for deprecated properties.
|
static String |
createLoggingStringIllegalCharacter(char cIllegalChar) |
static String |
createLoggingStringParseError(ParseException ex) |
static String |
createLoggingStringParseError(Token aLastValidToken,
int[][] aExpectedTokenSequencesVal,
String[] aTokenImageVal,
Token aLastSkippedToken) |
static String |
createLoggingStringUnexpectedRule(Token aCurrentToken,
String sRule,
String sMsg)
Create a common string to be used for unexpected rules.
|
void |
onCSSBrowserCompliantSkip(ParseException ex,
Token aFromToken,
Token aToToken)
This method is only called in browser compliant mode if a certain part of
the CSS is skipped.
|
void |
onCSSDeprecatedProperty(Token aPrefixToken,
Token aIdentifierToken)
To be called, if a deprecated old IE 6/7 property is found.
|
void |
onCSSParseError(ParseException aParseEx,
Token aLastSkippedToken)
Called upon a recoverable error.
|
void |
onCSSUnexpectedRule(Token aCurrentToken,
String sRule,
String sMsg)
Called upon an unexpected rule.
|
void |
onIllegalCharacter(char cIllegalChar)
This method is invoked, when an illegal character is encountered (in
TokenManager), and the respective rule is part of the JavaCC grammar.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitandpublic LoggingCSSParseErrorHandler()
@Nonnull @Nonempty public static String createLoggingStringParseError(@Nonnull ParseException ex)
@Nonnull @Nonempty public static String createLoggingStringParseError(@Nonnull Token aLastValidToken, @Nonnull int[][] aExpectedTokenSequencesVal, @Nonnull String[] aTokenImageVal, @Nullable Token aLastSkippedToken)
public void onCSSParseError(@Nonnull ParseException aParseEx, @Nullable Token aLastSkippedToken) throws ParseException
ICSSParseErrorHandlerParseException.onCSSParseError in interface ICSSParseErrorHandleraParseEx - The original parse exception. May not be null.aLastSkippedToken - The token until which was skipped (incl.) May be null.ParseException - In case the error is fatal and should be propagated.@Nonnull @Nonempty public static String createLoggingStringUnexpectedRule(@Nonnull Token aCurrentToken, @Nonnull @Nonempty String sRule, @Nonnull @Nonempty String sMsg)
aCurrentToken - The current token that caused an error. Never null.sRule - The name of the rule. Always starts with a '@'. May neither be
null nor empty.sMsg - The custom error message. Neither null nor empty.null nor empty.public void onCSSUnexpectedRule(@Nonnull Token aCurrentToken, @Nonnull @Nonempty String sRule, @Nonnull @Nonempty String sMsg) throws ParseException
ICSSParseErrorHandler@import
is used in the middle of the file.onCSSUnexpectedRule in interface ICSSParseErrorHandleraCurrentToken - The token that could not be interpreted. Never null.sRule - The name of the rule. Always starts with a '@'. Neither
null nor empty.sMsg - The custom error message. Neither null nor empty.ParseException - In case the error is fatal and should be propagated.@Nonnull @Nonempty public static String createLoggingStringDeprecatedProperty(@Nonnull Token aPrefixToken, @Nonnull Token aIdentifierToken)
aPrefixToken - The prefix token found (like '$' or '*'). Never null.aIdentifierToken - The identifier token found. Never null.null nor empty.ParseException - In case the error is fatal and should be propagated.public void onCSSDeprecatedProperty(@Nonnull Token aPrefixToken, @Nonnull Token aIdentifierToken)
ICSSParseErrorHandleronCSSDeprecatedProperty in interface ICSSParseErrorHandleraPrefixToken - The prefix token found (like '$' or '*'). Never null.aIdentifierToken - The identifier token found. Never null.@Nonnull @Nonempty public static String createLoggingStringBrowserCompliantSkip(@Nullable ParseException ex, @Nonnull Token aFromToken, @Nonnull Token aToToken)
public void onCSSBrowserCompliantSkip(@Nullable ParseException ex, @Nonnull Token aFromToken, @Nonnull Token aToToken) throws ParseException
ICSSParseErrorHandleronCSSBrowserCompliantSkip in interface ICSSParseErrorHandlerex - The original ParseException that causes the parser to skip.
May be null.aFromToken - Original token that caused the error and was skipped (inclusive).
Never null.aToToken - The end token until which was skipped (exclusive). Never
null.ParseException - In case the error is fatal and should be propagated.CSSReaderSettings.setBrowserCompliantMode(boolean)@Nonnull @Nonempty public static String createLoggingStringIllegalCharacter(char cIllegalChar)
public void onIllegalCharacter(char cIllegalChar)
ICSSParseErrorHandleronIllegalCharacter in interface ICSSParseErrorHandlercIllegalChar - The illegal charCopyright © 2014–2022 Philip Helger. All rights reserved.