fix some bad code in legalAtom, allowing /a/b not to be quoted (obs from Paulo Moura).

This commit is contained in:
Vitor Santos Costa 2010-11-26 23:36:50 +00:00
parent f470a44efe
commit 471cc93f6c
1 changed files with 12 additions and 11 deletions

View File

@ -292,29 +292,30 @@ wrputref(CODEADDR ref, int Quote_illegal, wrf writewch) /* writes a data base
static int
legalAtom(unsigned char *s) /* Is this a legal atom ? */
{
wchar_t ch = *s;
if (ch == '\0')
return(FALSE);
return FALSE;
if (Yap_chtype[ch] != LC) {
if (ch == '[')
return (*++s == ']' && !(*++s));
else if (ch == '{')
return (*++s == '}' && !(*++s));
if (ch == '[') {
return (s[1] == ']' && !s[2]);
} else if (ch == '{') {
return (s[1] == '}' && !s[2]);
// else if (ch == '/')
// return (*++s != '*');
else if (Yap_chtype[ch] == SL)
return (!*++s);
else if ((ch == ',' || ch == '.') && !s[1])
} else if (Yap_chtype[ch] == SL) {
return (!s[1]);
} else if ((ch == ',' || ch == '.') && !s[1]) {
return FALSE;
else
} else {
while (ch) {
if (Yap_chtype[ch] != SY)
if (Yap_chtype[ch] != SY) {
return FALSE;
}
ch = *++s;
}
}
return TRUE;
} else
while ((ch = *++s) != 0)