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