aboutsummaryrefslogtreecommitdiff
path: root/src/parse.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-31 02:11:03 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-31 02:11:03 -0400
commit7a172be6213839a3d023ba21c3bafd7540a4bfe8 (patch)
tree5646ba0e4c0690fe64711fb77658308541de695b /src/parse.c
parentd3655740cc6a8e6c4788946af412065fb52f51dc (diff)
Remove threads and mutexed data from the language in favor of a
module-based approach
Diffstat (limited to 'src/parse.c')
-rw-r--r--src/parse.c40
1 files changed, 2 insertions, 38 deletions
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;