unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: nalaginrut <nalaginrut@gmail.com>
To: guile-devel <guile-devel@gnu.org>
Subject: Re: can't use variable in sxml-match?
Date: Fri, 20 May 2011 10:26:48 +0800	[thread overview]
Message-ID: <1305858408.1981.26.camel@Renee-desktop> (raw)
In-Reply-To: <1305853596.1981.13.camel@Renee-desktop>

Sorry, there's a typo caused huge misunderstand in IRC.
Let me fix my letter:
================Begin=================
    (sxml-match
     cl
     [(http://www.w3.org/2005/Atom:content
       (@ (type ,tv)) ,cv)
        ...do something...
     [,otherwise #f])
===============End==================
As you see, I must write "content" with the namespace for some reason.
But I want a more generic solution ,or I must change source code when
namespace changes. Like:
===============Begin===============
(lambda (mypattern)
(sxml-match
  cl
   [(my-pattern  
      (@ (type ,tv)) ,cv)
     ...............
===============End===============

I can't substitute 'http://www.w3.org/2005/Atom:content by a variable,
say ,mypattern. It spews a lot of error message.

And the error message like these:
====================Begin===============
key sxml-match-error, throw_args (#f "bad pattern syntax (not an element
pattern)" (#(syntax-object sxml-match ((top) #(ribcage () () ())
#(ribcage #(s) #((top)) #("i344")) #(ribcage () () ()) #(ribcage #(msg
exp sub) #((top) (top) (top)) #("i339" "i340" "i341")) #(ribcage
#(sxml-match-syntax-error ellipsis? literal? keyword? extract-cata-fun
add-pat-var add-cata-def process-cata-exp process-cata-defs
cata-defs->pvar-lst process-output-action compile-element-pat
compile-end-element compile-attr-list compile-item-list
compile-dotted-pattern-list compile-item) #((top) (top) (top) (top)
(top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top)
(top)) #("i302" "i303" "i304" "i305" "i306" "i307" "i308" "i309" "i310"
"i311" "i312" "i313" "i314" "i315" "i316" "i317" "i318")) #(ribcage ()
() ()) #(ribcage #(stx) #((top)) #("i301"))) (hygiene sxml match))
#(syntax-object (#(syntax-object compile-clause ((m266 top) #(ribcage ()
() ()) shift #(ribcage #(dummy exp cata-fun clause0 clause) #((m2252
top) (top) (top) (top) (top)) #("i2266" "i2267" "i2268" "i2269"
"i2270")) #(ribcage () () ()) #(ribcage #(x) #((m2252 top)) #("i2254")))
(hygiene sxml match)) #(syntax-object (((unquote-splicing (string-append
ns "content")) (@ (type (unquote tv))) (unquote cv)) (begin (if tv (set!
type tv)) (if cv (set! content cv)))) ((top) #(ribcage () () ())
#(ribcage () () ()) #(ribcage #(exp) #((m261 top)) #("i265")) #(ribcage
#(cfun) #((m261 top)) #("i262")) #(ribcage () () ()) #(ribcage () () ())
#(ribcage () () ()) #(ribcage #(content) #((top)) #("i259")) #(ribcage
() () ()) #(ribcage #(type) #((top)) #("i257")) #(ribcage () () ())
#(ribcage #(title) #((top)) #("i255")) #(ribcage () () ()) #(ribcage
#(author-name) #((top)) #("i253")) #(ribcage () () ()) #(ribcage #(feed)
#((top)) #("i251")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage
#(sxml) #((top)) #("i249"))) (hygiene guile-user)) #(syntax-object exp
((m261 top) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(exp)
#((m261 top)) #("i265")) #(ribcage #(cfun) #((m261 top)) #("i262"))
#(ribcage () () ()) shift #(ribcage #(dummy val clause0 clause) #((m2277
top) (top) (top) (top)) #("i2282" "i2283" "i2284" "i2285")) #(ribcage ()
() ()) #(ribcage #(x) #((m2277 top)) #("i2279"))) (hygiene sxml match))
#(syntax-object cfun ((m261 top) #(ribcage () () ()) #(ribcage () () ())
#(ribcage #(exp) #((m261 top)) #("i265")) #(ribcage #(cfun) #((m261
top)) #("i262")) #(ribcage () () ()) shift #(ribcage #(dummy val clause0
clause) #((m2277 top) (top) (top) (top)) #("i2282" "i2283" "i2284"
"i2285")) #(ribcage () () ()) #(ribcage #(x) #((m2277 top)) #("i2279")))
(hygiene sxml match)) (#(syntax-object lambda ((m266 top) #(ribcage ()
() ()) shift #(ribcage #(dummy exp cata-fun clause0 clause) #((m2252
top) (top) (top) (top) (top)) #("i2266" "i2267" "i2268" "i2269"
"i2270")) #(ribcage () () ()) #(ribcage #(x) #((m2252 top)) #("i2254")))
(hygiene sxml match)) () (#(syntax-object call-with-values ((m266 top)
#(ribcage () () ()) shift #(ribcage #(dummy exp cata-fun clause0 clause)
#((m2252 top) (top) (top) (top) (top)) #("i2266" "i2267" "i2268" "i2269"
"i2270")) #(ribcage () () ()) #(ribcage #(x) #((m2252 top)) #("i2254")))
(hygiene sxml match)) (#(syntax-object lambda ((m266 top) #(ribcage ()
() ()) shift #(ribcage #(dummy exp cata-fun clause0 clause) #((m2252
top) (top) (top) (top) (top)) #("i2266" "i2267" "i2268" "i2269"
"i2270")) #(ribcage () () ()) #(ribcage #(x) #((m2252 top)) #("i2254")))
(hygiene sxml match)) () (#(syntax-object sxml-match1 ((m266 top)
#(ribcage () () ()) shift #(ribcage #(dummy exp cata-fun clause0 clause)
#((m2252 top) (top) (top) (top) (top)) #("i2266" "i2267" "i2268" "i2269"
"i2270")) #(ribcage () () ()) #(ribcage #(x) #((m2252 top)) #("i2254")))
(hygiene sxml match)) #(syntax-object exp ((m261 top) #(ribcage () ()
()) #(ribcage () () ()) #(ribcage #(exp) #((m261 top)) #("i265"))
#(ribcage #(cfun) #((m261 top)) #("i262")) #(ribcage () () ()) shift
#(ribcage #(dummy val clause0 clause) #((m2277 top) (top) (top) (top))
#("i2282" "i2283" "i2284" "i2285")) #(ribcage () () ()) #(ribcage #(x)
#((m2277 top)) #("i2279"))) (hygiene sxml match)) #(syntax-object cfun
((m261 top) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(exp)
#((m261 top)) #("i265")) #(ribcage #(cfun) #((m261 top)) #("i262"))
#(ribcage () () ()) shift #(ribcage #(dummy val clause0 clause) #((m2277
top) (top) (top) (top)) #("i2282" "i2283" "i2284" "i2285")) #(ribcage ()
() ()) #(ribcage #(x) #((m2277 top)) #("i2279"))) (hygiene sxml match))
#(syntax-object ((unquote otherwise) #f) ((top) #(ribcage () () ())
#(ribcage () () ()) #(ribcage #(exp) #((m261 top)) #("i265")) #(ribcage
#(cfun) #((m261 top)) #("i262")) #(ribcage () () ()) #(ribcage () () ())
#(ribcage () () ()) #(ribcage #(content) #((top)) #("i259")) #(ribcage
() () ()) #(ribcage #(type) #((top)) #("i257")) #(ribcage () () ())
#(ribcage #(title) #((top)) #("i255")) #(ribcage () () ()) #(ribcage
#(author-name) #((top)) #("i253")) #(ribcage () () ()) #(ribcage #(feed)
#((top)) #("i251")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage
#(sxml) #((top)) #("i249"))) (hygiene guile-user)))) #(syntax-object
escape ((m266 top) #(ribcage () () ()) shift #(ribcage #(dummy exp
cata-fun clause0 clause) #((m2252 top) (top) (top) (top) (top))
#("i2266" "i2267" "i2268" "i2269" "i2270")) #(ribcage () () ())
#(ribcage #(x) #((m2252 top)) #("i2254"))) (hygiene sxml match)))))
((#f) shift #(ribcage () () ()) #(ribcage #(escape) #((m266 top))
#("i270")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage () () ()))
(hygiene guile-user))) (#(syntax-object (unquote-splicing (string-append
ns "content")) ((#f top) shift #(ribcage () () ()) #(ribcage #(escape)
#((m266 top)) #("i270")) #(ribcage () () ()) #(ribcage () () ())
#(ribcage () () ()) #(ribcage () () ()) #(ribcage () () ()) #(ribcage
#(exp) #((m261 top)) #("i265")) #(ribcage #(cfun) #((m261 top))
#("i262")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage () () ())
#(ribcage #(content) #((top)) #("i259")) #(ribcage () () ()) #(ribcage
#(type) #((top)) #("i257")) #(ribcage () () ()) #(ribcage #(title)
#((top)) #("i255")) #(ribcage () () ()) #(ribcage #(author-name)
#((top)) #("i253")) #(ribcage () () ()) #(ribcage #(feed) #((top))
#("i251")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(sxml)
#((top)) #("i249"))) (hygiene guile-user)) #(syntax-object (@ (type
(unquote tv))) ((#f top) shift #(ribcage () () ()) #(ribcage #(escape)
#((m266 top)) #("i270")) #(ribcage () () ()) #(ribcage () () ())
#(ribcage () () ()) #(ribcage () () ()) #(ribcage () () ()) #(ribcage
#(exp) #((m261 top)) #("i265")) #(ribcage #(cfun) #((m261 top))
#("i262")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage () () ())
#(ribcage #(content) #((top)) #("i259")) #(ribcage () () ()) #(ribcage
#(type) #((top)) #("i257")) #(ribcage () () ()) #(ribcage #(title)
#((top)) #("i255")) #(ribcage () () ()) #(ribcage #(author-name)
#((top)) #("i253")) #(ribcage () () ()) #(ribcage #(feed) #((top))
#("i251")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(sxml)
#((top)) #("i249"))) (hygiene guile-user)) #(syntax-object (unquote cv)
((#f top) shift #(ribcage () () ()) #(ribcage #(escape) #((m266 top))
#("i270")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage () () ())
#(ribcage () () ()) #(ribcage () () ()) #(ribcage #(exp) #((m261 top))
#("i265")) #(ribcage #(cfun) #((m261 top)) #("i262")) #(ribcage () ()
()) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(content)
#((top)) #("i259")) #(ribcage () () ()) #(ribcage #(type) #((top))
#("i257")) #(ribcage () () ()) #(ribcage #(title) #((top)) #("i255"))
#(ribcage () () ()) #(ribcage #(author-name) #((top)) #("i253"))
#(ribcage () () ()) #(ribcage #(feed) #((top)) #("i251")) #(ribcage ()
() ()) #(ribcage () () ()) #(ribcage #(sxml) #((top)) #("i249")))
(hygiene guile-user))))
====================End===================


-- 
GNU Powered it
GPL Protected it
GOD Blessed it

HFG - NalaGinrut

--hacker key--
v4sw7CUSMhw6ln6pr8OSFck4ma9u8MLSOFw3WDXGm7g/l8Li6e7t4TNGSb8AGORTDLMen6g6RASZOGCHPa28s1MIr4p-x hackerkey.com
---end key---




  reply	other threads:[~2011-05-20  2:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-20  1:06 can't use variable in sxml-match? nalaginrut
2011-05-20  2:26 ` nalaginrut [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-05-20  3:55 Ian Price
2011-05-20  5:17 ` nalaginrut
2011-05-31 22:01 ` Ludovic Courtès
2011-05-31 23:56   ` nalaginrut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1305858408.1981.26.camel@Renee-desktop \
    --to=nalaginrut@gmail.com \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).