From b08907ef2737c942cf3953ba83ac4ccf5eb47621 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Thu, 7 Feb 2008 17:12:50 -0600 Subject: [PATCH] extra/multiline checks for EOF now --- extra/multiline/multiline.factor | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/extra/multiline/multiline.factor b/extra/multiline/multiline.factor index 7f831e5351..0ed72f6936 100644 --- a/extra/multiline/multiline.factor +++ b/extra/multiline/multiline.factor @@ -7,8 +7,11 @@ IN: multiline lexer get dup next-line line-text ; : (parse-here) ( -- ) - next-line-text dup ";" = - [ drop lexer get next-line ] [ % "\n" % (parse-here) ] if ; + next-line-text [ + dup ";" = + [ drop lexer get next-line ] + [ % "\n" % (parse-here) ] if + ] [ ";" unexpected-eof ] if* ; : parse-here ( -- str ) [ (parse-here) ] "" make 1 head* @@ -19,11 +22,13 @@ IN: multiline parse-here 1quotation define ; parsing : (parse-multiline-string) ( start-index end-text -- end-index ) - lexer get line-text 2dup start - [ rot dupd >r >r swap subseq % r> r> length + ] [ - rot tail % "\n" % 0 - lexer get next-line swap (parse-multiline-string) - ] if* ; + lexer get line-text [ + 2dup start + [ rot dupd >r >r swap subseq % r> r> length + ] [ + rot tail % "\n" % 0 + lexer get next-line swap (parse-multiline-string) + ] if* + ] [ nip unexpected-eof ] if* ; : parse-multiline-string ( end-text -- str ) [