Skip to content

Public API

Numbat provides a class SourcetrailDB created to be easily used by external projects to create Sourcetrail projects. It provides methods to:

numbat.SourcetrailDB

SourcetrailDB(database, path, logger=None)

This class implement a wrapper to Sourcetrail internal database, it is able to create, edit and delete the underlying sqlite3 database used by Sourcetrail.

exists classmethod

exists(path)

This method check if there is a Sourcetrail db with the given path. If the provided path does not end with the sourcetrail db correct suffix. It will be added.

Parameters:

Name Type Description Default
path Path | str

The path to test

required

Returns:

Type Description
bool

a bool

open classmethod

open(path, clear=False)

This method allow to open an existing sourcetrail database

Parameters:

Name Type Description Default
path Path | str

The path to the existing database

required
clear bool

If set to True the database is cleared (Optional)

False

Returns:

Type Description
SourcetrailDB

the SourcetrailDB object corresponding to the given DB

create classmethod

create(path)

This method allow to create a sourcetrail database

Parameters:

Name Type Description Default
path Path | str

The path to the new database

required

Returns:

Type Description
SourcetrailDB

the SourcetrailDB object corresponding to the given DB path

commit

commit()

This method allow to commit changes made to a sourcetrail database. Any change made to the database using this API will be lost if not committed before closing the database.

Returns:

Type Description
None

None

clear

clear()

Clear all elements present in the database.

Returns:

Type Description
None

None

close

close()

This method allow to close a sourcetrail database. The database must be closed after use in order to liberate memory and resources allocated for it.

Returns:

Type Description
None

None

record_symbol_node

