devana.syntax_abstraction

Subpackages

devana.syntax_abstraction.attribute

class Attribute(name, namespace=None, arguments=None, parent=None)[source]

Bases: object

An attribute defined by the C++11 and C23 standard. In addition to the standard attributes of the C ++ language, it can contain any custom attributes, both specific to compilers and not existing in any compiler.

This behavior allows attributes to be defined and used only as needed by Devan. And it allows you to enter any compilers (no clear list of attributes, it is impossible to know all compiler-specific attributes). And it allows you to enter any compilers (no clear list of attributes, it is impossible to know all compiler-specific attributes). Whether the attributes will be printed depends on the currently used configuration. Attributes are pre-parsed to extract the namespace and arguments.

property arguments: Optional[List[str]]

Arguments of attribute - parsed value.

Return type

Optional[List[str]]

clone()[source]
classmethod from_text(text, parent=None)[source]
classmethod from_whole_declaration_text(text, parent=None)[source]
property name: str

Attribute name.

Return type

str

property namespace: Optional[str]

Explicitly declared namespace of attributes - not applicable to the using directive.

Return type

Optional[str]

property parent: Optional
Return type

Optional

class AttributeDeclaration(attributes, using_namespace=None, parent=None)[source]

Bases: object

C++11 attribute declaration. Provides a description of a single declaration in curly braces that may contain either the using keyword or a list of multiple attributes.

property attributes: List[Attribute]

List of declared attributes.

Return type

List[Attribute]

clone()[source]
classmethod create_from_element(source, scope, parent=None)[source]
property parent: Optional
Return type

Optional

property using_namespace: Optional[str]

Namespace with a using directive if present.

Return type

Optional[str]

class DescriptiveByAttributes(cursor, parent=None)[source]

Bases: object

Mixin class for implement C++ standard attributes linked to a code element.

property attributes: List[AttributeDeclaration]

C++11/C23 attributes associated with the syntax.

Return type

List[AttributeDeclaration]

property flatten_attributes: List[Attribute]

List of all attributes without information on which declarations they belong to.

Return type

List[Attribute]

devana.syntax_abstraction.classinfo

class AccessSpecifier(value)[source]

Bases: Enum

C++ class access specifier to members.

PRIVATE = 'private'
PROTECTED = 'protected'
PUBLIC = 'public'
static from_cursor(cursor)[source]
class ClassInfo(cursor=None, parent=None)[source]

Bases: CodeContainer, DescriptiveByAttributes

Data of a class type.

property associated_comment: Optional[Comment]
Return type

Optional[Comment]

property constructors: Tuple[ConstructorInfo]

Constructors associated with class.

Return type

Tuple[ConstructorInfo]

classmethod create_default(parent=None)[source]

Create a default, valid instance. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

property definition: Any

Definition of class.

Return type

Any

property destructor: Optional[DestructorInfo]

Destructor associated with class.

Return type

Optional[DestructorInfo]

property fields: Tuple[FieldInfo]

Class fields.

Return type

Tuple[FieldInfo]

classmethod from_cursor(cursor, parent=None)[source]

