From 6c005b1e9458430a77bfeba6d08deed4778ad71d Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 13 Dec 2015 13:11:51 +0100 Subject: Bug 759281 - Doxygen parser confused by C++11 attributes --- src/scanner.l | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/scanner.l b/src/scanner.l index 819ee4a..e468b8f 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -75,6 +75,7 @@ static int lastCSConstraint; static int lastHereDocContext; static int lastDefineContext; static int lastAlignAsContext; +static int lastC11AttributeContext; static Protection protection; static Protection baseProt; static int sharpCount = 0 ; @@ -668,6 +669,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) %x SkipPHPString %x SkipInits %x SkipC11Inits +%x SkipC11Attribute %x SkipCPP %x SkipCPPBlock %x SkipComment @@ -5024,6 +5026,9 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(SkipInits); } } +"]]" { + BEGIN(lastC11AttributeContext); + } "{" { // C++11 style initializer unput('{'); BEGIN( Function ); @@ -5127,7 +5132,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) //addToBody(yytext); BEGIN( SkipCurlyCpp ); } -\n { +\n { lineCount(); //addToBody(yytext); } @@ -5156,22 +5161,22 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) //addToBody(yytext); lineCount(); } -"/*" { +"/*" { //addToBody(yytext); lastCContext = YY_START; BEGIN(SkipComment); } -"//" { +"//" { //addToBody(yytext); lastCContext = YY_START; BEGIN(SkipCxxComment); } -"(" { +"(" { roundCount=0; lastSkipRoundContext=YY_START; BEGIN(SkipRound); } -\" { +\" { lastStringContext=YY_START; BEGIN( SkipString ); } @@ -5206,7 +5211,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(SkipPHPString); } } -. { } +. { } \\. { } \" { BEGIN( lastStringContext ); @@ -6001,7 +6006,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } . { current->program += *yytext ; } -("//"{B}*)?"/*!" { +("//"{B}*)?"/*!" { //printf("Start doc block at %d\n",yyLineNr); removeSlashes=(yytext[1]=='/'); tmpDocType=-1; @@ -6530,6 +6535,12 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( lastCContext ) ; } [^\*\n]+ + +"[[" { // C++11 attribute + lastC11AttributeContext = YY_START; + BEGIN( SkipC11Attribute ); + } + <*>\n { lineCount(); } <*>\" { if (insideIDL && insideCppQuote) -- cgit v0.12