diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-03-14 02:45:20 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-03-14 02:45:20 -0700 |
commit | a8b0e36b1760e51a8a3a25d4e22a325e407ef3d4 (patch) | |
tree | 181e7880cabac7b05ea72a7e81578c291235bfdd | |
parent | 9cfd4e0adf28ad932b2a99886c1aae96715669a3 (diff) | |
download | txr-a8b0e36b1760e51a8a3a25d4e22a325e407ef3d4.tar.gz txr-a8b0e36b1760e51a8a3a25d4e22a325e407ef3d4.tar.bz2 txr-a8b0e36b1760e51a8a3a25d4e22a325e407ef3d4.zip |
* parser.l (regex_parse, lisp_parse): Fix neglected handling of
optional arguments. This problem can cause the symbol : to be
planted as the std_error stream, resulting in an error loop
that blows the stack.
* regex.c (regex_compile): Likewise.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | parser.l | 5 | ||||
-rw-r--r-- | regex.c | 2 |
3 files changed, 14 insertions, 2 deletions
@@ -1,5 +1,14 @@ 2014-03-14 Kaz Kylheku <kaz@kylheku.com> + * parser.l (regex_parse, lisp_parse): Fix neglected handling of + optional arguments. This problem can cause the symbol : to be + planted as the std_error stream, resulting in an error loop + that blows the stack. + + * regex.c (regex_compile): Likewise. + +2014-03-14 Kaz Kylheku <kaz@kylheku.com> + * utf8.c (w_fopen, w_popen, w_freopen, w_remove, w_rename): We have similar functions in the MSVCRT library used by MinGW, so if _WIN32 is defined, our functions now just wrap those. @@ -910,6 +910,7 @@ val regex_parse(val string, val error_stream) yyin_stream = make_string_byte_input_stream(parse_string); errors = 0; lineno = 1; + error_stream = default_bool_arg(error_stream); std_error = if3(error_stream == t, std_output, or2(error_stream, std_null)); { int gc = gc_state(0); @@ -924,9 +925,10 @@ val regex_parse(val string, val error_stream) return errors ? nil : get_spec(); } -val lisp_parse(val source, val error_stream) +val lisp_parse(val source_in, val error_stream) { uses_or2; + val source = default_bool_arg(source_in); val input_stream = if3(stringp(source), make_string_byte_input_stream(source), or2(source, std_input)); @@ -938,6 +940,7 @@ val lisp_parse(val source, val error_stream) yyin_stream = make_catenated_stream(list(secret_token_stream, input_stream, nao)); errors = 0; lineno = 1; + error_stream = default_bool_arg(error_stream); std_error = if3(error_stream == t, std_output, or2(error_stream, std_null)); { int gc = gc_state(0); @@ -1645,7 +1645,7 @@ static val regex_requires_dv(val exp) val regex_compile(val regex_sexp, val error_stream) { if (stringp(regex_sexp)) { - regex_sexp = regex_parse(regex_sexp, error_stream); + regex_sexp = regex_parse(regex_sexp, default_bool_arg(error_stream)); return if2(regex_sexp, regex_compile(regex_sexp, error_stream)); } else if (opt_derivative_regex || regex_requires_dv(regex_sexp)) { return cons(compiled_regex_s, cons(dv_compile_regex(regex_sexp), nil)); |