summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-05-28 23:52:49 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-05-28 23:52:49 -0700
commit2ec8502b72574b244c1ed1e07383d8735aa90ac0 (patch)
treeddbc56534a5daee631aafa355af5aa1ccd383e7c /share
parentf05f004356e91f110f5297bdb61827a7c4436d2f (diff)
downloadtxr-2ec8502b72574b244c1ed1e07383d8735aa90ac0.tar.gz
txr-2ec8502b72574b244c1ed1e07383d8735aa90ac0.tar.bz2
txr-2ec8502b72574b244c1ed1e07383d8735aa90ac0.zip
parser: remove some parser access functions.
* parser.c (lisp_parse_impl): Access pi->eof directly instead of going through parser_eof. We are using pi->errors in the same expression! This is the only place pi->eof is needed. (read_file_common): Don't call parser_eof. Assume that if error_val emerges, and errors is zero, it must be eof. (read_eval_ret_last): Simplify: the code actually does nothing specia for eof versus errors, so we just bail if error_var emerges. (get_parser): Function removed. (parse_errors): This is the only caller of get_parser, which now just calls gethash to fetch the parser. (parser_eof): Function removed. (parse_init): sys:get-parser, sys:parser-errors and sys:parser-eof intrinsics removed. The C function parser_errors still exists; it is used in a few places. * parser.h (get_parser, parser_eof): Declarations removed. * share/txr/stdlib/compiler.tl (compile-file-conditionally): Use the new parse-errors function instead of the removed sys:parser-errors. Since that works on the stream, we don't have to call sys:get-parser. Because it returns nil if there are no errors, we drop the > test.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/compiler.tl7
1 files changed, 3 insertions, 4 deletions
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl
index e56dea66..e3d43658 100644
--- a/share/txr/stdlib/compiler.tl
+++ b/share/txr/stdlib/compiler.tl
@@ -2314,10 +2314,9 @@
(compile-form obj))
(dump-to-tlo out-stream out))
- (let ((parser (sys:get-parser in-stream)))
- (when (> (sys:parser-errors parser) 0)
- (error "~s: compilation of ~s failed" 'compile-file
- (stream-get-prop in-stream :name)))))
+ (when (parse-errors in-stream)
+ (error "~s: compilation of ~s failed" 'compile-file
+ (stream-get-prop in-stream :name))))
(flush-stream out-stream)
(set success t))))))