27
27
#include < ctype.h>
28
28
#include < stack>
29
29
#include < string>
30
+ #include < cassert>
30
31
31
32
#include " doctokenizer.h"
32
33
#include " cmdmapper.h"
@@ -115,12 +116,12 @@ bool doctokenizerYYpopContext()
115
116
116
117
QCString extractPartAfterNewLine (const QCString &text)
117
118
{
118
- int nl1 = text.findRev (' \n ' );
119
+ int nl1 = text.find (' \n ' );
119
120
if (nl1!=-1 )
120
121
{
121
122
return text.mid (nl1+1 );
122
123
}
123
- int nl2 = text.findRev (" \\ ilinebr" );
124
+ int nl2 = text.find (" \\ ilinebr" );
124
125
if (nl2!=-1 )
125
126
{
126
127
if (text.at (nl2+8 )==' ' ) nl2++; // skip space after \\ilinebr
@@ -499,6 +500,7 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio
499
500
lineCount (yytext,yyleng);
500
501
QCString text=yytext;
501
502
size_t dashPos = static_cast <size_t >(text.findRev (' -' ));
503
+ assert (dashPos!=std::string::npos);
502
504
g_token->isEnumList = text.at (dashPos+1 )==' #' ;
503
505
g_token->id = -1 ;
504
506
g_token->indent = computeIndent (yytext,dashPos);
@@ -517,6 +519,7 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio
517
519
reg::Match match;
518
520
reg::search (text,match,re);
519
521
size_t listPos = match.position ();
522
+ assert (listPos!=std::string::npos);
520
523
g_token->isEnumList = FALSE ;
521
524
g_token->id = -1 ;
522
525
g_token->indent = computeIndent (yytext,listPos);
@@ -534,16 +537,19 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio
534
537
static const reg::Ex re (R"( \d+)" );
535
538
reg::Match match;
536
539
reg::search (text,match,re);
540
+ size_t markPos = match.position ();
541
+ assert (markPos!=std::string::npos);
537
542
g_token->isEnumList = true ;
538
543
g_token->id = std::stoul (match.str ());
539
- g_token->indent = computeIndent (yytext,match. position () );
544
+ g_token->indent = computeIndent (yytext,markPos );
540
545
return TK_LISTITEM;
541
546
}
542
547
}
543
548
<St_Para >{BLANK }* (\n | " \\ ilinebr" ){LISTITEM } { /* list item on next line */
544
549
lineCount (yytext,yyleng);
545
550
QCString text=extractPartAfterNewLine (yytext);
546
551
size_t dashPos = static_cast <size_t >(text.findRev (' -' ));
552
+ assert (dashPos!=std::string::npos);
547
553
g_token->isEnumList = text.at (dashPos+1 )==' #' ;
548
554
g_token->id = -1 ;
549
555
g_token->indent = computeIndent (text,dashPos);
@@ -562,6 +568,7 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio
562
568
reg::Match match;
563
569
reg::search (text,match,re);
564
570
size_t markPos = match.position ();
571
+ assert (markPos!=std::string::npos);
565
572
g_token->isEnumList = FALSE ;
566
573
g_token->id = -1 ;
567
574
g_token->indent = computeIndent (text.c_str (),markPos);
@@ -580,15 +587,18 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio
580
587
static const reg::Ex re (R"( \d+)" );
581
588
reg::Match match;
582
589
reg::search (text,match,re);
590
+ size_t markPos = match.position ();
591
+ assert (markPos!=std::string::npos);
583
592
g_token->isEnumList = true ;
584
593
g_token->id = std::stoul (match.str ());
585
- g_token->indent = computeIndent (text.c_str (),match. position () );
594
+ g_token->indent = computeIndent (text.c_str (),markPos );
586
595
return TK_LISTITEM;
587
596
}
588
597
}
589
598
<St_Para >^ {ENDLIST } { /* end list */
590
599
lineCount (yytext,yyleng);
591
600
int dotPos = QCString (yytext).findRev (' .' );
601
+ assert (dotPos!=-1 );
592
602
g_token->indent = computeIndent (yytext,dotPos);
593
603
return TK_ENDLIST;
594
604
}
0 commit comments