From 72eed17195c6650d503c191fb8e3ed54d3426df4 Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 6 Dec 2019 12:46:49 +0100 Subject: Email address seen as code starter Some email addresses give problems in the comment converter as they contain e.g. `@code`, so we try to detect Email addresses (analogous to doctokenizer.l) to prevent these false positives. The given warning would ne like: ``` aa.h:13: warning: Reached end of file while still inside a (nested) comment. Nesting level 1 (probable line reference: 1) ``` --- src/commentcnv.l | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/commentcnv.l b/src/commentcnv.l index 13a21c3..66aada1 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -119,6 +119,8 @@ static void replaceComment(yyscan_t yyscanner,int offset); %} +MAILADR ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z_A-Z0-9\-]+ + %option noyywrap %x Scan @@ -335,6 +337,10 @@ static void replaceComment(yyscan_t yyscanner,int offset); yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); } } +{MAILADR} | +"<"{MAILADR}">" { // Mail address, to prevent seeing e.g x@code-factory.org as start of a code block + copyToOutput(yyscanner,yytext,(int)yyleng); + } "{@code"/[ \t\n] { copyToOutput(yyscanner,"@code",5); yyextra->lastCommentContext = YY_START; @@ -519,7 +525,7 @@ static void replaceComment(yyscan_t yyscanner,int offset); copyToOutput(yyscanner,yytext,(int)yyleng); } -[^\\!@*\n{\"\/]* { /* anything that is not a '*' or command */ +[^ <\\!@*\n{\"\/]* { /* anything that is not a '*' or command */ copyToOutput(yyscanner,yytext,(int)yyleng); } "*"+[^*/\\@\n{\"]* { /* stars without slashes */ -- cgit v0.12