modern: Fix handling of FOO: in { } [ ] ( )

modern-harvey3
Doug Coleman 2020-01-26 13:08:01 -06:00
parent a076fe99cf
commit 1268a9e1c6
2 changed files with 21 additions and 4 deletions

View File

@ -266,3 +266,19 @@ IN: modern.tests
{ 1 } [ "ABC\\DEF: 1" string>literals length ] unit-test
{ 2 } [ "ABC\\DEF: 1 2 3 B\\C: lol" string>literals length ] unit-test
{ } [
"{ B: 1 } D: 3" string>literals drop
] unit-test
{ } [
"{ B: 1 -- C: 2 } D: 3" string>literals drop
] unit-test
{ } [
"[ B: 1 -- C: 2 ] D: 3" string>literals drop
] unit-test
{ } [
"( B: 1 -- C: 2 ) D: 3" string>literals drop
] unit-test

View File

@ -3,8 +3,9 @@
USING: accessors arrays assocs combinators
combinators.short-circuit continuations io.encodings.utf8
io.files kernel make math math.order math.parser modern.compiler
modern.paths modern.slices sequences sequences.extras sets
splitting strings syntax.modern unicode vocabs.loader ;
modern.paths modern.slices sequences sequences.extras
sequences.generalizations sets splitting strings syntax.modern
unicode vocabs.loader ;
IN: modern
: <ws> ( obj -- obj ) ;
@ -310,7 +311,7 @@ MACRO:: read-matched ( $ch -- quot: ( string n tag -- string n' slice' ) )
} 1&& ;
: read-til-semicolon ( string n slice -- string n' semi )
[ but-last ";" append ";" "--" ")" 4array lex-colon-until ] keep
[ but-last ";" append ";" "--" ")" "]" "}" 6 narray lex-colon-until ] keep
swap
! What ended the FOO: .. ; form?
! Remove the ; from the payload if present