Class ThrowingCSSParseErrorHandler
- java.lang.Object
-
- com.helger.css.reader.errorhandler.ThrowingCSSParseErrorHandler
-
- All Implemented Interfaces:
ICSSParseErrorHandler
@Immutable public class ThrowingCSSParseErrorHandler extends Object implements ICSSParseErrorHandler
An implementation ofICSSParseErrorHandler
that throws aParseException
. So in case a recoverable error occurs, a newParseException
is thrown. This is the most strict implementation ofICSSParseErrorHandler
.- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description ThrowingCSSParseErrorHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.css.reader.errorhandler.ICSSParseErrorHandler
and
-
-
-
-
Method Detail
-
onCSSParseError
public void onCSSParseError(@Nonnull ParseException aParseEx, @Nullable Token aLastSkippedToken) throws ParseException
Description copied from interface:ICSSParseErrorHandler
Called upon a recoverable error. The parameter list is similar to the one of theParseException
.- Specified by:
onCSSParseError
in interfaceICSSParseErrorHandler
- 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
public void onCSSUnexpectedRule(@Nonnull Token aCurrentToken, @Nonnull @Nonempty String sRule, @Nonnull @Nonempty String sMsg) throws ParseException
Description copied from interface:ICSSParseErrorHandler
Called upon an unexpected rule. This happens e.g. when@import
is used in the middle of the file.- Specified by:
onCSSUnexpectedRule
in interfaceICSSParseErrorHandler
- Parameters:
aCurrentToken
- The token that could not be interpreted. Nevernull
.sRule
- The name of the rule. Always starts with a '@'. Neithernull
nor empty.sMsg
- The custom error message. Neithernull
nor empty.- Throws:
ParseException
- In case the error is fatal and should be propagated.
-
onCSSDeprecatedProperty
public void onCSSDeprecatedProperty(@Nonnull Token aPrefixToken, @Nonnull Token aIdentifierToken) throws ParseException
Description copied from interface:ICSSParseErrorHandler
To be called, if a deprecated old IE 6/7 property is found.- Specified by:
onCSSDeprecatedProperty
in interfaceICSSParseErrorHandler
- 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.
-
onCSSBrowserCompliantSkip
public void onCSSBrowserCompliantSkip(@Nullable ParseException ex, @Nonnull Token aFromToken, @Nonnull Token aToToken) throws ParseException
Description copied from interface:ICSSParseErrorHandler
This method is only called in browser compliant mode if a certain part of the CSS is skipped.- Specified by:
onCSSBrowserCompliantSkip
in interfaceICSSParseErrorHandler
- Parameters:
ex
- The originalParseException
that 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
public void onIllegalCharacter(char cIllegalChar)
Description copied from interface:ICSSParseErrorHandler
This method is invoked, when an illegal character is encountered (in TokenManager), and the respective rule is part of the JavaCC grammar.- Specified by:
onIllegalCharacter
in interfaceICSSParseErrorHandler
- Parameters:
cIllegalChar
- The illegal char
-
-