From 42d6d59993fc099447e024c8536953530c97cbe7 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 20 Jun 2016 13:40:01 -0700 Subject: [PATCH] modern: more fixes for PRIVATE< PRIVATE> etc. --- core/modern/modern-tests.factor | 4 ++++ core/modern/modern.factor | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/core/modern/modern-tests.factor b/core/modern/modern-tests.factor index 23bf0fc257..bc58123ab9 100644 --- a/core/modern/modern-tests.factor +++ b/core/modern/modern-tests.factor @@ -104,3 +104,7 @@ in: modern.tests { 1 } [ "postpone\\ main:" string>literals length ] unit-test { 1 } [ "char: \\!" string>literals length ] unit-test + + +{ 1 } [ "HI< OMG: BYE< BYE> HI>" string>literals length ] unit-test +{ 1 } [ "HI< OMG: ; BYE< BYE> HI>" string>literals length ] unit-test \ No newline at end of file diff --git a/core/modern/modern.factor b/core/modern/modern.factor index 63caa2f350..f45c5952e4 100644 --- a/core/modern/modern.factor +++ b/core/modern/modern.factor @@ -204,6 +204,7 @@ ERROR: string-expected-got-eof n string ; delimiter >string >>delimiter tag delimiter payload 3array >>seq ; inline +ERROR: closing-delimiter-required opening-delimiter ; :: make-matched-literal ( payload closing tag opening-delimiter class -- literal ) class new tag >string >>tag @@ -213,6 +214,11 @@ ERROR: string-expected-got-eof n string ; dup single-matched-literal? [ closing dup [ tag>> ] when >>closing-tag ] when + ! 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 :: make-decorator-literal ( payload delimiter class -- literal ) @@ -367,13 +373,12 @@ ERROR: cannot-nest-upper-colon n string string' ; ERROR: closing-tag-required lexer tag ; :: read-upper-less-than ( lexer slice -- less-than/f ) - lexer peek-tag top-level-less-than? [ + lexer peek-tag top-level-colon? [ lexer slice roll-back-lexer f ] [ lexer slice [ - lexer slice scoped-less-than-name - [ but-last ">" append 1array ] [ ">" 1array ] if* lex-until - dup [ lexer slice >string closing-tag-required ] unless + lexer slice scoped-less-than-name but-last ">" append 1array lex-until + ! dup [ lexer slice >string closing-tag-required ] unless slice 1 cut-slice* less-than-literal make-matched-literal ] with-tag ] if ;