From 18bbe6292afc9fa1add305c09ac58644e74e4fc4 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Sat, 15 Aug 2015 09:12:06 -0700 Subject: [PATCH] parser: split parse-file into (parse-file). --- core/parser/parser.factor | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/core/parser/parser.factor b/core/parser/parser.factor index 1bda0e48f7..20c1dd5fdb 100644 --- a/core/parser/parser.factor +++ b/core/parser/parser.factor @@ -222,12 +222,17 @@ print-use-hook [ [ ] ] initialize : parse-file-restarts ( path -- restarts ) "Load " " again" surround t 2array 1array ; -: parse-file ( path -- quot ) +: (parse-file) ( path -- quot ) [ - [ parsing-file ] keep - [ utf8 ] keep - parse-stream - ] [ + dup [ + utf8 file-lines dup parse-fresh + [ nip ] [ finish-parsing ] 2bi + forget-smudged + ] with-source-file + ] with-compilation-unit ; + +: parse-file ( path -- quot ) + [ (parse-file) ] [ over parse-file-restarts rethrow-restarts drop parse-file ] recover ;