Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Constructing Compond statement without brackets

Hi thanks for the response.

But are there ways to actually force a change into a text file, read the change source file into an ast. That would also work . But all these need to be performed within one refactoring click. 

And are there ways to insert / delete child nodes into an IASTNode. actually even this exists, that would suffice.

On Wed, Oct 22, 2014 at 2:33 PM, Corbat Thomas <tcorbat@xxxxxx> wrote:

Hi Krishna

 

Unfortunately, there is no such operation for getting an intermediate AST yet. While the AST could be created in such a way, there might be inconsistencies regarding location information (positions not corresponding to actual source code). That's one problem, but a much more severe issue would be to provide a complete resolution of the bindings for the intermediate AST. That goes far beyond of the capabilities of the ASTRewrite.

 

Regards

Thomas

 

 

From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Krishna Narasimhan
Sent: Mittwoch, 22. Oktober 2014 14:27
To: CDT General developers list.
Subject: Re: [cdt-dev] Constructing Compond statement without brackets

 

I wanted to do that. But, I am currently using a very lame and crude approach of performing all my modifications on a IASTNode (which only supports replace and only when the node being modified is a AMbigiousNode).

 

This is because I was facing an issue with the ASTRewrite.

 

I have a question : 

 

1) How do I get the AST after every modification and continue to work on that AST . Basically how do I save and retreive the state of an AST after every rewrite operation and how do I use a Saved AST ... 

 

 

something like 

 

ASTRewrite rewriter = collector.getRewriterforast(ast);

rewriter.insertbefore(...)

astsaved = rewriter.getAST(ast)

 

 

Something like that... 

 

On Wed, Oct 22, 2014 at 8:14 AM, Corbat Thomas <tcorbat@xxxxxx> wrote:

Hi Krishna

 

A compound statement is always surrounded by curly braces. Can't you just insert the "bunch of other statements" before the statement which should be at the end?

 

Regards

Thomas

 

From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Krishna Narasimhan
Sent: Montag, 20. Oktober 2014 12:04
To: CDT General developers list.
Subject: [cdt-dev] Constructing Compond statement without brackets

 

Dear all,

           I am trying to construct a replace a statement with a bunch of other statements and itself at the end. The problem I have here is that when I use a compound statement, it places a bracket . Anyway to remove this?

 


 

 

Regards
       Krishna


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev



 

--
-----------------------------------------------------
I dare do all that may become a man; Who dares do more, is none - Macbeth, twelfh night!
Regards
       Krishna


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev



--
-----------------------------------------------------
I dare do all that may become a man; Who dares do more, is none - Macbeth, twelfh night!
Regards
       Krishna

Back to the top