Warning, /kdevelop/kdev-python/DESIGN is written in an unsupported language. File is not indexed.
0001 Python Plugin Design: 0002 0003 This plugin consists of two parts: the parser, which is intended to create an 0004 abstract syntax tree (AST) from a string of python code, and the DUChain Library, 0005 which analyzes this AST semantically, extracting information about contexts, variable / 0006 class / function declarations, and other stuff. 0007 0008 The parser 0009 ---------- 0010 ... is not written by us. We're querying the python C API to extract an AST from a given 0011 string of python code. For information about the parser API, see 0012 http://docs.python.org/c-api/veryhigh.html?highlight=pyparser_#PyParser_SimpleParseString 0013 (for example). As this AST is based on PyObjects, relies on a large amount of macros for data 0014 access, and is not based on classes, but on structs, we transform it to a more convenient form. 0015 This is done in parser/astbuilder.cpp by the PythonAstTransformer class. It walks through a python 0016 tree, and generates the corresponding plugin-tree objects (those which end with Ast, like StatementAst etc.). 0017 This transformer is not written by hand, but is generated by the conversionGenerator.py script. This script 0018 reads information on how the AST should be transformed from the parser/python26.sdef file. 0019 It should be obvious from the large amount of examples what those rules look like. 0020 This class returns a CodeAst, which is then passed back to the parse job, which then calls 0021 the DUChain classes to analyze the tree. If an error occurs, parsing is aborted and the error is 0022 reported to the user. 0023 0024 The DUChain Library 0025 ------------------- 0026 See https://api.kde.org/extragear-api/kdevelop-apidocs/kdevelop/kdevplatform/language/duchain/html/duchain-design.html