scsh-users
[Top] [All Lists]

regexp subexpression matching

To: scsh@martigny.ai.mit.edu
Subject: regexp subexpression matching
From: shivers@ai.mit.edu (Olin Shivers)
Date: 27 Dec 1996 21:48:07 -0500
Organization: Artificial Intelligence Lab, MIT
Reply-to: shivers@ai.mit.edu
    From: Bruno.Verlyck@inria.fr
    Subject: Re: scsh bug ?

    I see no accessible way (no module exporting a function) to know if
    sub-match 1 has matched nothing.  Is there another approved way I can't
    see, or is it time to extend scsh-regexp-interface ?

I fixed the C underpinnings to make this work in the last release, and then
didn't export it to Scheme. I think the right thing to do would be to re-define
match:start and match:end to return false when the subexp doesn't match. I've
changed the two functions in re.scm to be

(define (match:start match . maybe-index)
  (vector-ref (regexp-match:start match)
              (:optional maybe-index 0)))

(define (match:end match . maybe-index)
  (vector-ref (regexp-match:end match)
              (:optional maybe-index 0)))

It's in the manual and will be the next release.
    -Olin

<Prev in Thread] Current Thread [Next in Thread>
  • scsh bug ?, Brian D . Carlstrom
    • regexp subexpression matching, Olin Shivers <=