modern: save -- tokens. need a compound-sequence payload slot soon. do print leading whitespace.
parent
20e1a1590c
commit
9ae2cf6323
|
@ -2,11 +2,12 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors arrays assocs assocs.extras combinators
|
USING: accessors arrays assocs assocs.extras combinators
|
||||||
combinators.short-circuit constructors continuations fry
|
combinators.short-circuit constructors continuations fry
|
||||||
io.encodings.utf8 io.files kernel locals macros make math
|
generalizations io.encodings.utf8 io.files kernel locals macros
|
||||||
math.order modern.paths modern.slices multiline namespaces
|
make math math.order modern.lexer modern.paths modern.slices
|
||||||
quotations sequences sequences.extras splitting modern.lexer
|
multiline namespaces quotations sequences sequences.extras
|
||||||
splitting.monotonic strings unicode generalizations shuffle ;
|
shuffle splitting splitting.extras splitting.monotonic strings
|
||||||
IN: modern
|
unicode ;
|
||||||
|
in: modern
|
||||||
|
|
||||||
COMPILE<
|
COMPILE<
|
||||||
! Base rules, everything should have a generator macro
|
! Base rules, everything should have a generator macro
|
||||||
|
@ -103,7 +104,7 @@ M: array collapse-decorators
|
||||||
] map ;
|
] map ;
|
||||||
|
|
||||||
: split-double-dash ( seq -- seqs )
|
: split-double-dash ( seq -- seqs )
|
||||||
dup [ { [ tag-literal? ] [ tag>> "--" = ] } 1&& ] split-when
|
dup [ { [ tag-literal? ] [ tag>> "--" = ] } 1&& ] split*-when
|
||||||
dup length 1 > [
|
dup length 1 > [
|
||||||
nip <compound-sequence-literal>
|
nip <compound-sequence-literal>
|
||||||
] [
|
] [
|
||||||
|
|
|
@ -13,8 +13,8 @@ symbol: last-slice
|
||||||
[ dup blank? [ drop char: \s ] unless ] map ;
|
[ dup blank? [ drop char: \s ] unless ] map ;
|
||||||
|
|
||||||
: write-whitespace ( obj -- )
|
: write-whitespace ( obj -- )
|
||||||
! [ last-slice get [ swap slice-between ] [ slice-before ] if* io:write ]
|
[ 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 get [ swap slice-between replace-whitespace io:write ] [ drop ] if* ]
|
||||||
[ last-slice namespaces:set ] bi ;
|
[ last-slice namespaces:set ] bi ;
|
||||||
|
|
||||||
defer: write-literal
|
defer: write-literal
|
||||||
|
|
Loading…
Reference in New Issue