Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] backslashes in ocamllex
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alain.Frisch@e...
Subject: Re: [Caml-list] backslashes in ocamllex
On Mon, 6 Oct 2003, Christian Lindig wrote:

> and string = parse (* lexer for strings *)
>     eof     -> { fun buf -> error "EOF in string" }
>   | '\\' _  -> { fun buf -> let c = getchar lexbuf 1 in
>...
>   | _       -> { fun buf -> string lexbuf (Buffer.add_string (get lexbuf)
>   | "'"     -> { fun buf -> Buffer.contents buf } (* return string *)

Note that the new ocamllex in OCaml 3.07 allows rules to have extra
arguments. It is both more readable and more efficient (no closure is
built for each action) than explicit abstractions in actions.

(Btw the CHANGES file fails to mention this new feature.)


-- Alain

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners