summaryrefslogtreecommitdiff
path: root/compiler/parser/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/parser/parser.c')
-rw-r--r--compiler/parser/parser.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/compiler/parser/parser.c b/compiler/parser/parser.c
index 261385b..a630e37 100644
--- a/compiler/parser/parser.c
+++ b/compiler/parser/parser.c
@@ -15,7 +15,7 @@
#include "parser.h"
static void
-add_builtin(struct hashmap *map, char *name, size_t size, int n_ptrs)
+add_builtin(struct hashmap *map, char *name, size_t size)
{
struct type *type;
size_t name_len;
@@ -27,7 +27,7 @@ add_builtin(struct hashmap *map, char *name, size_t size, int n_ptrs)
type->name = name;
type->name_len = name_len;
type->size = size;
- type->n_ptrs = n_ptrs;
+ type->n_ptrs = 0;
hashmap_add(map, &type->hashmap_entry);
}
@@ -67,8 +67,7 @@ parser_parse(struct parser *ctx)
break;
default:
tok_error(&ctx->tok, "unexpected \"%.*s\"\n", (int)ctx->tok.len, ctx->tok.pos);
- next_token(ctx);
- break;
+ return;
}
}
}
@@ -79,10 +78,10 @@ parser_init(struct parser *ctx, char *source)
debug("Initializing parser...\n");
lexer_init(&ctx->lexer, source);
- add_builtin(ctx->types, "any", 0, 0);
- add_builtin(ctx->types, "uint", sizeof(void*), 0);
- add_builtin(ctx->types, "uint64", 8, 0);
- add_builtin(ctx->types, "uint32", 4, 0);
- add_builtin(ctx->types, "uint16", 2, 0);
- add_builtin(ctx->types, "uint8", 1, 0);
+ add_builtin(ctx->types, "any", 0);
+ add_builtin(ctx->types, "uint", sizeof(void*));
+ add_builtin(ctx->types, "uint64", 8);
+ add_builtin(ctx->types, "uint32", 4);
+ add_builtin(ctx->types, "uint16", 2);
+ add_builtin(ctx->types, "uint8", 1);
}