}
return result;
}
public Import handleImport(HiddenTokenAwareTree token) {
Import result = new Import(token);
switch (token.getType()) {
case LessLexer.IMPORT_SYM:
result.setMultiplicity(Import.ImportMultiplicity.IMPORT);
break;
case LessLexer.IMPORT_ONCE_SYM:
result.setMultiplicity(Import.ImportMultiplicity.IMPORT_ONCE);
problemsHandler.deprecatedImportOnce(result);
break;
case LessLexer.IMPORT_MULTIPLE_SYM:
result.setMultiplicity(Import.ImportMultiplicity.IMPORT_MULTIPLE);
problemsHandler.deprecatedImportMultiple(result);
break;
default:
throw new BugHappened(GRAMMAR_MISMATCH, token);
}
Iterator<HiddenTokenAwareTree> children = token.getChildren().iterator();
HiddenTokenAwareTree nextChild = children.next();
if (nextChild.getType() == LessLexer.IMPORT_OPTIONS) {
configureImportOptions(result, nextChild.getChildren());
nextChild = children.next();
}
result.setUrlExpression(handleTerm(nextChild));
while (children.hasNext()) {
HiddenTokenAwareTree kid = children.next();
if (kid.getType() == LessLexer.COMMA) {
kid.pushHiddenToSiblings();
} else if (kid.getType() == LessLexer.MEDIA_QUERY) {
result.add(handleMediaQuery(kid));
} else {
throw new BugHappened(GRAMMAR_MISMATCH, token);
}
}