@@ -293,6 +293,7 @@ struct preYY_state
293293 bool isSource = false ;
294294
295295 yy_size_t fenceSize = 0 ;
296+ char fenceChar = ' ' ;
296297 bool ccomment = false ;
297298 QCString delimiter;
298299 bool isSpecialComment = false ;
@@ -340,6 +341,7 @@ static void setFileName(yyscan_t yyscanner,const QCString &name);
340341static int yyread (yyscan_t yyscanner,char *buf,int max_size);
341342static Define * isDefined (yyscan_t yyscanner,const QCString &name);
342343static void determineBlockName (yyscan_t yyscanner);
344+ static yy_size_t getFenceSize (char *txt, yy_size_t leng);
343345
344346/* ----------------------------------------------------------------- */
345347
@@ -1422,7 +1424,8 @@ WSopt [ \t\r]*
14221424 }
14231425 else
14241426 {
1425- yyextra->fenceSize =(int )yyleng;
1427+ yyextra->fenceChar =' ~' ;
1428+ yyextra->fenceSize =(int )getFenceSize (yytext,yyleng);
14261429 BEGIN (SkipCondVerbatim);
14271430 }
14281431 }
@@ -1434,7 +1437,8 @@ WSopt [ \t\r]*
14341437 }
14351438 else
14361439 {
1437- yyextra->fenceSize =(int )yyleng;
1440+ yyextra->fenceChar =' `' ;
1441+ yyextra->fenceSize =(int )getFenceSize (yytext,yyleng);
14381442 BEGIN (SkipCondVerbatim);
14391443 }
14401444 }
@@ -1447,7 +1451,8 @@ WSopt [ \t\r]*
14471451 else
14481452 {
14491453 outputArray (yyscanner,yytext,yyleng);
1450- yyextra->fenceSize =(int )yyleng;
1454+ yyextra->fenceChar =' ~' ;
1455+ yyextra->fenceSize =(int )getFenceSize (yytext,yyleng);
14511456 BEGIN (SkipVerbatim);
14521457 }
14531458 }
@@ -1460,7 +1465,8 @@ WSopt [ \t\r]*
14601465 else
14611466 {
14621467 outputArray (yyscanner,yytext,yyleng);
1463- yyextra->fenceSize =(int )yyleng;
1468+ yyextra->fenceChar =' `' ;
1469+ yyextra->fenceSize =(int )getFenceSize (yytext,yyleng);
14641470 BEGIN (SkipVerbatim);
14651471 }
14661472 }
@@ -1626,27 +1632,27 @@ WSopt [ \t\r]*
16261632 }
16271633 }
16281634<SkipCondVerbatim >^ ({B }* " *" + )? {B }{0,3 }" ~~~" [~ ]* {
1629- if (yyextra->fenceSize ==( yy_size_t ) yyleng)
1635+ if (yyextra->fenceSize ==getFenceSize (yytext, yyleng) && yyextra-> fenceChar == ' ~ ' )
16301636 {
16311637 BEGIN (SkipCond);
16321638 }
16331639 }
16341640<SkipCondVerbatim >^ ({B }* " *" + )? {B }{0,3 }" ```" [` ]* {
1635- if (yyextra->fenceSize ==( yy_size_t ) yyleng)
1641+ if (yyextra->fenceSize ==getFenceSize (yytext, yyleng) && yyextra-> fenceChar == ' ` ' )
16361642 {
16371643 BEGIN (SkipCond);
16381644 }
16391645 }
16401646<SkipVerbatim >^ ({B }* " *" + )? {B }{0,3 }" ~~~" [~ ]* {
16411647 outputArray (yyscanner,yytext,yyleng);
1642- if (yyextra->fenceSize ==( yy_size_t ) yyleng)
1648+ if (yyextra->fenceSize ==getFenceSize (yytext, yyleng) && yyextra-> fenceChar == ' ~ ' )
16431649 {
16441650 BEGIN (SkipCComment);
16451651 }
16461652 }
16471653<SkipVerbatim >^ ({B }* " *" + )? {B }{0,3 }" ```" [` ]* {
16481654 outputArray (yyscanner,yytext,yyleng);
1649- if (yyextra->fenceSize ==( yy_size_t ) yyleng)
1655+ if (yyextra->fenceSize ==getFenceSize (yytext, yyleng) && yyextra-> fenceChar == ' ` ' )
16501656 {
16511657 BEGIN (SkipCComment);
16521658 }
@@ -2083,6 +2089,17 @@ static int yyread(yyscan_t yyscanner,char *buf,int max_size)
20832089 return bytesToCopy;
20842090}
20852091
2092+ static yy_size_t getFenceSize (char *txt, yy_size_t leng)
2093+ {
2094+ yy_size_t fenceSize = 0 ;
2095+ for (size_t i = 0 ; i < leng; i++)
2096+ {
2097+ if (txt[i] != ' ' && txt[i] != ' *' && txt[i] != ' \t ' ) break ;
2098+ fenceSize++;
2099+ }
2100+ return leng-fenceSize;
2101+ }
2102+
20862103static void setFileName (yyscan_t yyscanner,const QCString &name)
20872104{
20882105 YY_EXTRA_TYPE state = preYYget_extra (yyscanner);
0 commit comments