From 51b5973b0e356392462aa1385a36e8925dafb863 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Thu, 5 Feb 2009 21:26:40 -0600 Subject: [PATCH] Documenting XML interpolation inverse --- basis/xml/syntax/syntax-docs.factor | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/basis/xml/syntax/syntax-docs.factor b/basis/xml/syntax/syntax-docs.factor index 19f059078b..34473fecfc 100644 --- a/basis/xml/syntax/syntax-docs.factor +++ b/basis/xml/syntax/syntax-docs.factor @@ -84,7 +84,17 @@ $nl word=<-word-> /> XML> pprint-xml ] "} {" -"} } ; +"} } +"XML interpolation can also be used, in conjunction with " { $vocab-link "inverse" } " in pattern matching. For example:" +{ $example {" USING: sequences xml.syntax inverse ; +: dispatch ( xml -- string ) + { + { [ [XML <-> XML] ] [ "a" prepend ] } + { [ [XML <-> XML] ] [ "b" prepend ] } + { [ [XML XML] ] [ "yes" ] } + { [ [XML /> XML] ] [ "no" prepend ] } + } switch ; +[XML pple XML] dispatch write "} "apple" } ; HELP: XML-NS: { $syntax "XML-NS: name http://url" }