From 9b79fc678855b0cec0cc13d7c05b08a20c99fcfc Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 20 Jun 2016 16:40:49 -0700 Subject: [PATCH] modern: fix ![[ ]] --- collections/stream/extras/extras.factor | 1 - core/modern/modern.factor | 14 +++++++------- core/modern/out/out-tests.factor | 11 ++++++++++- core/modern/slices/slices.factor | 1 - 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/collections/stream/extras/extras.factor b/collections/stream/extras/extras.factor index 0f75d95108..185abf4516 100644 --- a/collections/stream/extras/extras.factor +++ b/collections/stream/extras/extras.factor @@ -15,4 +15,3 @@ in: stream.extras : write1-flush ( str -- ) output-stream get stream-write1-flush ; inline : write-flush ( str -- ) output-stream get stream-write-flush ; inline : print-flush ( str -- ) output-stream get stream-print-flush ; inline - diff --git a/core/modern/modern.factor b/core/modern/modern.factor index f91e192eea..07811f022c 100644 --- a/core/modern/modern.factor +++ b/core/modern/modern.factor @@ -33,7 +33,7 @@ TUPLE: matched-literal < tag-literal delimiter payload closing-tag ; TUPLE: delimited-literal < tag-literal delimiter payload ; TUPLE: decorator-literal < literal delimiter payload ; -TUPLE: dquote-literal < delimited-literal ; +TUPLE: dquote-literal < matched-literal ; TUPLE: single-matched-literal < matched-literal ; TUPLE: double-matched-literal < matched-literal ; TUPLE: less-than-literal < single-matched-literal ; @@ -210,12 +210,11 @@ ERROR: closing-delimiter-required opening-delimiter ; payload postprocess-lexed opening-delimiter "\"" = [ split-double-dash ] unless >>payload tag closing [ dup tag-literal? [ lexed-underlying ] when ] bi@ ?span-slices >>underlying opening-delimiter >string >>delimiter - dup single-matched-literal? [ - closing dup [ tag>> ] when >>closing-tag - ] when + + closing dup tag-literal? [ tag>> ] when >string >>closing-tag + ! PRIVATE< PRIVATE> dup less-than-literal? [ - closing dup [ tag>> ] when >>closing-tag closing f = [ opening-delimiter closing-delimiter-required ] when ] when tag opening-delimiter payload closing 4array >>seq ; inline @@ -394,7 +393,8 @@ ERROR: closing-tag-required lexer tag ; : take-comment ( lexer slice -- comment ) over ?lexer-nth char: \[ = [ - [ [ 1 + ] change-n ] dip over ?lexer-nth read-double-matched-bracket + [ [ 1 + ] change-n ] [ 1 modify-to ] bi* + over ?lexer-nth read-double-matched-bracket ] [ [ lex-til-eol drop 2nip dup ] dip 1 cut-slice* line-comment-literal make-delimited-literal ] if ; @@ -562,4 +562,4 @@ vocab-roots get [ vocabs-from reject-some-paths ] map concat } diff [ modern-source-path ] map [ ] rewrite-paths -]] \ No newline at end of file +]] diff --git a/core/modern/out/out-tests.factor b/core/modern/out/out-tests.factor index 185b7d8302..889b1b140d 100644 --- a/core/modern/out/out-tests.factor +++ b/core/modern/out/out-tests.factor @@ -62,4 +62,13 @@ in: modern.out.tests { t } [ "foo<{ ptx-2op-instruction ptx-float-ftz }" rewrite-same-string ] unit-test { t } [ [=[ [ dup 0 > [ number>string ] [ drop "No more" ] if ]]=] rewrite-same-string ] unit-test -{ t } [ [=[ [[omg]]]=] rewrite-same-string ] unit-test \ No newline at end of file +{ t } [ [=[ [[omg]]]=] rewrite-same-string ] unit-test + +{ t } [ "lol[[]]" rewrite-same-string ] unit-test +{ t } [ "![[]]" rewrite-same-string ] unit-test +{ t } [ "lol[[abc]]" rewrite-same-string ] unit-test +{ t } [ "![[abc]]" rewrite-same-string ] unit-test +{ t } [ "lol[==[]==]" rewrite-same-string ] unit-test +{ t } [ "![==[]==]" rewrite-same-string ] unit-test +{ t } [ "lol[==[abc]==]" rewrite-same-string ] unit-test +{ t } [ "![==[abc]==]" rewrite-same-string ] unit-test \ No newline at end of file diff --git a/core/modern/slices/slices.factor b/core/modern/slices/slices.factor index 5e8b7d8624..f716c79e9e 100644 --- a/core/modern/slices/slices.factor +++ b/core/modern/slices/slices.factor @@ -196,4 +196,3 @@ ERROR: subseq-expected-but-got-eof n string expected ; dup length 1 = [ -1 modify-to [ 1 - ] 2dip ] unless ; -