modern: Fix rewriting ![[ ]] and ![=[ ]=]

modern-harvey3-triple
Doug Coleman 2018-08-07 15:06:45 -04:00
parent f52694159f
commit 8eea6188bd
2 changed files with 10 additions and 1 deletions

View File

@ -241,3 +241,12 @@ IN: modern.tests
{ "<BAR" { } "BAR>" }
}
} [ "foo:: <FOO FOO> [ 0 ] [ 1 ] [ 2 ] [ 3 ] <BAR BAR>" string>literals >strings ] unit-test
{ t } [ "![[ ]]" [ rewrite-string-exact ] keep sequence= ] unit-test
{ t } [ "![=[ ]=]" [ rewrite-string-exact ] keep sequence= ] unit-test
{ t } [ "![==[ ]==]" [ rewrite-string-exact ] keep sequence= ] unit-test
{ t } [ "foo[[ ]]" [ rewrite-string-exact ] keep sequence= ] unit-test
{ t } [ "foo[=[ ]=]" [ rewrite-string-exact ] keep sequence= ] unit-test
{ t } [ "foo[==[ ]==]" [ rewrite-string-exact ] keep sequence= ] unit-test

View File

@ -131,7 +131,7 @@ MACRO:: read-matched ( ch -- quot: ( n string tag -- n' string slice' ) )
: take-comment ( n string slice -- n' string comment )
2over ?nth char: \[ = [
[ 1 + ] 2dip 2over ?nth read-double-matched-bracket
[ 1 + ] 2dip 1 modify-to 2over ?nth read-double-matched-bracket
] [
[ slice-til-eol drop ] dip swap 2array
] if ;