mirror of
https://github.com/fachat/xa65.git
synced 2025-04-09 09:41:20 +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(!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')
|
||||
break; /*return(E_OK);*/
|
||||
else
|
||||
@ -464,6 +482,7 @@ int pp_replace(char *to, char *ti, int a,int b)
|
||||
t++;
|
||||
ti++;
|
||||
}
|
||||
}
|
||||
|
||||
for(l=0;isalnum(t[l])||t[l]=='_';l++);
|
||||
ld=l;
|
||||
|
Loading…
x
Reference in New Issue
Block a user