English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
lex: including regex definitions from a separate file
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-11-19 (22:44)
From: Oliver Bandel <oliver@f...>
Subject: Re: [Caml-list] lex: including regex definitions from a separate file
Zitat von Sam Steingold <sds@gnu.org>:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I have several lexers in the same directory and I want them to share the
> regexp definitions.
> is there a way to put the regexp definitions in foo.mll and include them
>  in bar.mll?
[...]

You can't share the definitions, only the generated scanner-functions
and tables/tokens (but I never looked at these thingas in detail,
I normally only used the scanner functions).


It is possible to have more than one lexer definition
in a ocamllex-file. So, if you not necessarily need
all those seperated files, you can use one *.mll file
and throw in all scanner-definitions.

But be aware on possibly name-problems then,
if some scanner-definitions might have the same name.
As you then have all things in one compilation unit, you can't distinguish
function "token" from another function "token", so you may have to
rename your functions in the scanner.


Ciao,
   Oliver