diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-02-13 20:27:19 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-02-13 20:27:19 -0500 |
| commit | 853b8e505e007c30fe9ad26ad4f611874f4e7d4f (patch) | |
| tree | fc48bad52f6a8671789b258e65693beee11d9c20 /parse.c | |
| parent | c60b21bf3c5c9341e4ced1d19d3aeed13dcfc778 (diff) | |
Add secret structs
Diffstat (limited to 'parse.c')
| -rw-r--r-- | parse.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -1400,6 +1400,21 @@ PARSER(parse_struct_def) { arg_ast_t *fields = parse_args(ctx, &pos, false); + whitespace(&pos); + bool secret = false; + if (match(&pos, ";")) { // Extra flags + for (bool done = false; !done; done = true) { + whitespace(&pos); + if (match_word(&pos, "secret")) { + secret = true; + done = false; + } + whitespace(&pos); + match(&pos, ","); + match(&pos, ";"); + } + } + expect_closing(ctx, &pos, ")", "I wasn't able to parse the rest of this struct"); const char *ns_pos = pos; @@ -1412,7 +1427,7 @@ PARSER(parse_struct_def) { } if (!namespace) namespace = NewAST(ctx->file, pos, pos, Block, .statements=NULL); - return NewAST(ctx->file, start, pos, StructDef, .name=name, .fields=fields, .namespace=namespace); + return NewAST(ctx->file, start, pos, StructDef, .name=name, .fields=fields, .namespace=namespace, .secret=secret); } ast_t *parse_enum_def(parse_ctx_t *ctx, const char *pos) { |
