[ ] and {} should be handled by the scanner, not the parser (obs from Paulo Moura).

This commit is contained in:
Vitor Santos Costa
2009-12-03 22:51:29 +00:00
parent 1176f71f3a
commit 97a27bd4b6
2 changed files with 28 additions and 22 deletions

View File

@@ -581,31 +581,19 @@ ParseTerm(int prio, JMPBUFF *FailBuff)
break;
case '[':
NextToken;
if (Yap_tokptr->Tok == Ord(Ponctuation_tok) &&
Unsigned(Yap_tokptr->TokInfo) == ']') {
t = TermNil;
NextToken;
} else {
t = ParseList(FailBuff);
checkfor((Term) ']', FailBuff);
}
t = ParseList(FailBuff);
checkfor((Term) ']', FailBuff);
break;
case '{':
NextToken;
if (Yap_tokptr->Tok == Ord(Ponctuation_tok) &&
Unsigned(Yap_tokptr->TokInfo) == '}') {
t = MkAtomTerm(NameOfFunctor(FunctorBraces));
NextToken;
} else {
t = ParseTerm(1200, FailBuff);
t = Yap_MkApplTerm(FunctorBraces, 1, &t);
/* check for possible overflow against local stack */
if (H > ASP-4096) {
Yap_ErrorMessage = "Stack Overflow";
FAIL;
}
checkfor((Term) '}', FailBuff);
}
t = ParseTerm(1200, FailBuff);
t = Yap_MkApplTerm(FunctorBraces, 1, &t);
/* check for possible overflow against local stack */
if (H > ASP-4096) {
Yap_ErrorMessage = "Stack Overflow";
FAIL;
}
checkfor((Term) '}', FailBuff);
break;
default:
FAIL;