Browse thread
[Caml-list] On ocamlyacc and ocamllex
[
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: | John Max Skaller <skaller@m...> |
| Subject: | Re: [Caml-list] On ocamlyacc and ocamllex |
Christian Lindig wrote:
> You can pass the map to the lexer such that it does not has to be
> global:
>
> rule token = parse
> eof { fun map -> P.EOF }
> | ws+ { fun map -> token lexbuf map }
> | tab { fun map -> tab lexbuf map; token lexbuf map }
> | nl { fun map -> nl lexbuf map ; token lexbuf map }
> | nl '#' { fun map -> line lexbuf map 0; token lexbuf map }
> ....
I use this technique, works fine. Pass an (OO style) object.
A bit boring writing 'fun map ->' in front of everything,
but it works.
--
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
New generation programming language Felix http://felix.sourceforge.net
Literate Programming tool Interscript
http://Interscript.sourceforge.net
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr