unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* sxml-match bad pattern syntax
@ 2021-12-28  6:21 Thien-Thi Nguyen
  2021-12-28  7:19 ` tomas
  0 siblings, 1 reply; 6+ messages in thread
From: Thien-Thi Nguyen @ 2021-12-28  6:21 UTC (permalink / raw)
  To: guile-user


[-- Attachment #1.1: Type: text/plain, Size: 328 bytes --]


In an effort to join the current millennium, i have started to
play w/ Guile 2.x's SXML facilities.  Good stuff!  I've run into
a problem, however, and hope i can get help resolving it here.

The following small program attempts to use ‘sxml-match’ to
remove an unwanted attribute from a (well-formed) SXML snippet.

[-- Attachment #1.2: UNBOGUS --]
[-- Type: text/plain, Size: 303 bytes --]

#!/usr/bin/guile -s
!#
(use-modules
 (sxml match))

(define (unbogus x)
  (sxml-match x
    ((a (@ . ,attrs) ...)
     `(a (@ ,@(delete '(shape "rect") attrs)) ...))))

(define bad '(a (@ (shape "rect") (href "foo.html")) "kid"))

(pk bad)

(pk (unbogus bad))
;; expect: (a (@ (href "foo.html")) "kid")

[-- Attachment #1.3: Type: text/plain, Size: 754 bytes --]


When i run it, i see it fail w/ error message:

 sxml/sxml-match.ss:342:31: Throw to key `sxml-match-error'
 with args `(#f "bad pattern syntax (symbol not allowed
 in this context)" [...]

(output folded and truncated).  To my untrained eye, the form
looks similar to the examples in Info node ‘(guile) sxml-match’
but evidently i am missing something.  What?

-- 
Thien-Thi Nguyen -----------------------------------------------
 (defun responsep (query)               ; (2021) Software Libero
   (pcase (context query)               ;       = Dissenso Etico
     (`(technical ,ml) (correctp ml))
     ...))                              748E A0E8 1CB8 A748 9BFA
--------------------------------------- 6CE4 6703 2224 4C80 7502


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 219 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-12-28 10:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-28  6:21 sxml-match bad pattern syntax Thien-Thi Nguyen
2021-12-28  7:19 ` tomas
2021-12-28  7:58   ` Thien-Thi Nguyen
2021-12-28  8:28     ` tomas
2021-12-28  9:21       ` Thien-Thi Nguyen
2021-12-28 10:06         ` tomas

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).