Skip to content

Commit

Permalink
Handle single line comment followed by comment block
Browse files Browse the repository at this point in the history
  • Loading branch information
toots committed Nov 1, 2023
1 parent 15b5779 commit 91e8f94
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/scanner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ enum State {
IN_FLOAT_NO_LBRA,
IN_COMMENT_START,
IN_INLINE_COMMENT,
IN_INLINE_COMMENT_CONTINUE,
IN_INLINE_COMMENT_END,
IN_MULTILINE_COMMENT,
IN_MULTILINE_COMMENT_END,
Expand Down Expand Up @@ -201,6 +202,20 @@ bool tree_sitter_liquidsoap_external_scanner_scan(void *payload, TSLexer *lexer,
ADVANCE(IN_INLINE_COMMENT_END);

if (lookahead == '#')
ADVANCE(IN_INLINE_COMMENT_CONTINUE);

result = true;
lexer->result_symbol = COMMENT;
config->reset();
END_STATE();

case IN_INLINE_COMMENT_CONTINUE:
if (lookahead == '\n') {
lexer->mark_end(lexer);
ADVANCE(IN_INLINE_COMMENT_END);
}

if (lookahead != '<')
ADVANCE(IN_INLINE_COMMENT);

result = true;
Expand Down

0 comments on commit 91e8f94

Please sign in to comment.