Skip to content

Commit

Permalink
Warning on empty \cond statement plus extra empty line.
Browse files Browse the repository at this point in the history
When we have a Fortran file like:
```
!> \file

!> \cond
!>
      subroutine test
      end subroutine
!> \endcond
```
We get the warning:
```
.../bb.f90:4: warning: problem evaluating expression '!': Unexpected end of expression
```
But in the console output we also see an empty line like:`
```
Reading .../bb.f90...

.../bb.f90:4: warning: problem evaluating expression '!': Unexpected end of expression
Prepassing fixed form of .../bb.f90
```
This newline can also be observed in C code, when the preprocessing is disabled.
This is due to the fact that during the processing of the `CondLine` the `\n` is not caught properly and thus the default rule kicks in.
  • Loading branch information
albert-github committed Nov 5, 2021
1 parent 7bb99b8 commit f31a630
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/commentcnv.l
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,7 @@ SLASHopt [/]*
yyextra->condCtx=YY_START;
handleCondSectionId(yyscanner," "); // fake section id causing the section to be hidden unconditionally
}
<CondLine>\n |
<CondLine>. { // forgot section id?
handleCondSectionId(yyscanner," "); // fake section id causing the section to be hidden unconditionally
if (*yytext=='\n') yyextra->lineNr++;
Expand Down Expand Up @@ -948,6 +949,9 @@ SLASHopt [/]*
<*>. {
copyToOutput(yyscanner,yytext,(int)yyleng);
}
/*
<*>\n { fprintf(stderr,"Lex scanner %s (%s) default rule newline for state %s.\n", __FILE__, qPrint(yyextra->fileName),stateToString(YY_START));}
*/
%%

static void replaceCommentMarker(yyscan_t yyscanner,const char *s,int len)
Expand Down

0 comments on commit f31a630

Please sign in to comment.