From e7fc4d005927e8ca1cca4c1a9534b1ac7182d771 Mon Sep 17 00:00:00 2001 From: vsc Date: Mon, 28 Oct 2002 20:00:59 +0000 Subject: [PATCH] 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 --- C/iopreds.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/C/iopreds.c b/C/iopreds.c index 3d2cc7334..3ca66c0c9 100644 --- a/C/iopreds.c +++ b/C/iopreds.c @@ -2849,7 +2849,7 @@ p_read (void) } old_TR = TR; while (TRUE) { - CELL *old_H = H; + CELL *old_H; /* Scans the term using stack space */ eot_before_eof = FALSE; @@ -2860,6 +2860,9 @@ p_read (void) else { 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) && !eot_before_eof) { if (tokstart != NIL && tokstart->Tok != Ord (eot_tok)) { @@ -2885,6 +2888,7 @@ p_read (void) /* ignore term we just built */ H = old_H; if (growstack_in_parser(&old_TR, &tokstart, &VarTable)) { + old_H = H; tokptr = toktide = tokstart; ErrorMessage = NULL; goto repeat_cycle;