guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sxml-match bad pattern syntax


From: Thien-Thi Nguyen
Subject: sxml-match bad pattern syntax
Date: Tue, 28 Dec 2021 01:21:31 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

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.
#!/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")
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: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]