|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Reinit method Usage Hi there,
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. Exception in thread "main" java.lang.Error at event.check.<init>(check.java:1384) at event.check.main(check.java:205) --------------------------------------------------- Please help me to use the reinit method in correctly. Thanks. |
|
|
Re: Re[JavaCC] init method UsageOn 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@... |
| Free embeddable forum powered by Nabble | Forum Help |