Automatic code refactoring

Alexander Dymo adymo at mksat.net
Wed Mar 2 14:21:09 UTC 2005


On Monday 28 February 2005 18:02, Calvin Spealman wrote:
> Also, I see parsing of source seems to be done in completely arbitrary ways
> by different language parts. What about building in a EBNF parser that
> could make parsing of all languages much more advanced. This could make
> scope identification easier for refactoring features like this, as well as
> the autocomplete mechanisms.
I don't see that is possible because refactoring (or any other code wizards)
for the language requires knowledge about the language. For example,
an algorythm of adding a class method is different for different languages.
That's why each language support plugin have its own parsing code.

Nevertheless, we have "Code model" - a least common denominator of code
structure that is used by other plugins to perform various operations on
code symbols (example is a class viewer which uses code model to represent
a tree of classes/methods/etc). But it is not possible to do refactoring
using only a code model because code model is not able to write changes
to source files. You need to write a change to a file and then update code
model to reflet changes. That's how code model works.

-- 
Alexander Dymo
ICST Department, National University of Shipbuilding, Mykolayiv, Ukraine




More information about the KDevelop-devel mailing list