Skip to content

Commit

Permalink
Made shebangs be ignored like comments, allowing for single file scri…
Browse files Browse the repository at this point in the history
…pts.
  • Loading branch information
ellipse12 committed Sep 30, 2024
1 parent c9b9de2 commit 34a368a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/compiler/lexer.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,14 @@ static void skip_whitespace(Lexer *lexer)
{
switch (peek(lexer))
{
//Case for shebang line #!
case '#':
if(peek_next(lexer) == '!')
{
skip(lexer, 2);
parse_line_comment(lexer);
continue;
}
case '/':
if (lexer->mode == LEX_DOCS) return;
// The '//' case
Expand Down
1 change: 1 addition & 0 deletions test/test_suite/comments/simple_comments.c3
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module comments;
#!/bin/c3
/* Span *//* style */

/* Nested /* Errors // Inside */ */
Expand Down

0 comments on commit 34a368a

Please sign in to comment.