Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
camlp4 help
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-07-20 (07:37)
From: Hendrik Tews <tews@t...>
Subject: Re: [Caml-list] camlp4 help
Pietro Abate <> writes:

   However, for some reasons, it doesn't work as expected. The function test
   correctly recognizes the string "-----" but then I get a Stream.Error from
   nowhere ( guess from Grammar.Entry.of_parser ) and the parsin fails...
Your test function is _not_ an oracle that guards an camlp4
grammar rule. Instead test is kind of a parsing function itself.
Consequently, if parsing succeeds you have to discard some

let test rex strm =
  match Stream.peek strm with
    | Some(_,s) when s =~ rex -> 
	prerr_endline "!!!!" ; 
	Stream.junk strm
    | _ -> raise Stream.Failure

   #ocamlfind ocamlc -package str -c -pp "camlp4o -I . pa_extend.cmo q_MLast.cmo " -I /usr/lib/ocaml/3.08.3/camlp4
I've never used ocamlfind, but why not

ocamlfind ocamlc -package str -c -pp "camlp4o pa_extend.cmo q_MLast.cmo " \
        -I +camlp4

(deleted "-I ." and use "-I +camlp4") ?