core: Add TH{ for making assoc tuples.

See #1449.
https://github.com/factor/factor/issues/1449
char-rename
Doug Coleman 2017-05-30 20:14:29 -05:00
parent f3bbc30c8a
commit e93d8f82bc
3 changed files with 12 additions and 0 deletions

View File

@ -48,6 +48,7 @@ IN: bootstrap.syntax
"final"
"SLOT:"
"T{"
"TH{"
"UNION:"
"INTERSECTION:"
"USE:"

View File

@ -115,5 +115,15 @@ M: tuple-class boa>object
[ bad-literal-tuple ]
} case ;
: parse-tuple-hash-literal-slots ( class slots -- tuple )
scan-token {
{ "{" [ 2dup parse-slot-values assoc>object ] }
{ "}" [ drop new ] }
[ bad-literal-tuple ]
} case ;
: parse-tuple-literal ( -- tuple )
scan-word dup all-slots parse-tuple-literal-slots ;
: parse-tuple-hash-literal ( -- tuple )
scan-word dup all-slots parse-tuple-hash-literal-slots ;

View File

@ -105,6 +105,7 @@ IN: bootstrap.syntax
"BV{" [ \ } [ >byte-vector ] parse-literal ] define-core-syntax
"H{" [ \ } [ parse-hashtable ] parse-literal ] define-core-syntax
"T{" [ parse-tuple-literal suffix! ] define-core-syntax
"TH{" [ parse-tuple-hash-literal suffix! ] define-core-syntax
"W{" [ \ } [ first <wrapper> ] parse-literal ] define-core-syntax
"HS{" [ \ } [ >hash-set ] parse-literal ] define-core-syntax