2014-10-29 10:44 GMT+01:00 Mark Rizun <mri...@gmail.com>: > > > 2014-10-29 11:40 GMT+02:00 Thierry Goubier <thierry.goub...@gmail.com>: > >> >> >> 2014-10-29 10:22 GMT+01:00 Mark Rizun <mri...@gmail.com>: >> >>> Second one, I do replace node all the time. >>> >> >> You insert new code inside the text view? >> > > Yes > > >> >> For me, if you replace nodes and display that, then you are "slowly" >> replacing nodes. Anything which has some display to a user in the loop is >> "slow". >> > I'm not doing this in loop. I have AST and text view of it. Than I do one > replace and update text view. > When I wrote "all the time", I ment replacing nodes is very important in > my tool, as it does main functionality. >
This is well how I understood it. Are you implementing something around the use of refactoring? > > >> >> >>> Thinking a bit about it, I'd try reparse, get node from selection index, >>>> find equal old node in old (modified) ast, or replace old (modified) ast >>>> with new one. >>>> >>> Can you explain this, sorry I didn't get the point >>> >> >> Use either =, equalTo:withMapping:, match:inContext: to find the relevant >> new node equal to your old node in the new ast. >> > Good, thanks for advice. Firstly, I will check your suggestion with > equality. If it fails for me, I'll try my suggestion with calculating > inside tool. > Keep us updated on your solution. It is significant because the equality between ast nodes is part of the SmaCC parser generator toolkit, so any solution on that may also be used when manipulating non-smalltalk code (C, Java, C#, Python, R, Ada, etc...). Thierry > > Thanks again, > Mark > >