com.phloc.css.reader.errorhandler.ICSSParseErrorHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of phloc-css-jdk5 Show documentation
Show all versions of phloc-css-jdk5 Show documentation
phloc CSS parser an other components
/**
* Copyright (C) 2006-2014 phloc systems
* http://www.phloc.com
* office[at]phloc[dot]com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.phloc.css.reader.errorhandler;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.phloc.commons.annotations.Nonempty;
import com.phloc.css.parser.ParseException;
import com.phloc.css.parser.Token;
/**
* Special CSS handler that is invoked during reading in case of a recoverable
* errors. In case of unrecoverable errors, a
* {@link com.phloc.css.parser.ParseException} is thrown!
*
* @author Philip Helger
*/
public interface ICSSParseErrorHandler
{
/**
* Called upon a recoverable error. The parameter list is similar to the one
* of the {@link com.phloc.css.parser.ParseException}.
*
* @param aLastValidToken
* The last valid token. May not be null
.
* @param aExpectedTokenSequencesVal
* The expected token. May not be null
.
* @param aTokenImageVal
* The error token image. May not be null
.
* @param aLastSkippedToken
* The token until which was skipped (incl.) May be null
.
* @throws ParseException
* In case the error is fatal and should be propagated.
*/
void onCSSParseError (@Nonnull Token aLastValidToken,
@Nonnull int [][] aExpectedTokenSequencesVal,
@Nonnull String [] aTokenImageVal,
@Nullable Token aLastSkippedToken) throws ParseException;
/**
* Called upon an unexpected rule. This happens e.g. when @import
* is used in the middle of the file.
*
* @param aCurrentToken
* The token that could not be interpreted. Never null
.
* @param sRule
* The name of the rule. Always starts with a '@'. Neither
* null
nor empty.
* @param sMsg
* The custom error message. Neither null
nor empty.
* @throws ParseException
* In case the error is fatal and should be propagated.
*/
void onCSSUnexpectedRule (@Nonnull Token aCurrentToken,
@Nonnull @Nonempty String sRule,
@Nonnull @Nonempty String sMsg) throws ParseException;
}