2008-12-12 02:00:23 -05:00
|
|
|
! (c) Joe Groff, see license for details
|
2009-05-03 18:23:14 -04:00
|
|
|
USING: accessors continuations kernel parser words quotations
|
2009-05-05 16:54:49 -04:00
|
|
|
combinators.smart vectors sequences fry ;
|
2008-12-09 02:13:26 -05:00
|
|
|
IN: literals
|
|
|
|
|
2009-05-05 16:54:49 -04:00
|
|
|
<PRIVATE
|
|
|
|
|
|
|
|
! Use def>> call so that CONSTANT:s defined in the same file can
|
|
|
|
! be called
|
|
|
|
|
|
|
|
: expand-literal ( seq obj -- seq' )
|
|
|
|
'[ _ dup word? [ def>> call ] when ] with-datastack ;
|
|
|
|
|
|
|
|
: expand-literals ( seq -- seq' )
|
|
|
|
[ [ { } ] dip expand-literal ] map concat ;
|
|
|
|
|
|
|
|
PRIVATE>
|
|
|
|
|
|
|
|
SYNTAX: $ scan-word expand-literal >vector ;
|
2009-03-21 02:27:50 -04:00
|
|
|
SYNTAX: $[ parse-quotation with-datastack >vector ;
|
2009-05-05 16:54:49 -04:00
|
|
|
SYNTAX: ${ \ } [ expand-literals ] parse-literal ;
|