}
}
}
public MediaQuery handleMediaQuery(HiddenTokenAwareTree token) {
MediaQuery result = new MediaQuery(token);
List<HiddenTokenAwareTree> originalChildren = token.getChildren();
// each AND identifier may hold preceding comments must be pushed to other
// tokens
LinkedList<HiddenTokenAwareTree> children = new LinkedList<HiddenTokenAwareTree>();
for (HiddenTokenAwareTree kid : originalChildren) {
if (kid.getType() == LessLexer.IDENT) {
HiddenTokenAwareTree lastKid = children.peekLast();
if (lastKid != null) {
lastKid.addFollowing(kid.getPreceding());
}
} else {
children.add(kid);
}
}
// we have three types of children:
// * MEDIUM_TYPE
// * identifier AND whose only function is to hold comments
// * FIXED_MEDIA_EXPRESSION
for (HiddenTokenAwareTree kid : children) {
if (kid.getType() != LessLexer.IDENT) {
result.addMember(switchOn(kid));
} else {
// we have to copy comments from the AND identifier to surrounding
// elements.
}
}