From 7a172be6213839a3d023ba21c3bafd7540a4bfe8 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 31 Mar 2025 02:11:03 -0400 Subject: Remove threads and mutexed data from the language in favor of a module-based approach --- src/parse.c | 40 ++-------------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) (limited to 'src/parse.c') diff --git a/src/parse.c b/src/parse.c index 4ace5a67..14221cc0 100644 --- a/src/parse.c +++ b/src/parse.c @@ -63,8 +63,8 @@ int op_tightness[] = { static const char *keywords[] = { "yes", "xor", "while", "when", "use", "unless", "struct", "stop", "skip", "return", - "or", "not", "none", "no", "mutexed", "mod1", "mod", "pass", "lang", "inline", "in", "if", - "holding", "func", "for", "extern", "enum", "else", "do", "deserialize", "defer", "and", + "or", "not", "none", "no", "mod1", "mod", "pass", "lang", "inline", "in", "if", + "func", "for", "extern", "enum", "else", "do", "deserialize", "defer", "and", "_min_", "_max_", NULL, }; @@ -94,7 +94,6 @@ static type_ast_t *parse_array_type(parse_ctx_t *ctx, const char *pos); static type_ast_t *parse_func_type(parse_ctx_t *ctx, const char *pos); static type_ast_t *parse_non_optional_type(parse_ctx_t *ctx, const char *pos); static type_ast_t *parse_pointer_type(parse_ctx_t *ctx, const char *pos); -static type_ast_t *parse_mutexed_type(parse_ctx_t *ctx, const char *pos); static type_ast_t *parse_set_type(parse_ctx_t *ctx, const char *pos); static type_ast_t *parse_table_type(parse_ctx_t *ctx, const char *pos); static type_ast_t *parse_type(parse_ctx_t *ctx, const char *pos); @@ -116,13 +115,11 @@ static PARSER(parse_file_body); static PARSER(parse_for); static PARSER(parse_func_def); static PARSER(parse_heap_alloc); -static PARSER(parse_holding); static PARSER(parse_if); static PARSER(parse_inline_c); static PARSER(parse_int); static PARSER(parse_lambda); static PARSER(parse_lang_def); -static PARSER(parse_mutexed); static PARSER(parse_namespace); static PARSER(parse_negative); static PARSER(parse_not); @@ -573,19 +570,6 @@ type_ast_t *parse_pointer_type(parse_ctx_t *ctx, const char *pos) { return ptr_type; } -type_ast_t *parse_mutexed_type(parse_ctx_t *ctx, const char *pos) { - const char *start = pos; - if (!match_word(&pos, "mutexed")) return NULL; - spaces(&pos); - if (!match(&pos, "(")) return NULL; - spaces(&pos); - type_ast_t *mutexed = expect(ctx, start, &pos, parse_type, - "I couldn't parse a mutexed type after this point"); - spaces(&pos); - if (!match(&pos, ")")) return NULL; - return NewTypeAST(ctx->file, start, pos, MutexedTypeAST, .type=mutexed); -} - type_ast_t *parse_type_name(parse_ctx_t *ctx, const char *pos) { const char *start = pos; const char *id = get_id(&pos); @@ -612,7 +596,6 @@ type_ast_t *parse_non_optional_type(parse_ctx_t *ctx, const char *pos) { || (type=parse_set_type(ctx, pos)) || (type=parse_type_name(ctx, pos)) || (type=parse_func_type(ctx, pos)) - || (type=parse_mutexed_type(ctx, pos)) ); if (!success && match(&pos, "(")) { whitespace(&pos); @@ -1190,23 +1173,6 @@ PARSER(parse_stack_reference) { return ast; } -PARSER(parse_mutexed) { - const char *start = pos; - if (!match_word(&pos, "mutexed")) return NULL; - spaces(&pos); - ast_t *val = expect(ctx, start, &pos, parse_term, "I expected an expression for this 'mutexed'"); - return NewAST(ctx->file, start, pos, Mutexed, .value=val); -} - -PARSER(parse_holding) { - const char *start = pos; - if (!match_word(&pos, "holding")) return NULL; - spaces(&pos); - ast_t *mutexed = expect(ctx, start, &pos, parse_expr, "I expected an expression for this 'holding'"); - ast_t *body = expect(ctx, start, &pos, parse_block, "I expected a block to be here"); - return NewAST(ctx->file, start, pos, Holding, .mutexed=mutexed, .body=body); -} - PARSER(parse_not) { const char *start = pos; if (!match_word(&pos, "not")) return NULL; @@ -1526,7 +1492,6 @@ PARSER(parse_term_no_suffix) { || (term=parse_stop(ctx, pos)) || (term=parse_return(ctx, pos)) || (term=parse_not(ctx, pos)) - || (term=parse_mutexed(ctx, pos)) || (term=parse_extern(ctx, pos)) || (term=parse_inline_c(ctx, pos)) ); @@ -1858,7 +1823,6 @@ PARSER(parse_extended_expr) { || (expr=optional(ctx, &pos, parse_when)) || (expr=optional(ctx, &pos, parse_repeat)) || (expr=optional(ctx, &pos, parse_do)) - || (expr=optional(ctx, &pos, parse_holding)) ) return expr; -- cgit v1.2.3