caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Frank A. Christoph" <christo@nextsolution.co.jp>
To: "CAML List" <caml-list@inria.fr>
Subject: Stream parsers, again
Date: Tue, 1 Feb 2000 11:19:18 +0900	[thread overview]
Message-ID: <000001bf6c5a$be528a00$0150ebca@nextsolution.co.jp> (raw)

Regarding my previous message, I just figured out that it is actually quite
easy to get "midstream" counts. Define this:

let count = parser bp [< >] -> bp

and then you can insert it in critical places like the example I gave:

  parser [< e = p; i = count; e' = p' ? err i >] -> ...

BTW, it is nice that the error expression is itself lazily evaluated. I
think it is too restrictive that it needs to return a string rather than an
arbitrary type, but fortunately you can just raise an exception from within
the stream error exception itself:

  exception Err of int
  let err cnt = raise (Err cnt)

--fac




             reply	other threads:[~2000-02-02 15:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-01  2:19 Frank A. Christoph [this message]
2000-02-02 15:46 ` Daniel de Rauglaudre

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='000001bf6c5a$be528a00$0150ebca@nextsolution.co.jp' \
    --to=christo@nextsolution.co.jp \
    --cc=caml-list@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).