use of com.gargoylesoftware.css.parser.selector.SelectorListImpl in project LoboEvolution by LoboEvolution.
the class CSS3Parser method selectorList.
public final SelectorList selectorList() throws ParseException {
SelectorListImpl selList = new SelectorListImpl();
Selector sel;
sel = selector();
selList.setLocator(sel.getLocator());
label_42: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case COMMA:
{
;
break;
}
default:
jj_la1[65] = jj_gen;
break label_42;
}
jj_consume_token(COMMA);
label_43: while (true) {
switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {
case S:
{
;
break;
}
default:
jj_la1[66] = jj_gen;
break label_43;
}
jj_consume_token(S);
}
selList.add(sel);
sel = selector();
selList.setLocator(sel.getLocator());
}
selList.add(sel);
return selList;
}
use of com.gargoylesoftware.css.parser.selector.SelectorListImpl in project htmlunit by HtmlUnit.
the class CSSStyleSheet method parseSelectors.
/**
* Parses the selectors at the specified input source. If anything at all goes wrong, this
* method returns an empty selector list.
*
* @param source the source from which to retrieve the selectors to be parsed
* @return the selectors parsed from the specified input source
*/
public SelectorList parseSelectors(final String source) {
SelectorList selectors;
try {
final CSSErrorHandler errorHandler = getWindow().getWebWindow().getWebClient().getCssErrorHandler();
final CSSOMParser parser = new CSSOMParser(new CSS3Parser());
parser.setErrorHandler(errorHandler);
selectors = parser.parseSelectors(source);
// in case of error parseSelectors returns null
if (null == selectors) {
selectors = new SelectorListImpl();
}
} catch (final Throwable t) {
if (LOG.isErrorEnabled()) {
LOG.error("Error parsing CSS selectors from '" + source + "': " + t.getMessage(), t);
}
selectors = new SelectorListImpl();
}
return selectors;
}
Aggregations