Commit 22ce4672 authored by Dimitri van Heesch's avatar Dimitri van Heesch

Bug 709526 - C++ parsing problem with operators <<, <, >, >> inside templates

parent cfc02d4c
...@@ -212,6 +212,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" ...@@ -212,6 +212,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\"
else // yytext=='<' else // yytext=='<'
{ {
g_argSharpCount=0; g_argSharpCount=0;
g_argRoundCount=0;
BEGIN( CopyArgSharp ); BEGIN( CopyArgSharp );
} }
} }
...@@ -239,6 +240,26 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" ...@@ -239,6 +240,26 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\"
if (g_argRoundCount>0) g_argRoundCount--; if (g_argRoundCount>0) g_argRoundCount--;
else BEGIN( g_readArgContext ); else BEGIN( g_readArgContext );
} }
<CopyArgSharp>"<<" {
if (g_argRoundCount>0)
{
*g_copyArgValue += yytext;
}
else
{
REJECT;
}
}
<CopyArgSharp>">>" {
if (g_argRoundCount>0)
{
*g_copyArgValue += yytext;
}
else
{
REJECT;
}
}
<CopyArgSharp>"<" { <CopyArgSharp>"<" {
g_argSharpCount++; g_argSharpCount++;
*g_copyArgValue += *yytext; *g_copyArgValue += *yytext;
...@@ -248,6 +269,14 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" ...@@ -248,6 +269,14 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\"
if (g_argSharpCount>0) g_argSharpCount--; if (g_argSharpCount>0) g_argSharpCount--;
else BEGIN( g_readArgContext ); else BEGIN( g_readArgContext );
} }
<CopyArgSharp>"(" {
g_argRoundCount++;
*g_copyArgValue += *yytext;
}
<CopyArgSharp>")" {
g_argRoundCount--;
*g_copyArgValue += *yytext;
}
<CopyArgCurly>"{" { <CopyArgCurly>"{" {
g_argCurlyCount++; g_argCurlyCount++;
*g_copyArgValue += *yytext; *g_copyArgValue += *yytext;
......
...@@ -4437,6 +4437,13 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) ...@@ -4437,6 +4437,13 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
else else
BEGIN( lastCopyArgContext ); BEGIN( lastCopyArgContext );
} }
<CopyArgSharp>"(" {
*copyArgString+=*yytext;
fullArgString+=*yytext;
argRoundCount=0;
lastCopyArgContext = YY_START;
BEGIN( CopyArgRound );
}
<CopyArgSharp>"<" { <CopyArgSharp>"<" {
argSharpCount++; argSharpCount++;
//printf("argSharpCount++=%d copy\n",argSharpCount); //printf("argSharpCount++=%d copy\n",argSharpCount);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment