Skip to content

Commit c42c0ae

Browse files
committed
Length of identifying fenced code block
In case we have a problem like: ``` /** \file * ``` * router = (new Router()); * ``` */ ``` there is no problem, but as soon as we add a space somewhere before the start or end identifier of the fenced code block we get: ``` .../aa.h:6: warning: reached end of file while inside a '```' block! The command that should end the block seems to be missing! ``` i.e. a problem like: ``` /** \file * ``` * router = (new Router()); * ``` */ ``` or ``` /** \file * ``` * router = (new Router()); * ``` */ ``` The relevant length is the length identifying the fenced code block / number of back ticks, not the number of spaces in front of it (analogous number of tildes).
1 parent ad9be5f commit c42c0ae

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/scanner.l

+12-8
Original file line numberDiff line numberDiff line change
@@ -6630,16 +6630,18 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
66306630
BEGIN(DocCopyBlock);
66316631
}
66326632
<DocBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
6633-
docBlock+=substitute(yytext,"*"," ");
6633+
QCString pat = substitute(yytext,"*"," ");
6634+
docBlock+=pat;
66346635
docBlockName="~~~";
6635-
g_fencedSize=yyleng;
6636+
g_fencedSize=pat.stripWhiteSpace().length();
66366637
g_nestedComment=FALSE;
66376638
BEGIN(DocCopyBlock);
66386639
}
66396640
<DocBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* {
6640-
docBlock+=substitute(yytext,"*"," ");
6641+
QCString pat = substitute(yytext,"*"," ");
6642+
docBlock+=pat;
66416643
docBlockName="```";
6642-
g_fencedSize=yyleng;
6644+
g_fencedSize=pat.stripWhiteSpace().length();
66436645
g_nestedComment=FALSE;
66446646
BEGIN(DocCopyBlock);
66456647
}
@@ -6755,15 +6757,17 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
67556757
}
67566758
}
67576759
<DocCopyBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
6758-
docBlock+=substitute(yytext,"*"," ");
6759-
if (g_fencedSize==yyleng)
6760+
QCString pat = substitute(yytext,"*"," ");
6761+
docBlock+=pat;
6762+
if (g_fencedSize==pat.stripWhiteSpace().length())
67606763
{
67616764
BEGIN(DocBlock);
67626765
}
67636766
}
67646767
<DocCopyBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* {
6765-
docBlock+=substitute(yytext,"*"," ");
6766-
if (g_fencedSize==yyleng)
6768+
QCString pat = substitute(yytext,"*"," ");
6769+
docBlock+=pat;
6770+
if (g_fencedSize==pat.stripWhiteSpace().length())
67676771
{
67686772
BEGIN(DocBlock);
67696773
}

0 commit comments

Comments
 (0)