diff options
-rw-r--r-- | share/txr/stdlib/match.tl | 17 | ||||
-rw-r--r-- | txr.1 | 9 |
2 files changed, 20 insertions, 6 deletions
diff --git a/share/txr/stdlib/match.tl b/share/txr/stdlib/match.tl index df143dac..dca0ebf9 100644 --- a/share/txr/stdlib/match.tl +++ b/share/txr/stdlib/match.tl @@ -989,11 +989,9 @@ (defun transform-qquote (syn) (match-case syn - ((sys:hash-lit @props . @(coll (@key @val))) - (if props - (error "~s: only equal hash tables supported" syn) - ^@(hash ,*(zip [mapcar transform-qquote key] - [mapcar transform-qquote val])))) + ((sys:hash-lit nil . @(coll (@key @val))) + ^@(hash ,*(zip [mapcar transform-qquote key] + [mapcar transform-qquote val]))) ((sys:struct-lit @type . @args) ^@(struct ,(transform-qquote type) ,*[mapcar transform-qquote args])) @@ -1003,6 +1001,15 @@ ((sys:unquote @pat) (if (symbolp pat) ^(sys:var ,pat) ^(sys:expr ,pat))) + ((sys:hash-lit @(have) . @nil) + (compile-error *match-form* + "only equal hash tables supported")) + ((@(or sys:qquote) . @nil) + (compile-error *match-form* + "pattern-matching quasiquote doesn't support nesting")) + ((sys:splice . @nil) + (compile-error *match-form* + "pattern-matching quasiquote doesn't support splicing")) ((@ca . @cd) (cons (transform-qquote ca) (transform-qquote cd))) (@else else))) @@ -41361,11 +41361,18 @@ A JSON hash quasiquote is translated into .onom exactly like a hash. .meIP >> ( car . << cdr ) -Tree structure is translated according ot the +Tree structure is translated according to the .mono .meti <> ([ car ] . <> [ cdr ]) .onom pattern: it is recursively examined for translations. +.meIP >> ^ nested-qq-syntax +A nested quasiquote pattern is diagnosed as an error. +.meIP >> ,* expr +Splicing syntax is diagnosed as an error. +.meIP >> ~* expr +Splicing JSON syntax is diagnosed as an error inside a JSON quasiliteral. +.meIP >> ~* expr .meIP < obj Any other quasiquoted object is left untranslated. .RE |