From 64ae7ff7f88a2049a75c9696d83aaa8250fb58b2 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 20 Jun 2016 16:23:59 -0700 Subject: [PATCH] modern: make string payloads >string after the fact. too early and they lose the position information. --- core/modern/modern.factor | 9 ++++++--- core/modern/out/out-tests.factor | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/modern/modern.factor b/core/modern/modern.factor index db8f02f4bc..f91e192eea 100644 --- a/core/modern/modern.factor +++ b/core/modern/modern.factor @@ -254,12 +254,14 @@ MACRO:: read-double-matched ( open-ch -- quot: ( lexer tag ch -- seq ) ) opening matching-delimiter-string :> needle lexer needle lex-til-string :> ( n'' string'' payload closing ) - payload >string closing tag but-last-slice opening double-matched-literal make-matched-literal + payload closing tag but-last-slice opening double-matched-literal make-matched-literal + [ >string ] change-payload ] } { open-ch [ tag 1 cut-slice* swap tag! 1 modify-to :> opening lexer [ 1 + ] change-n closestr2 lex-til-string :> ( n' string' payload closing ) - payload >string closing tag opening double-matched-literal make-matched-literal + payload closing tag opening double-matched-literal make-matched-literal + [ >string ] change-payload ] } [ [ tag openstr2 lexer ] dip long-opening-mismatch ] } case @@ -337,7 +339,8 @@ MACRO:: read-matched ( ch -- quot: ( lexer tag -- slice' ) ) n' [ n string string-expected-got-eof ] unless n n' 1 - string n' 1 - n' string - tag 1 cut-slice* dquote-literal make-matched-literal ; + tag 1 cut-slice* dquote-literal make-matched-literal + [ >string ] change-payload ; diff --git a/core/modern/out/out-tests.factor b/core/modern/out/out-tests.factor index c427736ade..185b7d8302 100644 --- a/core/modern/out/out-tests.factor +++ b/core/modern/out/out-tests.factor @@ -61,4 +61,5 @@ in: modern.out.tests { t } [ "<{ ptx-2op-instruction ptx-float-ftz }" rewrite-same-string ] unit-test { 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 \ No newline at end of file +{ 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