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

View File

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