kdevplatform/language/codegen
Overview | Refactoring and Code Generation
The code generation api provides a system to simplify the creation of refactoring and code generating tools. The definition-use chain (duchain) and the language's specific abstract syntax tree (AST) provide the basis of a two-tiered, high-level and low-level api respectively. This gives you the simplicity and reusability of working with a language-independent api (the duchain) while still having the full power to manipulate language specifics (the AST).
To perform code generation, you should create a new duchain (eg. starting with a KDevelop::DUContext or KDevelop::Declaration) and then if desired attach AST branches where required.
To perform refactoring, a change set needs to be created against pre-existing duchains and/or ASTs; the chains/ASTs are not modified directly. Create a KDevelop::DUChangeSet and/or an KDevelop::AstChangeSet. Once created, this api will use the KDevelop::EditorIntegrator to modify the editor text, or directly edit on-disk files.
Refactoring which includes some code generation can combine the two different approaches (direct creation of objects and change sets).
For questions and discussons about editor either contact the author or the [email protected] mailing list.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Mar 7 2021 23:29:26 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.