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 { 1 } [ "ABC\\DEF: 1" string>literals length ] unit-test
{ 2 } [ "ABC\\DEF: 1 2 3 B\\C: lol" 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 USING: accessors arrays assocs combinators
combinators.short-circuit continuations io.encodings.utf8 combinators.short-circuit continuations io.encodings.utf8
io.files kernel make math math.order math.parser modern.compiler io.files kernel make math math.order math.parser modern.compiler
modern.paths modern.slices sequences sequences.extras sets modern.paths modern.slices sequences sequences.extras
splitting strings syntax.modern unicode vocabs.loader ; sequences.generalizations sets splitting strings syntax.modern
unicode vocabs.loader ;
IN: modern IN: modern
: <ws> ( obj -- obj ) ; : <ws> ( obj -- obj ) ;
@ -310,7 +311,7 @@ MACRO:: read-matched ( $ch -- quot: ( string n tag -- string n' slice' ) )
} 1&& ; } 1&& ;
: read-til-semicolon ( string n slice -- string n' semi ) : 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 swap
! What ended the FOO: .. ; form? ! What ended the FOO: .. ; form?
! Remove the ; from the payload if present ! Remove the ; from the payload if present