diff options
| author | Ginger Bill <bill@gingerbill.org> | 2016-11-24 23:22:16 +0000 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2016-11-24 23:22:16 +0000 |
| commit | cbb70c78731b9d928508a52180a186b178d30a5e (patch) | |
| tree | f1f67ab062a91b719d008795dd4b462a81e12579 /src/parser.c | |
| parent | 5aa0ef54c8616dc4994b6aee54c942f9c578a0b2 (diff) | |
Fix parsing for comments; add global ODIN_* string constants
Diffstat (limited to 'src/parser.c')
| -rw-r--r-- | src/parser.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/parser.c b/src/parser.c index 1ea8ba430..c5eae58b0 100644 --- a/src/parser.c +++ b/src/parser.c @@ -100,6 +100,7 @@ AstNodeArray make_ast_node_array(AstFile *f) { } + #define AST_NODE_KINDS \ AST_NODE_KIND(BasicLit, "basic literal", Token) \ AST_NODE_KIND(Ident, "identifier", Token) \ @@ -2656,10 +2657,6 @@ AstNode *parse_stmt(AstFile *f) { AstNode *s = NULL; Token token = f->curr_token; switch (token.kind) { - case Token_Comment: - next_token(f); - return parse_stmt(f); - // Operands case Token_Identifier: case Token_Integer: @@ -2886,9 +2883,6 @@ ParseFileError init_ast_file(AstFile *f, String fullpath) { if (token.kind == Token_Invalid) { return ParseFile_InvalidToken; } - if (token.kind == Token_Comment) { - continue; - } array_add(&f->tokens, token); if (token.kind == Token_EOF) { @@ -3097,6 +3091,9 @@ void parse_file(Parser *p, AstFile *f) { base_dir.len--; } + while (f->curr_token.kind == Token_Comment) { + next_token(f); + } f->decls = parse_stmt_list(f); |