Re: Using include and namespaces
- Posted by jbrown105 at speedymail.org Aug 17, 2002
- 597 views
On 0, Juergen Luethje <jluethje at gmx.de> wrote: > > jbrown <jbrown105 at speedymail.org> wrote: > > <snip> > > (My parser rewrites all include statements, replacing them with > > direct code, so Eu's own version of include is ignored.) > > This will change the scope of local variables in the "included" files > (and also the effect of with/without statements inside there). > Couldn't this lead to undesirable results? > > Regards, > Juergen > Well, the answer is yes. However, I got around this problem by renaming local variables in such a way that they would not comflict. For example, in ex.ex: include file1.e ... in file1.e atom a a = 1 ? a ... include file2.e ... in file2.e atom a a = 2 ? a ... ? a my parser would rewrite it as something like this: atom a_1 a_1 = 1 ? a atom a_2 a_2 = 2 ? a_2 ? a_3 It would show the first 2 variables corectly, and Eu would crash on the third ? statement, since it is undeclared both ways. With/without is more tricky, I based my parser on David Cuny's contcat program (renamed fix I believe) which simply commented them out. jbrown -- http://fastmail.fm - Taking the "ail" out of email!