aboutsummaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-05-12 20:13:19 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-05-12 20:13:19 -0400
commit02fe49a7646807964d214605a478c90d82d2c8a3 (patch)
treef732f3db3b6d7e2eebed68dc4c6f1af57a313279 /parse.c
parent934fd8a173ccad9aa1291c658dbac712eef78b4b (diff)
Deprecate interfaces (RIP)
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c37
1 files changed, 0 insertions, 37 deletions
diff --git a/parse.c b/parse.c
index 7e9c246d..cdebf0fb 100644
--- a/parse.c
+++ b/parse.c
@@ -91,7 +91,6 @@ static PARSER(parse_var);
static PARSER(parse_enum_def);
static PARSER(parse_struct_def);
static PARSER(parse_lang_def);
-static PARSER(parse_interface_def);
static PARSER(parse_text);
static PARSER(parse_func_def);
static PARSER(parse_extern);
@@ -1598,7 +1597,6 @@ PARSER(parse_namespace) {
if ((stmt=optional(ctx, &pos, parse_struct_def))
||(stmt=optional(ctx, &pos, parse_enum_def))
||(stmt=optional(ctx, &pos, parse_lang_def))
- ||(stmt=optional(ctx, &pos, parse_interface_def))
||(stmt=optional(ctx, &pos, parse_func_def))
||(stmt=optional(ctx, &pos, parse_use))
||(stmt=optional(ctx, &pos, parse_linker))
@@ -1634,7 +1632,6 @@ PARSER(parse_file_body) {
if ((stmt=optional(ctx, &pos, parse_struct_def))
||(stmt=optional(ctx, &pos, parse_enum_def))
||(stmt=optional(ctx, &pos, parse_lang_def))
- ||(stmt=optional(ctx, &pos, parse_interface_def))
||(stmt=optional(ctx, &pos, parse_func_def))
||(stmt=optional(ctx, &pos, parse_use))
||(stmt=optional(ctx, &pos, parse_linker))
@@ -1812,40 +1809,6 @@ PARSER(parse_lang_def) {
return NewAST(ctx->file, start, pos, LangDef, .name=name, .namespace=namespace);
}
-PARSER(parse_interface_def) {
- // interface Name(T; field:type, ...): namespace...
- const char *start = pos;
- if (!match_word(&pos, "interface")) return NULL;
- int64_t starting_indent = get_indent(ctx, pos);
- spaces(&pos);
- const char *name = get_id(&pos);
- if (!name)
- parser_err(ctx, start, pos, "I expected a name for this interface");
- spaces(&pos);
-
- if (!match(&pos, "("))
- parser_err(ctx, pos, pos, "I expected a '(' and a list of fields here");
- whitespace(&pos);
- arg_ast_t *fields = parse_args(ctx, &pos, false);
- whitespace(&pos);
- expect_closing(ctx, &pos, ")", "I wasn't able to parse the rest of this interface definition");
-
- ast_t *namespace = NULL;
- if (match(&pos, ":")) {
- const char *ns_pos = pos;
- whitespace(&ns_pos);
- int64_t ns_indent = get_indent(ctx, ns_pos);
- if (ns_indent > starting_indent) {
- pos = ns_pos;
- namespace = optional(ctx, &pos, parse_namespace);
- }
- }
- if (!namespace)
- namespace = NewAST(ctx->file, pos, pos, Block, .statements=NULL);
-
- return NewAST(ctx->file, start, pos, InterfaceDef, .name=name, .fields=fields, .namespace=namespace);
-}
-
arg_ast_t *parse_args(parse_ctx_t *ctx, const char **pos, bool allow_unnamed)
{
arg_ast_t *args = NULL;