« Return to Thread: JAVACC parser

Re: JAVACC parser

by J.Chris Findlay :: Rate this Message:

Reply to Author | View in Thread

For the parser to be nonStatic, you have to use it then throw it away and make a whole new one, and all the code in it needs to be aware of the fact it's accessing instance data not static data.
Otherwise, follow the instructions in the errorMessage and use a single instance of the static parser, and reset it's input via ReInit as covered in the docs, making sure you don't have leftover custom state un-reset.

On Thu, Apr 9, 2009 at 11:29 AM, netchandri <netchandri@...> wrote:

Hi Chris,

Thanks for helping me out on this. It did work for me after I created a
String wrapper for my variable.

But my parser is only reading the first XML TAG and fails to read the next
one in the XML file. I receive the following error :
-----------------------------------------------
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 test.check.<init>(check.java:952)
       at test.check.main(check.java:52)
-----------------------------------------------

This error is probably because I use a FOR loop to read the XML TAGS And I
am calling the constructor each time I try to read a XML TAG and it causes
the constructor call to fail for the second time and so forth.

Any thoughts on this, I tried to use STATIC = false in options, but it
fails.

Thanks.
--
View this message in context: http://www.nabble.com/JAVACC-parser-tp22955955p22961835.html
Sent from the java.net - javacc users mailing list archive at Nabble.com.


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




--
- J.Chris Findlay
  (c:

 « Return to Thread: JAVACC parser