Search in sources :

Example 1 with TokenMgrError

use of com.gargoylesoftware.css.parser.javacc.TokenMgrError in project LoboEvolution by LoboEvolution.

the class AbstractCSSParser method parseSelectors.

/**
 * Parse a comma separated list of selectors.
 *
 * @param source source to be parsed
 * @return a selector list
 * @exception CSSException Any CSS exception, possibly
 *            wrapping another exception.
 * @exception java.io.IOException An IO exception from the parser,
 *            possibly from a byte stream or character stream
 *            supplied by the application.
 */
public SelectorList parseSelectors(final InputSource source) throws IOException {
    source_ = source;
    ReInit(getCharStream(source));
    SelectorList sl = null;
    try {
        sl = parseSelectorsInternal();
    } catch (final ParseException e) {
        getErrorHandler().error(toCSSParseException("invalidSelectorList", e));
    } catch (final TokenMgrError e) {
        getErrorHandler().error(toCSSParseException(e));
    } catch (final CSSParseException e) {
        getErrorHandler().error(e);
    }
    return sl;
}
Also used : SelectorList(com.gargoylesoftware.css.parser.selector.SelectorList) TokenMgrError(com.gargoylesoftware.css.parser.javacc.TokenMgrError) ParseException(com.gargoylesoftware.css.parser.javacc.ParseException)

Example 2 with TokenMgrError

use of com.gargoylesoftware.css.parser.javacc.TokenMgrError in project LoboEvolution by LoboEvolution.

the class AbstractCSSParser method parseMedia.

/**
 * Parse the given input source and return the media list.
 * @param source the input source
 * @return new media list
 * @throws IOException in case of errors
 */
public MediaQueryList parseMedia(final InputSource source) throws IOException {
    source_ = source;
    ReInit(getCharStream(source));
    final MediaQueryList ml = new MediaQueryList();
    try {
        mediaList(ml);
    } catch (final ParseException e) {
        getErrorHandler().error(toCSSParseException("invalidMediaList", e));
    } catch (final TokenMgrError e) {
        getErrorHandler().error(toCSSParseException(e));
    } catch (final CSSParseException e) {
        getErrorHandler().error(e);
    }
    return ml;
}
Also used : MediaQueryList(com.gargoylesoftware.css.parser.media.MediaQueryList) TokenMgrError(com.gargoylesoftware.css.parser.javacc.TokenMgrError) ParseException(com.gargoylesoftware.css.parser.javacc.ParseException)

Aggregations

ParseException (com.gargoylesoftware.css.parser.javacc.ParseException)2 TokenMgrError (com.gargoylesoftware.css.parser.javacc.TokenMgrError)2 MediaQueryList (com.gargoylesoftware.css.parser.media.MediaQueryList)1 SelectorList (com.gargoylesoftware.css.parser.selector.SelectorList)1