caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Jérôme Vouillon" <vouillon@pps.univ-paris-diderot.fr>
To: Tom Ridge <tom.j.ridge+list@googlemail.com>,
	caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] ocaml-re library, partial match semantics
Date: Wed, 01 Oct 2014 13:53:10 +0200	[thread overview]
Message-ID: <542BEB26.4060209@pps.univ-paris-diderot.fr> (raw)
In-Reply-To: <CABooLwOYnSMYf2cuw2x3i4nwbhjKPw9gHduqdcAGFf87OsNddQ@mail.gmail.com>

Hi,

On 09/30/2014 14:35, Tom Ridge wrote:
> I am using the ocaml-re library
> 
> https://github.com/ocaml/ocaml-re
> 
> I have the following code:
> 
> open Re;
> 
> let a = char 'a'
> let b = char 'b'
> 
> let re = seq[a;b] |> compile
[...]
> let _ = assert (exec_partial re "a" = `Mismatch)
> 
> I was expecting that the exec_partial in the final line would return
> `Partial, indicating that a prefix of a match was found. However, a
> `Mismatch was returned instead. What is the meaning/behaviour of
> exec_partial? Can I use it to perform a partial match?

There was a bug in exec_partial, which is fixed in version 1.2.2.
Now, you get the correct result:

# exec_partial re "a";;
- : [ `Full | `Mismatch | `Partial ] = `Partial

-- Jérôme

      reply	other threads:[~2014-10-01 11:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-30 12:35 Tom Ridge
2014-10-01 11:53 ` Jérôme Vouillon [this message]

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

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

  git send-email \
    --in-reply-to=542BEB26.4060209@pps.univ-paris-diderot.fr \
    --to=vouillon@pps.univ-paris-diderot.fr \
    --cc=caml-list@inria.fr \
    --cc=tom.j.ridge+list@googlemail.com \
    /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 NNTP newsgroup(s).