diff options
author | Himbeer <himbeer@disroot.org> | 2024-09-20 11:07:15 +0200 |
---|---|---|
committer | Himbeer <himbeer@disroot.org> | 2024-09-20 11:07:44 +0200 |
commit | 3e0d442bc046c6fe917a86ab5f1de7299290c824 (patch) | |
tree | 67246884e165ab7ece0cfa4f05ebff56e8794fea /src | |
parent | 52c028b48a501c0fc8f51049c27500e3df923080 (diff) |
Skip comments by default unless the parser requests them explicitly
Most comments aren't relevant to the parser. It is still possible to
implement documentation comments for automated documentation generation.
Diffstat (limited to 'src')
-rw-r--r-- | src/lex.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -252,6 +252,13 @@ lex_comment(struct lexer *lexer, struct token *out) enum lexical_token lex(struct lexer *lexer, struct token *out) { + while (lex_any(lexer, out) == T_COMMENT); + return out->token; +} + +enum lexical_token +lex_any(struct lexer *lexer, struct token *out) +{ if (lexer->un.token != T_NONE) { *out = lexer->un; lexer->un.token = T_NONE; |