|
|
| Author |
Message |
< Erlang patches mailing list ~ Absolute module references in Yecc parsers (was: New yecc:fi |
| Guest |
Posted: Thu Feb 14, 2008 4:26 pm |
|
|
|
Guest
|
Il giorno gio, 14/02/2008 alle 14.43 +0100, Alceste Scalas ha scritto:
> This option allows to generate parsers within Erlang packages: for
> example, given the file src/foo/bar/parser.yrl, a call like
>
> yecc:file(parser, [{parserpackage, 'foo.bar'}])
>
> will generate parser.erl with module 'foo.bar.parser' (instead of
> 'parser' alone).
The following patch may help, too: it makes the generated parsers always
use absolute module references, by adding a leading dot to some function
calls (both in yecc.erl and yeccpre.hrl).
I chose this solution over two other approaches:
1. adding -import(lists) and -import(io_lib) to yeccpre.hrl;
2. asking the Yecc users to explicitly add -import(lists) and
-import(io_lib) to the "Erlang code" section of their grammars,
when they want to generate parsers inside a package hierarchy.
IMHO the patch is clearer (no packaging issues at all) and cleaner (it
does not interfere with "Erlang code" sections by adding unexpected
imports).
Regards,
alceste
--
Alceste Scalas <alceste@crs4.it>
CRS4 - http://www.crs4.it/
Post recived from mailinglist |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|