summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2019-09-24 19:31:40 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2019-09-24 19:31:40 (GMT)
commitf8ce2e4edbf986248b7382a702d982173c2f41d0 (patch)
treed8b64eb333043fd7e7d83307f728678e437bf2d1
parentf63047687a895dc30656913d5d6ff110bde4bd7a (diff)
downloadDoxygen-f8ce2e4edbf986248b7382a702d982173c2f41d0.zip
Doxygen-f8ce2e4edbf986248b7382a702d982173c2f41d0.tar.gz
Doxygen-f8ce2e4edbf986248b7382a702d982173c2f41d0.tar.bz2
issue #7265: Double quote character in C++ raw string literal causes Doxygen to process the string contents
-rw-r--r--src/pre.l25
-rw-r--r--src/scanner.l11
2 files changed, 36 insertions, 0 deletions
diff --git a/src/pre.l b/src/pre.l
index c413a11..cebc98f 100644
--- a/src/pre.l
+++ b/src/pre.l
@@ -385,6 +385,7 @@ static bool g_isSource;
static bool g_lexInit = FALSE;
static int g_fenceSize = 0;
static bool g_ccomment;
+static QCString g_delimiter;
//DefineDict* getGlobalDefineDict()
//{
@@ -1768,6 +1769,8 @@ static int yyread(char *buf,int max_size)
ID [a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]*
B [ \t]
BN [ \t\r\n]
+RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"("
+RAWEND ")"[^ \t\(\)\\]{0,16}\"
CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
%option noyywrap
@@ -1782,6 +1785,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
%x CopyStringCs
%x CopyStringFtn
%x CopyStringFtnDouble
+%x CopyRawString
%x Include
%x IncludeID
%x EndImport
@@ -1868,6 +1872,12 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
g_yyLineNr+=text.contains('\n');
outputArray(yytext,(int)yyleng);
}
+<CopyLine>{RAWBEGIN} {
+ g_delimiter = yytext+2;
+ g_delimiter=g_delimiter.left(g_delimiter.length()-1);
+ outputArray(yytext,(int)yyleng);
+ BEGIN(CopyRawString);
+ }
<CopyLine>"{" { // count brackets inside the main file
if (g_includeStack.isEmpty())
{
@@ -1945,6 +1955,21 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
outputChar(*yytext);
BEGIN( CopyLine );
}
+<CopyRawString>{RAWEND} {
+ outputArray(yytext,(int)yyleng);
+ QCString delimiter = yytext+1;
+ delimiter=delimiter.left(delimiter.length()-1);
+ if (delimiter==g_delimiter)
+ {
+ BEGIN( CopyLine );
+ }
+ }
+<CopyRawString>[^)]+ {
+ outputArray(yytext,(int)yyleng);
+ }
+<CopyRawString>. {
+ outputChar(*yytext);
+ }
<CopyLine>{ID}/{BN}{0,80}"(" {
g_expectGuard = FALSE;
Define *def=0;
diff --git a/src/scanner.l b/src/scanner.l
index f6ffdff..07d5c71 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -142,6 +142,7 @@ static int lastCopyArgStringContext;
static int lastCopyArgContext;
static QCString *copyArgString;
static QCString fullArgString;
+static QCString dummyRawString;
static ArgumentList *currentArgumentList;
static char lastCopyArgChar;
@@ -5398,6 +5399,16 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
BEGIN(HereDoc);
}
}
+<SkipCurly,SkipCurlyCpp>{B}*{RAWBEGIN} {
+ QCString raw=QCString(yytext).stripWhiteSpace();
+ g_delimiter = raw.data()+2;
+ g_delimiter=g_delimiter.left(g_delimiter.length()-1);
+ lastRawStringContext = YY_START;
+ dummyRawString.resize(0);
+ pCopyRawString = &dummyRawString;
+ *pCopyRawString+=yytext;
+ BEGIN(RawString);
+ }
<SkipCurly,SkipCurlyCpp>[^\n#"'@\\/{}<]+ {
lineCount(); // for g_column updates
//addToBody(yytext);