Related articles |
---|
problem with cup didelot@iie.cnam.fr (Xavier Didelot) (2002-07-15) |
Re: problem with cup ronih@luukku.com (Roni Hursti) (2002-07-31) |
From: | "Roni Hursti" <ronih@luukku.com> |
Newsgroups: | comp.compilers |
Date: | 31 Jul 2002 01:05:07 -0400 |
Organization: | Elisa Internet customer |
References: | 02-07-044 |
Keywords: | Java, parse |
Posted-Date: | 31 Jul 2002 01:05:07 EDT |
> I have a little problem using cup. I need to have my program for
> example write something in a file in certain cases of the grammar. I
> have a rule looking like this :
>
> expr ::= true {: file.println("lol"); :}
>
> but how to make the variable file accessible to this part of the code
> ? this line of code will be in the cup$parser$actions class, so that
> it doesn't have access to anything... Or is there a way to give it a
> member and initialize it in the cup file ? (of course it would be easy
> to make it work by modifing the code generated by cup, but it's not my
> aim...)
Use action block like this
action code {:
private File file;
:};
Best Regards
Roni
Return to the
comp.compilers page.
Search the
comp.compilers archives again.