caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: David Thomas <david_hd@yahoo.com>
To: caml-list@yquem.inria.fr
Subject: Text.get/Text.search in labltk
Date: Sun, 24 Jul 2005 11:37:49 -0700 (PDT)	[thread overview]
Message-ID: <20050724183749.34099.qmail@web30506.mail.mud.yahoo.com> (raw)

I've run into an interesting issue.  There's a bug
somewhere, but I've no clue whether it's in my code or
the library.

The code below *should* (I think) print the second
word in the text box along with it's location. 
However, when I run it with "foo bar" in the text box,
I get "(1, 4) -> foo" and I can't figure out why.  If
I run it with "foo    bar" I get "(1, 7) -> foo" so it
definately seems to be finding the location of the
second word, but not getting it correctly.  I've been
fussing with it, and can't figure out what I'm doing
wrong, if anything.  Anyone have any notions?


The code:
let rec printwords () =
        match Text.search
                ~switches:[`Regexp]
                ~pattern:"[a-zA-Z]"
                ~start:(`Atxy (0, 0), [`Wordend; `Char
1])
                text
        with `Linechar (l, c) ->
                Printf.printf "(%d, %d) -> %s\n%!"
                        l c
                        (Text.get
                                ~start:(`Atxy (l+1,
c), [])
                                ~stop:(`Atxy (l, c),
[`Lineend])
                                text
                        );;







		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 


             reply	other threads:[~2005-07-24 18:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-24 18:37 David Thomas [this message]
2005-07-25  2:16 David Thomas

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=20050724183749.34099.qmail@web30506.mail.mud.yahoo.com \
    --to=david_hd@yahoo.com \
    --cc=caml-list@yquem.inria.fr \
    /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).