From 13f553b2846a213466cc1a8ffb09cd76ded00632 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Sun, 29 Mar 2009 20:29:38 -0500 Subject: [PATCH 1/2] Fixing farkup's parsing of [aaa] --- basis/farkup/farkup-tests.factor | 2 +- basis/farkup/farkup.factor | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/basis/farkup/farkup-tests.factor b/basis/farkup/farkup-tests.factor index 7cae523efb..abee7194a2 100644 --- a/basis/farkup/farkup-tests.factor +++ b/basis/farkup/farkup-tests.factor @@ -182,7 +182,7 @@ link-no-follow? off [ "
foo|bar
" ] [ "|foo\\|bar|" convert-farkup ] unit-test [ "

" ] [ "\\" convert-farkup ] unit-test -! [ "

[abc]

" ] [ "[abc]" convert-farkup ] unit-test +[ "

[abc]

" ] [ "[abc]" convert-farkup ] unit-test : random-markup ( -- string ) 10 [ diff --git a/basis/farkup/farkup.factor b/basis/farkup/farkup.factor index 41c6c4aa00..c400457c0b 100644 --- a/basis/farkup/farkup.factor +++ b/basis/farkup/farkup.factor @@ -121,7 +121,7 @@ DEFER: (parse-paragraph) ] if ] if ; -: take-until ( state delimiter -- string/f state' ) +: take-until ( state delimiter -- string state'/f ) V{ } clone (take-until) ; : count= ( string -- n ) @@ -186,11 +186,12 @@ DEFER: (parse-paragraph) : parse-code ( state -- state' item ) dup 1 look CHAR: [ = - [ unclip-slice make-paragraph ] [ - "{" take-until - [ rest ] dip - "}]" take-until - [ code boa ] dip swap + [ take-line make-paragraph ] [ + dup "{" take-until [ + [ nip rest ] dip + "}]" take-until + [ code boa ] dip swap + ] [ drop take-line make-paragraph ] if* ] if ; : parse-item ( state -- state' item ) From 5a903d7bcd935efab6134f74e60a845ed13346cb Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 29 Mar 2009 22:46:27 -0500 Subject: [PATCH 2/2] Fix a bug in CONSTANT: -- it wasn't calling reset-word --- core/syntax/syntax.factor | 2 +- core/words/alias/alias-tests.factor | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 core/words/alias/alias-tests.factor diff --git a/core/syntax/syntax.factor b/core/syntax/syntax.factor index bcf9decdf3..cb5cdfd5ac 100644 --- a/core/syntax/syntax.factor +++ b/core/syntax/syntax.factor @@ -138,7 +138,7 @@ IN: bootstrap.syntax ] define-core-syntax "CONSTANT:" [ - CREATE scan-object define-constant + CREATE-WORD scan-object define-constant ] define-core-syntax ":" [ diff --git a/core/words/alias/alias-tests.factor b/core/words/alias/alias-tests.factor new file mode 100644 index 0000000000..0278a4d4b9 --- /dev/null +++ b/core/words/alias/alias-tests.factor @@ -0,0 +1,6 @@ +USING: math eval tools.test effects ; +IN: words.alias.tests + +ALIAS: foo + +[ ] [ "IN: words.alias.tests CONSTANT: foo 5" eval ] unit-test +[ (( -- value )) ] [ \ foo stack-effect ] unit-test \ No newline at end of file