bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#1518: `rx' making nested `or' forms in a `group' wrong


From: martin rudalics
Subject: bug#1518: `rx' making nested `or' forms in a `group' wrong
Date: Tue, 09 Dec 2008 19:19:52 +0100
User-agent: Thunderbird 2.0.0.16 (Windows/20080708)

> This one is wrong:
>
> (rx (seq (group "foo" (or (or "asdf" "lkjh") "zab")) "bar"))
> =>
> "\\(foo\\(?:asdf\\|lkjh\\)\\|zab\\)bar"

Just a wild guess - could you try with the following version of
rx-submatch?  I don't have the slightest idea how this is supposed to
work :-(

martin


(defun rx-submatch (form)
  "Parse and produce code from FORM, which is `(submatch ...)'."
  (rx-check form)
  (concat "\\("
          (if (and (listp (cdr form)) (listp (cadr form)))
              (mapconcat #'rx-form (cdr form) nil)
            (rx-group-if
             (mapconcat (lambda (x) (rx-form x ':)) (cdr form) nil)
             (and (memq rx-parent '(* t)) rx-parent)))
          "\\)"))







reply via email to

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