diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | dep.mk | 2 | ||||
-rw-r--r-- | parser.l | 15 |
3 files changed, 23 insertions, 4 deletions
@@ -1,5 +1,15 @@ 2014-10-19 Kaz Kylheku <kaz@kylheku.com> + * parser.l (lisp_parse): Bugfix: the error_stream argument + must be checked to be a stream before we plant it in place + of std_error, otherwise we will get a type exception thrown + lower down, which leads to runaway recursion as TXR tries + to print the error messages on std_error. + + * dep.mk: Regenerated. + +2014-10-19 Kaz Kylheku <kaz@kylheku.com> + * parser.y (r_exprs): New grammar symbol. r_exprs uses left-recursive rules to avoid filling the yacc stack, and returns the items in reverse order. The output of each @@ -1,5 +1,5 @@ ./txr.o: config.h $(top_srcdir)/./lib.h $(top_srcdir)/./stream.h $(top_srcdir)/./gc.h $(top_srcdir)/./signal.h $(top_srcdir)/./unwind.h $(top_srcdir)/./parser.h $(top_srcdir)/./match.h $(top_srcdir)/./utf8.h $(top_srcdir)/./debug.h $(top_srcdir)/./syslog.h $(top_srcdir)/./eval.h $(top_srcdir)/./regex.h $(top_srcdir)/./arith.h $(top_srcdir)/./txr.h -./lex.yy.o: config.h $(top_srcdir)/./lib.h $(top_srcdir)/./gc.h $(top_srcdir)/./stream.h $(top_srcdir)/./utf8.h $(top_srcdir)/./signal.h $(top_srcdir)/./unwind.h $(top_srcdir)/./hash.h $(top_srcdir)/./parser.h y.tab.h +./lex.yy.o: config.h $(top_srcdir)/./lib.h $(top_srcdir)/./gc.h $(top_srcdir)/./stream.h $(top_srcdir)/./utf8.h $(top_srcdir)/./signal.h $(top_srcdir)/./unwind.h $(top_srcdir)/./hash.h $(top_srcdir)/./parser.h $(top_srcdir)/./eval.h y.tab.h ./y.tab.o: config.h $(top_srcdir)/./lib.h $(top_srcdir)/./signal.h $(top_srcdir)/./unwind.h $(top_srcdir)/./regex.h $(top_srcdir)/./utf8.h $(top_srcdir)/./match.h $(top_srcdir)/./hash.h $(top_srcdir)/./eval.h $(top_srcdir)/./stream.h $(top_srcdir)/./parser.h ./match.o: config.h $(top_srcdir)/./lib.h $(top_srcdir)/./gc.h $(top_srcdir)/./signal.h $(top_srcdir)/./unwind.h $(top_srcdir)/./regex.h $(top_srcdir)/./stream.h $(top_srcdir)/./parser.h $(top_srcdir)/./txr.h $(top_srcdir)/./utf8.h $(top_srcdir)/./filter.h $(top_srcdir)/./hash.h $(top_srcdir)/./debug.h $(top_srcdir)/./eval.h $(top_srcdir)/./match.h ./lib.o: config.h $(top_srcdir)/./lib.h $(top_srcdir)/./gc.h $(top_srcdir)/./arith.h $(top_srcdir)/./rand.h $(top_srcdir)/./hash.h $(top_srcdir)/./signal.h $(top_srcdir)/./unwind.h $(top_srcdir)/./stream.h $(top_srcdir)/./utf8.h $(top_srcdir)/./filter.h $(top_srcdir)/./eval.h $(top_srcdir)/./sysif.h $(top_srcdir)/./regex.h @@ -48,6 +48,7 @@ #include "unwind.h" #include "hash.h" #include "parser.h" +#include "eval.h" #include "y.tab.h" #define YY_INPUT(buf, result, max_size) \ @@ -996,24 +997,32 @@ val lisp_parse(val source_in, val error_stream, val error_return_val) val name = if3(stringp(source), format(nil, lit("expr --> ~a"), source, nao), stream_get_prop(input_stream, name_k)); - val save_stream = std_error; val stream = make_catenated_stream(list(secret_token_stream, input_stream, nao)); + val saved_dyn = dyn_env; parser_t parser; + dyn_env = make_env(nil, nil, dyn_env); + error_stream = default_bool_arg(error_stream); - std_error = if3(error_stream == t, std_output, or2(error_stream, std_null)); + error_stream = if3(error_stream == t, std_output, or2(error_stream, std_null)); + class_check (error_stream, stream_s); + + env_vbind(dyn_env, stderr_s, error_stream); + { int gc = gc_state(0); name = if3(std_error != std_null, name, lit("")); parse(stream, name, &parser); gc_state(gc); } - std_error = save_stream; + + dyn_env = saved_dyn; if (parser.errors) { if (missingp(error_return_val)) uw_throwf(syntax_error_s, lit("read: syntax error"), nao); return error_return_val; } + return parser.syntax_tree; } |