}
}
}
private void parseKeyword(Context ctx, Keyword kw) throws IOException {
final IfDefinition idef;
final Expression expr;
switch (kw.getValue()) {
case INCLUDE:
parseInclude(ctx, kw);
return;
case CHARSET:
case IMPORT:
new RawValue(ctx.block.owner, "@import "+_in.getUntil(";")+'\n', kw.getLine());
return;
case MEDIA:
String scope = _in.getUntil("{");
if (!scope.endsWith("{"))
throw error("'{' expected", kw);
scope = scope.substring(0, scope.length() - 1);
newBlock(ctx,
new MediaDefinition(ctx.block.owner, scope, kw.getLine()));
return;
case FONTFACE:
new RawValue(ctx.block.owner, "@font-face "+_in.getUntil("}")+'\n', kw.getLine());
return;
case IF:
nextAndCheck(ctx, '(', false);
expr = new Expression(_in.getLine());
parseExpression(ctx, expr, '{');
newBlock(ctx,
new BlockDefinition(
new IfDefinition(ctx.block.owner, kw.getLine()), expr, expr.getLine()));
return;
case ELSE:
idef = getLastIf(ctx, kw);
nextAndCheck(ctx, '{', false);
newBlock(ctx, new BlockDefinition(idef, null, kw.getLine()));