caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Str.string_match raising Invalid_argument "String.sub" in gc
@ 2001-08-22 18:53 neale-caml
  2001-08-22 19:18 ` Alain Frisch
  2001-08-22 20:23 ` Markus Mottl
  0 siblings, 2 replies; 40+ messages in thread
From: neale-caml @ 2001-08-22 18:53 UTC (permalink / raw)
  To: caml-list

Hi, I'm converting over some examples from the Perl cookbook to learn
OCaml and help with the PLEAC project <http://pleac.sourceforge.net/>,
and I'm running into some strange behavior with the Str structure; I
think it's something to do with garbage collection.

  # let rec f l =
      let sep = Str.regexp "^[ \t\n]*\\(.+\\)" in
      match l with
      | [] -> []
      | [""] -> []
      | s :: rest -> if (Str.string_match sep s 0) then
          let foo = print_string ("match " ^ Str.matched_group 1 s ^ "\n") in
          (Str.matched_group 1 s) :: (f rest)
      else
          let foo = print_string "nomatch\n" in
          (f rest);;
  val f : string list -> string list = <fun>
  # f ["  arf"];;
  match arf
  - : string list = ["arf"]
  # f ["  arf";  "barf"];;
  match arf
  match barf
  - : string list = ["  ar"; "barf"]
  # f [" arf"; " barf"];;
  match arf
  match barf
  Uncaught exception: Invalid_argument "String.sub".

First question: why is
  f ["  arf"] = ["arf"]
while
  f ["  arf"; "barf"] = ["  ar"; "barf"]
?  I don't think I've entered any code which should modify the string
after it's been matched.

Second question: What is causing the Invalid_argument exception?

Thanks in advance for any assistance,

Neale
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 40+ messages in thread
* Re: [Caml-list] standard regex package
@ 2001-08-24 18:46 Arturo Borquez
  0 siblings, 0 replies; 40+ messages in thread
From: Arturo Borquez @ 2001-08-24 18:46 UTC (permalink / raw)
  To: miles; +Cc: caml-list

On Fri, 24 August 2001, Miles Egan wrote:

> 
> I'd be happy to do it, but I'm afraid it's a bit beyond my abilities.  What do
> you think of Markus' suggestion of simply keeping the current str module and
> adding a new pcre module?
> 
> -- 
> miles
> 
I believe that the best choice is what Markus proposed
that is to put PCRE as a different module and deprecate
Str (or not do any further development with Str).

Arturo.


Find the best deals on the web at AltaVista Shopping!
http://www.shopping.altavista.com
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

end of thread, other threads:[~2001-08-30  8:40 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-22 18:53 [Caml-list] Str.string_match raising Invalid_argument "String.sub" in gc neale-caml
2001-08-22 19:18 ` Alain Frisch
2001-08-22 20:41   ` Neale Pickett
2001-08-23 10:21     ` Frank Atanassow
2001-08-23 16:06       ` Neale Pickett
2001-08-23 16:25         ` Alain Frisch
2001-08-23 18:14           ` Neale Pickett
2001-08-22 20:23 ` Markus Mottl
2001-08-22 20:31   ` Miles Egan
2001-08-22 20:52     ` Michael Leary
2001-08-23  5:36       ` Jeremy Fincher
2001-08-22 22:06     ` Nicolas George
2001-08-23  7:08       ` [Caml-list] PCRE as standard (Was: Str.string_match raising Invalid_argument...) Florian Hars
2001-08-23 17:31       ` [Caml-list] Str.string_match raising Invalid_argument "String.sub" in gc Brian Rogoff
2001-08-23 18:08         ` [Caml-list] standard regex package Miles Egan
2001-08-23 19:28           ` Brian Rogoff
2001-08-23 19:49             ` Miles Egan
2001-08-23 19:51             ` Gerd Stolpmann
2001-08-23 21:12               ` Brian Rogoff
2001-08-23 21:27               ` Benjamin C. Pierce
2001-08-23 21:49                 ` Gerd Stolpmann
2001-08-23 22:11                   ` Miles Egan
2001-08-23 23:55                     ` Gerd Stolpmann
2001-08-24  9:03                       ` Claudio Sacerdoti Coen
2001-08-24  9:26                       ` Sven
2001-08-27 15:46                         ` [Caml-list] Package dependencies [Was: standard regex package] Ian Zimmerman
2001-08-27 20:50                           ` Gerd Stolpmann
2001-08-24  9:23                   ` [Caml-list] standard regex package Sven
2001-08-27 15:54                     ` Ian Zimmerman
2001-08-30  8:41                       ` Sven
2001-08-23 21:06             ` RE : " Lionel Fourquaux
2001-08-24  9:23               ` [Caml-list] dynamic loading and OS interface Xavier Leroy
2001-08-27 15:16             ` [Caml-list] standard regex package Ian Zimmerman
2001-08-27 15:35               ` Brian Rogoff
2001-08-24  9:13           ` Xavier Leroy
2001-08-24 10:16             ` Markus Mottl
2001-08-24 16:49             ` Miles Egan
     [not found]   ` <w533d6j1vxn.fsf@woozle.org>
     [not found]     ` <20010823112653.A7085@chopin.ai.univie.ac.at>
     [not found]       ` <w5366be7fd0.fsf_-_@woozle.org>
2001-08-23 20:01         ` [Caml-list] Re: [OFF-LIST] Str.string_match raising Invalid_argument "String.sub" in gc Markus Mottl
2001-08-23 20:31           ` Patrick M Doane
2001-08-24 18:46 [Caml-list] standard regex package Arturo Borquez

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