modern: better compound literals.

modern-harvey2
Doug Coleman 2017-12-03 22:47:44 -06:00
parent 57872a8a17
commit b14955365c
1 changed files with 8 additions and 11 deletions

View File

@ -340,12 +340,11 @@ DEFER: lex-factor-top*
"\"\\!:[{(]})<>\s\r\n" slice-til-either
lex-factor-top* ; inline
ERROR: compound-syntax-disallowed seq i obj ;
: check-for-compound-syntax ( seq -- seq' )
dup [ length 1 > ] find
[ compound-syntax-disallowed ] [ drop ] if* ;
ERROR: compound-syntax-disallowed n seq obj ;
: check-for-compound-syntax ( n/f seq obj -- n/f seq obj )
dup length 1 > [ compound-syntax-disallowed ] when ;
: check-next-compound ( n/f string -- n/f string ? )
: check-compound-loop ( n/f string -- n/f string ? )
[ ] [ peek-from ] [ previous-from ] 2tri
[ blank? ] bi@ or not ! no blanks between tokens
pick and ; ! and a valid index
@ -354,15 +353,13 @@ ERROR: compound-syntax-disallowed seq i obj ;
[
! Compound syntax loop
[
lex-factor-top
f like [ , ] when*
lex-factor-top f like [ , ] when*
! concatenated syntax ( a )[ a 1 + ]( b )
check-next-compound
check-compound-loop
] loop
] { } make
! check-for-compound-syntax
! concat
f like ;
check-for-compound-syntax
concat f like ;
: string>literals ( string -- sequence )
[ 0 ] dip [