Browse thread
camlp4 char stream
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Pietro Abate <Pietro.Abate@a...> |
| Subject: | Re: [Caml-list] camlp4 char stream |
If I understand you problem correctly,
here there is a small example to parse string of the type
TEST ------ END
where ----- can be whatever you want.
http://caml.inria.fr/pub/ml-archives/caml-list/2005/07/244afe98fd8ddfb6aff6f0bcda52d9ac.en.html
read the thread further as you need to add Stream.junk strm to the
function test.
this way you can basically switch to an other parser (to parse "----" )
and get back to camlp4.
hope it helps.
:)
p
On Mon, Sep 12, 2005 at 07:39:35AM +0200, Christophe Raffalli wrote:
>
> OK, I found it (quote from your tutorial):
>
> let operator_rparen =
> Grammar.Entry.of_parser gram "operator_rparen"
> (fun strm ->
> match Stream.npeek 2 strm with
> | [("", s); ("", ")")] when is_operator s ->
> begin
> Stream.junk strm;
> Stream.junk strm;
> s
> end
> | _ -> raise Stream.Failure)
>
> OK, I read your tutorial, but did not get the point ... thks
>
> and what is the first member of the tuple ?
> Why is the second member a string and not a char ?
>
> >
> >See paragraph "Do it yourself" at
> >http://wwwtcs.inf.tu-dresden.de/~tews/ocamlp4/camlp4-undoc.html#power
> >
> >
> >
> >Martin
> >
> >--
> >Martin Jambon, PhD
> >http://martin.jambon.free.fr
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
--
++ Blog: http://blog.rsise.anu.edu.au/?q=pietro
++
++ "All great truths begin as blasphemies." -George Bernard Shaw
++ Please avoid sending me Word or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html