record_symbol_node(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a "SYMBOL" symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_type_node

record_type_node(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a TYPE symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_buitin_type_node

record_buitin_type_node(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a BUILTIN_TYPE symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_module

record_module(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a MODULE symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_namespace

record_namespace(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a NAMESPACE symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_package

record_package(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a PACKAGE symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_struct

record_struct(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a STRUCT symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_class

record_class(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a CLASS symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_interface

record_interface(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a INTERFACE symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_annotation

record_annotation(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a ANNOTATION symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_global_variable

record_global_variable(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a GLOBAL_VARIABLE symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_field

record_field(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a FIELD symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_function

record_function(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a FUNCTION symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_method

record_method(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a METHOD symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_enum

record_enum(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a ENUM symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_enum_constant

record_enum_constant(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a ENUM_CONSTANT symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_typedef_node

record_typedef_node(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a TYPEDEF symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_type_parameter_node

record_type_parameter_node(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a TYPE_PARAMETER symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_macro

record_macro(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a MACRO symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_union

record_union(
    name="",
    prefix="",
    postfix="",
    delimiter=NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
    hover_display="",
)

Record a UNION symbol into the DB

Parameters:

Name Type Description Default
name str

The name of the element to insert

''
prefix str

The prefix of the element to insert

''
postfix str

The postfix of the element to insert

''
delimiter str

The delimiter of the element, if the element has a parent, it will not be taken into account as the parent delimiter will be used

NAME_DELIMITER_CXX
parent_id int

The identifier of the class in which the method is defined.

None
is_indexed bool

if the element is explicit or non-indexed

True
hover_display str

the display text when hovering over the node

''

Returns:

Type Description
int | None

The identifier of the new class or None if it could not be inserted

record_public_access

record_public_access(symbol_id)

Record the public access specifier for a symbol

Parameters:

Name Type Description Default
symbol_id int

The identifier of the symbol to update

required

Returns:

Type Description
None

None

record_private_access

record_private_access(symbol_id)

Record the private access specifier for a symbol

Parameters:

Name Type Description Default
symbol_id int

The identifier of the symbol to update

required

Returns:

Type Description
None

None

record_protected_access

record_protected_access(symbol_id)

Record the protected access specifier for a symbol

Parameters:

Name Type Description Default
symbol_id int

The identifier of the symbol to update

required

Returns:

Type Description
None

None

record_default_access

record_default_access(symbol_id)

Record the default access specifier for a symbol

Parameters:

Name Type Description Default
symbol_id int

The identifier of the symbol to update

required

Returns:

Type Description
None

None

record_template_parameter_access

record_template_parameter_access(symbol_id)

Record the template parameter access specifier for a symbol

Parameters:

Name Type Description Default
symbol_id int

The identifier of the symbol to update

required

Returns:

Type Description
None

None

record_type_parameter_access

record_type_parameter_access(symbol_id)

Record the type parameter access specifier for a symbol

Parameters:

Name Type Description Default
symbol_id int

The identifier of the symbol to update

required

Returns:

Type Description
None

None

set_node_type

set_node_type(type_to_change, graph_display='', hover_display='')

Change the display text of a node type.

Allowed values for node types: annotation built-in type class enum enum constant field file function global variable interface macro method module namespace package struct symbol type type parameter typedef union

Parameters:

Name Type Description Default
type_to_change str

The node type to update

required
graph_display str

The display text in the Sourcetrail graph

''
hover_display str

The display text when hovering over a node

''

change_node_color

change_node_color(
    node_id,
    fill_color="default",
    border_color="default",
    text_color="default",
    icon_color="default",
    hatching_color="default",
)

Change the color of a node

Supported values for colors: RGB hex code (e.g. #AABBCC), SVG color keyword

Parameters:

Name Type Description Default
node_id int

Id of the node to change

required
fill_color str

Color of the node body

'default'
border_color str

Color of the border

'default'
text_color str

Color of the node text

'default'
icon_color str

Color of the node icon (if applicable)

'default'
hatching_color str

Color of the node hatching (if applicable)

'default'

Returns:

Type Description
None

None

change_edge_color

change_edge_color(edge_id, color)

Change the color of an edge

Supported values for colors: RGB hex code (e.g. #AABBCC), SVG color keyword

Parameters:

Name Type Description Default
edge_id int

Id of the edge to change

required
color str

RGB hex code or name of the edge's new color

required

Returns:

Type Description
None

None

set_custom_command

set_custom_command(node_id, command, description)

Add a custom command to a node's context menu

Parameters:

Name Type Description Default
node_id int

Id of the node to add the custom command to

required
command list

List containing the command to execute and its arguments

required
description str

Description of the command

required

Returns:

Type Description
None

None

associate_file_to_node

associate_file_to_node(node_id, file, display_content)

Copy a file to the project directory and link it to a node

Parameters:

Name Type Description Default
node_id int

Id of the node to link

required
file Path

Path to the file to link

required
display_content bool

Whether the file content should be displayed or not

required

Returns:

Type Description
None

None

record_ref_member

record_ref_member(source_id, dest_id, hover_display='')

Add a member reference (aka an edge) between two elements

Parameters:

Name Type Description Default
source_id int

The source identifier

required
dest_id int

The destination identifier

required
hover_display str

The display text when hovering over the edge

''

Returns:

Type Description
int

the reference id

record_ref_type_usage

record_ref_type_usage(source_id, dest_id, hover_display='')

Add a TYPE_USAGE reference (aka an edge) between two elements

Parameters:

Name Type Description Default
source_id int

The source identifier

required
dest_id int

The destination identifier

required
hover_display str

The display text when hovering over the edge

''

Returns:

Type Description
int

the reference id

record_ref_usage

record_ref_usage(source_id, dest_id, hover_display='')

Add a USAGE reference (aka an edge) between two elements

Parameters:

Name Type Description Default
source_id int

The source identifier

required
dest_id int

The destination identifier

required
hover_display str

The display text when hovering over the edge

''

Returns:

Type Description
int

the reference id

record_ref_call

record_ref_call(source_id, dest_id, hover_display='')

Add a CALL reference (aka an edge) between two elements

Parameters:

Name Type Description Default
source_id int

The source identifier

required
dest_id int

The destination identifier

required
hover_display str

The display text when hovering over the edge

''

Returns:

Type Description
int

the reference id

record_ref_inheritance

record_ref_inheritance(source_id, dest_id, hover_display='')

Add an INHERITANCE reference (aka an edge) between two elements

Parameters:

Name Type Description Default
source_id int

The source identifier

required
dest_id int

The destination identifier

required
hover_display str

The display text when hovering over the edge

''

Returns:

Type Description
int

the reference id

record_ref_override

record_ref_override(source_id, dest_id, hover_display='')

Add an OVERRIDE reference (aka an edge) between two elements

Parameters:

Name Type Description Default
source_id int

The source identifier

required
dest_id int

The destination identifier

required
hover_display str

The display text when hovering over the edge

''

Returns:

Type Description
int

the reference id

record_ref_type_argument

record_ref_type_argument(source_id, dest_id, hover_display='')

Add a TYPE_ARGUMENT reference (aka an edge) between two elements

Parameters:

Name Type Description Default
source_id int

The source identifier

required
dest_id int

The destination identifier

required
hover_display str

The display text when hovering over the edge

''

Returns:

Type Description
int

the reference id

record_ref_template_specialization

record_ref_template_specialization(source_id, dest_id, hover_display='')

Add a TEMPLATE_SPECIALIZATION reference (aka an edge) between two elements

Parameters:

Name Type Description Default
source_id int

The source identifier

required
dest_id int

The destination identifier

required
hover_display str

The display text when hovering over the edge

''

Returns:

Type Description
int

the reference id

record_ref_include

record_ref_include(source_id, dest_id, hover_display='')

Add an INCLUDE reference (aka an edge) between two elements

Parameters:

Name Type Description Default
source_id int

The source identifier

required
dest_id int

The destination identifier

required
hover_display str

The display text when hovering over the edge

''

Returns:

Type Description
int

the reference id

record_ref_import

record_ref_import(source_id, dest_id, hover_display='')

Add an import reference (aka an edge) between two elements

Parameters:

Name Type Description Default
source_id int

The source identifier (who imports)

required
dest_id int

The destination identifier (who is imported)

required
hover_display str

The display text when hovering over the edge

''

Returns:

Type Description
int

the reference id

record_ref_bundled_edges

record_ref_bundled_edges(source_id, dest_id, hover_display='')

Add a BUNDLED_EDGES reference (aka an edge) between two elements

Parameters:

Name Type Description Default
source_id int

The source identifier

required
dest_id int

The destination identifier

required
hover_display str

The display text when hovering over the edge

''

Returns:

Type Description
int

the reference id

record_ref_macro_usage

record_ref_macro_usage(source_id, dest_id, hover_display='')

Add a MACRO_USAGE reference (aka an edge) between two elements

Parameters:

Name Type Description Default
source_id int

The source identifier

required
dest_id int

The destination identifier

required
hover_display str

The display text when hovering over the edge

''

Returns:

Type Description
int

the reference id

record_ref_annotation_usage

record_ref_annotation_usage(source_id, dest_id, hover_display='')

Add an ANNOTATION_USAGE reference (aka an edge) between two elements

Parameters:

Name Type Description Default
source_id int

The source identifier

required
dest_id int

The destination identifier

required
hover_display str

The display text when hovering over the edge

''

Returns:

Type Description
int

the reference id

record_reference_to_unsolved_symbol

record_reference_to_unsolved_symbol(
    symbol_id,
    reference_type,
    file_id,
    start_line,
    start_column,
    end_line,
    end_column,
    hover_display="",
)

Record a reference to an unsolved symbol.

Parameters:

Name Type Description Default
symbol_id int

The identifier of the symbol

required
reference_type EdgeType

The type of reference

required
file_id int

The identifier of the source file in which the symbol is located

required
start_line int

The line at which the element starts.

required
start_column int

The column at which the element starts.

required
end_line int

The line at which the element ends.

required
end_column int

The line at which the element ends.

required
hover_display str

the display text when hovering over the edge

''

Returns:

Type Description
int

The identifier of the new reference

record_reference_is_ambiguous

record_reference_is_ambiguous(reference_id)

Add an indication in the database to tell that the reference is ambiguous

Parameters:

Name Type Description Default
reference_id int

the identifier of the reference

required

Returns:

Type Description
None

None

record_file

record_file(path, indexed=True, hover_display='')

Record a source file in the database

Parameters:

Name Type Description Default
path Path

The path to the existing source file

required
indexed bool

A boolean that indicates if the source file was indexed by the parser

True
hover_display str

The display text when hovering over the node

''

Returns:

Type Description
int

The identifier of the inserted file

record_file_language

record_file_language(id_, language)

Set the language of an existing file inside the database

Parameters:

Name Type Description Default
id_ int

The identifier of the file

required
language str

A string that indicate the programming language of the file

required

Returns:

Type Description
None

None

record_symbol_location

record_symbol_location(
    symbol_id, file_id, start_line, start_column, end_line, end_column
)

Record a new source location of type TOKEN

Parameters:

Name Type Description Default
symbol_id int

The identifier of the symbol

required
file_id int

The identifier of the source file in which the symbol is located

required
start_line int

The line at which the element starts.

required
start_column int

The column at which the element starts.

required
end_line int

The line at which the element ends.

required
end_column int

The line at which the element ends.

required

Returns:

Type Description
None

None

record_symbol_scope_location

record_symbol_scope_location(
    symbol_id, file_id, start_line, start_column, end_line, end_column
)

Record a new source location of type SCOPE

Parameters:

Name Type Description Default
symbol_id int

The identifier of the symbol

required
file_id int

The identifier of the source file in which the symbol is located

required
start_line int

The line at which the element starts.

required
start_column int

The column at which the element starts.

required
end_line int

The line at which the element ends.

required
end_column int

The line at which the element ends.

required

Returns:

Type Description
None

None

record_symbol_signature_location

record_symbol_signature_location(
    symbol_id, file_id, start_line, start_column, end_line, end_column
)

Record a new source location of type SCOPE

Parameters:

Name Type Description Default
symbol_id int

The identifier of the symbol

required
file_id int

The identifier of the source file in which the symbol is located

required
start_line int

The line at which the element starts.

required
start_column int

The column at which the element starts.

required
end_line int

The line at which the element ends.

required
end_column int

The line at which the element ends.

required

Returns:

Type Description
None

None

record_reference_location

record_reference_location(
    reference_id, file_id, start_line, start_column, end_line, end_column
)

Record a new reference location of type TOKEN

Parameters:

Name Type Description Default
reference_id int

The reference identifier

required
file_id int

The identifier of the source file in which the symbol is located

required
start_line int

The line at which the element starts.

required
start_column int

The column at which the element starts.

required
end_line int

The line at which the element ends.

required
end_column int

The line at which the element ends.

required

Returns:

Type Description
None

None

record_qualifier_location

record_qualifier_location(
    symbol_id, file_id, start_line, start_column, end_line, end_column
)

Record a new source location of type QUALIFIER

Parameters:

Name Type Description Default
symbol_id int

The identifier of the symbol

required
file_id int

The identifier of the source file in which the symbol is located

required
start_line int

The line at which the element starts.

required
start_column int

The column at which the element starts.

required
end_line int

The line at which the element ends.

required
end_column int

The line at which the element ends.

required

Returns:

Type Description
None

None

record_local_symbol

record_local_symbol(name)

Record a new local symbol

Parameters:

Name Type Description Default
name str

The name of the new local symbol

required

Returns:

Type Description
int

The identifier of the new local symbol

record_local_symbol_location

record_local_symbol_location(
    symbol_id, file_id, start_line, start_column, end_line, end_column
)

Record a new source location of type LOCAL_SYMBOL

Parameters:

Name Type Description Default
symbol_id int

The identifier of the symbol

required
file_id int

The identifier of the source file in which the symbol is located

required
start_line int

The line at which the element starts.

required
start_column int

The column at which the element starts.

required
end_line int

The line at which the element ends.

required
end_column int

The line at which the element ends.

required

Returns:

Type Description
None

None

record_atomic_source_range

record_atomic_source_range(
    symbol_id, file_id, start_line, start_column, end_line, end_column
)

Record a new source location of type ATOMIC_RANGE

Parameters:

Name Type Description Default
symbol_id int

The identifier of the symbol

required
file_id int

The identifier of the source file in which the symbol is located

required
start_line int

The line at which the element starts.

required
start_column int

The column at which the element starts.

required
end_line int

The line at which the element ends.

required
end_column int

The line at which the element ends.

required

Returns:

Type Description
None

None

record_error

record_error(
    msg, fatal, file_id, start_line, start_column, end_line, end_column
)

Record a new indexer error in the database

Parameters:

Name Type Description Default
msg str

The description of the error

required
fatal bool

A boolean indicating if the error stop the execution of the parser

required
file_id int

The identifier of the source file being parsed

required
start_line int

The line at which the element starts.

required
start_column int

The column at which the element starts.

required
end_line int

The line at which the element ends.

required
end_column int

The line at which the element ends.

required

Returns:

Type Description
None

None