From d8d7c0cd3cd2d685ae0f2b4999b4f2f41336f502 Mon Sep 17 00:00:00 2001
From: Doug Coleman <doug.coleman@gmail.com>
Date: Mon, 4 Sep 2017 11:33:47 -0500
Subject: [PATCH] modern: Allow comound literals

---
 extra/modern/modern.factor | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/extra/modern/modern.factor b/extra/modern/modern.factor
index dc6ce08162..64e637a0b8 100644
--- a/extra/modern/modern.factor
+++ b/extra/modern/modern.factor
@@ -51,7 +51,7 @@ ERROR: lex-expected-but-got-eof n string expected ;
 : lex-until ( n string tag-sequence -- n' string payload )
     3dup '[
         [
-            lex-factor dup [ , ] when* [
+            lex-factor dup f like [ , ] when* [
                 dup [
                     ! } gets a chance, but then also full seq { } after recursion...
                     [ _ ] dip '[ _ sequence= ] any? not
@@ -67,7 +67,7 @@ ERROR: lex-expected-but-got-eof n string expected ;
 : lex-colon-until ( n string tag-sequence -- n' string payload )
     '[
         [
-            lex-factor dup [ , ] when* [
+            lex-factor dup f like [ , ] when* [
                 dup [
                     ! } gets a chance, but then also full seq { } after recursion...
                     [ _ ] dip '[ _ sequence= ] any? not
@@ -218,10 +218,9 @@ ERROR: no-backslash-payload n string slice ;
     ] when ;
 
 ! If the slice is 0 width, we stopped on whitespace.
-! Advance the index and read again!
-: read-token-or-whitespace ( n string slice -- n' string slice )
-    dup length 0 =
-    [ drop [ 1 + ] dip lex-factor ] when ;
+! Advance the index and read again somewhere else!
+: read-token-or-whitespace ( n string slice -- n' string slice/f )
+    dup length 0 = [ [ 1 + ] 2dip ] when ;
 
 ERROR: mismatched-terminator n string slice ;
 : read-terminator ( n string slice -- n' string slice ) ;
@@ -267,9 +266,9 @@ ERROR: mismatched-terminator n string slice ;
         { char: \[ [ read-bracket ] }
         { char: \{ [ read-brace ] }
         { char: \( [ read-paren ] }
-        { char: \] [  ] }
-        { char: \} [  ] }
-        { char: \) [  ] }
+        { char: \] [ ] }
+        { char: \} [ ] }
+        { char: \) [ ] }
         { char: \s [ read-token-or-whitespace ] }
         { char: \r [ read-token-or-whitespace ] }
         { char: \n [ read-token-or-whitespace ] }
@@ -301,7 +300,7 @@ ERROR: mismatched-terminator n string slice ;
     ] if ; inline
 
 : string>literals ( string -- sequence )
-    [ 0 ] dip [ lex-factor ] loop>array 2nip ;
+    [ 0 ] dip [ [ lex-factor f like ] loop>array f like ] loop>array 2nip ;
 
 : vocab>literals ( vocab -- sequence )
     ".private" ?tail drop