aboutsummaryrefslogtreecommitdiff
path: root/src/parse
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/expressions.c2
-rw-r--r--src/parse/files.c15
-rw-r--r--src/parse/files.h1
-rw-r--r--src/parse/typedefs.c6
-rw-r--r--src/parse/utils.c8
5 files changed, 10 insertions, 22 deletions
diff --git a/src/parse/expressions.c b/src/parse/expressions.c
index 606c7b4e..7410f678 100644
--- a/src/parse/expressions.c
+++ b/src/parse/expressions.c
@@ -196,7 +196,7 @@ ast_t *parse_term_no_suffix(parse_ctx_t *ctx, const char *pos) {
|| (term = parse_deserialize(ctx, pos)) || (term = parse_var(ctx, pos)) || (term = parse_list(ctx, pos))
|| (term = parse_reduction(ctx, pos)) || (term = parse_pass(ctx, pos)) || (term = parse_defer(ctx, pos))
|| (term = parse_skip(ctx, pos)) || (term = parse_stop(ctx, pos)) || (term = parse_return(ctx, pos))
- || (term = parse_not(ctx, pos)) || (term = parse_extern(ctx, pos)) || (term = parse_inline_c(ctx, pos)));
+ || (term = parse_not(ctx, pos)) || (term = parse_inline_c(ctx, pos)));
return term;
}
diff --git a/src/parse/files.c b/src/parse/files.c
index 5ff41c68..caecbbe8 100644
--- a/src/parse/files.c
+++ b/src/parse/files.c
@@ -43,8 +43,8 @@ ast_t *parse_file_body(parse_ctx_t *ctx, const char *pos) {
if ((stmt = optional(ctx, &pos, parse_struct_def)) || (stmt = optional(ctx, &pos, parse_func_def))
|| (stmt = optional(ctx, &pos, parse_enum_def)) || (stmt = optional(ctx, &pos, parse_lang_def))
|| (stmt = optional(ctx, &pos, parse_extend)) || (stmt = optional(ctx, &pos, parse_convert_def))
- || (stmt = optional(ctx, &pos, parse_use)) || (stmt = optional(ctx, &pos, parse_extern))
- || (stmt = optional(ctx, &pos, parse_inline_c)) || (stmt = optional(ctx, &pos, parse_top_declaration))) {
+ || (stmt = optional(ctx, &pos, parse_use)) || (stmt = optional(ctx, &pos, parse_inline_c))
+ || (stmt = optional(ctx, &pos, parse_top_declaration))) {
statements = new (ast_list_t, .ast = stmt, .next = statements);
pos = stmt->end;
whitespace(ctx, &pos); // TODO: check for newline
@@ -151,17 +151,6 @@ ast_t *parse_use(parse_ctx_t *ctx, const char *pos) {
return NewAST(ctx->file, start, pos, Use, .var = var, .path = name, .what = what);
}
-ast_t *parse_extern(parse_ctx_t *ctx, const char *pos) {
- const char *start = pos;
- if (!match_word(&pos, "extern")) return NULL;
- spaces(&pos);
- const char *name = get_id(&pos);
- spaces(&pos);
- if (!match(&pos, ":")) parser_err(ctx, start, pos, "I couldn't get a type for this extern");
- type_ast_t *type = expect(ctx, start, &pos, parse_type, "I couldn't parse the type for this extern");
- return NewAST(ctx->file, start, pos, Extern, .name = name, .type = type);
-}
-
public
ast_t *parse_file_str(const char *str) {
file_t *file = spoof_file("<string>", str);
diff --git a/src/parse/files.h b/src/parse/files.h
index 3073449e..ebebc20c 100644
--- a/src/parse/files.h
+++ b/src/parse/files.h
@@ -12,4 +12,3 @@ ast_t *parse_file(const char *path, jmp_buf *on_err);
ast_t *parse_file_body(parse_ctx_t *ctx, const char *pos);
ast_t *parse_use(parse_ctx_t *ctx, const char *pos);
-ast_t *parse_extern(parse_ctx_t *ctx, const char *pos);
diff --git a/src/parse/typedefs.c b/src/parse/typedefs.c
index 50562536..fe48cb2c 100644
--- a/src/parse/typedefs.c
+++ b/src/parse/typedefs.c
@@ -27,8 +27,8 @@ ast_t *parse_namespace(parse_ctx_t *ctx, const char *pos) {
if ((stmt = optional(ctx, &pos, parse_struct_def)) || (stmt = optional(ctx, &pos, parse_func_def))
|| (stmt = optional(ctx, &pos, parse_enum_def)) || (stmt = optional(ctx, &pos, parse_lang_def))
|| (stmt = optional(ctx, &pos, parse_extend)) || (stmt = optional(ctx, &pos, parse_convert_def))
- || (stmt = optional(ctx, &pos, parse_use)) || (stmt = optional(ctx, &pos, parse_extern))
- || (stmt = optional(ctx, &pos, parse_inline_c)) || (stmt = optional(ctx, &pos, parse_declaration))) {
+ || (stmt = optional(ctx, &pos, parse_use)) || (stmt = optional(ctx, &pos, parse_inline_c))
+ || (stmt = optional(ctx, &pos, parse_declaration))) {
statements = new (ast_list_t, .ast = stmt, .next = statements);
pos = stmt->end;
whitespace(ctx, &pos); // TODO: check for newline
@@ -69,7 +69,7 @@ ast_t *parse_struct_def(parse_ctx_t *ctx, const char *pos) {
for (;;) {
if (match_word(&pos, "secret")) {
secret = true;
- } else if (match_word(&pos, "extern")) {
+ } else if (match_word(&pos, "external")) {
external = true;
} else if (match_word(&pos, "opaque")) {
if (fields)
diff --git a/src/parse/utils.c b/src/parse/utils.c
index 0644bfa0..2048a3ff 100644
--- a/src/parse/utils.c
+++ b/src/parse/utils.c
@@ -12,10 +12,10 @@
#include "utils.h"
static const char *keywords[] = {
- "C_code", "_max_", "_min_", "and", "assert", "break", "continue", "defer", "deserialize", "do",
- "else", "enum", "extend", "extern", "for", "func", "if", "in", "lang", "mod",
- "mod1", "no", "none", "not", "or", "pass", "return", "skip", "skip", "stop",
- "struct", "then", "unless", "use", "when", "while", "xor", "yes",
+ "C_code", "_max_", "_min_", "and", "assert", "break", "continue", "defer", "deserialize", "do",
+ "else", "enum", "extend", "for", "func", "if", "in", "lang", "mod", "mod1",
+ "no", "none", "not", "or", "pass", "return", "skip", "skip", "stop", "struct",
+ "then", "unless", "use", "when", "while", "xor", "yes",
};
CONSTFUNC bool is_keyword(const char *word) {