summaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/parse.c b/parse.c
new file mode 100644
index 0000000..b1b5c93
--- /dev/null
+++ b/parse.c
@@ -0,0 +1,21 @@
+#include "parse.h"
+#include <stdio.h>
+
+int parse(const Token *tok)
+{
+ while (tok->type != TOK_NONE) {
+ switch (tok->type) {
+ case TOK_KW_FN:
+ case TOK_KW_VAR:
+ case TOK_KW_CONST:
+ break;
+ default:
+ fprintf(stderr, "unexpected %s at %u:%u\n",
+ token_type_str(tok->type),
+ tok->line, tok->column);
+ return 1;
+ }
+ tok += 1;
+ }
+ return 0;
+}