diff --git a/core/bootstrap/syntax.factor b/core/bootstrap/syntax.factor index eccd30c4a1..f2fef33f7b 100644 --- a/core/bootstrap/syntax.factor +++ b/core/bootstrap/syntax.factor @@ -48,6 +48,7 @@ IN: bootstrap.syntax "final" "SLOT:" "T{" + "TH{" "UNION:" "INTERSECTION:" "USE:" diff --git a/core/classes/tuple/parser/parser.factor b/core/classes/tuple/parser/parser.factor index 202214770b..90a34ae860 100644 --- a/core/classes/tuple/parser/parser.factor +++ b/core/classes/tuple/parser/parser.factor @@ -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 ; diff --git a/core/syntax/syntax.factor b/core/syntax/syntax.factor index a0908b7040..bd5baa3c40 100644 --- a/core/syntax/syntax.factor +++ b/core/syntax/syntax.factor @@ -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 ] parse-literal ] define-core-syntax "HS{" [ \ } [ >hash-set ] parse-literal ] define-core-syntax