Interface ICSSParseErrorHandler
-
- All Known Implementing Classes:
CollectingCSSParseErrorHandler,DoNothingCSSParseErrorHandler,LoggingCSSParseErrorHandler,ThrowingCSSParseErrorHandler
public interface ICSSParseErrorHandlerSpecial CSS handler that is invoked during reading in case of a recoverable errors. In case of unrecoverable errors, aParseExceptionis thrown!- Author:
- Philip Helger
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default ICSSParseErrorHandlerand(ICSSParseErrorHandler aOther)Create a newICSSParseErrorHandlerthat invokes boththisand the other error handler in a serial way.voidonCSSBrowserCompliantSkip(ParseException ex, Token aFromToken, Token aToToken)This method is only called in browser compliant mode if a certain part of the CSS is skipped.voidonCSSDeprecatedProperty(Token aPrefixToken, Token aIdentifierToken)To be called, if a deprecated old IE 6/7 property is found.voidonCSSParseError(ParseException aParseEx, Token aLastSkippedToken)Called upon a recoverable error.voidonCSSUnexpectedRule(Token aCurrentToken, String sRule, String sMsg)Called upon an unexpected rule.default voidonIllegalCharacter(char cIllegalChar)This method is invoked, when an illegal character is encountered (in TokenManager), and the respective rule is part of the JavaCC grammar.
-
-
-
Method Detail
-
onCSSParseError
void onCSSParseError(@Nonnull ParseException aParseEx, @Nullable Token aLastSkippedToken) throws ParseException
Called upon a recoverable error. The parameter list is similar to the one of theParseException.- Parameters:
aParseEx- The original parse exception. May not benull.aLastSkippedToken- The token until which was skipped (incl.) May benull.- Throws:
ParseException- In case the error is fatal and should be propagated.
-
onCSSUnexpectedRule
void onCSSUnexpectedRule(@Nonnull Token aCurrentToken, @Nonnull @Nonempty String sRule, @Nonnull @Nonempty String sMsg) throws ParseException
Called upon an unexpected rule. This happens e.g. when@importis used in the middle of the file.- Parameters:
aCurrentToken- The token that could not be interpreted. Nevernull.sRule- The name of the rule. Always starts with a '@'. Neithernullnor empty.sMsg- The custom error message. Neithernullnor empty.- Throws:
ParseException- In case the error is fatal and should be propagated.
-
onCSSDeprecatedProperty
void onCSSDeprecatedProperty(@Nonnull Token aPrefixToken, @Nonnull Token aIdentifierToken) throws ParseException
To be called, if a deprecated old IE 6/7 property is found.- Parameters:
aPrefixToken- The prefix token found (like '$' or '*'). Nevernull.aIdentifierToken- The identifier token found. Nevernull.- Throws:
ParseException- In case the error is fatal and should be propagated.- Since:
- 6.5.0
-
onCSSBrowserCompliantSkip
void onCSSBrowserCompliantSkip(@Nullable ParseException ex, @Nonnull Token aFromToken, @Nonnull Token aToToken) throws ParseException
This method is only called in browser compliant mode if a certain part of the CSS is skipped.- Parameters:
ex- The originalParseExceptionthat causes the parser to skip. May benull.aFromToken- Original token that caused the error and was skipped (inclusive). Nevernull.aToToken- The end token until which was skipped (exclusive). Nevernull.- Throws:
ParseException- In case the error is fatal and should be propagated.- See Also:
CSSReaderSettings.setBrowserCompliantMode(boolean)
-
onIllegalCharacter
default 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.- Parameters:
cIllegalChar- The illegal char- Since:
- 5.0.3
-
and
@Nonnull default ICSSParseErrorHandler and(@Nonnull ICSSParseErrorHandler aOther)
Create a newICSSParseErrorHandlerthat invokes boththisand the other error handler in a serial way.- Parameters:
aOther- The other handler to also be invoked.- Returns:
- A new instance. Never
null.
-
-