summaryrefslogtreecommitdiffstats
path: root/parser.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-05-07 06:39:07 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-05-07 06:39:07 -0700
commit7025b2c547d3611301e3e6fde8422aaba2acfd3f (patch)
tree606737c602e6f607c10750b3c03cf895585d12af /parser.c
parent535fff2f4e9d8a84521296c77c01e90122fcdd48 (diff)
downloadtxr-7025b2c547d3611301e3e6fde8422aaba2acfd3f.tar.gz
txr-7025b2c547d3611301e3e6fde8422aaba2acfd3f.tar.bz2
txr-7025b2c547d3611301e3e6fde8422aaba2acfd3f.zip
* Makefile (LISP_TO_C_STRING): Strip comments, but not comment lines,
so line numbers don't change. * eval.c (eval_init): Fix registrations of lisp-parse and read. * lisplib.c (place_instantiate): Give name to parsed string stream using new lisp_parse argument. * parser.c (lisp_parse): Takes new argument to override name. * parser.h (lisp_parse): Declaration updated. * txr.c (txr_main): Call lisp_parse with four args, defaulting the new one. * txr.1: Documented new argument.
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/parser.c b/parser.c
index 8a2a5d5b..4bed7be9 100644
--- a/parser.c
+++ b/parser.c
@@ -118,7 +118,7 @@ val regex_parse(val string, val error_stream)
return parser.errors ? nil : parser.syntax_tree;
}
-val lisp_parse(val source_in, val error_stream, val error_return_val)
+val lisp_parse(val source_in, val error_stream, val error_return_val, val name_in)
{
uses_or2;
val source = default_bool_arg(source_in);
@@ -126,9 +126,10 @@ val lisp_parse(val source_in, val error_stream, val error_return_val)
make_string_byte_input_stream(source),
or2(source, std_input));
val secret_token_stream = make_string_byte_input_stream(lit("@\x01" "E"));
- val name = if3(stringp(source),
- lit("string"),
- stream_get_prop(input_stream, name_k));
+ val name = or2(default_bool_arg(name_in),
+ if3(stringp(source),
+ lit("string"),
+ stream_get_prop(input_stream, name_k)));
val stream = make_catenated_stream(list(secret_token_stream, input_stream, nao));
val saved_dyn = dyn_env;
parser_t parser;