Index: uspace/app/sbi/src/parse.c
===================================================================
--- uspace/app/sbi/src/parse.c	(revision c5cb943d5d19ad0d75578f54188f2491dfd64937)
+++ uspace/app/sbi/src/parse.c	(revision f2b3d3ea3dc1fbb7a2312b326613bcc88a3bfaf5)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2010 Jiri Svoboda
+ * Copyright (c) 2011 Jiri Svoboda
  * All rights reserved.
  *
@@ -82,4 +82,5 @@
 static stree_vdecl_t *parse_vdecl(parse_t *parse);
 static stree_if_t *parse_if(parse_t *parse);
+static stree_switch_t *parse_switch(parse_t *parse);
 static stree_while_t *parse_while(parse_t *parse);
 static stree_for_t *parse_for(parse_t *parse);
@@ -667,5 +668,4 @@
 	stree_prop_t *prop;
 	stree_symbol_t *symbol;
-	bool_t body_expected;
 
 	stree_ident_t *ident;
@@ -720,6 +720,4 @@
 	/* Parse attributes. */
 	parse_symbol_attrs(parse, symbol);
-
-	body_expected = (outer_csi->cc != csi_interface);
 
 	lmatch(parse, lc_is);
@@ -1070,4 +1068,5 @@
 	stree_vdecl_t *vdecl_s;
 	stree_if_t *if_s;
+	stree_switch_t *switch_s;
 	stree_while_t *while_s;
 	stree_for_t *for_s;
@@ -1092,4 +1091,9 @@
 		stat->u.if_s = if_s;
 		break;
+	case lc_switch:
+		switch_s = parse_switch(parse);
+		stat = stree_stat_new(st_switch);
+		stat->u.switch_s = switch_s;
+		break;
 	case lc_while:
 		while_s = parse_while(parse);
@@ -1214,4 +1218,58 @@
 	lmatch(parse, lc_end);
 	return if_s;
+}
+
+/** Parse @c switch statement.
+ *
+ * @param parse		Parser object.
+ * @return		New syntax tree node.
+ */
+static stree_switch_t *parse_switch(parse_t *parse)
+{
+	stree_switch_t *switch_s;
+	stree_when_t *when_c;
+	stree_expr_t *expr;
+
+#ifdef DEBUG_PARSE_TRACE
+	printf("Parse 'switch' statement.\n");
+#endif
+	lmatch(parse, lc_switch);
+
+	switch_s = stree_switch_new();
+	list_init(&switch_s->when_clauses);
+
+	switch_s->expr = parse_expr(parse);
+	lmatch(parse, lc_is);
+
+	/* Parse @c when clauses. */
+	while (lcur_lc(parse) == lc_when) {
+		lskip(parse);
+		when_c = stree_when_new();
+		list_init(&when_c->exprs);
+		while (b_true) {
+			expr = parse_expr(parse);
+			list_append(&when_c->exprs, expr);
+			if (lcur_lc(parse) != lc_comma)
+				break;
+			lskip(parse);
+		}
+
+		lmatch(parse, lc_do);
+		when_c->block = parse_block(parse);
+
+		list_append(&switch_s->when_clauses, when_c);
+	}
+
+	/* Parse @c else clause. */
+	if (lcur_lc(parse) == lc_else) {
+		lskip(parse);
+		lmatch(parse, lc_do);
+		switch_s->else_block = parse_block(parse);
+	} else {
+		switch_s->else_block = NULL;
+	}
+
+	lmatch(parse, lc_end);
+	return switch_s;
 }
 
@@ -1654,4 +1712,5 @@
 	case lc_except:
 	case lc_finally:
+	case lc_when:
 		return b_true;
 	default:
