HiddenTokenAwareTree charset = children.get(1);
return new CharsetDeclaration(token, termBuilder.createCssString(charset, charset.getText()));
}
public RuleSet handleRuleSet(HiddenTokenAwareTree token) {
RuleSet ruleSet = new RuleSet(token);
List<Selector> selectors = new ArrayList<Selector>();
List<Guard> guards = new ArrayList<Guard>();
List<HiddenTokenAwareTree> children = token.getChildren();
ASTCssNode previousKid = null;
for (HiddenTokenAwareTree kid : children) {
if (kid.getType() == LessLexer.SELECTOR) {
Selector selector = handleSelector(kid);
if (selector != null)
selectors.add(selector);
previousKid = selector;
} else if (kid.getType() == LessLexer.BODY) {
GeneralBody body = handleGeneralBody(kid);
ruleSet.setBody(body);
previousKid = body;
} else if (kid.getType() == LessLexer.GUARD) {
guards.add(handleGuard(kid));
} else if (kid.getType() == LessLexer.COMMA) {
if (previousKid != null)
previousKid.getUnderlyingStructure().addFollowing(kid.getPreceding());
}
}
ruleSet.addSelectors(selectors);
ruleSet.addGuards(guards);
return ruleSet;
}