diff --git a/glcpp-lex.l b/glcpp-lex.l index 0954ab7e83d..7bc5fab76da 100644 --- a/glcpp-lex.l +++ b/glcpp-lex.l @@ -53,7 +53,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? } /* Multi-line comments */ -[/][*]([^*]*[*]+[^/])*[^*]*[*]*[/] { +[/][*]([^*]*[*]+[^*/])*[^*]*[*]+[/] { if (yyextra->space_tokens) return SPACE; } diff --git a/tests/063-comments.c b/tests/063-comments.c index 4cda52236e0..e641d2f0f9e 100644 --- a/tests/063-comments.c +++ b/tests/063-comments.c @@ -13,3 +13,8 @@ and slashes / *** / and other stuff. ****/ more code here +/* Test that /* nested + comments */ +are not treated like comments. +/*/ this is a comment */ +/*/*/