summaryrefslogtreecommitdiffstats
path: root/src/scanner.l
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2018-07-17 12:40:37 (GMT)
committerGitHub <noreply@github.com>2018-07-17 12:40:37 (GMT)
commit400b3168c2ca7b113331af2bd5e96092354b8724 (patch)
tree6516545117bea61c7cf68efc808c1fe260dd8b8f /src/scanner.l
parente037ab502cc2a5107f0df7bab15fd5214f29d6f9 (diff)
parent7d325579b7b38a898d3766d186f9358d899dc304 (diff)
downloadDoxygen-400b3168c2ca7b113331af2bd5e96092354b8724.zip
Doxygen-400b3168c2ca7b113331af2bd5e96092354b8724.tar.gz
Doxygen-400b3168c2ca7b113331af2bd5e96092354b8724.tar.bz2
Merge pull request #717 from albert-github/feature/bug_769414
Bug 769414 - PHP: New array syntax not supported when parsing initial value
Diffstat (limited to 'src/scanner.l')
-rw-r--r--src/scanner.l60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/scanner.l b/src/scanner.l
index 21b845f..4846132 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -149,6 +149,7 @@ static QCString *pCopyRawString;
static QGString *pCopyCurlyGString;
static QGString *pCopyRoundGString;
+static QGString *pCopySquareGString;
static QGString *pCopyQuotedGString;
static QGString *pCopyHereDocGString;
static QGString *pCopyRawGString;
@@ -734,6 +735,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
%x CopyRound
%x CopyCurly
%x GCopyRound
+%x GCopySquare
%x GCopyCurly
%x SkipUnionSwitch
%x Specialization
@@ -2838,6 +2840,14 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
current->initializer+=*yytext;
BEGIN(GCopyRound);
}
+<ReadInitializer>"[" {
+ if (!insidePHP) REJECT;
+ lastSquareContext=YY_START;
+ pCopySquareGString=&current->initializer;
+ squareCount=0;
+ current->initializer+=*yytext;
+ BEGIN(GCopySquare);
+ }
<ReadInitializer>"{" {
lastCurlyContext=YY_START;
pCopyCurlyGString=&current->initializer;
@@ -3180,6 +3190,56 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
*pCopyRoundGString+=*yytext;
}
+ /* generic square bracket list copy rules for growable strings, we should only enter here in case of php, left the test part as in GCopyRound to keep it compatible with te round bracket version */
+<GCopySquare>\" {
+ *pCopySquareGString+=*yytext;
+ pCopyQuotedGString=pCopySquareGString;
+ lastStringContext=YY_START;
+ BEGIN(CopyGString);
+ }
+<GCopySquare>"[" {
+ *pCopySquareGString+=*yytext;
+ squareCount++;
+ }
+<GCopySquare>"]" {
+ *pCopySquareGString+=*yytext;
+ if (--squareCount<0)
+ BEGIN(lastSquareContext);
+ }
+<GCopySquare>\n {
+ lineCount();
+ *pCopySquareGString+=*yytext;
+ }
+<GCopySquare>\' {
+ if (insidePHP)
+ {
+ current->initializer+=yytext;
+ pCopyQuotedGString = pCopySquareGString;
+ lastStringContext=YY_START;
+ BEGIN(CopyPHPGString);
+ }
+ else
+ {
+ *pCopySquareGString+=yytext;
+ }
+ }
+<GCopySquare>{CHARLIT} {
+ if (insidePHP)
+ {
+ REJECT;
+ }
+ else
+ {
+ *pCopySquareGString+=yytext;
+ }
+ }
+<GCopySquare>[^"\[\]\n/]+ {
+ *pCopySquareGString+=yytext;
+ }
+<GCopySquare>. {
+ *pCopySquareGString+=*yytext;
+ }
+
/* generic curly bracket list copy rules */
<CopyCurly>\" {
*pCopyCurlyString+=*yytext;