parsing code for defer and more

* disable goto and label support see #44
 * refactor the way block contexts work
This commit is contained in:
Andrew Kelley
2016-02-05 23:20:34 -07:00
parent 4339d55562
commit 6a2ede5a6e
11 changed files with 347 additions and 329 deletions

View File

@@ -122,6 +122,8 @@ static const char *node_type_str(NodeType node_type) {
return "Directive";
case NodeTypeReturnExpr:
return "ReturnExpr";
case NodeTypeDeferExpr:
return "DeferExpr";
case NodeTypeVariableDeclaration:
return "VariableDeclaration";
case NodeTypeTypeDecl:
@@ -259,6 +261,14 @@ void ast_print(FILE *f, AstNode *node, int indent) {
ast_print(f, node->data.return_expr.expr, indent + 2);
break;
}
case NodeTypeDeferExpr:
{
const char *prefix_str = return_prefix_str(node->data.defer_expr.kind);
fprintf(f, "%s%s\n", prefix_str, node_type_str(node->type));
if (node->data.defer_expr.expr)
ast_print(f, node->data.defer_expr.expr, indent + 2);
break;
}
case NodeTypeVariableDeclaration:
{
Buf *name_buf = &node->data.variable_declaration.symbol;
@@ -620,6 +630,8 @@ static void render_node(AstRender *ar, AstNode *node) {
break;
case NodeTypeReturnExpr:
zig_panic("TODO");
case NodeTypeDeferExpr:
zig_panic("TODO");
case NodeTypeVariableDeclaration:
{
const char *pub_str = visib_mod_string(node->data.variable_declaration.visib_mod);