Compiler: Fix the "@" character was not allowed in macro definitions (while the documentation stated that they were).

Imported from Pawn 3.1.3599.
This commit is contained in:
Arkshine 2014-08-15 17:55:43 +02:00
parent 17114347d1
commit cd189320e5
2 changed files with 15 additions and 15 deletions

View File

@ -1270,7 +1270,7 @@ static int command(void)
} /* while */ } /* while */
end=lptr; end=lptr;
/* check pattern to match */ /* check pattern to match */
if (!isalpha(*start) && *start!='_') { if (!alpha(*start)) {
error(74); /* pattern must start with an alphabetic character */ error(74); /* pattern must start with an alphabetic character */
break; break;
} /* if */ } /* if */
@ -1321,7 +1321,7 @@ static int command(void)
} /* while */ } /* while */
substitution[count]='\0'; substitution[count]='\0';
/* check whether the definition already exists */ /* check whether the definition already exists */
for (prefixlen=0,start=(unsigned char*)pattern; isalpha(*start) || isdigit(*start) || *start=='_'; prefixlen++,start++) for (prefixlen=0,start=(unsigned char*)pattern; alphanum(*start); prefixlen++,start++)
/* nothing */; /* nothing */;
assert(prefixlen>0); assert(prefixlen>0);
if ((def=find_subst(pattern,prefixlen))!=NULL) { if ((def=find_subst(pattern,prefixlen))!=NULL) {
@ -1485,7 +1485,7 @@ static int substpattern(unsigned char *line,size_t buffersize,char *pattern,char
memset(args,0,sizeof args); memset(args,0,sizeof args);
/* check the length of the prefix */ /* check the length of the prefix */
for (prefixlen=0,s=(unsigned char*)pattern; isalpha(*s) || isdigit(*s) || *s=='_'; prefixlen++,s++) for (prefixlen=0,s=(unsigned char*)pattern; alphanum(*s); prefixlen++,s++)
/* nothing */; /* nothing */;
assert(prefixlen>0); assert(prefixlen>0);
assert(strncmp((char*)line,pattern,prefixlen)==0); assert(strncmp((char*)line,pattern,prefixlen)==0);
@ -1645,7 +1645,7 @@ static void substallpatterns(unsigned char *line,int buffersize)
/* find the start of a prefix (skip all non-alphabetic characters), /* find the start of a prefix (skip all non-alphabetic characters),
* also skip strings * also skip strings
*/ */
while (!isalpha(*start) && *start!='_' && *start!='\0') { while (!alpha(*start) && *start!='\0') {
/* skip strings */ /* skip strings */
if (is_startstring(start)) { if (is_startstring(start)) {
start=(unsigned char *)skipstring(start); start=(unsigned char *)skipstring(start);
@ -1663,7 +1663,7 @@ static void substallpatterns(unsigned char *line,int buffersize)
while ((*start<=' ' && *start!='\0') || *start=='(') while ((*start<=' ' && *start!='\0') || *start=='(')
start++; start++;
/* skip the symbol behind it */ /* skip the symbol behind it */
while (isalpha(*start) || isdigit(*start) || *start=='_') while (alphanum(*start))
start++; start++;
/* drop back into the main loop */ /* drop back into the main loop */
continue; continue;
@ -1671,7 +1671,7 @@ static void substallpatterns(unsigned char *line,int buffersize)
/* get the prefix (length), look for a matching definition */ /* get the prefix (length), look for a matching definition */
prefixlen=0; prefixlen=0;
end=start; end=start;
while (isalpha(*end) || isdigit(*end) || *end=='_') { while (alphanum(*end)) {
prefixlen++; prefixlen++;
end++; end++;
} /* while */ } /* while */
@ -2512,7 +2512,7 @@ SC_FUNC void delete_symbols(symbol *root,int level,int delete_labels,int delete_
/* for user defined operators, also remove the "prototyped" flag, as /* for user defined operators, also remove the "prototyped" flag, as
* user-defined operators *must* be declared before use * user-defined operators *must* be declared before use
*/ */
if (sym->ident==iFUNCTN && !isalpha(*sym->name) && *sym->name!='_' && *sym->name!=PUBLIC_CHAR) if (sym->ident==iFUNCTN && !alpha(*sym->name))
sym->usage &= ~uPROTOTYPED; sym->usage &= ~uPROTOTYPED;
root=sym; /* skip the symbol */ root=sym; /* skip the symbol */
} /* if */ } /* if */

View File

@ -255,16 +255,16 @@ SC_FUNC void delete_pathtable(void)
static stringpair substpair = { NULL, NULL, NULL}; /* list of substitution pairs */ static stringpair substpair = { NULL, NULL, NULL}; /* list of substitution pairs */
static stringpair *substindex['z'-'A'+1]; /* quick index to first character */ static stringpair *substindex['z'-PUBLIC_CHAR+1]; /* quick index to first character */
static void adjustindex(char c) static void adjustindex(char c)
{ {
stringpair *cur; stringpair *cur;
assert(c>='A' && c<='Z' || c>='a' && c<='z' || c=='_'); assert(c>='A' && c<='Z' || c>='a' && c<='z' || c=='_' || c==PUBLIC_CHAR);
assert('A'<'_' && '_'<'z'); assert(PUBLIC_CHAR<'A' && 'A'<'_' && '_'<'z');
for (cur=substpair.next; cur!=NULL && cur->first[0]!=c; cur=cur->next) for (cur=substpair.next; cur!=NULL && cur->first[0]!=c; cur=cur->next)
/* nothing */; /* nothing */;
substindex[(int)c-'A']=cur; substindex[(int)c-PUBLIC_CHAR]=cur;
} }
SC_FUNC stringpair *insert_subst(char *pattern,char *substitution,int prefixlen) SC_FUNC stringpair *insert_subst(char *pattern,char *substitution,int prefixlen)
@ -304,8 +304,8 @@ SC_FUNC stringpair *find_subst(char *name,int length)
stringpair *item; stringpair *item;
assert(name!=NULL); assert(name!=NULL);
assert(length>0); assert(length>0);
assert(*name>='A' && *name<='Z' || *name>='a' && *name<='z' || *name=='_'); assert(*name>='A' && *name<='Z' || *name>='a' && *name<='z' || *name=='_' || *name==PUBLIC_CHAR);
item=substindex[(int)*name-'A']; item=substindex[(int)*name-PUBLIC_CHAR];
if (item!=NULL) if (item!=NULL)
item=find_stringpair(item,name,length); item=find_stringpair(item,name,length);
@ -334,8 +334,8 @@ SC_FUNC int delete_subst(char *name,int length)
stringpair *item; stringpair *item;
assert(name!=NULL); assert(name!=NULL);
assert(length>0); assert(length>0);
assert(*name>='A' && *name<='Z' || *name>='a' && *name<='z' || *name=='_'); assert(*name>='A' && *name<='Z' || *name>='a' && *name<='z' || *name=='_' || *name==PUBLIC_CHAR);
item=substindex[(int)*name-'A']; item=substindex[(int)*name-PUBLIC_CHAR];
if (item!=NULL) if (item!=NULL)
item=find_stringpair(item,name,length); item=find_stringpair(item,name,length);
if (item==NULL) if (item==NULL)