Create an instance from parsed information from clang. Return None if creation is not possible. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_params(cls, parent=None, content=None, namespace=None, attributes=None, is_class=None, is_struct=None, is_final=None, name=None, inheritance=None, is_declaration=None, is_definition=None, namespaces=None, lexicon=None, template=None, associated_comment=None, prefix=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

ClassInfo

property inheritance: Optional[InheritanceInfo]

Inheritance, if any.

Return type

Optional[InheritanceInfo]

property is_class: bool

Flag abut is class.

Return type

bool

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

property is_declaration: bool

Determine kind, definition or declaration.

Return type

bool

property is_definition: bool

Determine kind, definition or declaration.

Return type

bool

property is_final: bool

Flag about final key-world in class.

Return type

bool

property is_struct: bool

Flag abut is struct.

Return type

bool

property lexicon: Lexicon

Current lexicon storage of an object.

Return type

Lexicon

property methods: Tuple[MethodInfo]
Return type

Tuple[MethodInfo]

property name: str

Name of class.

Return type

str

property namespaces: List[str]

Explicitly declared namespaces. For example: class namespace1::namespace2::ClassName; or class namespace1::ClassName {};

Return type

List[str]

property operators: Tuple[MethodInfo]

Operators of class.

Return type

Tuple[MethodInfo]

property prefix: str

The text that precedes the function. Only applicable for code generation, allowing you to inject compiler attributes e.g. dllexport.

Return type

str

property private: Tuple[ISyntaxElement]
Return type

Tuple[ISyntaxElement]

property protected: Tuple[ISyntaxElement]
Return type

Tuple[ISyntaxElement]

property public: Tuple[ISyntaxElement]
Return type

Tuple[ISyntaxElement]

property sections: Tuple[SectionInfo]

List of sections present in an object.

Return type

Tuple[SectionInfo]

property template: Optional[TemplateInfo]

Template information if declaration is template.

Return type

Optional[TemplateInfo]

property text_source: Optional[CodePiece]

Source of this element.

Return type

Optional[CodePiece]

class ClassMember(cursor=None)[source]

Bases: IBasicCreatable, ISyntaxElement

Base class for all class members.

property access_specifier: AccessSpecifier

Access scope of member.

Return type

AccessSpecifier

classmethod create_default(_=None)[source]

Create a default, valid instance. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_cursor(cursor, _=None)[source]

Create an instance from parsed information from clang. Return None if creation is not possible. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_params(cls, access_specifier=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

ClassMember

class ConstructorInfo(cursor=None, parent=None)[source]

Bases: MethodInfo

Constructor method information.

class InitializerInfo(name, value)[source]

Bases: object

Information about one of initializer lists.

property name: str

Name of an initialized element.

Return type

str

property value: str

Value of initialization.

Return type

str

classmethod from_params(cls, parent=None, arguments=None, name=None, modification=None, body=None, namespaces=None, lexicon=None, template=None, associated_comment=None, prefix=None, access_specifier=None, type=None, initializer_list=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

ConstructorInfo

property initializer_list: List[InitializerInfo]

Initializer list paired with constructor.

Return type

List[InitializerInfo]

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

property name: str

Name of function, without namespace.

Return type

str

property return_type: None

Function return type. None of class functions like constructor.

Return type

None

property type: MethodType

Type kind of function method.

Return type

MethodType

class DestructorInfo(cursor=None, parent=None)[source]

Bases: MethodInfo

Destructor information.

classmethod from_params(cls, parent=None, arguments=None, name=None, modification=None, body=None, namespaces=None, lexicon=None, template=None, associated_comment=None, prefix=None, access_specifier=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

DestructorInfo

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

property name: str

Name of function, without namespace.

Return type

str

property return_type: None

Function return type. None of class functions like constructor.

Return type

None

property type: MethodType

Type kind of function method.

Return type

MethodType

class FieldInfo(cursor=None, parent=None)[source]

Bases: Variable, ClassMember, ICursorValidate, DescriptiveByAttributes

Field of class/struct.

property associated_comment: Optional[Comment]
Return type

Optional[Comment]

classmethod create_default(parent=None)[source]

Create a default, valid instance. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_cursor(cursor, parent=None)[source]

Create an instance from parsed information from clang. Return None if creation is not possible. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_params(cls, parent=None, name=None, type=None, default_value=None, lexicon=None, access_specifier=None, attributes=None, associated_comment=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

FieldInfo

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

class InheritanceInfo(cursor=None, parent=None)[source]

Bases: IFromCursorCreatable, IFromParamsCreatable, ISyntaxElement

Information about class/structure inheritance.

class InheritanceValue(cursor=None, parent=None)[source]

Bases: IBasicCreatable, ISyntaxElement

One of parent (in C++ mean) information.

property access_specifier: AccessSpecifier

Inheritance mode like public.

Return type

AccessSpecifier

classmethod create_default(parent=None)[source]

Create a default, valid instance. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_cursor(cursor, parent=None)[source]

Create an instance from parsed information from clang. Return None if creation is not possible. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_params(cls, parent=None, access_specifier=None, type=None, is_virtual=None, template_arguments=None, namespaces=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

InheritanceValue

property is_virtual: bool

Defines is virtual inheritance

Return type

bool

property namespaces: List[str]

Provide information about used namespaces in parent type.

Return type

List[str]

property parent: CodeContainer

Class parent.

Return type

CodeContainer

property template_arguments: List[TypeExpression]
Return type

List[TypeExpression]

property type: Optional

Type of inheritance provided by lexicon.

Return type

Optional

classmethod from_cursor(cursor, parent=None)[source]

Create an instance from parsed information from clang. Return None if creation is not possible. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_params(cls, parent=None, type_parents=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

InheritanceInfo

property lexicon
property parent
property type_parents: List[InheritanceValue]

List of parents in code meaning.

Return type

List[InheritanceValue]

class MethodInfo(cursor=None, parent=None)[source]

Bases: FunctionInfo, ClassMember

Information abut class member function - methods.

classmethod from_params(cls, parent=None, arguments=None, name=None, return_type=None, modification=None, body=None, namespaces=None, lexicon=None, template=None, associated_comment=None, prefix=None, access_specifier=None, type=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

MethodInfo

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

property template: Optional[TemplateInfo]

Template information if declaration is template.

Return type

Optional[TemplateInfo]

property type: MethodType

Type kind of function method.

Return type

MethodType

class MethodType(value)[source]

Bases: Enum

Information about a type of described method.

CONSTRUCTOR = 3
COPY_ASSIGNMENT = 6
COPY_CONSTRUCTOR = 4
DESTRUCTOR = 8
MOVE_ASSIGNMENT = 7
MOVE_CONSTRUCTOR = 5
OPERATOR = 2
STANDARD = 1
static check_assignment(name)[source]
Return type

bool

static check_operator(name)[source]
Return type

bool

property is_constructor: bool
Return type

bool

property is_copy_assignment: bool
Return type

bool

property is_copy_constructor: bool
Return type

bool

property is_destructor: bool
Return type

bool

property is_move_assignment: bool
Return type

bool

property is_move_constructor: bool
Return type

bool

property is_operator: bool
Return type

bool

property is_standard: bool
Return type

bool

class SectionInfo(cursor=None, parent=None)[source]

Bases: IBasicCreatable, ICursorValidate, ISyntaxElement

Representation of class sections like private, public and protected.

property content: List[Any]
Return type

List[Any]

classmethod create_default(parent=None)[source]

Create a default, valid instance. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_cursor(cursor, parent=None)[source]

Create an instance from parsed information from clang. Return None if creation is not possible. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_params(cls, parent=None, type=None, is_unnamed=None, content=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

SectionInfo

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

property is_unnamed: bool

Return a flag about section source if code line or standard access in class body.

Return type

bool

property parent: CodeContainer

Structural parent element like file, namespace or class.

Return type

CodeContainer

property text_source: Optional[CodePiece]

Source of this element.

Return type

Optional[CodePiece]

property type: AccessSpecifier

Section type, for example public.

Return type

AccessSpecifier

devana.syntax_abstraction.codelocation

class CodeLocation(row, col)[source]

Bases: object

Class hold information about code coordinates in file.

property col: int
Return type

int

property row: int
Return type

int

devana.syntax_abstraction.codepiece

class CodePiece(cursor=None)[source]

Bases: object

Class represented code as raw characters sequence seen as sees it programmer with comments and not replaced preprocessor stuff. Only white character correction is allowed.

Code can be bind to existing file if its source is file or CodePiece is used as representative of code generation result.

property begin: CodeLocation

Start of code.

Return type

CodeLocation

property end: CodeLocation

End of code.

Return type

CodeLocation

property file: Optional[str]

Absolute string path to code file. None value mean unnamed, virtual file used in code generation process.

Return type

Optional[str]

classmethod from_location(begin, end, file)[source]
property text: str

Raw text of code, from begin to end.

Return type

str

devana.syntax_abstraction.comment

class Comment(marker=CommentMarker.ONE_LINE, begin=None, end=None, parent=None)[source]

Bases: object

The representing class exists in the comments code. Not all existing code comments need to be instantiated. In particular, comments inside implementation bodies are not instantiated and other, depending on parsing settings.

property begin: Optional[CodeLocation]
Return type

Optional[CodeLocation]

property end: Optional[CodeLocation]
Return type

Optional[CodeLocation]

classmethod from_code_piece(marker, code_piece, parent=None)[source]
property homogeneous_text: str

Text as a single text string.

Return type

str

property marker: CommentMarker

Defines whether a comment uses multi-line content markers or just a single-line comment style.

Return type

CommentMarker

property parent: Optional
Return type

Optional

property text: List[str]
Return type

List[str]

class CommentMarker(value)[source]

Bases: Enum

One-line comment marker ‘//’ or multiple lines.

MULTI_LINE = 2
ONE_LINE = 1
property begin_marker: str

String representation of start comment marker.

Return type

str

property end_marker: Optional[str]

String representation of start comment marker. It may be None for one line comment.

Return type

Optional[str]

class CommentsFactory(source)[source]

Bases: object

Internal the class that collects all detected comments in the file. Its purpose is to help you find comments requested by specific code elements.

property comments: List[Comment]
Return type

List[Comment]

get_upper_comment(element)[source]
Return type

Optional[Comment]

preamble()[source]
Return type

Optional[Comment]

devana.syntax_abstraction.enuminfo

class EnumInfo(cursor=None, parent=None)[source]

Bases: CodeContainer, DescriptiveByAttributes

Enum declaration.

class EnumValue(cursor=None, parent=None)[source]

Bases: IBasicCreatable, ICursorValidate, ISyntaxElement

Enum value stored in EnumInfo.

property associated_comment: Optional[Comment]
Return type

Optional[Comment]

classmethod create_default(parent=None)[source]

Create a default, valid instance. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_cursor(cursor, parent=None)[source]

Create an instance from parsed information from clang. Return None if creation is not possible. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_params(cls, parent=None, name=None, value=None, is_default=None, associated_comment=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

EnumValue

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

property is_default: bool

Flag inform about value is default generated.

Return type

bool

property name: str

Enumeration name.

Return type

str

property parent: CodeContainer

Structural parent element like file, namespace or class.

Return type

CodeContainer

property text_source: Optional[CodePiece]

Source of this element.

Return type

Optional[CodePiece]

property value: int

Enumeration value, automatic or standard.

Return type

int

property associated_comment: Optional[Comment]
Return type

Optional[Comment]

property definition: Optional[Any]

Definition of enum.

Return type

Optional[Any]

classmethod from_params(cls, parent=None, content=None, namespace=None, attributes=None, name=None, values=None, is_scoped=None, prefix=None, numeric_type=None, is_declaration=None, is_definition=None, lexicon=None, associated_comment=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

EnumInfo

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

property is_declaration: bool

Determine kind, definition or declaration.

Return type

bool

property is_definition: bool

Determine kind, definition or declaration.

Return type

bool

property is_scoped: bool

Flag that is scoped enum - enum class or enum struct

Return type

bool

property lexicon

Current lexicon storage of an object.

property name: str

Enum name.

Return type

str

property numeric_type: BasicType

Used numeric type.

Return type

BasicType

property parent

Structural parent element like file, namespace or class.

property prefix: Optional[Literal['class', 'struct']]

Scoped enum prefix, class or struct.

Return type

Optional[Literal[‘class’, ‘struct’]]

property text_source: Optional[CodePiece]

Source of this element.

Return type

Optional[CodePiece]

property values: List[EnumValue]

List of possible values of enum.

Return type

List[EnumValue]

devana.syntax_abstraction.externc

class ExternC(cursor=None, parent=None)[source]

Bases: CodeContainer

Object representation of current usage of extern C set of functions. It may contain one or more functions.

classmethod from_params(cls, parent=None, content=None, namespace=None, name=None, lexicon=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

property lexicon: Lexicon

Current lexicon storage of an object.

Return type

Lexicon

property name: str
Return type

str

devana.syntax_abstraction.functioninfo

class FunctionInfo(cursor=None, parent=None)[source]

Bases: IBasicCreatable, ICursorValidate, DescriptiveByAttributes, ISyntaxElement

Representative of function definition or declaration.

class Argument(cursor=None, parent=None)[source]

Bases: Variable, ICursorValidate, DescriptiveByAttributes, ISyntaxElement

Data of function or method argument.

property attributes: List[AttributeDeclaration]

C++11/C23 attributes associated with the syntax.

Return type

List[AttributeDeclaration]

classmethod from_params(cls, parent=None, name=None, type=None, default_value=None, lexicon=None, attributes=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

Argument

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

property arguments: List[Argument]

List of function input arguments.

Return type

List[Argument]

property associated_comment: Optional[Comment]
Return type

Optional[Comment]

property body: Optional[str]

Body of function - source code. None if it is a declaration.

Return type

Optional[str]

property complex_name: str

Name of function, without namespace, with return typ name and arguments types (but no variable names).

Return type

str

classmethod create_default(parent=None)[source]

Create a default, valid instance. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

property definition: Any

Definition of function.

Return type

Any

classmethod from_cursor(cursor, parent=None)[source]

Create an instance from parsed information from clang. Return None if creation is not possible. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_params(cls, parent=None, attributes=None, arguments=None, name=None, return_type=None, modification=None, body=None, namespaces=None, lexicon=None, template=None, associated_comment=None, prefix=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

FunctionInfo

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

property is_declaration: bool

Determine function kind, definition or declaration.

Return type

bool

property is_definition: bool

Determine function kind, definition or declaration.

Return type

bool

property lexicon: Lexicon

Current lexicon storage of an object.

Return type

Lexicon

property modification: FunctionModification

Function modification enum flag.

Return type

FunctionModification

property name: str

Name of function, without namespace.

Return type

str

property namespaces: List[str]

Explicitly declared namespaces. For example: double namespace1::namespace2::functionName().

Return type

List[str]

property overloading: Tuple

List of another function overloading this name.

Return type

Tuple

property overloading_family: Tuple

List of all functions overloading this name including this one.

Return type

Tuple

property parent: CodeContainer

Structural parent element like file, namespace or class.

Return type

CodeContainer

property prefix: str

The text that precedes the function. Only applicable for code generation, allowing you to inject compiler attributes e.g. dllexport.

Return type

str

property return_type: TypeExpression

Function return type. None of class functions like constructor.

Return type

TypeExpression

property template: Optional[TemplateInfo]

Template information if declaration is template.

Return type

Optional[TemplateInfo]

property text_source: CodePiece

Source of this element.

Return type

CodePiece

class FunctionModification(value=None, expect_value=None)[source]

Bases: object

Modification for functions and methods.

CONST(expect_value) = <devana.syntax_abstraction.functioninfo.FunctionModification object>
CONSTEVAL(expect_value) = <devana.syntax_abstraction.functioninfo.FunctionModification object>
CONSTEXPR(expect_value) = <devana.syntax_abstraction.functioninfo.FunctionModification object>
DEFAULT(expect_value) = <devana.syntax_abstraction.functioninfo.FunctionModification object>
DELETE(expect_value) = <devana.syntax_abstraction.functioninfo.FunctionModification object>
EXPLICIT(expect_value) = <devana.syntax_abstraction.functioninfo.FunctionModification object>
FINAL(expect_value) = <devana.syntax_abstraction.functioninfo.FunctionModification object>
INLINE(expect_value) = <devana.syntax_abstraction.functioninfo.FunctionModification object>
class ModificationKind(value)[source]

Bases: IntFlag

Internal enum list.

CONST = 2
CONSTEVAL = 4096
CONSTEXPR = 2048
DEFAULT = 1024
DELETE = 512
EXPLICIT = 4
FINAL = 128
INLINE = 64
NOEXCEPT = 16384
NONE = 1
OVERRIDE = 256
PURE_VIRTUAL = 32
STATIC = 8
VIRTUAL = 16
VOLATILE = 8192
NOEXCEPT(expect_value) = <devana.syntax_abstraction.functioninfo.FunctionModification object>
NONE(expect_value) = <devana.syntax_abstraction.functioninfo.FunctionModification object>
OVERRIDE(expect_value) = <devana.syntax_abstraction.functioninfo.FunctionModification object>
PURE_VIRTUAL(expect_value) = <devana.syntax_abstraction.functioninfo.FunctionModification object>
STATIC(expect_value) = <devana.syntax_abstraction.functioninfo.FunctionModification object>
VIRTUAL(expect_value) = <devana.syntax_abstraction.functioninfo.FunctionModification object>
VOLATILE(expect_value) = <devana.syntax_abstraction.functioninfo.FunctionModification object>
classmethod create_noexcept(noexcept_value)[source]
enum_source

alias of ModificationKind

property is_const: bool
Return type

bool

property is_consteval: bool
Return type

bool

property is_constexpr: bool
Return type

bool

property is_default: bool
Return type

bool

property is_delete: bool
Return type

bool

property is_explicit: bool
Return type

bool

property is_final: bool
Return type

bool

property is_inline: bool
Return type

bool

property is_noexcept: bool
Return type

bool

property is_override: bool
Return type

bool

property is_pure_virtual: bool
Return type

bool

property is_static: bool
Return type

bool

property is_virtual: bool
Return type

bool

property is_volatile: bool
Return type

bool

property noexcept_value: Optional[str]

Returns noexcept if it appears with parentheses. Due to parsing based on the token list, whitespace (meaning nothing for c++) is skipped.

Return type

Optional[str]

property value: ModificationKind
Return type

ModificationKind

devana.syntax_abstraction.functiontype

class FunctionType(cursor=None, parent=None)[source]

Bases: IBasicCreatable, ICursorValidate, ISyntaxElement

Class representing the type of function (function pointer) that can appear as a variable or in a typedef etc.

property arguments: List[TypeExpression]

List of function input arguments types.

Return type

List[TypeExpression]

classmethod create_default(parent=None)[source]

Create a default, valid instance. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_cursor(cursor, parent=None)[source]

Create an instance from parsed information from clang. Return None if creation is not possible. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_params(cls, parent=None, arguments=None, return_type=None, lexicon=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

FunctionType

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

property lexicon: Lexicon

Current lexicon storage of object.

Return type

Lexicon

property name: str
Return type

str

property parent: CodeContainer

Structural parent element like file, namespace or class.

Return type

CodeContainer

property return_type: TypeExpression

Function return type.

Return type

TypeExpression

property text_source: CodePiece

Source of this element.

Return type

CodePiece

devana.syntax_abstraction.namespaceinfo

class NamespaceInfo(cursor=None, parent=None)[source]

Bases: CodeContainer, DescriptiveByAttributes

Object representation of current scope namespace, for example usage in file or global namespace with all namespaces component placed in many files.

property associated_comment: Optional[Comment]
Return type

Optional[Comment]

classmethod from_params(cls, parent=None, content=None, namespace=None, attributes=None, name=None, lexicon=None, associated_comment=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

NamespaceInfo

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

property lexicon: Lexicon

Current lexicon storage of an object.

Return type

Lexicon

property name: str
Return type

str

property text_source: Optional[CodePiece]

Source of this element.

Return type

Optional[CodePiece]

devana.syntax_abstraction.syntax

class ISyntaxElement[source]

Bases: ABC

Empty interface for C++ elements other than types to clarify what actually return devan functions that can return any element - to avoid the Any type.

devana.syntax_abstraction.templateinfo

class GenericTypeParameter(name, parent=None)[source]

Bases: ISyntaxElement

An unresolved generic template parameter, known idiomatically in C++ as T.

static from_cursor(type_c, cursor, parent=None)[source]
property name
class TemplateInfo(cursor=None, parent=None)[source]

Bases: IBasicCreatable, ICursorValidate, ISyntaxElement

General template syntax information abut template definition.

class TemplateParameter(cursor=None, parent=None)[source]

Bases: IBasicCreatable, ICursorValidate, ISyntaxElement

A description of the generic component for the type/function claim.

classmethod create_default(parent=None)[source]

Create a default, valid instance. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

property default_value: Optional[str]

Default value of parameter.

Return type

Optional[str]

classmethod from_cursor(cursor, parent=None)[source]

Create an instance from parsed information from clang. Return None if creation is not possible. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_params(cls, parent=None, specifier=None, name=None, default_value=None, is_variadic=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

TemplateParameter

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

property is_variadic: bool
Return type

bool

property lexicon: CodeContainer

Current lexicon storage of an object.

Return type

CodeContainer

property name: str

Name of string parameter.

Return type

str

property parent
property specifier: str

Keyword before name.

Return type

str

classmethod create_default(parent=None)[source]

Create a default, valid instance. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_cursor(cursor, parent=None)[source]

Create an instance from parsed information from clang. Return None if creation is not possible. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_params(cls, parent=None, specialisation_values=None, specialisations=None, parameters=None, is_empty=None, lexicon=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

TemplateInfo

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

property is_empty: bool
Return type

bool

property lexicon: CodeContainer

Current lexicon storage of an object.

Return type

CodeContainer

property parameters: List[TemplateParameter]

Template parameters list.

Return type

List[TemplateParameter]

property parent: ISyntaxElement
Return type

ISyntaxElement

property specialisation_values: List[Union[TypeExpression, str]]

Used values for partial specialisation, types or string for other values. Return all other defined specialisations of template.

Return type

List[Union[TypeExpression, str]]

property specialisations: Tuple

Return all others defined specialisations of template.

Return type

Tuple

property specialisations_family: Tuple

Return all defined specializations of template including this one.

Return type

Tuple

devana.syntax_abstraction.typedefinfo

class TypedefInfo(cursor=None, parent=None)[source]

Bases: IBasicCreatable, ICursorValidate, ISyntaxElement

Class represented typedef declaration.

property associated_comment: Optional[Comment]
Return type

Optional[Comment]

classmethod create_default(parent=None)[source]

Create a default, valid instance. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_cursor(cursor, parent=None)[source]

Create an instance from parsed information from clang. Return None if creation is not possible. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_params(cls, parent=None, type_info=None, name=None, lexicon=None, associated_comment=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

TypedefInfo

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

property lexicon: CodeContainer

Current lexicon storage of object.

Return type

CodeContainer

property name: str

Typedef alias name.

Return type

str

property parent: CodeContainer

Structural parent element like file, namespace or class.

Return type

CodeContainer

property text_source: Optional[CodePiece]

Source of this element.

Return type

Optional[CodePiece]

property type_info: Union[TypeExpression, ISyntaxElement]

Type alias can be true type or next typedef.

Return type

Union[TypeExpression, ISyntaxElement]

devana.syntax_abstraction.typeexpression

class BasicType(value)[source]

Bases: Enum

Provides information about common types like integer of floating point. It should be implemented as Enum subclass.

BOOL = <devana.syntax_abstraction.typeexpression.BasicType.BasicTypeValue object>
BasicTypeValue(name, value, unsigned=False) = <class 'devana.syntax_abstraction.typeexpression.BasicType.BasicTypeValue'>[source]
CHAR = <devana.syntax_abstraction.typeexpression.BasicType.BasicTypeValue object>
DOUBLE = <devana.syntax_abstraction.typeexpression.BasicType.BasicTypeValue object>
FLOAT = <devana.syntax_abstraction.typeexpression.BasicType.BasicTypeValue object>
INT = <devana.syntax_abstraction.typeexpression.BasicType.BasicTypeValue object>
LONG = <devana.syntax_abstraction.typeexpression.BasicType.BasicTypeValue object>
LONG_DOUBLE = <devana.syntax_abstraction.typeexpression.BasicType.BasicTypeValue object>
LONG_LONG = <devana.syntax_abstraction.typeexpression.BasicType.BasicTypeValue object>
SHORT = <devana.syntax_abstraction.typeexpression.BasicType.BasicTypeValue object>
U_CHAR = <devana.syntax_abstraction.typeexpression.BasicType.BasicTypeValue object>
U_INT = <devana.syntax_abstraction.typeexpression.BasicType.BasicTypeValue object>
U_LONG = <devana.syntax_abstraction.typeexpression.BasicType.BasicTypeValue object>
U_LONG_LONG = <devana.syntax_abstraction.typeexpression.BasicType.BasicTypeValue object>
U_SHORT = <devana.syntax_abstraction.typeexpression.BasicType.BasicTypeValue object>
VOID = <devana.syntax_abstraction.typeexpression.BasicType.BasicTypeValue object>
static from_cursor(cursor)[source]
property unsigned: bool
Return type

bool

class TypeExpression(cursor=None, parent=None)[source]

Bases: IBasicCreatable, ISyntaxElement

Hold information about C++ type usage in common expression, for example, function argument declaration, class field, function return value or part of typedef declaration.

classmethod create_default(parent=None)[source]

Create a default, valid instance. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

static cursor_parse_from_array(cursor)[source]
static cursor_parse_from_pointer(cursor)[source]
property details: ISyntaxElement

Object linked to all type information.

This field linked to first type information. If TypeExpression is used by alias, details contain typedef information, so jump to root of typedef declaration may be needed.

Return type

ISyntaxElement

classmethod from_cursor(cursor, parent=None)[source]

Create an instance from parsed information from clang. Return None if creation is not possible. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_params(cls, parent=None, modification=None, namespaces=None, template_arguments=None, details=None, lexicon=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

TypeExpression

property is_generic: bool

Flag informed type is generic or not.

Return type

bool

property lexicon
property modification: TypeModification

Usages modifications.

Return type

TypeModification

property name: str

Used name of a type in the current context.

Name of a type is exactly the same name as used in expression, with all type modifications, namespace, template arguments and use or not type aliases.

Return type

str

property namespaces: List[str]

List of namespaces used in name.

Return type

List[str]

property parent: ISyntaxElement

Object scope of usage this data.

Return type

ISyntaxElement

property template_arguments: Optional[List[TypeExpression]]

Arguments list of template concretization. None if type is not template.

Return type

Optional[List[TypeExpression]]

property text_source: Optional[CodePiece]

Source of this element.

Return type

Optional[CodePiece]

class TypeModification(value=None, order=None)[source]

Bases: object

Possible type modifications like const or being a pointer type.

ARRAY = <devana.syntax_abstraction.typeexpression.TypeModification object>
CONST = <devana.syntax_abstraction.typeexpression.TypeModification object>
CONSTEXPR = <devana.syntax_abstraction.typeexpression.TypeModification object>
CONSTINIT = <devana.syntax_abstraction.typeexpression.TypeModification object>
INLINE = <devana.syntax_abstraction.typeexpression.TypeModification object>
MUTABLE = <devana.syntax_abstraction.typeexpression.TypeModification object>
class ModificationKind(value)[source]

Bases: IntFlag

Internal enum list.

ARRAY = 128
CONST = 8
CONSTEXPR = 1024
CONSTINIT = 2048
INLINE = 8192
MUTABLE = 4096
NONE = 1
POINTER = 4
REFERENCE = 2
RESTRICT = 512
RVALUE_REF = 256
STATIC = 64
TEMPLATE = 32
VOLATILE = 16
NONE = <devana.syntax_abstraction.typeexpression.TypeModification object>
POINTER = <devana.syntax_abstraction.typeexpression.TypeModification object>
REFERENCE = <devana.syntax_abstraction.typeexpression.TypeModification object>
RESTRICT = <devana.syntax_abstraction.typeexpression.TypeModification object>
RVALUE_REF = <devana.syntax_abstraction.typeexpression.TypeModification object>
STATIC = <devana.syntax_abstraction.typeexpression.TypeModification object>
TEMPLATE = <devana.syntax_abstraction.typeexpression.TypeModification object>
VOLATILE = <devana.syntax_abstraction.typeexpression.TypeModification object>
property array_order: Optional[List[str]]
Return type

Optional[List[str]]

classmethod create_array(order)[source]
classmethod create_pointer(order)[source]
enum_source

alias of ModificationKind

property is_array: bool
Return type

bool

property is_const: bool
Return type

bool

property is_constexpr: bool
Return type

bool

property is_constinit: bool
Return type

bool

property is_inline: bool
Return type

bool

property is_mutable: bool
Return type

bool

property is_no_modification: bool
Return type

bool

property is_pointer: bool
Return type

bool

property is_reference: bool
Return type

bool

property is_restrict: bool
Return type

bool

property is_rvalue_ref: bool
Return type

bool

property is_static: bool
Return type

bool

property is_template: bool
Return type

bool

property is_volatile: bool
Return type

bool

property pointer_order: Optional[int]
Return type

Optional[int]

property value: ModificationKind
Return type

ModificationKind

devana.syntax_abstraction.unioninfo

class UnionInfo(cursor=None, parent=None)[source]

Bases: CodeContainer

Named or anonymous union.

property associated_comment: Optional[Comment]
Return type

Optional[Comment]

property definition: Optional[Any]

Definition of union.

Return type

Optional[Any]

classmethod from_params(cls, parent=None, content=None, namespace=None, name=None, is_declaration=None, is_definition=None, lexicon=None, associated_comment=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

UnionInfo

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

property is_declaration: bool

Determine kind, definition or declaration.

Return type

bool

property is_definition: bool

Determine function kind, definition or declaration.

Return type

bool

property lexicon

Current lexicon storage of an object.

property name: Optional[str]

Name of union or None is anonymous.

Return type

Optional[str]

devana.syntax_abstraction.using

class Using(cursor=None, parent=None)[source]

Bases: IFromCursorCreatable, ICursorValidate, IFromParamsCreatable, ISyntaxElement

Class represented typedef declaration e.g., using AliasTypeName = const namespace::namespace::Type. Using without “=” as using namespace::Type; is not supported.

property associated_comment: Optional[Comment]
Return type

Optional[Comment]

classmethod from_cursor(cursor, parent=None)[source]

Create an instance from parsed information from clang. Return None if creation is not possible. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_params(cls, parent=None, type_info=None, name=None, lexicon=None, associated_comment=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

Using

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

property lexicon: CodeContainer

Current lexicon storage of object.

Return type

CodeContainer

property name: str

Typedef alias name.

Return type

str

property parent: CodeContainer

Structural parent element like file, namespace or class.

Return type

CodeContainer

property text_source: Optional[CodePiece]

Source of this element.

Return type

Optional[CodePiece]

property type_info: Union[TypeExpression, ISyntaxElement]

Type alias can be true type or next typedef.

Return type

Union[TypeExpression, ISyntaxElement]

devana.syntax_abstraction.usingnamespace

class UsingNamespace(cursor=None, parent=None)[source]

Bases: IFromCursorCreatable, ICursorValidate, IFromParamsCreatable, ISyntaxElement

Using namespace in scope.

classmethod from_cursor(cursor, parent=None)[source]

Create an instance from parsed information from clang. Return None if creation is not possible. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_namespace(namespace, parent=None)[source]
classmethod from_params(cls, parent=None, namespaces=None, lexicon=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

UsingNamespace

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

property lexicon
property namespace: Optional[str]
Return type

Optional[str]

property namespaces: Union[List[str], List[Lexicon]]
Return type

Union[List[str], List[Lexicon]]

property parent: Optional[ISyntaxElement]

Higher in the hierarchy scope, if any. In most cases, another CodeContainer.

Return type

Optional[ISyntaxElement]

property text_source: Optional[CodePiece]

Source of this element.

Return type

Optional[CodePiece]

devana.syntax_abstraction.variable

class GlobalVariable(cursor=None, parent=None)[source]

Bases: Variable, ICursorValidate

Data about global, independent variable used in code (out of class scope)

property associated_comment: Optional[Comment]
Return type

Optional[Comment]

classmethod from_cursor(cursor, parent=None)[source]

Create an instance from parsed information from clang. Return None if creation is not possible. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_params(cls, parent=None, name=None, type=None, default_value=None, lexicon=None, associated_comment=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

GlobalVariable

static is_cursor_valid(cursor)[source]

It checks if it is possible to create a valid object on the basis of the rate.

Return type

bool

class Variable(cursor=None, parent=None)[source]

Bases: IBasicCreatable, ISyntaxElement

Data about variable used in code

classmethod create_default(parent=None)[source]

Create a default, valid instance. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

property default_value: Optional[str]

Default value assigned to variable.

Return type

Optional[str]

classmethod from_cursor(cursor, parent=None)[source]

Create an instance from parsed information from clang. Return None if creation is not possible. Cls parameter allows implementing this method once if init meets requirements in all derivative types.

classmethod from_params(cls, parent=None, name=None, type=None, default_value=None, lexicon=None)[source]

Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.

Return type

Variable

property lexicon
property name: str

Variable name.

Return type

str

property parent: ISyntaxElement

Object scope of usage this data.

Return type

ISyntaxElement

property text_source: CodePiece

Source of this element.

Return type

CodePiece

property type: TypeExpression

Variable type.

Return type

TypeExpression

Syntax abstraction provides pythons classes, representing C ++ code elements.