Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Hendrik Tews <tews@t...>
Subject: Re: [Caml-list] camlp4 help
Pietro Abate <Pietro.Abate@anu.edu.au> 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
tokens:

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 te.ml
   
I've never used ocamlfind, but why not

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

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

Bye,

Hendrik