diff --git a/src/scanner.c b/src/scanner.c index 269f6b2a..a0ec91cb 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -214,6 +214,9 @@ typedef struct { static inline void process_left_forward_slash(BlockCommentProcessing *processing, char current) { if (current == '*') { processing->nestingDepth += 1; + } else if (current == '/') { + processing->state = LeftForwardSlash; + return; } processing->state = Continuing; }; diff --git a/test/corpus/source_files.txt b/test/corpus/source_files.txt index a7a000e2..dd76f1de 100644 --- a/test/corpus/source_files.txt +++ b/test/corpus/source_files.txt @@ -48,6 +48,13 @@ Nested block comments // --- +/* + nested with extra slash between two nested block comments + /**///**/ +*/ + +// --- + ---- (source_file @@ -56,6 +63,8 @@ Nested block comments (block_comment) (line_comment) (block_comment) + (line_comment) + (block_comment) (line_comment)) ============================================