caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* lex: including regex definitions from a separate file
@ 2007-11-19 20:29 Sam Steingold
  2007-11-19 21:24 ` [Caml-list] " Richard Jones
  2007-11-19 22:44 ` Oliver Bandel
  0 siblings, 2 replies; 3+ messages in thread
From: Sam Steingold @ 2007-11-19 20:29 UTC (permalink / raw)
  To: caml-list

-----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?
thanks.
Sam.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHQfIcPp1Qsf2qnMcRAhw0AKCNEN68D2FHJvUIoEuhDFKWRdyVgwCfZXg1
P4yHKBFFgy4n4Zxyyrd1R6c=
=LA2G
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] lex: including regex definitions from a separate file
  2007-11-19 20:29 lex: including regex definitions from a separate file Sam Steingold
@ 2007-11-19 21:24 ` Richard Jones
  2007-11-19 22:44 ` Oliver Bandel
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Jones @ 2007-11-19 21:24 UTC (permalink / raw)
  To: Sam Steingold; +Cc: caml-list

On Mon, Nov 19, 2007 at 03:29:16PM -0500, Sam Steingold wrote:
> 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?

Probably your best bet is to preprocess bar.mll in a Makefile -- eg.
using cpp or m4 to generate the file from an input 'bar.mll.in'.

Rich.

-- 
Richard Jones
Red Hat


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] lex: including regex definitions from a separate file
  2007-11-19 20:29 lex: including regex definitions from a separate file Sam Steingold
  2007-11-19 21:24 ` [Caml-list] " Richard Jones
@ 2007-11-19 22:44 ` Oliver Bandel
  1 sibling, 0 replies; 3+ messages in thread
From: Oliver Bandel @ 2007-11-19 22:44 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-11-19 22:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-19 20:29 lex: including regex definitions from a separate file Sam Steingold
2007-11-19 21:24 ` [Caml-list] " Richard Jones
2007-11-19 22:44 ` Oliver Bandel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).