devana.syntax_abstraction.organizers
devana.syntax_abstraction.organizers.codecontainer
- class CodeContainer(cursor=None, parent=None)[source]
Bases:
IBasicCreatable
,ICursorValidate
,ISyntaxElement
,ABC
Class representing part of code source who is able to hold other sources in his body.
- property allowed_namespaces: List
List of all others allowed namespaces in container without Name:: prefix given by using namespace.
- Return type
List
- property content: List[Any]
List of source code objects.
- 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, content=None, namespace=None)[source]
Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.
- Return type
- property lexicon: Any
Current lexicon storage of an object.
- Return type
Any
- property namespace: Optional[str]
Namespace name if any.
- Return type
Optional
[str
]
- property parent: Optional[Any]
Higher in the hierarchy scope, if any. In most cases another CodeContainer.
- Return type
Optional
[Any
]
devana.syntax_abstraction.organizers.lexicon
- class Lexicon(source=None)[source]
Bases:
object
Class storage all multiple usage code elements in working context.
Lexicon hold reference to all definitions and declarations. It will hold all typedefs, namespaces, classes, functions, methods and templates. Main application of Lexicon is avoided parsing or created source code data types again. Existing data can be taken from lexicon. Additional, Lexicon can hold data who are not present in source files e.g. for make consistent devana structures and handcrafted code generation. Lexicon data are stacked in tree-like structures by data namespaces.
- property allowed_namespaces: List
List of all others allowed namespaces in container without Name:: prefix given by using namespace.
- Return type
List
- property content: List
Return code content.
- Return type
List
- classmethod create(source=None)[source]
Use this method to create lexicon inside syntax object to fit lexicon scope.
- property namespace: Optional[str]
- Return type
Optional
[str
]
- property namespaces_chain: List[str]
From root to current lexicon namespaces.
- Return type
List
[str
]
- property nodes: List
Return list of nested lexicons.
- Return type
List
- property parent: Optional
- Return type
Optional
- property root: Optional
Root of lexicon.
- Return type
Optional
- property sources: List[CodeContainer]
- Return type
List
[CodeContainer
]
devana.syntax_abstraction.organizers.sourcefile
- class IncludeInfo(cursor=None, parent=None)[source]
Bases:
ISyntaxElement
,IFromParamsCreatable
Include present in file.
- classmethod from_params(cls, parent=None, value=None, is_standard=None, path=None, source_file=None)[source]
Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.
- Return type
- property is_standard: bool
Information that include search in compiler headers in first order as include <stdlib> - is_standard true.
- Return type
bool
- property parent: Optional
Source file parent.
- Return type
Optional
- property path: str
Unrolled path of element of include.
- Return type
str
- property source_file: Optional
- Return type
Optional
- property text: Optional[str]
Source text of this element.
- Return type
Optional
[str
]
- property value: str
Value of include.
- Return type
str
- class SourceFile(source=None, parent=None, configuration=None)[source]
Bases:
CodeContainer
Information about specific source code file.
- bind_comment(element)[source]
Function take code element present in this source file and return associated comment depending on the configuration. A common use case is when specific instances of code elements use this.
- Return type
Optional
[Comment
]
- property configuration: Configuration
- Return type
- 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.
- Return type
Any
- property diagnostics: List
Information about backend parsing warnings and errors.
- Return type
List
- property extension: Union[Literal['h', 'hpp', 'hxx', 'c', 'cpp', 'cxx', 'cc'], str]
File extension. In most common way, it will be standard, well know C++ extension.
- Return type
Union
[Literal
[‘h’, ‘hpp’, ‘hxx’, ‘c’, ‘cpp’, ‘cxx’, ‘cc’],str
]
- classmethod from_cursor(cursor, parent=None, configuration=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, type=None, path=None, lexicon=None, includes=None, preamble=None, header_guard=None, configuration=None)[source]
Multi-parameter constructor. Similar to the default value, except that it allows you to set some basic properties.
- Return type
- property header_guard: Optional[str]
- Return type
Optional
[str
]
- property includes: List[IncludeInfo]
- Return type
List
[IncludeInfo
]
- 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
Current lexicon storage of an object.
- property module: Any
Parent module of source file.
- Return type
Any
- property name: str
Name of source file without extension.
- Return type
str
- property namespace: Optional[str]
Namespace name if any.
- Return type
Optional
[str
]
- property path: Optional[Path]
Relative to module source file path.
- Return type
Optional
[Path
]
- property preamble: Optional[Comment]
First comment in file - Must start with the first line. Standard comment grouping policies apply.
- Return type
Optional
[Comment
]
- property type: SourceFileType
Information abut file type.
- Return type
devana.syntax_abstraction.organizers.sourcemodule
- class ModuleFilter(allowed_filter=None, forbidden_filter=None)[source]
Bases:
object
Regular expressions to filter files and paths.
- allowed_filter: Optional[List[str]] = None
- forbidden_filter: Optional[List[str]] = None
- class SourceModule(name, root_path, module_filter=None, parent=None, configuration=None)[source]
Bases:
object
Logic unit of code as named collection of source files.
- property configuration
- property files: Iterable[SourceFile]
List of SourceFile from module.
- Return type
Iterable
[SourceFile
]
- property lexicon: Any
Lexicon linked to module.
- Return type
Any
- property module_filter
- property name: str
Name of module.
- Return type
str
- property parent
- property path: str
Absolute base path of module.
- Return type
str
Organizers provides pythons classes, including base classes, that can store other code elements, creating a structured hierarchy.