From e29aa52460df6a5d3e78f7e466947bcdd7a3bbb0 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 4 Mar 2024 13:51:47 -0500 Subject: Struct and enum methods and static members --- parse.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'parse.c') diff --git a/parse.c b/parse.c index 0b1ebd6d..5d1bcb20 100644 --- a/parse.c +++ b/parse.c @@ -1708,7 +1708,7 @@ PARSER(parse_func_def) { arg_ast_t *args = parse_args(ctx, &pos, false); whitespace(&pos); - bool is_inline = false; + bool is_inline = false, is_private = false; ast_t *cache_ast = NULL; for (bool specials = match(&pos, ";"); specials; specials = match_separator(&pos)) { const char *flag_start = pos; @@ -1721,6 +1721,8 @@ PARSER(parse_func_def) { parser_err(ctx, flag_start, pos, "I expected a value for 'cache_size'"); whitespace(&pos); cache_ast = expect(ctx, start, &pos, parse_expr, "I expected a maximum size for the cache"); + } else if (match_word(&pos, "private")) { + is_private = true; } } expect_closing(ctx, &pos, ")", "I wasn't able to parse the rest of this function definition"); @@ -1734,7 +1736,7 @@ PARSER(parse_func_def) { "This function needs a body block"); return NewAST(ctx->file, start, pos, FunctionDef, .name=name, .args=args, .ret_type=ret_type, .body=body, .cache=cache_ast, - .is_inline=is_inline); + .is_inline=is_inline, .is_private=is_private); } PARSER(parse_extern) { -- cgit v1.2.3