Commit 569dc007 authored by Dimitri van Heesch's avatar Dimitri van Heesch

Bug 705219 - Accept IDs using unicode for C/C++ preprocessor

parent 1f22d19e
...@@ -1705,7 +1705,7 @@ static int yyread(char *buf,int max_size) ...@@ -1705,7 +1705,7 @@ static int yyread(char *buf,int max_size)
%} %}
ID [a-z_A-Z][a-z_A-Z0-9]* ID [a-zA-Z_\x80-\xFF][a-zA-Z0-9_\x80-\xFF]+
B [ \t] B [ \t]
BN [ \t\r\n] BN [ \t\r\n]
CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
...@@ -1761,7 +1761,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) ...@@ -1761,7 +1761,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
outputArray(yytext,(int)yyleng); outputArray(yytext,(int)yyleng);
BEGIN(CopyLine); BEGIN(CopyLine);
} }
<Start>^{B}*[_A-Z][_A-Z0-9]*{B}*"("[^\)\n]*")"/{BN}{1,10}*[:{] { // constructors? <Start>^{B}*[a-zA-Z_\x80-\xFF][a-zA-Z0-9_\x80-\xFF]+{B}*"("[^\)\n]*")"/{BN}{1,10}*[:{] { // constructors?
int i; int i;
for (i=(int)yyleng-1;i>=0;i--) for (i=(int)yyleng-1;i>=0;i--)
{ {
...@@ -1769,8 +1769,8 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) ...@@ -1769,8 +1769,8 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
} }
BEGIN(CopyLine); BEGIN(CopyLine);
} }
<Start>^{B}*[_A-Z][_A-Z0-9]*{B}*"("[^\(\)\n]*"("[^\)\n]*")"[^\)\n]*")"{B}*\n | // function list macro with one (...) argument, e.g. for K_GLOBAL_STATIC_WITH_ARGS <Start>^{B}*[a-zA-Z_\x80-\xFF][a-zA-Z0-9_\x80-\xFF]+{B}*"("[^\(\)\n]*"("[^\)\n]*")"[^\)\n]*")"{B}*\n | // function list macro with one (...) argument, e.g. for K_GLOBAL_STATIC_WITH_ARGS
<Start>^{B}*[_A-Z][_A-Z0-9]*{B}*"("[^\)\n]*")"{B}*\n { // function like macro <Start>^{B}*[a-zA-Z_\x80-\xFF][a-zA-Z0-9_\x80-\xFF]+{B}*"("[^\)\n]*")"{B}*\n { // function like macro
static bool skipFuncMacros = Config_getBool("SKIP_FUNCTION_MACROS"); static bool skipFuncMacros = Config_getBool("SKIP_FUNCTION_MACROS");
QCString name(yytext); QCString name(yytext);
name=name.left(name.find('(')).stripWhiteSpace(); name=name.left(name.find('(')).stripWhiteSpace();
...@@ -2042,7 +2042,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) ...@@ -2042,7 +2042,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
BEGIN(SkipCPPBlock); BEGIN(SkipCPPBlock);
} }
} }
<Command>"else"/[^a-z_A-Z0-9] { <Command>"else"/[^a-zA-Z0-9_\x80-\xFF] {
//printf("else g_levelGuard[%d]=%d\n",g_level-1,g_levelGuard[g_level-1]); //printf("else g_levelGuard[%d]=%d\n",g_level-1,g_levelGuard[g_level-1]);
if (otherCaseDone()) if (otherCaseDone())
{ {
...@@ -2065,7 +2065,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) ...@@ -2065,7 +2065,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
BEGIN(Guard); BEGIN(Guard);
} }
} }
<Command>"endif"/[^a-z_A-Z0-9] { <Command>"endif"/[^a-zA-Z0-9_\x80-\xFF] {
//printf("Pre.l: #endif\n"); //printf("Pre.l: #endif\n");
decrLevel(); decrLevel();
} }
...@@ -2481,7 +2481,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) ...@@ -2481,7 +2481,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
g_condCtx=YY_START; g_condCtx=YY_START;
BEGIN(CondLineC); BEGIN(CondLineC);
} }
<CondLineC,CondLineCpp>[!()&| \ta-z_A-Z0-9.\-]+ { <CondLineC,CondLineCpp>[!()&| \ta-zA-Z0-9_\x80-\xFF.\-]+ {
startCondSection(yytext); startCondSection(yytext);
if (g_skip) if (g_skip)
{ {
...@@ -2544,13 +2544,13 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) ...@@ -2544,13 +2544,13 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
<SkipCond>[^\/\!*\\@\n]+ { } <SkipCond>[^\/\!*\\@\n]+ { }
<SkipCond>"//"[/!] { g_ccomment=FALSE; } <SkipCond>"//"[/!] { g_ccomment=FALSE; }
<SkipCond>"/*"[*!] { g_ccomment=TRUE; } <SkipCond>"/*"[*!] { g_ccomment=TRUE; }
<SkipCond,SkipCComment,SkipCPPComment>[\\@][\\@]"endcond"/[^a-z_A-Z0-9] { <SkipCond,SkipCComment,SkipCPPComment>[\\@][\\@]"endcond"/[^a-zA-Z0-9_\x80-\xFF] {
if (!g_skip) if (!g_skip)
{ {
outputArray(yytext,(int)yyleng); outputArray(yytext,(int)yyleng);
} }
} }
<SkipCond>[\\@]"endcond"/[^a-z_A-Z0-9] { <SkipCond>[\\@]"endcond"/[^a-zA-Z0-9_\x80-\xFF] {
bool oldSkip = g_skip; bool oldSkip = g_skip;
endCondSection(); endCondSection();
if (oldSkip && !g_skip) if (oldSkip && !g_skip)
...@@ -2562,7 +2562,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) ...@@ -2562,7 +2562,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
BEGIN(g_condCtx); BEGIN(g_condCtx);
} }
} }
<SkipCComment,SkipCPPComment>[\\@]"endcond"/[^a-z_A-Z0-9] { <SkipCComment,SkipCPPComment>[\\@]"endcond"/[^a-zA-Z0-9_\x80-\xFF] {
bool oldSkip = g_skip; bool oldSkip = g_skip;
endCondSection(); endCondSection();
if (oldSkip && !g_skip) if (oldSkip && !g_skip)
...@@ -2601,7 +2601,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) ...@@ -2601,7 +2601,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
<SkipCComment,SkipVerbatim>. { <SkipCComment,SkipVerbatim>. {
outputChar(*yytext); outputChar(*yytext);
} }
<CopyCComment>[^*a-z_A-Z\n]+ { <CopyCComment>[^*a-zA-Z_\x80-\xFF\n]+ {
g_defLitText+=yytext; g_defLitText+=yytext;
g_defText+=escapeAt(yytext); g_defText+=escapeAt(yytext);
} }
...@@ -3002,7 +3002,7 @@ void preprocessFile(const char *fileName,BufStr &input,BufStr &output) ...@@ -3002,7 +3002,7 @@ void preprocessFile(const char *fileName,BufStr &input,BufStr &output)
) // predefined function macro definition ) // predefined function macro definition
{ {
//printf("predefined function macro '%s'\n",defStr); //printf("predefined function macro '%s'\n",defStr);
QRegExp reId("[a-z_A-Z][a-z_A-Z0-9]*"); // regexp matching an id QRegExp reId("[a-zA-Z_\x80-\xFF][a-zA-Z0-9_\x80-\xFF]+"); // regexp matching an id
QDict<int> argDict(17); QDict<int> argDict(17);
argDict.setAutoDelete(TRUE); argDict.setAutoDelete(TRUE);
int i=i_obrace+1,p,l,count=0; int i=i_obrace+1,p,l,count=0;
......
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