From 9ae2cf6323e4f83b5abc6a625300d690d29b9c55 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 20 Jun 2016 18:01:05 -0700 Subject: [PATCH] modern: save -- tokens. need a compound-sequence payload slot soon. do print leading whitespace. --- core/modern/modern.factor | 13 +++++++------ core/modern/out/out.factor | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/core/modern/modern.factor b/core/modern/modern.factor index 046e2c2489..3648875dcd 100644 --- a/core/modern/modern.factor +++ b/core/modern/modern.factor @@ -2,11 +2,12 @@ ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays assocs assocs.extras combinators combinators.short-circuit constructors continuations fry -io.encodings.utf8 io.files kernel locals macros make math -math.order modern.paths modern.slices multiline namespaces -quotations sequences sequences.extras splitting modern.lexer -splitting.monotonic strings unicode generalizations shuffle ; -IN: modern +generalizations io.encodings.utf8 io.files kernel locals macros +make math math.order modern.lexer modern.paths modern.slices +multiline namespaces quotations sequences sequences.extras +shuffle splitting splitting.extras splitting.monotonic strings +unicode ; +in: modern COMPILE< ! Base rules, everything should have a generator macro @@ -103,7 +104,7 @@ M: array collapse-decorators ] map ; : split-double-dash ( seq -- seqs ) - dup [ { [ tag-literal? ] [ tag>> "--" = ] } 1&& ] split-when + dup [ { [ tag-literal? ] [ tag>> "--" = ] } 1&& ] split*-when dup length 1 > [ nip ] [ diff --git a/core/modern/out/out.factor b/core/modern/out/out.factor index 5a03449da1..419df88aa6 100644 --- a/core/modern/out/out.factor +++ b/core/modern/out/out.factor @@ -13,8 +13,8 @@ symbol: last-slice [ dup blank? [ drop char: \s ] unless ] map ; : write-whitespace ( obj -- ) - ! [ last-slice get [ swap slice-between ] [ slice-before ] if* io:write ] - [ last-slice get [ swap slice-between replace-whitespace io:write ] [ drop ] if* ] + [ last-slice get [ swap slice-between ] [ slice-before ] if* replace-whitespace io:write ] + ! [ last-slice get [ swap slice-between replace-whitespace io:write ] [ drop ] if* ] [ last-slice namespaces:set ] bi ; defer: write-literal