modern: re-add foo\ words for postpone\, SYNTAX\ etc.

locals-and-roots
Doug Coleman 2016-06-05 15:47:20 -07:00
parent 2807239af7
commit e89f1b3521
3 changed files with 8 additions and 11 deletions

View File

@ -97,3 +97,7 @@ in: modern.tests
{ 1 } [ ":foo" string>literals length ] unit-test
{ 1 } [ "( :integer )" string>literals length ] unit-test
{ 1 } [ "postpone\\ main:" string>literals length ] unit-test
{ 1 } [ "char: \\!" string>literals length ] unit-test

View File

@ -326,18 +326,11 @@ ERROR: colon-word-must-be-all-uppercase-or-lowercase n string word ;
dup { [ "!" sequence= ] [ "#!" sequence= ] } 1||
[ take-comment ] [ merge-slice-til-whitespace make-tag-literal ] if ;
! XXX: Allow foo\ or just \?
ERROR: backslash-expects-whitespace slice ;
: read-backslash ( n string slice -- n' string obj )
2over peek-from blank? [
! \ foo, M\ foo
dup length 1 > [
! M\ foo\
merge-slice-til-whitespace make-tag-literal
] [
! \
[ skip-blank-from slice-til-whitespace drop dup ] dip 1 cut-slice* backslash-literal make-delimited-literal
] if
] [
! M\N
merge-slice-til-whitespace make-tag-literal

View File

@ -80,10 +80,10 @@ in: project-euler.011
length iota [ 0 <repetition> ] map
] keep [ <reversed> append ] 2map ;
: diagonal/ ( -- matrix )
: diagonal-one ( -- matrix )
horizontal reverse pad-front pad-back flip ;
: diagonal\ ( -- matrix )
: diagonal-two ( -- matrix )
horizontal pad-front pad-back flip ;
: max-product ( matrix width -- n )
@ -94,7 +94,7 @@ PRIVATE>
: euler011 ( -- answer )
[
{ [ horizontal ] [ vertical ] [ diagonal/ ] [ diagonal\ ] }
{ [ horizontal ] [ vertical ] [ diagonal-one ] [ diagonal-two ] }
[ call( -- matrix ) 4 max-product , ] each
] { } make supremum ;