diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-01-29 17:28:06 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-01-29 17:28:06 -0500 |
commit | acbe89c2fd6d093dee1eac23521da1fbcd222962 (patch) | |
tree | 498267710d8c6990f811685e4bf5f4a542a1f7ad | |
parent | 01f2052b91d2c352e8b3ff455a9dda5a2a44fc0f (diff) |
more namespaces
-rw-r--r-- | .parse.c.swp | bin | 0 -> 94208 bytes | |||
-rw-r--r-- | copy.c | 3 | ||||
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | parse.c | 7 |
4 files changed, 11 insertions, 1 deletions
diff --git a/.parse.c.swp b/.parse.c.swp Binary files differnew file mode 100644 index 0000000..68b132c --- /dev/null +++ b/.parse.c.swp @@ -318,6 +318,9 @@ static void copy_stmt(Copier *c, Statement *out, Statement *in) { case STMT_DECL: copy_decl(c, &out->decl, &in->decl); break; + case STMT_NAMESPACE: + copy_block(c, &out->ns.body, &in->ns.body); + break; } } @@ -18,7 +18,7 @@ /* TODO: -nested packages +namespace constants in structs #if @@ -2025,6 +2025,7 @@ static bool parse_stmt(Parser *p, Statement *s, bool *was_a_statement) { ++t->token; if (t->token->kind == TOKEN_IDENT) { s->ns.name = t->token->ident; + ++t->token; } else { s->ns.name = NULL; } @@ -2398,6 +2399,12 @@ static void fprint_stmt(FILE *out, Statement *s) { fprintf(out, ";\n"); } break; + case STMT_NAMESPACE: + fprintf(out, "namespace "); + if (s->ns.name) + fprint_ident(out, s->ns.name); + fprint_block(out, &s->ns.body); + break; } } |