« Return to Thread: Reinit method Usage

Re: Re[JavaCC] init method Usage

by Tom Copeland :: Rate this Message:

Reply to Author | View in Thread

On Apr 17, 2009, at 4:43 PM, netchandri wrote:

> I am trying to use a Reinit method and I get some errors with it.  
> Please
> help me to debug this issue.  I have the following code in a FOR loop:
>
> --------------------------------------------------
>
>  StringReader sr = new StringReader( t3 );
>  Reader r = new BufferedReader (sr);
>  check parser = new check(r);
>  parser.ReInit(r);
>  String event1 = check.event();
>
> ---------------------------------------------------
>
> My StringReader gets a new String "t3" every time it enters the  
> loop. I have
> a Reinit method to reinitialize the input but I get the following  
> error each
> time I try to use the String "t3" but the first instance of Stinrg  
> "t3" runs
> fine:
>
> ---------------------------------------------------
> ERROR: Second call to constructor of static parser.
>       You must either use ReInit() or set the JavaCC option STATIC  
> to false
>       during parser generation.

You may want to turn "check" into an instance (or class, or global)  
variable rather than calling "new check()" each time through the for  
loop.

Yours,

Tom
http://generatingparserswithjavacc.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

 « Return to Thread: Reinit method Usage