Incomplete code AST [message #908194] |
Tue, 04 September 2012 19:05  |
Eclipse User |
|
|
|
Hi all,
My goal is to develop a plugin which will use the user code. I was doing some previous work with ASTParser and I would get the AST only if the code was fully compileable. However, it is possible that the user inputs some statement fraction. In that case, ASTParser will, as far as I know, return me an empty AST. Is it possible to circumvent or hack this and to get the AST?
|
|
|
|
|
|
Re: Incomplete code AST [message #909396 is a reply to message #909273] |
Fri, 07 September 2012 00:50  |
Eclipse User |
|
|
|
Stephan Herrmann wrote on Thu, 06 September 2012 17:14oh, I didn't know how incomplete your code is.
Have you tried ASTParser.setStatementsRecovery(true) ?
Of course there are limits what a parser can recognize if it's not legal code (and incomplete statements are by definition illegal ...).
Stephan
Thanks Stephan, that is quite helpful. I can see with ASTView that in this case it recovers in a way that it removes the "+" sign. I think this will be good enough only if I can somehow "apply" that tree to remove that "+". Basically, I would like to remove that part and then add some mine. How hard/easy is that?
|
|
|
Powered by
FUDForum. Page generated in 0.22668 seconds