From a47c456eadf1895654a3e8c4a6232e67db20371b Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 14 Dec 2019 13:32:56 +0100 Subject: issue #7206: Problems with Fortran and `@cond` --- src/commentcnv.l | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/commentcnv.l b/src/commentcnv.l index 66aada1..95d0347 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -791,7 +791,7 @@ MAILADR ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z BEGIN(yyextra->condCtx); } } -[ \t]* +[ \t]*/\n | [\\@]"cond"[ \t\r]*/\n | . { // forgot section id? if (YY_START!=CondLine) yyextra->condCtx=YY_START; @@ -942,24 +942,32 @@ static inline int computeIndent(const char *s) static inline void copyToOutput(yyscan_t yyscanner,const char *s,int len) { + int tabSize=Config_getInt(TAB_SIZE); struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; int i; if (yyextra->skip) // only add newlines. { - for (i=0;i skip %d\n",g_lineNr); - yyextra->lineNr++; + case '\n': + ADDCHAR('\n'); + yyextra->lineNr++; + yyextra->col=0; + break; + case '\t': + yyextra->col+=tabSize-(yyextra->col%tabSize); + break; + default: + yyextra->col++; + break; } } } else if (len>0) { ADDARRAY(s,len); - static int tabSize=Config_getInt(TAB_SIZE); for (i=0;i