mirror of
https://github.com/fachat/xa65.git
synced 2024-06-26 08:29:29 +00:00
fixes issue#4 by ignoreing quoted strings when finding a preprocessor pattern to be replaced
This commit is contained in:
parent
a98b3770ee
commit
6b85ae268c
21
xa/src/xap.c
21
xa/src/xap.c
|
@ -456,7 +456,25 @@ int pp_replace(char *to, char *ti, int a,int b)
|
||||||
{
|
{
|
||||||
while(t[0]!='\0')
|
while(t[0]!='\0')
|
||||||
{
|
{
|
||||||
while(!isalpha(t[0]) && t[0]!='_')
|
/* find start of a potential token to be replaced */
|
||||||
|
while(!isalpha(t[0]) && t[0]!='_') {
|
||||||
|
|
||||||
|
/* escape strings quoted with " */
|
||||||
|
if (t[0] == '\"') {
|
||||||
|
do {
|
||||||
|
t++;
|
||||||
|
ti++;
|
||||||
|
} while (t[0] && t[0]!='\"');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* escape strings quoted with ' */
|
||||||
|
if (t[0] == '\'') {
|
||||||
|
do {
|
||||||
|
t++;
|
||||||
|
ti++;
|
||||||
|
} while (t[0] && t[0]!='\'');
|
||||||
|
}
|
||||||
|
|
||||||
if(t[0]=='\0')
|
if(t[0]=='\0')
|
||||||
break; /*return(E_OK);*/
|
break; /*return(E_OK);*/
|
||||||
else
|
else
|
||||||
|
@ -464,6 +482,7 @@ int pp_replace(char *to, char *ti, int a,int b)
|
||||||
t++;
|
t++;
|
||||||
ti++;
|
ti++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(l=0;isalnum(t[l])||t[l]=='_';l++);
|
for(l=0;isalnum(t[l])||t[l]=='_';l++);
|
||||||
ld=l;
|
ld=l;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user