diff options
| author | gingerBill <bill@gingerbill.org> | 2020-11-17 15:45:55 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-11-17 15:45:55 +0000 |
| commit | 34ca4e92eb5316cebb66aa1c69d4ced5719e7773 (patch) | |
| tree | 0a913552799899c5671a3118c2c2902a0d2518e0 /src/parser.cpp | |
| parent | 7442f4bab653917a99fb34a75276eab551ef4d58 (diff) | |
Fix parser logic for first comment group line in a file
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index ce5e53d92..9e9708f9c 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -1193,6 +1193,12 @@ CommentGroup *consume_comment_group(AstFile *f, isize n, isize *end_line_) { Array<Token> list = {}; list.allocator = heap_allocator(); isize end_line = f->curr_token.pos.line; + if (f->curr_token_index == 1 && + f->prev_token.kind == Token_Comment && + f->prev_token.pos.line+1 == f->curr_token.pos.line) { + // NOTE(bill): Special logic for the first comment in the file + array_add(&list, f->prev_token); + } while (f->curr_token.kind == Token_Comment && f->curr_token.pos.line <= end_line+n) { array_add(&list, consume_comment(f, &end_line)); |