Skip to content

Api

numbat.api

Public API of Numbat. Allow to create and manipulate Sourcetrail DB

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

_record_symbol(hierarchy)

Record a new Symbol in the database

Parameters:

Name Type Description Default
hierarchy NameHierarchy

The hierarchy of the symbol to insert

required

Returns:

Type Description
int

An unique integer that identify the inserted element

_get_symbol

_get_symbol(hierarchy)

Return the corresponding Symbol from the database

Parameters:

Name Type Description Default
hierarchy NameHierarchy

The hierarchy of the symbol to retrieve

required

Returns:

Type Description
int | None

The identifier of the existing symbol or None if the symbol does not exist.

_record_symbol_kind

_record_symbol_kind(id_, type_)

Set the type of the symbol which is equivalent to setting the type of the underlying node.

Parameters:

Name Type Description Default
id_ int

The identifier of the element

required
type_ NodeType

The new type for the symbol

required

Returns:

Type Description
None

None

_record_symbol_definition_kind

_record_symbol_definition_kind(id_, kind)

Set the type of definition of the corresponding element

Parameters:

Name Type Description Default
id_ int

The identifier of the element

required
kind SymbolType

The new type for the symbol

required

Returns:

Type Description
None

None

record_symbol_node

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

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

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=NameHierarchy.NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
)

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

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=NameHierarchy.NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
)

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

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=NameHierarchy.NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
)

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

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=NameHierarchy.NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
)

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

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=NameHierarchy.NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
)

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

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=NameHierarchy.NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
)

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

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=NameHierarchy.NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
)

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

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=NameHierarchy.NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
)

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

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=NameHierarchy.NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
)

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

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=NameHierarchy.NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
)

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

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=NameHierarchy.NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
)

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

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=NameHierarchy.NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
)

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

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=NameHierarchy.NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
)

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

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=NameHierarchy.NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
)

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

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=NameHierarchy.NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
)

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

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=NameHierarchy.NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
)

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

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=NameHierarchy.NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
)

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

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=NameHierarchy.NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
)

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

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=NameHierarchy.NAME_DELIMITER_CXX,
    parent_id=None,
    is_indexed=True,
)

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

Returns:

Type Description
int | None

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

_record_reference

_record_reference(source_id, dest_id, type_)

Add a new reference (an edge) between two elements

Parameters:

Name Type Description Default
source_id int

The source identifier of the reference

required
dest_id int

The destination identifier of the reference

required
type_ EdgeType

The type of reference to add

required

Returns:

Type Description
int

None

record_ref_member

record_ref_member(source_id, dest_id)

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

Returns:

Type Description
int

the reference id

record_ref_type_usage

record_ref_type_usage(source_id, dest_id)

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

Returns:

Type Description
int

the reference id

record_ref_usage

record_ref_usage(source_id, dest_id)

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

Returns:

Type Description
int

the reference id

record_ref_call

record_ref_call(source_id, dest_id)

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

Returns:

Type Description
int

the reference id

record_ref_inheritance

record_ref_inheritance(source_id, dest_id)

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

Returns:

Type Description
int

the reference id

record_ref_override

record_ref_override(source_id, dest_id)

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

Returns:

Type Description
int

the reference id

record_ref_type_argument

record_ref_type_argument(source_id, dest_id)

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

Returns:

Type Description
int

the reference id

record_ref_template_specialization

record_ref_template_specialization(source_id, dest_id)

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

Returns:

Type Description
int

the reference id

record_ref_include

record_ref_include(source_id, dest_id)

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

Returns:

Type Description
int

the reference id

record_ref_import

record_ref_import(source_id, dest_id)

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

Returns:

Type Description
int

the reference id

record_ref_bundled_edges

record_ref_bundled_edges(source_id, dest_id)

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

Returns:

Type Description
int

the reference id

record_ref_macro_usage

record_ref_macro_usage(source_id, dest_id)

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

Returns:

Type Description
int

the reference id

record_ref_annotation_usage

record_ref_annotation_usage(source_id, dest_id)

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

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
)

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

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)

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

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