If parser overflows in local stack, expand global with

scanned terms.


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@656 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2002-10-28 20:00:59 +00:00
parent ad552d04b4
commit e7fc4d0059

View File

@ -2849,7 +2849,7 @@ p_read (void)
} }
old_TR = TR; old_TR = TR;
while (TRUE) { while (TRUE) {
CELL *old_H = H; CELL *old_H;
/* Scans the term using stack space */ /* Scans the term using stack space */
eot_before_eof = FALSE; eot_before_eof = FALSE;
@ -2860,6 +2860,9 @@ p_read (void)
else { else {
tokstart = tokptr = toktide = fast_tokenizer (); tokstart = tokptr = toktide = fast_tokenizer ();
} }
/* preserve value of H after scanning: otherwise we may lose strings
and floats */
old_H = H;
if ((Stream[c_input_stream].status & Eof_Stream_f) if ((Stream[c_input_stream].status & Eof_Stream_f)
&& !eot_before_eof) { && !eot_before_eof) {
if (tokstart != NIL && tokstart->Tok != Ord (eot_tok)) { if (tokstart != NIL && tokstart->Tok != Ord (eot_tok)) {
@ -2885,6 +2888,7 @@ p_read (void)
/* ignore term we just built */ /* ignore term we just built */
H = old_H; H = old_H;
if (growstack_in_parser(&old_TR, &tokstart, &VarTable)) { if (growstack_in_parser(&old_TR, &tokstart, &VarTable)) {
old_H = H;
tokptr = toktide = tokstart; tokptr = toktide = tokstart;
ErrorMessage = NULL; ErrorMessage = NULL;
goto repeat_cycle; goto repeat_cycle;