1
0
mirror of https://github.com/fachat/xa65.git synced 2024-06-17 04:29:48 +00:00

fixes issue#4 by ignoreing quoted strings when finding a preprocessor pattern to be replaced

This commit is contained in:
Andre Fachat 2019-10-30 22:41:52 +01:00
parent a98b3770ee
commit 6b85ae268c

View File

@ -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;