8. Python API reference

Python binding of the Libadalang API. Please consider all exported entities whose names that start with an underscore (“_”) as internal implementation details. They are not meant to be used directly.

class libadalang.AbortAbsent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.AbortNode(c_value, node_c_value, metadata, rebindings)[source]

Qualifier for the abort keyword.

p_as_bool

Return whether this is an instance of AbortPresent :rtype: bool

class libadalang.AbortPresent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.AbortStmt(c_value, node_c_value, metadata, rebindings)[source]

abort statement.

f_names

This field contains a list that itself contains one of the following nodes: * AttributeRef * CallExpr * CharLiteral * DottedName * ExplicitDeref * Identifier * QualExpr * StringLiteral * TargetName :rtype: NameList

class libadalang.AbstractAbsent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.AbstractFormalSubpDecl(c_value, node_c_value, metadata, rebindings)[source]

Formal declaration for an abstract subprogram.

class libadalang.AbstractNode(c_value, node_c_value, metadata, rebindings)[source]

Qualifier for the abstract keyword.

p_as_bool

Return whether this is an instance of AbstractPresent

Return type:bool
class libadalang.AbstractPresent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.AbstractSubpDecl(c_value, node_c_value, metadata, rebindings)[source]

Declaration for an abstract subprogram.

class libadalang.AcceptStmt(c_value, node_c_value, metadata, rebindings)[source]

accept statement.

f_entry_index_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_name
f_params
class libadalang.AcceptStmtWithStmts(c_value, node_c_value, metadata, rebindings)[source]

Extended accept statement.

f_end_name
f_stmts
class libadalang.AccessDef(c_value, node_c_value, metadata, rebindings)[source]

Base class for access type definitions.

f_has_not_null
class libadalang.AccessToSubpDef(c_value, node_c_value, metadata, rebindings)[source]

Type definition for accesses to subprograms.

f_has_protected
f_subp_spec
class libadalang.AdaList(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.AdaNode(c_value, node_c_value, metadata, rebindings)[source]

Root node class for the Ada syntax tree.

cast(typ)[source]

Fluent interface style method. Return self, raise an error if self is not of type typ. :type typ: () -> T :rtype: T

child_index

Return the 0-based index for Node in its parent’s children. :rtype: int

children

Return an array that contains the direct lexical children. :rtype: List[AdaNode]

dump(indent='', file=<open file '<stdout>', mode 'w'>)[source]

Dump the sub-tree in a human-readable format on the given file. :param str indent: Prefix printed on each line during the dump. :param file file: File in which the dump must occur.

dump_str()[source]

Dump the sub-tree to a string in a human-readable format.

entity_repr
find(ast_type_or_pred, **kwargs)[source]

Helper for finditer that will return only the first result. See finditer’s documentation for more details.

findall(ast_type_or_pred, **kwargs)[source]

Helper for finditer that will return all results as a list. See finditer’s documentation for more details.

finditer(ast_type_or_pred, **kwargs)[source]

Find every node corresponding to the passed predicates. :param ast_type_or_pred: If supplied with a subclass of

AdaNode, will constrain the resulting collection to only the instances of this type or any subclass. If supplied with a predicate, it will apply the predicate on every node and keep only the ones for which it returns True. If supplied with a list of subclasses of AdaNode, it will match all instances of any of them.
Parameters:kwargs (dict[str, Any]) – Allows the user to filter on attributes of the node. For every key value association, if the node has an attribute of name key that has the specified value, then the child is kept.
full_sloc_image

Return a string containing the filename + the sloc in GNU conformant format. Useful to create diagnostics from a node. :rtype: str

image

Return a representation of this node as a string.

is_a(*types)[source]

Shortcut for isinstance(self, types). :rtype: bool

is_ghost

Return whether the node is a ghost. Unlike regular nodes, ghost nodes cover no token in the input source: they are logically located instead between two tokens. The “token_first” of all ghost nodes is the token right after this logical position, while they have no “token_last”. :rtype: bool

is_list_type = False
is_synthetic

Return whether this node is synthetic.

is_token_node

Return whether this node is a node that contains only a single token.

iter_fields()[source]

Iterate through all the fields this node contains. Return an iterator that yields (name, value) couples for all abstract fields in this node. If “self” is a list, field names will be “item_{n}” with “n” being the index.

kind_name

Return the kind of this node.

lookup(sloc)[source]

Return the bottom-most node from in Node and its children which contains Sloc, or None if there is none.

next_sibling

Return the node’s next sibling, if there is one. :rtype: AdaNode

p_bool_type

Static method. Return the standard Boolean type. :rtype: AdaNode

p_choice_match(value)[source]

Assuming that self is a choice expression (such as what can appear in an alternative of a case statement or in the RHS of a membership expression, this property returns whether the given value satisfies it. .. ATTENTION:: This is an experimental feature, so even if it is exposed to allow experiments, it is totally unsupported and the API and behavior are very likely to change in the future. :param value: :type value: int :rtype: bool

p_complete

Return possible completions at this point in the file. :rtype: List[CompletionItem]

p_declarative_scope

Return the scope of definition of this basic declaration. :rtype: DeclarativePart

p_filter_is_imported_by(units, transitive)[source]

Filters out among the list of given units those that cannot refer to the unit in which this node lies. If transitive is True, the whole transitive closure of imports will be used to find a reference to the unit of this node. :param units: :type units: List[AnalysisUnit] :param transitive: :type transitive: bool :rtype: List[AnalysisUnit]

p_generic_instantiations

Return the potentially empty list of generic package/subprogram instantiations that led to the creation of this entity. Outer-most instantiations appear last. :rtype: List[GenericInstantiation]

p_gnat_xref(imprecise_fallback=False)[source]

Return a cross reference from this name to a defining identifier, trying to mimic GNAT’s xrefs as much as possible. :param imprecise_fallback: :type imprecise_fallback: bool :rtype: DefiningName

p_int_type

Static method. Return the standard Integer type. :rtype: AdaNode

p_parent_basic_decl

Return the parent basic decl for this node, if applicable, null otherwise. .. note:: If the parent BasicDecl of the given node is a generic declaration, this call will return the instantiation from which the node was retrieved instead, if any. :rtype: BasicDecl

p_resolve_names

This will resolve names for this node. If the operation is successful, then type_var and ref_var will be bound on appropriate subnodes of the statement. :rtype: bool

p_semantic_parent

Return the semantic parent for this node, if applicable, null otherwise. :rtype: AdaNode

p_standard_unit

Static method. Return the analysis unit corresponding to the Standard package. :rtype: AnalysisUnit

p_std_entity(sym)[source]

Static property. Return an entity from the standard package with name sym. :param sym: :type sym: str :rtype: AdaNode

p_top_level_decl(unit)[source]

Static method. Get the top-level decl in unit. This is the body of a Subunit, or the item of a LibraryItem. :param unit: :type unit: AnalysisUnit :rtype: BasicDecl

p_universal_int_type

Static method. Return the standard Universal Integer type. :rtype: AdaNode

p_universal_real_type

Static method. Return the standard Universal Real type. :rtype: AdaNode

p_valid_keywords

Return the list of keywords that are valid at this point in the file. .. note:: This is work in progress. It will return all keywords for now, without looking at the context. :rtype: List[str]

p_xref_entry_point

Designates entities that are entry point for the xref solving infrastructure. If this returns true, then resolve_names can be called on it. .. note:: For convenience, and unlike what is defined in the ARM wrt. complete contexts for name resolution, xref_entry_points can be nested. :rtype: bool

parent

Return the lexical parent for this node. Return null for the root AST node or for AST nodes for which no one has a reference to the parent. :rtype: AdaNode

parent_chain

Return the parent chain of self. Self will be the first element, followed by the first parent, then this parent’s parent, etc.

parents

Return an array that contains the lexical parents (this node included). Nearer parents are first in the list. :rtype: List[AdaNode]

previous_sibling

Return the node’s previous sibling, if there is one. :rtype: AdaNode

sloc_range

Return the spanning source location range for this node. Note that this returns the sloc of the parent for synthetic nodes.

text

Return the source buffer slice corresponding to the text that spans between the first and the last tokens of this node. Note that this returns the empty string for synthetic nodes.

to_data()[source]

Return a nested python data-structure, constituted only of standard data types (dicts, lists, strings, ints, etc), and representing the portion of the AST corresponding to this node.

to_json()[source]

Return a JSON representation of this node.

token_end

Return the last token used to parse this node. :rtype: Token

token_start

Return the first token used to parse this node. :rtype: Token

tokens

Return an iterator on the range of tokens that self encompasses.

unit

Return the analysis unit owning this node. :rtype: AnalysisUnit

class libadalang.AdaNodeList(c_value, node_c_value, metadata, rebindings)[source]

List of AdaNode. This list node can contain one of the following nodes: * AbstractSubpDecl * Allocator * AspectClause * AttributeRef * BaseAggregate * BinOp * BodyNode * CallExpr * CaseExpr * CharLiteral * ComponentClause * ComponentDecl * DeclExpr * DottedName * EntryDecl * ErrorDecl * ExceptionDecl * ExceptionHandler * ExplicitDeref * GenericDecl * GenericFormal * GenericInstantiation * GenericRenamingDecl * Identifier * IfExpr * IncompleteTypeDecl * MembershipExpr * NullComponentDecl * NullLiteral * NumLiteral * NumberDecl * ObjectDecl * OthersDesignator * PackageDecl * PackageRenamingDecl * ParenExpr * PragmaNode * ProtectedTypeDecl

  • QualExpr
  • QuantifiedExpr
  • RaiseExpr
  • SingleProtectedDecl
  • SingleTaskDecl
  • Stmt
  • StringLiteral
  • SubpDecl
  • SubtypeDecl
  • SubtypeIndication
  • TargetName
  • TaskTypeDecl
  • TypeDecl
  • UnOp
  • UseClause
  • WithClause
is_list_type = True
class libadalang.Aggregate(c_value, node_c_value, metadata, rebindings)[source]

Aggregate that is not a null record aggregate.

class libadalang.AggregateAssoc(c_value, node_c_value, metadata, rebindings)[source]

Assocation (X => Y) used for aggregates and parameter associations.

f_designators

This field contains a list that itself contains one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral

  • DeclExpr
  • DiscreteSubtypeIndication
  • DottedName
  • ExplicitDeref
  • Identifier
  • IfExpr
  • MembershipExpr
  • NullLiteral
  • NumLiteral
  • OthersDesignator
  • ParenExpr
  • QualExpr
  • QuantifiedExpr
  • RaiseExpr
  • StringLiteral
  • TargetName
  • UnOp
Return type:AlternativesList
f_r_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * BoxExpr * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

class libadalang.AliasedAbsent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.AliasedNode(c_value, node_c_value, metadata, rebindings)[source]

Qualifier for the aliased keyword.

p_as_bool

Return whether this is an instance of AliasedPresent :rtype: bool

class libadalang.AliasedPresent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.AllAbsent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.AllNode(c_value, node_c_value, metadata, rebindings)[source]

Qualifier for the all keyword.

p_as_bool

Return whether this is an instance of AllPresent :rtype: bool

class libadalang.AllPresent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.Allocator(c_value, node_c_value, metadata, rebindings)[source]

Allocator expression (new ...).

f_subpool

This field can contain one of the following nodes: * AttributeRef * CallExpr * CharLiteral * DottedName * ExplicitDeref * Identifier * QualExpr * StringLiteral * TargetName :rtype: Name

f_type_or_expr

This field can contain one of the following nodes: * QualExpr * SubtypeIndication :rtype: AdaNode

p_get_allocated_type

Return the allocated type for this allocator. :rtype: BaseTypeDecl

class libadalang.AlternativesList(c_value, node_c_value, metadata, rebindings)[source]

List of alternatives in a when ... clause. This list node can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DiscreteSubtypeIndication * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * OthersDesignator * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr

  • StringLiteral
  • TargetName
  • UnOp
is_list_type = True
class libadalang.AnalysisContext(charset=None, unit_provider=None, with_trivia=True, tab_stop=8, _c_value=None)[source]

This type represents a context for all source analysis. This is the first type you need to create to use Libadalang. It will contain the results of all analysis, and is the main holder for all the data. You can create several analysis contexts if you need to, which enables you, for example to: * analyze several different projects at the same time; * analyze different parts of the same projects in parallel. In the current design, contexts always keep all of their analysis units allocated. If you need to get this memory released, the only option at your disposal is to destroy your analysis context instance.

discard_errors_in_populate_lexical_env(discard)[source]

Debug helper. Set whether Property_Error exceptions raised in Populate_Lexical_Env should be discarded. They are by default.

get_from_buffer(filename, buffer, charset=None, reparse=False, rule='compilation_rule')[source]

Create a new analysis unit for Filename or return the existing one if any. Whether the analysis unit already exists or not, (re)parse it from the source code in Buffer. Rule controls which grammar rule is used to parse the unit. Use Charset in order to decode the source. If Charset is empty then use the context’s default charset. If any failure occurs, such as file opening, decoding, lexing or parsing failure, return an analysis unit anyway: errors are described as diagnostics of the returned analysis unit.

get_from_file(filename, charset=None, reparse=False, rule='compilation_rule')[source]

Create a new analysis unit for Filename or return the existing one if any. If Reparse is true and the analysis unit already exists, reparse it from Filename. Rule controls which grammar rule is used to parse the unit. Use Charset in order to decode the source. If Charset is empty then use the context’s default charset. If any failure occurs, such as file opening, decoding, lexing or parsing failure, return an analysis unit anyway: errors are described as diagnostics of the returned analysis unit.

get_from_provider(name, kind, charset=None, reparse=False)[source]

Create a new analysis unit for Name/Kind or return the existing one if any. If Reparse is true and the analysis unit already exists, reparse it from Filename. Use Charset in order to decode the source. If Charset is empty then use the context’s default charset. If the unit name cannot be tuned into a file name, raise an InvalidUnitNameError exception. If any other failure occurs, such as file opening, decoding, lexing or parsing failure, return an analysis unit anyway: errors are described as diagnostics of the returned analysis unit.

class libadalang.AnalysisUnit(context, c_value)[source]

This type represents the analysis of a single file.

class TokenIterator(first)[source]

Iterator over the tokens in an analysis unit.

next()
AnalysisUnit.context

Return the context that owns this unit.

AnalysisUnit.diagnostics

Diagnostics for this unit.

AnalysisUnit.filename

Return the filename this unit is associated to.

AnalysisUnit.first_token

Return a reference to the first token scanned in this unit.

AnalysisUnit.iter_tokens()[source]

Return an iterator that yields all the tokens in this unit.

AnalysisUnit.last_token

Return a reference to the last token scanned in this unit.

AnalysisUnit.lookup_token(sloc)[source]

Look for a token in this unit that contains the given source location. If this falls before the first token, return the first token. If this falls between two tokens, return the token that appears before. If this falls after the last token, return the last token. If there is no token in this unit, return no token.

AnalysisUnit.populate_lexical_env()[source]

Create lexical environments for this analysis unit, according to the specifications given in the language spec. If not done before, it will be automatically called during semantic analysis. Calling it before enables one to control where the latency occurs. Depending on whether errors are discarded (see Discard_Errors_In_Populate_Lexical_Env), raise a Property_Error on failure.

AnalysisUnit.reparse(buffer=None, charset=None)[source]

Reparse an analysis unit from a buffer, if provided, or from the original file otherwise. If Charset is empty or None, use the last charset successfuly used for this unit, otherwise use it to decode the content of the source file. If any failure occurs, such as decoding, lexing or parsing failure, diagnostic are emitted to explain what happened.

AnalysisUnit.root

Return the root node for this unit, or None if there is none. :rtype: AdaNode

AnalysisUnit.text

Return the source buffer associated to this unit.

AnalysisUnit.token_count

Return the number of tokens in this unit.

AnalysisUnit.trivia_count

Return the number of trivias in this unit. This is 0 for units that were parsed with trivia analysis disabled.

class libadalang.AnalysisUnitKind[source]

Specify a kind of analysis unit. Specification units provide an interface to the outer world while body units provide an implementation for the corresponding interface.

unit_body = 'unit_body'
unit_specification = 'unit_specification'
class libadalang.AnonymousObjectDecl(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.AnonymousType(c_value, node_c_value, metadata, rebindings)[source]

Container for inline anonymous array and access types declarations.

f_type_decl
class libadalang.AnonymousTypeAccessDef(c_value, node_c_value, metadata, rebindings)[source]

Synthetic type access, that will directly reference a type decl. It is used to generate synthetic anonymous access types.

f_type_decl
class libadalang.AnonymousTypeDecl(c_value, node_c_value, metadata, rebindings)[source]

Anonymous type declaration (for anonymous array or access types).

class libadalang.App[source]

Base class to regroup logic for an app. We use a class so that specific languages implementations can add specific arguments and processing by overriding specific methods: - main, which will be the main method of the app. - add_arguments to add arguments to the argparse.Parser instance - create_unit_provider to return a custom unit provider to be used by the

AnalysisContext.
  • description to change the description of the app.

Inside of main, the user can access app specific state: - self.units is a map of filenames to analysis units. - self.ctx is the analysis context. - self.u is the last parsed unit. The user can then run the app by calling App.run(). Here is a small example of an app subclassing App, that will simply print the tree of every unit passed as argument: .. code-block:: python

from libadalang import App class ExampleApp(App):

def main(self):
for u in self.units.values():
print u.filename print u.root.dump()

ExampleApp.run()

add_arguments()[source]
create_unit_provider()[source]
description

Description for this app. Empty by default.

process_files()[source]

Load units for all source files on the command-line in self.units. Put the last one in self.u.

classmethod run()[source]

Instantiate and run this application.

class libadalang.ArrayIndices(c_value, node_c_value, metadata, rebindings)[source]

Specification for array indexes.

class libadalang.ArrayTypeDef(c_value, node_c_value, metadata, rebindings)[source]

Type definition for an array.

f_component_type
f_indices
class libadalang.Aspect(exists, node, value)[source]

Composite field representing the aspect of an entity (RM 13).

exists

Whether the aspect is defined or not

node

Syntactic node that defines the aspect

value

Expr node defining the value of the aspect

class libadalang.AspectAssoc(c_value, node_c_value, metadata, rebindings)[source]

Name/expression association in an aspect.

f_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * ContractCases * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_id

This field can contain one of the following nodes:

  • AttributeRef
  • CallExpr
  • CharLiteral
  • DottedName
  • ExplicitDeref
  • Identifier
  • QualExpr
  • StringLiteral
  • TargetName
Return type:Name
class libadalang.AspectAssocList(c_value, node_c_value, metadata, rebindings)[source]

List of AspectAssoc.

is_list_type = True
class libadalang.AspectClause(c_value, node_c_value, metadata, rebindings)[source]

Base class for aspect clauses.

class libadalang.AspectSpec(c_value, node_c_value, metadata, rebindings)[source]

List of aspects in a declaration.

f_aspect_assocs
class libadalang.AssignStmt(c_value, node_c_value, metadata, rebindings)[source]

Statement for assignments.

f_dest

This field can contain one of the following nodes:

  • AttributeRef
  • CallExpr
  • CharLiteral
  • DottedName
  • ExplicitDeref
  • Identifier
  • QualExpr
  • StringLiteral
  • TargetName
Return type:Name
f_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

class libadalang.AssocList(c_value, node_c_value, metadata, rebindings)[source]

List of associations.

is_list_type = True
p_zip_with_params(imprecise_fallback=False)[source]

Returns an array of pairs, associating formal parameters to actual expressions. The formals to match are retrieved by resolving the call which this AssocList represents the actuals of. :param imprecise_fallback: :type imprecise_fallback: bool :rtype: List[ParamActual]

class libadalang.AtClause(c_value, node_c_value, metadata, rebindings)[source]

Representation clause (for .. use at ...;).

f_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_name

This field can contain one of the following nodes:

  • CharLiteral
  • Identifier
  • StringLiteral
Return type:BaseId
class libadalang.AttributeDefClause(c_value, node_c_value, metadata, rebindings)[source]

Clause for an attribute definition (for ...'Attribute use ...;).

f_attribute_expr

This field can contain one of the following nodes:

  • AttributeRef
  • CallExpr
  • CharLiteral
  • DottedName
  • ExplicitDeref
  • Identifier
  • QualExpr
  • StringLiteral
  • TargetName
Return type:Name
f_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

class libadalang.AttributeRef(c_value, node_c_value, metadata, rebindings)[source]

Expression to reference an attribute.

f_args
f_attribute
f_prefix

This field can contain one of the following nodes: * AttributeRef * CallExpr * CharLiteral * DottedName * ExplicitDeref * Identifier * QualExpr * StringLiteral * TargetName :rtype: Name

class libadalang.BaseAggregate(c_value, node_c_value, metadata, rebindings)[source]

Base class for aggregates.

f_ancestor_expr
f_assocs
class libadalang.BaseAssoc(c_value, node_c_value, metadata, rebindings)[source]

Abstract class for a key/value association, where the value is an expression.

p_assoc_expr

Returns the expression side of this assoc node.

Return type:Expr
class libadalang.BaseAssocList(c_value, node_c_value, metadata, rebindings)[source]

List of BaseAssoc.

is_list_type = True
class libadalang.BaseFormalParamDecl(c_value, node_c_value, metadata, rebindings)[source]

Base class for formal parameter declarations. This is used both for records components and for subprogram parameters. This is a Libadalang abstraction, that has no ARM existence.

p_formal_type(origin=None)[source]

Return the type for this formal. :param origin: :type origin: AdaNode :rtype: BaseTypeDecl

class libadalang.BaseFormalParamHolder(c_value, node_c_value, metadata, rebindings)[source]

Base class for lists of formal parameters. This is used both for subprogram specifications and for records, so that we can share the matching and unpacking logic.

p_abstract_formal_params

Return the list of abstract formal parameters for this holder. :rtype: List[BaseFormalParamDecl]

p_nb_max_params

Return the maximum number of parameters this subprogram can be called while still being a legal call. :rtype: int

p_nb_min_params

Return the minimum number of parameters this subprogram can be called while still being a legal call. :rtype: int

p_param_types(origin=None)[source]

Returns the type of each parameter of Self. :param origin: :type origin: AdaNode :rtype: List[BaseTypeDecl]

class libadalang.BaseId(c_value, node_c_value, metadata, rebindings)[source]

Base class for identifiers.

class libadalang.BaseLoopStmt(c_value, node_c_value, metadata, rebindings)[source]

Base class for loop statements.

f_end_name
f_spec
f_stmts

This field contains a list that itself contains one of the following nodes: * PragmaNode * Stmt :rtype: StmtList

class libadalang.BasePackageDecl(c_value, node_c_value, metadata, rebindings)[source]

Package declarations. Concrete instances of this class will be created in generic package declarations. Other non-generic package declarations will be instances of PackageDecl. The behavior is the same, the only difference is that BasePackageDecl and PackageDecl have different behavior regarding lexical environments. In the case of generic package declarations, we use BasePackageDecl which has no env_spec, and the environment behavior is handled by the GenericPackageDecl instance.

f_end_name
f_package_name
f_private_part
f_public_part
p_body_part

Return the PackageBody corresponding to this node. :rtype: PackageBody

class libadalang.BaseRecordDef(c_value, node_c_value, metadata, rebindings)[source]

Base class for record definitions.

f_components
class libadalang.BaseSubpBody(c_value, node_c_value, metadata, rebindings)[source]

Base class for subprogram bodies.

f_overriding
f_subp_spec
class libadalang.BaseSubpSpec(c_value, node_c_value, metadata, rebindings)[source]

Base class for subprogram specifications.

p_params

Returns the array of parameters specification for this subprogram spec. :rtype: List[ParamSpec]

p_primitive_subp_first_type

Return the first type of which this subprogram is a primitive of. :rtype: BaseTypeDecl

p_primitive_subp_tagged_type

If this subprogram is a primitive for a tagged type, then return this type. :rtype: BaseTypeDecl

p_primitive_subp_types

Return the types of which this subprogram is a primitive of. :rtype: List[BaseTypeDecl]

p_return_type(origin=None)[source]

Returns the return type of Self, if applicable (e.g. if Self is a subprogram). Else, returns null. :param origin: :type origin: AdaNode :rtype: BaseTypeDecl

p_returns

Syntax property. Return the type expression node corresponding to the return of this subprogram spec. :rtype: TypeExpr

class libadalang.BaseSubtypeDecl(c_value, node_c_value, metadata, rebindings)[source]

Base class for subtype declarations.

class libadalang.BaseTypeAccessDef(c_value, node_c_value, metadata, rebindings)[source]

Base class for access type definitions.

class libadalang.BaseTypeDecl(c_value, node_c_value, metadata, rebindings)[source]

Base class for type declarations.

f_name
p_accessed_type(origin=None)[source]

If this type is an access type, or a type with an Implicit_Dereference aspect, return the type of a dereference of an instance of this type. :param origin: :type origin: AdaNode :rtype: BaseTypeDecl

p_base_subtype(origin=None)[source]

If this type decl is a subtype decl, return the base subtype. If not, return Self. :param origin: :type origin: AdaNode :rtype: BaseTypeDecl

p_base_type(origin=None)[source]

Return the base type entity for this derived type declaration :param origin: :type origin: AdaNode :rtype: BaseTypeDecl

p_base_types(origin=None)[source]

Return the list of base types for Self. :param origin: :type origin: AdaNode :rtype: List[BaseTypeDecl]

p_canonical_type(origin=None)[source]

Return the canonical type declaration for this type declaration. For subtypes, it will return the base type declaration. :param origin: :type origin: AdaNode :rtype: BaseTypeDecl

p_comp_type(is_subscript=False, origin=None)[source]

Return the component type of Self, if applicable. The component type is the type you’ll get if you call a value whose type is Self. So it can either be: 1. The component type for an array. 2. The return type for an access to function. :param is_subscript: :type is_subscript: bool :param origin: :type origin: AdaNode :rtype: BaseTypeDecl

p_discrete_range

Return the discrete range for this type decl, if applicable. :rtype: DiscreteRange

p_discriminants_list

Return the list of all discriminants of this type. If this type has no discriminant or only unknown discriminants, an empty list is returned. :rtype: List[BaseFormalParamDecl]

p_find_all_derived_types(units, imprecise_fallback=False)[source]

Return the list of all types that inherit (directly or inderictly) from Self among the given units. :param units: :type units: List[AnalysisUnit] :param imprecise_fallback: :type imprecise_fallback: bool :rtype: List[TypeDecl]

p_find_derived_types(root, origin, imprecise_fallback=False)[source]

Find types derived from self in the given root and its children. :param root: :type root: AdaNode :param origin: :type origin: AdaNode :param imprecise_fallback: :type imprecise_fallback: bool :rtype: List[TypeDecl]

p_full_view

Return the full completion of this type. :rtype: BaseTypeDecl

p_get_enum_representation_clause(imprecise_fallback=False)[source]

Return the enum representation clause associated to this type decl, if applicable (i.e. this type decl defines an enum type). :param imprecise_fallback: :type imprecise_fallback: bool :rtype: EnumRepClause

p_get_record_representation_clause(imprecise_fallback=False)[source]

Return the record representation clause associated to this type decl, if applicable (i.e. this type decl defines a record type). :param imprecise_fallback: :type imprecise_fallback: bool :rtype: RecordRepClause

p_index_type(dim, origin=None)[source]

Return the index type for dimension dim for this type, if applicable. :param dim: :type dim: int :param origin: :type origin: AdaNode :rtype: BaseTypeDecl

p_is_access_type(origin=None)[source]

Whether Self is an access type or not :param origin: :type origin: AdaNode :rtype: bool

p_is_array_type(origin=None)[source]

Return whether this type is an array type. :param origin: :type origin: AdaNode :rtype: bool

p_is_char_type(origin=None)[source]

Whether type is a character type or not :param origin: :type origin: AdaNode :rtype: bool

p_is_definite_subtype(origin=None)[source]

Returns whether this is a definite subtype. For convenience, this will return False for incomplete types, even though the correct answer is more akin to “non applicable”. :param origin: :type origin: AdaNode :rtype: bool

p_is_derived_type(other_type, origin=None)[source]

Whether Self is derived from other_type. :param other_type: :type other_type: BaseTypeDecl :param origin: :type origin: AdaNode :rtype: bool

p_is_discrete_type(origin=None)[source]

Whether type is a discrete type or not. :param origin: :type origin: AdaNode :rtype: bool

p_is_enum_type(origin=None)[source]

Whether type is an enum type :param origin: :type origin: AdaNode :rtype: bool

p_is_fixed_point(origin=None)[source]

Whether type is a fixed point type or not. :param origin: :type origin: AdaNode :rtype: bool

p_is_float_type(origin=None)[source]

Whether type is a float type or not. :param origin: :type origin: AdaNode :rtype: bool

p_is_int_type(origin=None)[source]

Whether type is an integer type or not. :param origin: :type origin: AdaNode :rtype: bool

p_is_interface_type(origin=None)[source]

Return True iff this type declaration is an interface definition. :param origin: :type origin: AdaNode :rtype: bool

p_is_private

Whether node is a private view of corresponding type. :rtype: bool

p_is_real_type(origin=None)[source]

Whether type is a real type or not. :param origin: :type origin: AdaNode :rtype: bool

p_is_record_type(origin=None)[source]

Return whether this type is a record type. :param origin: :type origin: AdaNode :rtype: bool

p_is_tagged_type(origin=None)[source]

Whether type is tagged or not :param origin: :type origin: AdaNode :rtype: bool

p_matching_type(expected_type, origin=None)[source]

Return whether self matches expected_type. :param expected_type: :type expected_type: BaseTypeDecl :param origin: :type origin: AdaNode :rtype: bool

p_next_part

Returns the next part for this type decl. :rtype: BaseTypeDecl

p_previous_part(go_to_incomplete=True)[source]

Returns the previous part for this type decl. :param go_to_incomplete: :type go_to_incomplete: bool :rtype: BaseTypeDecl

p_private_completion

Return the private completion for this type, if there is one. :rtype: BaseTypeDecl

p_root_type(origin=None)[source]

Return the type that is at the root of the derivation hierarchy (ignoring secondary interfaces derivations for tagged types)

Parameters:origin (AdaNode) –
Return type:BaseTypeDecl
p_shapes(include_discriminants=True, origin=None)[source]

Must be called on a record (sub-)type declaration. Return all the possible shapes that a value of this record type can take. For example, consider the following record definition: .. code:: type R (A : Integer; B : Integer) is record X : Integer; case A is when 1 .. 10 => Y_1 : Integer; case B is when 1 .. 10 => Z_1 : Integer; when others => null; end case; when 11 .. 20 => Y_2 : Integer; case B is when 1 .. 10 => Z_2 : Integer; when others => null; end case; when others => null; end case; end record; For this instance, this property will return the following results: .. code:: [ [X, Y_1, Z_1], [X, Y_1], [X, Y_2, Z_2], [X, Y_2], [X] ] .. ATTENTION:: This property is inaccurate when called on a record extension which defines components under a certain condition C, and this same condition is used to define some components in the parent record: in that case, any feasible shape will in practice contain either both the components defined under condition C in the child record and the parent record, or none of them. However, due to the simplified algorithm we use here to compute the feasible shapes, we will also return shapes that include the components of the child record but not the parent record, and conversely. :param include_discriminants: :type include_discriminants: bool :param origin: :type origin: AdaNode :rtype: List[Shape]

class libadalang.BasicAssoc(c_value, node_c_value, metadata, rebindings)[source]

Association of one or several names to an expression.

p_get_params(imprecise_fallback=False)[source]

Return the list of parameters that this association refers to.

Parameters:imprecise_fallback (bool) –
Return type:List[DefiningName]
class libadalang.BasicAssocList(c_value, node_c_value, metadata, rebindings)[source]

List of BasicAssoc.

is_list_type = True
class libadalang.BasicDecl(c_value, node_c_value, metadata, rebindings)[source]

Root class for an Ada declaration (RM 3.1). A declaration associates a name with a language entity, for example a type or a variable.

f_aspects

Return the list of aspects that are attached to this node. :rtype: AspectSpec

p_base_subp_declarations

If Self declares a primitive subprogram of some tagged type T, return the set of all subprogram declarations that it overrides (including itself).

Return type:List[BasicDecl]
p_body_part_for_decl

Return the body corresponding to this declaration, if applicable. .. note:: It is not named body_part, subclasses have more precise versions named body_part and returning a more precise result. Probably, we want to rename the specific versions, and have the root property be named body_part. (TODO R925-008) :rtype: BodyNode

p_canonical_fully_qualified_name

Return a canonical representation of the fully qualified name corresponding to this declaration. :rtype: str

p_canonical_part

Return the canonical part for this decl. In the case of decls composed of several parts, the canonical part will be the first part. :rtype: BasicDecl

p_defining_name

Get the name of this declaration. If this declaration has several names, it will return the first one. :rtype: DefiningName

p_defining_names

Get all the names of this basic declaration. :rtype: List[DefiningName]

p_doc

Return the documentation associated with this decl. Raises a property error if the doc is incorrectly formatted. .. ATTENTION:: This is an experimental feature, so even if it is exposed to allow experiments, it is totally unsupported and the API and behavior are very likely to change in the future. :rtype: str

p_doc_annotations

Return the documentation annotations associated with this decl. Annotations are any comment line of the form:: –% [annotation_name]: [annotation] Raises a property error if the doc is incorrectly formatted. .. ATTENTION:: This is an experimental feature, so even if it is exposed to allow experiments, it is totally unsupported and the API and behavior are very likely to change in the future. :rtype: List[DocAnnotation]

p_find_all_overrides(units, imprecise_fallback=False)[source]

If Self is the declaration of a primitive of some type T, return the list of all subprogram that override this subprogram among the given units. :param units: :type units: List[AnalysisUnit] :param imprecise_fallback: :type imprecise_fallback: bool :rtype: List[BasicDecl]

p_fully_qualified_name

Return the fully qualified name corresponding to this declaration. :rtype: str

p_fully_qualified_name_array

Return the fully qualified name corresponding to this declaration, as an array of symbols. :rtype: List[str]

p_get_aspect(name, imprecise_fallback=False)[source]

Return the aspect with name name associated to this entity. Aspects are properties of entities that can be specified by the Ada program, either via aspect specifications, pragmas, or attributes. This will return the syntactic node corresponding to attribute directly. :param name: :type name: str :param imprecise_fallback: :type imprecise_fallback: bool :rtype: Aspect

p_get_aspect_assoc(name)[source]

Return the aspect with name name for this entity. :param name: :type name: str :rtype: AspectAssoc

p_get_aspect_spec_expr(name)[source]

Return the expression associated to the aspect with name name for this entity. :param name: :type name: str :rtype: Expr

p_get_pragma(name)[source]

Return the pragma with name name associated to this entity. :param name: :type name: str :rtype: PragmaNode

p_get_representation_clause(name, imprecise_fallback=False)[source]

Return the representation clause associated to this type decl that defines the given attribute name. :param name: :type name: str :param imprecise_fallback: :type imprecise_fallback: bool :rtype: AttributeDefClause

p_has_aspect(name, imprecise_fallback=False)[source]

Returns whether the boolean aspect named name is set on the entity represented by this node. “Aspect” is used as in RM terminology (see RM 13). :param name: :type name: str :param imprecise_fallback: :type imprecise_fallback: bool :rtype: bool

p_is_compilation_unit_root

Whether a BasicDecl is the root decl for its unit. :rtype: bool

p_is_formal

Whether this decl is the nested decl of a generic formal declaration. :rtype: bool

p_is_imported

Whether this declaration is imported from another language. :rtype: bool

p_is_static_decl(imprecise_fallback=False)[source]

Return whether this declaration is static. :param imprecise_fallback: :type imprecise_fallback: bool :rtype: bool

p_is_subprogram

Return True if self is a subprogram node in the general sense (which is, an entity that can be called). This includes separates and entries. :rtype: bool

p_is_visible(from_node)[source]

Return whether this declaration is visible from the point of view of the given origin node. .. ATTENTION:: Only package-level (public or private) declarations are supported for now. :param from_node: :type from_node: AdaNode :rtype: bool

p_next_part_for_decl

Return the next part of this declaration, if applicable. .. note:: It is not named next_part, because BaseTypeDecl has a more precise version of next_part that returns a BaseTypeDecl. Probably, we want to rename the specific versions, and have the root property be named next_part. (TODO R925-008) :rtype: BasicDecl

p_previous_part_for_decl

Return the previous part for this decl, if applicable. .. note:: It is not named previous_part, because BaseTypeDecl has a more precise version of previous_part that returns a BaseTypeDecl. Probably, we want to rename the specific versions, and have the root property be named previous_part. (TODO R925-008) :rtype: BasicDecl

p_relative_name

Return the relative name for Self. If Self’s defining name is A.B.C, return C as a node. :rtype: SingleTokNode

p_relative_name_text

Return the relative name for Self, as text. :rtype: str

p_root_subp_declarations(origin=None)[source]

If Self declares a primitive subprogram of some tagged type T, return the root subprogram declarations that it overrides. There can be several, as in the following scenario: - package Root defines the root tagged type T and subprogram Foo. - package Itf defines interface I and abstract subprogram Foo. - package D defines “type U is new Root.T and Itf.I” and an overriding subprogram Foo. Here, root_subp_declarations of Foo defined in package D will return both Foo from package Root and Foo from package Itf. :param origin: :type origin: AdaNode :rtype: List[BasicDecl]

p_subp_spec_or_null(follow_generic=False)[source]

If Self is a Subp, returns the specification of this subprogram. If follow_generic is True, will also work for instances of GenericSubpDecl. :param follow_generic: :type follow_generic: bool :rtype: BaseSubpSpec

p_type_expression

Return the type expression for this BasicDecl if applicable, a null otherwise. :rtype: TypeExpr

p_unique_identifying_name

Return a unique identifying name for this declaration, provided this declaration is a public declaration. In the case of subprograms, this will include the profile. .. attention:: This will only return a unique name for public declarations. Notably, anything nested in an unnamed declare block won’t be handled correctly. :rtype: str

class libadalang.BasicDeclList(c_value, node_c_value, metadata, rebindings)[source]

List of BasicDecl. This list node can contain one of the following nodes: * NumberDecl * ObjectDecl * SingleProtectedDecl * SingleTaskDecl

is_list_type = True
class libadalang.BasicSubpDecl(c_value, node_c_value, metadata, rebindings)[source]

Base class for subprogram declarations.

p_body_part

Return the BaseSubpBody corresponding to this node. :rtype: BaseSubpBody

p_subp_decl_spec

Return the specification for this subprogram :rtype: BaseSubpSpec

class libadalang.BeginBlock(c_value, node_c_value, metadata, rebindings)[source]

Statement block with no declarative part.

f_end_name
f_stmts
class libadalang.BinOp(c_value, node_c_value, metadata, rebindings)[source]

Binary expression.

f_left

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr

  • DottedName
  • ExplicitDeref
  • Identifier
  • IfExpr
  • MembershipExpr
  • NullLiteral
  • NumLiteral
  • ParenExpr
  • QualExpr
  • QuantifiedExpr
  • RaiseExpr
  • StringLiteral
  • TargetName
  • UnOp
Return type:Expr
f_op

This field can contain one of the following nodes: * OpAnd * OpAndThen * OpConcat * OpDiv

  • OpDoubleDot
  • OpEq
  • OpGt
  • OpGte
  • OpLt
  • OpLte
  • OpMinus
  • OpMod
  • OpMult
  • OpNeq
  • OpOr
  • OpOrElse
  • OpPlus
  • OpPow
  • OpRem
  • OpXor
Return type:Op
f_right

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

class libadalang.BlockStmt(c_value, node_c_value, metadata, rebindings)[source]

Base class for statement blocks.

class libadalang.BodyNode(c_value, node_c_value, metadata, rebindings)[source]

Base class for an Ada body (RM 3.11). A body is the completion of a declaration.

p_decl_part

Return the decl corresponding to this node if applicable. :rtype: BasicDecl

p_previous_part

Return the previous part for this body. Might be a declaration or a body stub. :rtype: BasicDecl

p_subunit_root

If self is a subunit, return the body in which it is rooted. :rtype: BasicDecl

class libadalang.BodyStub(c_value, node_c_value, metadata, rebindings)[source]

Base class for a body stub (RM 10.1.3). A body stub is meant to be completed by .

class libadalang.BoxExpr(c_value, node_c_value, metadata, rebindings)[source]

Box expression (<>).

class libadalang.BracketAggregate(c_value, node_c_value, metadata, rebindings)[source]

Bracket array or container aggregate (Ada 2020).

class libadalang.BracketDeltaAggregate(c_value, node_c_value, metadata, rebindings)[source]

Bracket delta aggregate (Ada 2020).

class libadalang.CallExpr(c_value, node_c_value, metadata, rebindings)[source]

Represent a syntactic call expression.

At the semantic level, this can be either a subprogram call, an array subcomponent access expression, an array slice or a type conversion.

f_name

This field can contain one of the following nodes: * AttributeRef * CallExpr * CharLiteral

  • DottedName
  • ExplicitDeref
  • Identifier
  • QualExpr
  • StringLiteral
  • TargetName
Return type:Name
f_suffix

This field can contain one of the following nodes: * AttributeRef * BasicAssocList * BinOp * CallExpr * CharLiteral * DiscreteSubtypeIndication * DottedName * ExplicitDeref * Identifier * QualExpr * StringLiteral * TargetName :rtype: AdaNode

p_is_array_slice

Return whether this CallExpr is actually an access to a slice of the array denoted by the prefix of this CallExpr. :rtype: bool

class libadalang.CallStmt(c_value, node_c_value, metadata, rebindings)[source]

Statement for entry or procedure calls.

f_call

This field can contain one of the following nodes: * AttributeRef * CallExpr * CharLiteral * DottedName * ExplicitDeref * Identifier * QualExpr * StringLiteral * TargetName :rtype: Name

class libadalang.CaseExpr(c_value, node_c_value, metadata, rebindings)[source]

case expression.

f_cases
f_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName

  • UnOp
Return type:Expr
class libadalang.CaseExprAlternative(c_value, node_c_value, metadata, rebindings)[source]

Alternative in a case expression (when ... => ...).

f_choices

This field contains a list that itself contains one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr

  • DiscreteSubtypeIndication
  • DottedName
  • ExplicitDeref
  • Identifier
  • IfExpr
  • MembershipExpr
  • NullLiteral
  • NumLiteral
  • OthersDesignator
  • ParenExpr
  • QualExpr
  • QuantifiedExpr
  • RaiseExpr
  • StringLiteral
  • TargetName
  • UnOp
Return type:AlternativesList
f_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

class libadalang.CaseExprAlternativeList(c_value, node_c_value, metadata, rebindings)[source]

List of CaseExprAlternative.

is_list_type = True
class libadalang.CaseStmt(c_value, node_c_value, metadata, rebindings)[source]

case statement.

f_alternatives
f_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

class libadalang.CaseStmtAlternative(c_value, node_c_value, metadata, rebindings)[source]

Alternative in a case statement (when ... => ...).

f_choices

This field contains a list that itself contains one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DiscreteSubtypeIndication * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * OthersDesignator * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: AlternativesList

f_stmts

This field contains a list that itself contains one of the following nodes: * PragmaNode * Stmt :rtype: StmtList

class libadalang.CaseStmtAlternativeList(c_value, node_c_value, metadata, rebindings)[source]

List of CaseStmtAlternative.

is_list_type = True
class libadalang.CharLiteral(c_value, node_c_value, metadata, rebindings)[source]

Character literal.

p_denoted_value

Return the value that this literal denotes. :rtype: str

class libadalang.ClassicSubpDecl(c_value, node_c_value, metadata, rebindings)[source]

This is an intermediate abstract class for subprogram declarations with a common structure: overriding indicator, SubpSpec, aspects, <other fields>.

f_overriding
f_subp_spec
class libadalang.ClasswideTypeDecl(c_value, node_c_value, metadata, rebindings)[source]

Synthetic node (not parsed, generated from a property call). Refers to the classwide type for a given tagged type. The aim is that those be mostly equivalent to their non-classwide type, except for some resolution rules.

class libadalang.CompilationUnit(c_value, node_c_value, metadata, rebindings)[source]

Root node for all Ada analysis units.

f_body

This field can contain one of the following nodes: * LibraryItem * Subunit :rtype: AdaNode

f_pragmas
f_prelude

with, use or pragma statements. This field contains a list that itself contains one of the following nodes: * PragmaNode * UseClause * WithClause :rtype: AdaNodeList

p_decl

Get the root basic decl defined in this compilation unit. :rtype: BasicDecl

p_imported_units

Return all the compilation units that are directly imported by this one. This includes “with”ed units as well as the direct parent unit. :rtype: List[CompilationUnit]

p_is_preelaborable

Whether this compilation unit is preelaborable or not. :rtype: bool

p_syntactic_fully_qualified_name

Return the syntactic fully qualified name of this compilation unit. :rtype: List[str]

p_unit_dependencies

Return the list of all the compilation units that are (direct and indirect) dependencies of this one. :rtype: List[CompilationUnit]

p_unit_kind

Return the kind corresponding to this analysis unit. :rtype: str

p_withed_units

Look for all “with” clauses at the top of this compilation unit and return all the compilation units designated by them. :rtype: List[CompilationUnit]

class libadalang.CompilationUnitList(c_value, node_c_value, metadata, rebindings)[source]

List of CompilationUnit.

is_list_type = True
class libadalang.CompletionItem(decl, is_dot_call, is_visible)[source]
decl
is_dot_call
is_visible
class libadalang.ComponentClause(c_value, node_c_value, metadata, rebindings)[source]

Representation clause for a single component.

f_id
f_position

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_range
class libadalang.ComponentDecl(c_value, node_c_value, metadata, rebindings)[source]

Declaration for a component.

f_component_def
f_default_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_ids
class libadalang.ComponentDef(c_value, node_c_value, metadata, rebindings)[source]

Definition for a component.

f_has_aliased
f_has_constant
f_type_expr

This field can contain one of the following nodes: * AnonymousType * SubtypeIndication :rtype: TypeExpr

class libadalang.ComponentList(c_value, node_c_value, metadata, rebindings)[source]

List of component declarations.

f_components
f_variant_part
class libadalang.CompositeStmt(c_value, node_c_value, metadata, rebindings)[source]

Base class for composite statements.

class libadalang.ConcreteFormalSubpDecl(c_value, node_c_value, metadata, rebindings)[source]

Formal declaration for a concrete subprogram.

class libadalang.ConstantAbsent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.ConstantNode(c_value, node_c_value, metadata, rebindings)[source]

Qualifier for the constant keyword.

p_as_bool

Return whether this is an instance of ConstantPresent :rtype: bool

class libadalang.ConstantPresent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.ConstrainedArrayIndices(c_value, node_c_value, metadata, rebindings)[source]

Constrained specification for array indexes.

f_list

This field contains a list that itself contains one of the following nodes: * AttributeRef * BinOp * CallExpr * CharLiteral * DottedName * ExplicitDeref * Identifier * QualExpr * StringLiteral * SubtypeIndication * TargetName :rtype: ConstraintList

class libadalang.ConstrainedSubtypeIndication(c_value, node_c_value, metadata, rebindings)[source]

Reference to a type with a range constraint.

class libadalang.Constraint(c_value, node_c_value, metadata, rebindings)[source]

Base class for type constraints.

class libadalang.ConstraintList(c_value, node_c_value, metadata, rebindings)[source]

List of constraints. This list node can contain one of the following nodes: * AttributeRef * BinOp * CallExpr * CharLiteral * DottedName * ExplicitDeref * Identifier * QualExpr * StringLiteral * SubtypeIndication

  • TargetName
is_list_type = True
class libadalang.ContractCaseAssoc(c_value, node_c_value, metadata, rebindings)[source]

Single association for the Contract_Case aspect.

f_consequence

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_guard

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral

  • DeclExpr
  • DottedName
  • ExplicitDeref
  • Identifier
  • IfExpr
  • MembershipExpr
  • NullLiteral
  • NumLiteral
  • OthersDesignator
  • ParenExpr
  • QualExpr
  • QuantifiedExpr
  • RaiseExpr
  • StringLiteral
  • TargetName
  • UnOp
Return type:AdaNode
class libadalang.ContractCaseAssocList(c_value, node_c_value, metadata, rebindings)[source]

List of ContractCaseAssoc.

is_list_type = True
class libadalang.ContractCases(c_value, node_c_value, metadata, rebindings)[source]

List of associations for the Contract_Case aspect.

f_contract_cases
class libadalang.DecimalFixedPointDef(c_value, node_c_value, metadata, rebindings)[source]

Type definition for decimal fixed-point numbers.

f_delta

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * BoxExpr * CallExpr

  • CaseExpr
  • CharLiteral
  • DeclExpr
  • DottedName
  • ExplicitDeref
  • Identifier
  • IfExpr
  • NullLiteral
  • NumLiteral
  • ParenExpr
  • QualExpr
  • QuantifiedExpr
  • RaiseExpr
  • StringLiteral
  • TargetName
  • UnOp
Return type:Expr
f_digits

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * BoxExpr * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_range
class libadalang.DeclBlock(c_value, node_c_value, metadata, rebindings)[source]

Statement block with a declarative part.

f_decls
f_end_name
f_stmts
class libadalang.DeclExpr(c_value, node_c_value, metadata, rebindings)[source]

Declare expression (Ada 2020).

f_decls

This field contains a list that itself contains one of the following nodes:

  • NumberDecl
  • ObjectDecl
  • SingleProtectedDecl
  • SingleTaskDecl
Return type:BasicDeclList
f_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr

  • QuantifiedExpr
  • RaiseExpr
  • StringLiteral
  • TargetName
  • UnOp
Return type:Expr
class libadalang.DeclList(c_value, node_c_value, metadata, rebindings)[source]

List of declarations. This list node can contain one of the following nodes: * AbstractSubpDecl * AspectClause * ComponentDecl * EntryDecl * ExprFunction * NullSubpDecl * PragmaNode * SubpDecl * SubpRenamingDecl

is_list_type = True
class libadalang.DeclarativePart(c_value, node_c_value, metadata, rebindings)[source]

List of declarations.

f_decls

This field contains a list that itself contains one of the following nodes: * AbstractSubpDecl * AspectClause * BodyNode * ComponentDecl * EntryDecl * ErrorDecl * ExceptionDecl * GenericDecl * GenericInstantiation * GenericRenamingDecl * IncompleteTypeDecl * NumberDecl * ObjectDecl * PackageDecl * PackageRenamingDecl * PragmaNode * ProtectedTypeDecl * SingleProtectedDecl * SingleTaskDecl * SubpDecl * SubtypeDecl * TaskTypeDecl * TypeDecl * UseClause :rtype: AdaNodeList

class libadalang.DefiningName(c_value, node_c_value, metadata, rebindings)[source]

Name that defines an entity.

f_name

This field can contain one of the following nodes: * CharLiteral * DottedName * Identifier * StringLiteral :rtype: Name

p_basic_decl

Returns this DefiningName’s basic declaration :rtype: BasicDecl

p_canonical_part

Like BasicDecl.canonical_part on a defining name :rtype: DefiningName

p_find_all_calls(units, imprecise_fallback=False)[source]

Return the list of all possible calls to the subprogram which Self is the defining name of. This will return the name corresponding to the call, excluding the parameters if there are any. For instance, it will return A for the A (B) call. .. note:: This does not yet support calls done inside generics. :param units: :type units: List[AnalysisUnit] :param imprecise_fallback: :type imprecise_fallback: bool :rtype: List[RefResult]

p_find_all_references(units, imprecise_fallback=False)[source]

Searches all references to this defining name in the given list of units. :param units: :type units: List[AnalysisUnit] :param imprecise_fallback: :type imprecise_fallback: bool :rtype: List[RefResult]

p_find_refs(root, origin, imprecise_fallback=False)[source]

Find all references to this defining name in the given root and its children. :param root: :type root: AdaNode :param origin: :type origin: AdaNode :param imprecise_fallback: :type imprecise_fallback: bool :rtype: List[RefResult]

p_next_part

Like BasicDecl.next_part_for_decl on a defining name :rtype: DefiningName

p_previous_part

Like BasicDecl.previous_part_for_decl on a defining name :rtype: DefiningName

class libadalang.DefiningNameList(c_value, node_c_value, metadata, rebindings)[source]

List of DefiningName.

is_list_type = True
class libadalang.DelayStmt(c_value, node_c_value, metadata, rebindings)[source]

delay statement.

f_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_has_until
class libadalang.DeltaAggregate(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.DeltaConstraint(c_value, node_c_value, metadata, rebindings)[source]

Delta and range type constraint.

f_digits

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_range
class libadalang.DerivedTypeDef(c_value, node_c_value, metadata, rebindings)[source]

Type definition for a derived type.

f_has_abstract
f_has_limited
f_has_synchronized
f_has_with_private
f_interfaces

This field contains a list that itself contains one of the following nodes: * CharLiteral * DottedName * Identifier * StringLiteral :rtype: ParentList

f_record_extension
f_subtype_indication
class libadalang.Diagnostic(sloc_range, message)[source]

Diagnostic for an analysis unit: cannot open the source file, parsing error, ...

as_text
class libadalang.DigitsConstraint(c_value, node_c_value, metadata, rebindings)[source]

Digits and range type constraint.

f_digits

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_range
class libadalang.DiscreteBaseSubtypeDecl(c_value, node_c_value, metadata, rebindings)[source]

Specific BaseSubtypeDecl synthetic subclass for the base type of scalar types.

class libadalang.DiscreteRange(low_bound, high_bound)[source]

Represent the range of a discrete type or subtype. The bounds are not evaluated, you need to call eval_as_int on them, if they’re static, to get their value.

high_bound
low_bound
class libadalang.DiscreteSubtypeIndication(c_value, node_c_value, metadata, rebindings)[source]

Reference to a type with a general constraint.

class libadalang.DiscreteSubtypeName(c_value, node_c_value, metadata, rebindings)[source]

Subtype name for membership test expressions.

f_subtype
class libadalang.DiscriminantAssoc(c_value, node_c_value, metadata, rebindings)[source]

Association of discriminant names to an expression.

f_discr_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_ids
class libadalang.DiscriminantChoiceList(c_value, node_c_value, metadata, rebindings)[source]

List of discriminant associations.

is_list_type = True
class libadalang.DiscriminantConstraint(c_value, node_c_value, metadata, rebindings)[source]

List of constraints that relate to type discriminants.

f_constraints

This field contains a list that itself contains one of the following nodes: * DiscriminantAssoc :rtype: AssocList

class libadalang.DiscriminantPart(c_value, node_c_value, metadata, rebindings)[source]

Specification for discriminants in type declarations.

class libadalang.DiscriminantSpec(c_value, node_c_value, metadata, rebindings)[source]

Known list of discriminants in type declarations.

f_default_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_ids
f_type_expr

This field can contain one of the following nodes:

  • AnonymousType
  • SubtypeIndication
Return type:TypeExpr
class libadalang.DiscriminantSpecList(c_value, node_c_value, metadata, rebindings)[source]

List of DiscriminantSpec.

is_list_type = True
class libadalang.DiscriminantValues(discriminant, values)[source]

Represent a set of values (as a list of choices) on a discriminant.

discriminant
values
class libadalang.DocAnnotation(key, value)[source]

Documentation annotation.

key

Annotation key

value

Annotation value

class libadalang.DottedName(c_value, node_c_value, metadata, rebindings)[source]

Name to select a suffix in a prefix.

f_prefix

This field can contain one of the following nodes: * AttributeRef * CallExpr * CharLiteral * DottedName * ExplicitDeref * Identifier * QualExpr * StringLiteral * TargetName :rtype: Name

f_suffix

This field can contain one of the following nodes: * CharLiteral * Identifier * StringLiteral :rtype: BaseId

class libadalang.ElsifExprPart(c_value, node_c_value, metadata, rebindings)[source]

elsif block, part of an if expression.

f_cond_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr

  • CharLiteral
  • DeclExpr
  • DottedName
  • ExplicitDeref
  • Identifier
  • IfExpr
  • MembershipExpr
  • NullLiteral
  • NumLiteral
  • ParenExpr
  • QualExpr
  • QuantifiedExpr
  • RaiseExpr
  • StringLiteral
  • TargetName
  • UnOp
Return type:Expr
f_then_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr

  • QuantifiedExpr
  • RaiseExpr
  • StringLiteral
  • TargetName
  • UnOp
Return type:Expr
class libadalang.ElsifExprPartList(c_value, node_c_value, metadata, rebindings)[source]

List of ElsifExprPart.

is_list_type = True
class libadalang.ElsifStmtPart(c_value, node_c_value, metadata, rebindings)[source]

elsif part in an if statement block.

f_cond_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_stmts

This field contains a list that itself contains one of the following nodes: * PragmaNode * Stmt :rtype: StmtList

class libadalang.ElsifStmtPartList(c_value, node_c_value, metadata, rebindings)[source]

List of ElsifStmtPart.

is_list_type = True
class libadalang.EndName(c_value, node_c_value, metadata, rebindings)[source]

Entity name in end ...; syntactic constructs.

f_name

This field can contain one of the following nodes: * CharLiteral * DottedName * Identifier * StringLiteral :rtype: Name

p_basic_decl

Returns this EndName’s basic declaration :rtype: BasicDecl

class libadalang.EntryBody(c_value, node_c_value, metadata, rebindings)[source]

Entry body.

f_barrier

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_decls
f_end_name
f_entry_name
f_index_spec
f_params
f_stmts
class libadalang.EntryCompletionFormalParams(c_value, node_c_value, metadata, rebindings)[source]

Formal parameters for the completion of an EntryDecl (either an EntryBody or an AcceptStmt).

f_params
class libadalang.EntryDecl(c_value, node_c_value, metadata, rebindings)[source]

Entry declaration.

f_overriding
f_spec
class libadalang.EntryIndexSpec(c_value, node_c_value, metadata, rebindings)[source]

Index specification for an entry body.

f_id
f_subtype

This field can contain one of the following nodes: * AttributeRef * BinOp * CallExpr * CharLiteral * DottedName * ExplicitDeref * Identifier * QualExpr * StringLiteral * SubtypeIndication * TargetName :rtype: AdaNode

class libadalang.EntrySpec(c_value, node_c_value, metadata, rebindings)[source]

Entry specification.

f_entry_name
f_entry_params
f_family_type

This field can contain one of the following nodes: * AttributeRef * BinOp * CallExpr * CharLiteral * DottedName * ExplicitDeref * Identifier * QualExpr * StringLiteral * SubtypeIndication * TargetName :rtype: AdaNode

class libadalang.EnumLitSynthTypeExpr(c_value, node_c_value, metadata, rebindings)[source]

Synthetic node. Represents the type expression for an enum literal.

class libadalang.EnumLiteralDecl(c_value, node_c_value, metadata, rebindings)[source]

Declaration for an enumeration literal.

f_name
p_enum_type

Return the enum type corresponding to this enum literal. :rtype: TypeDecl

class libadalang.EnumLiteralDeclList(c_value, node_c_value, metadata, rebindings)[source]

List of EnumLiteralDecl.

is_list_type = True
class libadalang.EnumRepClause(c_value, node_c_value, metadata, rebindings)[source]

Representation clause for enumeration types.

f_aggregate
f_type_name

This field can contain one of the following nodes: * CharLiteral * DottedName * Identifier * StringLiteral :rtype: Name

class libadalang.EnumSubpSpec(c_value, node_c_value, metadata, rebindings)[source]

Synthetic node for the abstract subprogram spec of an enum literal. NOTE: This has no existence in the ARM. While enum literals are functions semantically, they’re not such syntactically.

class libadalang.EnumTypeDef(c_value, node_c_value, metadata, rebindings)[source]

Type definition for enumerations.

f_enum_literals
class libadalang.ErrorDecl(c_value, node_c_value, metadata, rebindings)[source]

Placeholder node for syntax errors in lists of declarations.

class libadalang.ErrorStmt(c_value, node_c_value, metadata, rebindings)[source]

Placeholder node for syntax errors in lists of statements.

class libadalang.ExceptionDecl(c_value, node_c_value, metadata, rebindings)[source]

Exception declarations.

f_ids
f_renames
class libadalang.ExceptionHandler(c_value, node_c_value, metadata, rebindings)[source]

Exception handler.

f_exception_name
f_handled_exceptions

This field contains a list that itself contains one of the following nodes: * AttributeRef * CallExpr * CharLiteral * DottedName * ExplicitDeref * Identifier * OthersDesignator * QualExpr * StringLiteral * TargetName :rtype: AlternativesList

f_stmts

This field contains a list that itself contains one of the following nodes: * PragmaNode * Stmt :rtype: StmtList

class libadalang.ExitStmt(c_value, node_c_value, metadata, rebindings)[source]

exit statement.

f_cond_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_loop_name
class libadalang.ExplicitDeref(c_value, node_c_value, metadata, rebindings)[source]

Explicit dereference expression (.all).

f_prefix

This field can contain one of the following nodes: * AttributeRef * CallExpr * CharLiteral * DottedName * ExplicitDeref * Identifier * QualExpr * StringLiteral * TargetName :rtype: Name

class libadalang.Expr(c_value, node_c_value, metadata, rebindings)[source]

Base class for expressions.

p_eval_as_int

Statically evaluates self, and returns the value of the evaluation as an integer. .. note:: In order for a call to this not to raise, the expression needs to be a static expression, as specified in the ARM section 4.9. You can verify whether an expression is static with the is_static_expr property. .. ATTENTION:: This is an experimental feature, so even if it is exposed to allow experiments, it is totally unsupported and the API and behavior are very likely to change in the future.

Return type:int
p_eval_as_int_in_env(env)[source]

Statically evaluates self, and returns the value of the evaluation as an integer. The given environment is used to substitute references to declarations by actual values. .. note:: In order for a call to this not to raise, the expression needs to be a static expression, as specified in the ARM section 4.9. You can verify whether an expression is static with the is_static_expr property. .. ATTENTION:: This is an experimental feature, so even if it is exposed to allow experiments, it is totally unsupported and the API and behavior are very likely to change in the future. :param env: :type env: List[Substitution] :rtype: int

p_expression_type

Return the declaration corresponding to the type of this expression after name resolution. :rtype: BaseTypeDecl

p_first_corresponding_decl

Return the first decl that is lexically named like self in self’s scope. :rtype: BasicDecl

p_is_static_expr(imprecise_fallback=False)[source]

Return whether this expression is static according to the ARM definition of static. See RM 4.9. :param imprecise_fallback: :type imprecise_fallback: bool :rtype: bool

p_matching_nodes

Return the list of AST nodes that can be a match for this expression before overloading analysis. :rtype: List[AdaNode]

class libadalang.ExprAlternativesList(c_value, node_c_value, metadata, rebindings)[source]

List of alternatives in a membership test expression. This list node can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DiscreteSubtypeName * DottedName * ExplicitDeref * Identifier * IfExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp

is_list_type = True
class libadalang.ExprFunction(c_value, node_c_value, metadata, rebindings)[source]

Expression function.

f_expr

This field can contain one of the following nodes: * BaseAggregate * ParenExpr :rtype: Expr

class libadalang.ExprList(c_value, node_c_value, metadata, rebindings)[source]

List of Expr. This list node can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral

  • DeclExpr
  • DiscreteSubtypeName
  • DottedName
  • ExplicitDeref
  • Identifier
  • IfExpr
  • NullLiteral
  • NumLiteral
  • ParenExpr
  • QualExpr
  • QuantifiedExpr
  • RaiseExpr
  • StringLiteral
  • TargetName
  • UnOp
is_list_type = True
class libadalang.ExtendedReturnStmt(c_value, node_c_value, metadata, rebindings)[source]

Extended return statement.

f_decl
f_stmts
class libadalang.ExtendedReturnStmtObjectDecl(c_value, node_c_value, metadata, rebindings)[source]

Object declaration that is part of an extended return statement.

class libadalang.FindAllMode[source]
derivedtypes = 'derivedtypes'
references = 'references'
class libadalang.FloatingPointDef(c_value, node_c_value, metadata, rebindings)[source]

Type definition for floating-point numbers.

f_num_digits

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * BoxExpr * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_range
class libadalang.ForLoopSpec(c_value, node_c_value, metadata, rebindings)[source]

Specification for a for loop.

f_has_reverse
f_iter_expr

This field can contain one of the following nodes: * AttributeRef * BinOp * CallExpr * CharLiteral * DiscreteSubtypeIndication * DottedName * ExplicitDeref

  • Identifier
  • QualExpr
  • StringLiteral
  • TargetName
Return type:AdaNode
f_loop_type
f_var_decl
class libadalang.ForLoopStmt(c_value, node_c_value, metadata, rebindings)[source]

Statement for for loops (for ... loop ... end loop;).

class libadalang.ForLoopVarDecl(c_value, node_c_value, metadata, rebindings)[source]

Declaration for the controlling variable in a for loop.

f_id
f_id_type
class libadalang.FormalDiscreteTypeDef(c_value, node_c_value, metadata, rebindings)[source]

Type definition for discrete types in generic formals.

class libadalang.FormalSubpDecl(c_value, node_c_value, metadata, rebindings)[source]

Formal subprogram declarations, in generic declarations formal parts.

f_default_expr

This field can contain one of the following nodes: * AttributeRef * BoxExpr * CallExpr * CharLiteral * DottedName * ExplicitDeref * Identifier * NullLiteral * QualExpr * StringLiteral * TargetName :rtype: Expr

class libadalang.GenericDecl(c_value, node_c_value, metadata, rebindings)[source]

Base class for generic declarations.

f_formal_part
class libadalang.GenericFormal(c_value, node_c_value, metadata, rebindings)[source]

Enclosing declaration for a generic formal. The real declaration is accessible via the decl field.

f_decl

This field can contain one of the following nodes: * FormalSubpDecl * GenericInstantiation * IncompleteTypeDecl * NumberDecl * ObjectDecl * SingleProtectedDecl * SingleTaskDecl * TypeDecl :rtype: BasicDecl

class libadalang.GenericFormalObjDecl(c_value, node_c_value, metadata, rebindings)[source]

Formal declaration for an object.

class libadalang.GenericFormalPackage(c_value, node_c_value, metadata, rebindings)[source]

Formal declaration for a package.

class libadalang.GenericFormalPart(c_value, node_c_value, metadata, rebindings)[source]

List of declaration for generic formals.

f_decls

This field contains a list that itself contains one of the following nodes: * GenericFormal * PragmaNode * UseClause :rtype: AdaNodeList

class libadalang.GenericFormalSubpDecl(c_value, node_c_value, metadata, rebindings)[source]

Formal declaration for a subprogram.

class libadalang.GenericFormalTypeDecl(c_value, node_c_value, metadata, rebindings)[source]

Formal declaration for a type.

class libadalang.GenericInstantiation(c_value, node_c_value, metadata, rebindings)[source]

Instantiations of generics.

p_designated_generic_decl

Return the generic decl entity designated by this instantiation, containing the generic context. This is equivalent to the expanded generic unit in GNAT. :rtype: BasicDecl

class libadalang.GenericPackageDecl(c_value, node_c_value, metadata, rebindings)[source]

Generic package declaration.

f_package_decl
p_body_part

Return the PackageBody corresponding to this node, or null if there is none. :rtype: PackageBody

class libadalang.GenericPackageInstantiation(c_value, node_c_value, metadata, rebindings)[source]

Instantiations of a generic package.

f_generic_pkg_name

This field can contain one of the following nodes: * CharLiteral * DottedName * Identifier * StringLiteral :rtype: Name

f_name
f_params

This field contains a list that itself contains one of the following nodes: * ParamAssoc :rtype: AssocList

class libadalang.GenericPackageInternal(c_value, node_c_value, metadata, rebindings)[source]

This class denotes the internal package contained by a GenericPackageDecl.

class libadalang.GenericPackageRenamingDecl(c_value, node_c_value, metadata, rebindings)[source]

Declaration for a generic package renaming.

f_name
f_renames

This field can contain one of the following nodes: * CharLiteral * DottedName * Identifier * StringLiteral :rtype: Name

class libadalang.GenericRenamingDecl(c_value, node_c_value, metadata, rebindings)[source]

Base node for all generic renaming declarations.

class libadalang.GenericSubpDecl(c_value, node_c_value, metadata, rebindings)[source]

Generic subprogram declaration.

f_subp_decl
p_body_part

Return the BaseSubpBody corresponding to this node. :rtype: BaseSubpBody

class libadalang.GenericSubpInstantiation(c_value, node_c_value, metadata, rebindings)[source]

Instantiations of a generic subprogram.

f_generic_subp_name

This field can contain one of the following nodes: * CharLiteral * DottedName * Identifier * StringLiteral :rtype: Name

f_kind
f_overriding
f_params

This field contains a list that itself contains one of the following nodes: * ParamAssoc :rtype: AssocList

f_subp_name
p_designated_subp

Return the subprogram decl designated by this instantiation. :rtype: AdaNode

class libadalang.GenericSubpInternal(c_value, node_c_value, metadata, rebindings)[source]

Internal node for generic subprograms.

f_subp_spec
class libadalang.GenericSubpRenamingDecl(c_value, node_c_value, metadata, rebindings)[source]

Declaration for a generic subprogram renaming.

f_kind
f_name
f_renames

This field can contain one of the following nodes: * CharLiteral * DottedName * Identifier * StringLiteral :rtype: Name

class libadalang.GotoStmt(c_value, node_c_value, metadata, rebindings)[source]

goto statement.

f_label_name

This field can contain one of the following nodes: * CharLiteral * DottedName * Identifier * StringLiteral :rtype: Name

class libadalang.GrammarRule[source]

Gramar rule to use for parsing.

abort_stmt_rule = 'abort_stmt_rule'
abstract_subp_decl_rule = 'abstract_subp_decl_rule'
accept_stmt_rule = 'accept_stmt_rule'
access_def_rule = 'access_def_rule'
aggregate_assoc_rule = 'aggregate_assoc_rule'
aggregate_rule = 'aggregate_rule'
allocator_rule = 'allocator_rule'
anonymous_type_decl_rule = 'anonymous_type_decl_rule'
anonymous_type_rule = 'anonymous_type_rule'
array_type_def_rule = 'array_type_def_rule'
aspect_assoc_rule = 'aspect_assoc_rule'
aspect_clause_rule = 'aspect_clause_rule'
aspect_spec_rule = 'aspect_spec_rule'
assignment_stmt_rule = 'assignment_stmt_rule'
basic_decl_rule = 'basic_decl_rule'
basic_decls_rule = 'basic_decls_rule'
block_stmt_rule = 'block_stmt_rule'
body_rule = 'body_rule'
body_stub_rule = 'body_stub_rule'
boolean_op_rule = 'boolean_op_rule'
box_expr_rule = 'box_expr_rule'
bracket_aggregate_rule = 'bracket_aggregate_rule'
call_stmt_rule = 'call_stmt_rule'
call_suffix_rule = 'call_suffix_rule'
case_alt_rule = 'case_alt_rule'
case_expr_alt_rule = 'case_expr_alt_rule'
case_expr_rule = 'case_expr_rule'
case_stmt_rule = 'case_stmt_rule'
char_literal_rule = 'char_literal_rule'
choice_list_rule = 'choice_list_rule'
choice_rule = 'choice_rule'
compilation_rule = 'compilation_rule'
compilation_unit_rule = 'compilation_unit_rule'
component_clause_rule = 'component_clause_rule'
component_decl_rule = 'component_decl_rule'
component_def_rule = 'component_def_rule'
component_item_rule = 'component_item_rule'
component_list_rule = 'component_list_rule'
compound_stmt_rule = 'compound_stmt_rule'
conditional_expr_rule = 'conditional_expr_rule'
constrained_subtype_indication_rule = 'constrained_subtype_indication_rule'
constraint_list_rule = 'constraint_list_rule'
constraint_rule = 'constraint_rule'
context_item_rule = 'context_item_rule'
contract_case_assoc_rule = 'contract_case_assoc_rule'
contract_cases_expr_rule = 'contract_cases_expr_rule'
dec_literal_rule = 'dec_literal_rule'
decimal_fixed_point_def_rule = 'decimal_fixed_point_def_rule'
decl_part_rule = 'decl_part_rule'
declare_expr_rule = 'declare_expr_rule'
defining_id_list_rule = 'defining_id_list_rule'
defining_id_rule = 'defining_id_rule'
defining_name_rule = 'defining_name_rule'
delay_stmt_rule = 'delay_stmt_rule'
delta_constraint_rule = 'delta_constraint_rule'
derived_type_def_rule = 'derived_type_def_rule'
digits_constraint_rule = 'digits_constraint_rule'
direct_name_or_target_name_rule = 'direct_name_or_target_name_rule'
direct_name_rule = 'direct_name_rule'
discr_spec_list_rule = 'discr_spec_list_rule'
discrete_range_rule = 'discrete_range_rule'
discrete_subtype_definition_rule = 'discrete_subtype_definition_rule'
discrete_subtype_indication_rule = 'discrete_subtype_indication_rule'
discriminant_assoc_rule = 'discriminant_assoc_rule'
discriminant_constraint_rule = 'discriminant_constraint_rule'
discriminant_part_rule = 'discriminant_part_rule'
discriminant_spec_rule = 'discriminant_spec_rule'
entry_body_rule = 'entry_body_rule'
entry_decl_rule = 'entry_decl_rule'
enum_literal_decl_rule = 'enum_literal_decl_rule'
enum_type_def_rule = 'enum_type_def_rule'
exception_decl_rule = 'exception_decl_rule'
exception_handler_rule = 'exception_handler_rule'
exit_stmt_rule = 'exit_stmt_rule'
expr_fn_rule = 'expr_fn_rule'
expr_rule = 'expr_rule'
ext_ret_stmt_object_decl_rule = 'ext_ret_stmt_object_decl_rule'
ext_return_stmt_rule = 'ext_return_stmt_rule'
factor_rule = 'factor_rule'
floating_point_def_rule = 'floating_point_def_rule'
for_loop_param_spec_rule = 'for_loop_param_spec_rule'
formal_discrete_type_def_rule = 'formal_discrete_type_def_rule'
formal_subp_decl_rule = 'formal_subp_decl_rule'
generic_decl_rule = 'generic_decl_rule'
generic_formal_decl_rule = 'generic_formal_decl_rule'
generic_formal_part_rule = 'generic_formal_part_rule'
generic_instantiation_rule = 'generic_instantiation_rule'
generic_renaming_decl_rule = 'generic_renaming_decl_rule'
goto_stmt_rule = 'goto_stmt_rule'
handled_stmts_rule = 'handled_stmts_rule'
iblock_stmt_rule = 'iblock_stmt_rule'
identifier_rule = 'identifier_rule'
if_expr_rule = 'if_expr_rule'
if_stmt_rule = 'if_stmt_rule'
iloop_stmt_rule = 'iloop_stmt_rule'
index_constraint_rule = 'index_constraint_rule'
int_literal_rule = 'int_literal_rule'
interface_type_def_rule = 'interface_type_def_rule'
label_rule = 'label_rule'
library_item_rule = 'library_item_rule'
library_unit_body_rule = 'library_unit_body_rule'
library_unit_renaming_decl_rule = 'library_unit_renaming_decl_rule'
loop_stmt_rule = 'loop_stmt_rule'
membership_choice_list_rule = 'membership_choice_list_rule'
membership_choice_rule = 'membership_choice_rule'
mod_int_type_def_rule = 'mod_int_type_def_rule'
mode_rule = 'mode_rule'
multidim_array_assoc_rule = 'multidim_array_assoc_rule'
name_rule = 'name_rule'
null_literal_rule = 'null_literal_rule'
null_stmt_rule = 'null_stmt_rule'
null_subp_decl_rule = 'null_subp_decl_rule'
num_literal_rule = 'num_literal_rule'
number_decl_rule = 'number_decl_rule'
object_decl_rule = 'object_decl_rule'
ordinary_fixed_point_def_rule = 'ordinary_fixed_point_def_rule'
others_designator_rule = 'others_designator_rule'
overriding_indicator_rule = 'overriding_indicator_rule'
package_body_rule = 'package_body_rule'
package_body_stub_rule = 'package_body_stub_rule'
package_decl_rule = 'package_decl_rule'
package_renaming_decl_rule = 'package_renaming_decl_rule'
param_assoc_rule = 'param_assoc_rule'
param_spec_rule = 'param_spec_rule'
param_specs_rule = 'param_specs_rule'
paren_expr_rule = 'paren_expr_rule'
parent_list_rule = 'parent_list_rule'
pragma_argument_rule = 'pragma_argument_rule'
pragma_rule = 'pragma_rule'
primary_rule = 'primary_rule'
protected_body_rule = 'protected_body_rule'
protected_body_stub_rule = 'protected_body_stub_rule'
protected_decl_rule = 'protected_decl_rule'
protected_def_rule = 'protected_def_rule'
protected_el_rule = 'protected_el_rule'
protected_op_rule = 'protected_op_rule'
protected_type_decl_rule = 'protected_type_decl_rule'
qual_name_internal_rule = 'qual_name_internal_rule'
qualified_name_rule = 'qualified_name_rule'
quantified_expr_rule = 'quantified_expr_rule'
raise_expr_rule = 'raise_expr_rule'
raise_stmt_rule = 'raise_stmt_rule'
range_constraint_rule = 'range_constraint_rule'
range_spec_rule = 'range_spec_rule'
real_type_def_rule = 'real_type_def_rule'
record_def_rule = 'record_def_rule'
record_type_def_rule = 'record_type_def_rule'
recov_decl_part_rule = 'recov_decl_part_rule'
regular_aggregate_rule = 'regular_aggregate_rule'
rel_op_rule = 'rel_op_rule'
relation_rule = 'relation_rule'
renaming_clause_rule = 'renaming_clause_rule'
requeue_stmt_rule = 'requeue_stmt_rule'
return_stmt_rule = 'return_stmt_rule'
select_stmt_rule = 'select_stmt_rule'
sexpr_or_box_rule = 'sexpr_or_box_rule'
signed_int_type_def_rule = 'signed_int_type_def_rule'
simple_expr_rule = 'simple_expr_rule'
simple_stmt_rule = 'simple_stmt_rule'
simple_subp_decl_rule = 'simple_subp_decl_rule'
single_task_decl_rule = 'single_task_decl_rule'
static_name_rule = 'static_name_rule'
stmt_rule = 'stmt_rule'
stmts_rule = 'stmts_rule'
string_literal_rule = 'string_literal_rule'
sub_object_decl_rule = 'sub_object_decl_rule'
subp_body_rule = 'subp_body_rule'
subp_body_stub_rule = 'subp_body_stub_rule'
subp_decl_rule = 'subp_decl_rule'
subp_renaming_decl_rule = 'subp_renaming_decl_rule'
subp_spec_rule = 'subp_spec_rule'
subtype_decl_rule = 'subtype_decl_rule'
subtype_indication_rule = 'subtype_indication_rule'
subtype_name_rule = 'subtype_name_rule'
subunit_rule = 'subunit_rule'
target_name_rule = 'target_name_rule'
task_body_rule = 'task_body_rule'
task_body_stub_rule = 'task_body_stub_rule'
task_def_rule = 'task_def_rule'
task_item_rule = 'task_item_rule'
task_type_decl_rule = 'task_type_decl_rule'
term_rule = 'term_rule'
terminate_alternative_rule = 'terminate_alternative_rule'
type_decl_rule = 'type_decl_rule'
type_def_rule = 'type_def_rule'
type_expr_rule = 'type_expr_rule'
unconstrained_index_rule = 'unconstrained_index_rule'
unop_term_rule = 'unop_term_rule'
update_attr_aggregate_rule = 'update_attr_aggregate_rule'
update_attr_content_rule = 'update_attr_content_rule'
use_clause_rule = 'use_clause_rule'
use_package_clause_rule = 'use_package_clause_rule'
use_type_clause_rule = 'use_type_clause_rule'
variant_part_rule = 'variant_part_rule'
variant_rule = 'variant_rule'
with_clause_rule = 'with_clause_rule'
class libadalang.HandledStmts(c_value, node_c_value, metadata, rebindings)[source]

List of statements, with optional exception handlers.

f_exceptions

This field contains a list that itself contains one of the following nodes: * ExceptionHandler * PragmaNode :rtype: AdaNodeList

f_stmts

This field contains a list that itself contains one of the following nodes: * PragmaNode * Stmt :rtype: StmtList

class libadalang.Identifier(c_value, node_c_value, metadata, rebindings)[source]

Regular identifier.

class libadalang.IdentifierList(c_value, node_c_value, metadata, rebindings)[source]

List of Identifier.

is_list_type = True
class libadalang.IfExpr(c_value, node_c_value, metadata, rebindings)[source]

if expression.

f_alternatives
f_cond_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr

  • CharLiteral
  • DeclExpr
  • DottedName
  • ExplicitDeref
  • Identifier
  • IfExpr
  • MembershipExpr
  • NullLiteral
  • NumLiteral
  • ParenExpr
  • QualExpr
  • QuantifiedExpr
  • RaiseExpr
  • StringLiteral
  • TargetName
  • UnOp
Return type:Expr
f_else_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr

  • StringLiteral
  • TargetName
  • UnOp
Return type:Expr
f_then_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr

  • NullLiteral
  • NumLiteral
  • ParenExpr
  • QualExpr
  • QuantifiedExpr
  • RaiseExpr
  • StringLiteral
  • TargetName
  • UnOp
Return type:Expr
class libadalang.IfStmt(c_value, node_c_value, metadata, rebindings)[source]

if statement block.

f_alternatives
f_cond_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_else_stmts

This field contains a list that itself contains one of the following nodes: * PragmaNode * Stmt :rtype: StmtList

f_then_stmts

This field contains a list that itself contains one of the following nodes: * PragmaNode * Stmt :rtype: StmtList

class libadalang.IncompleteTaggedTypeDecl(c_value, node_c_value, metadata, rebindings)[source]

Incomplete declaration for a tagged type.

f_has_abstract
class libadalang.IncompleteTypeDecl(c_value, node_c_value, metadata, rebindings)[source]

Incomplete declaration for a type.

f_discriminants
class libadalang.IndexConstraint(c_value, node_c_value, metadata, rebindings)[source]

List of type constraints.

f_constraints

This field contains a list that itself contains one of the following nodes: * AttributeRef * BinOp * CallExpr * CharLiteral * DottedName * ExplicitDeref * Identifier * QualExpr * StringLiteral * SubtypeIndication * TargetName :rtype: ConstraintList

class libadalang.IntLiteral(c_value, node_c_value, metadata, rebindings)[source]

Literal for an integer.

p_denoted_value

Return the value that this literal denotes. :rtype: int

class libadalang.InterfaceKind(c_value, node_c_value, metadata, rebindings)[source]

Kind of interface type.

class libadalang.InterfaceKindLimited(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.InterfaceKindProtected(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.InterfaceKindSynchronized(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.InterfaceKindTask(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.InterfaceTypeDef(c_value, node_c_value, metadata, rebindings)[source]

Type definition for an interface.

f_interface_kind
f_interfaces

This field contains a list that itself contains one of the following nodes:

  • CharLiteral
  • DottedName
  • Identifier
  • StringLiteral
Return type:ParentList
exception libadalang.InvalidField[source]

Raised when introspection functions (Libadalang.Introspection) are requested an invalid field.

exception libadalang.InvalidInput[source]

Raised by lexing functions (Libadalang.Lexer) when the input contains an invalid byte sequence.

exception libadalang.InvalidProjectError[source]

Raised when an error occurs while loading a project file.

exception libadalang.InvalidSymbolError[source]

Exception raise when an invalid symbol is passed to a subprogram.

exception libadalang.InvalidUnitNameError[source]

Raised when an invalid unit name is provided.

class libadalang.IterType(c_value, node_c_value, metadata, rebindings)[source]

Iteration type for for loops.

class libadalang.IterTypeIn(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.IterTypeOf(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.IteratedAssoc(c_value, node_c_value, metadata, rebindings)[source]

Iterated association (Ada 2020).

f_r_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_spec
class libadalang.KnownDiscriminantPart(c_value, node_c_value, metadata, rebindings)[source]

Known list of discriminants in type declarations.

f_discr_specs
class libadalang.Label(c_value, node_c_value, metadata, rebindings)[source]

Statement to declare a code label.

f_decl
class libadalang.LabelDecl(c_value, node_c_value, metadata, rebindings)[source]

Declaration for a code label.

f_name
class libadalang.LibraryItem(c_value, node_c_value, metadata, rebindings)[source]

Library item in a compilation unit.

f_has_private
f_item

This field can contain one of the following nodes: * AbstractSubpDecl * BaseSubpBody * ErrorDecl * GenericDecl * GenericInstantiation * GenericRenamingDecl * PackageBody * PackageDecl * PackageRenamingDecl * SubpDecl :rtype: BasicDecl

class libadalang.LimitedAbsent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.LimitedNode(c_value, node_c_value, metadata, rebindings)[source]

Qualifier for the limited keyword.

p_as_bool

Return whether this is an instance of LimitedPresent :rtype: bool

class libadalang.LimitedPresent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.LookupKind[source]
flat = 'flat'
minimal = 'minimal'
recursive = 'recursive'
class libadalang.LoopSpec(c_value, node_c_value, metadata, rebindings)[source]

Base class for loop specifications.

class libadalang.LoopStmt(c_value, node_c_value, metadata, rebindings)[source]

Statement for simple loops (loop ... end loop;).

class libadalang.MembershipExpr(c_value, node_c_value, metadata, rebindings)[source]

Represent a membership test (in/not in operators).

Note that we don’t consider them as binary operators since multiple expressions on the right hand side are allowed.

f_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr

  • QualExpr
  • QuantifiedExpr
  • RaiseExpr
  • StringLiteral
  • TargetName
  • UnOp
Return type:Expr
f_membership_exprs

This field contains a list that itself contains one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DiscreteSubtypeName * DottedName * ExplicitDeref * Identifier * IfExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: ExprAlternativesList

f_op

This field can contain one of the following nodes:

  • OpIn
  • OpNotIn
Return type:Op
class libadalang.ModIntTypeDef(c_value, node_c_value, metadata, rebindings)[source]

Type definition for a modular integer type.

f_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * BoxExpr * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

class libadalang.Mode(c_value, node_c_value, metadata, rebindings)[source]

Syntactic indicators for passing modes in formals.

class libadalang.ModeDefault(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.ModeIn(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.ModeInOut(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.ModeOut(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.MultiDimArrayAssoc(c_value, node_c_value, metadata, rebindings)[source]

Association used for multi-dimension array aggregates.

class libadalang.Name(c_value, node_c_value, metadata, rebindings)[source]

Base class for names.

doc_name

Format this name to be a readable qualified name for the entity designated by it. Meant to be used in documentation context. If the entity is local, it will return the relative name. If it is non-local, return the shortest qualified name not taking use clauses into account.

Warning

This is an EXPERIMENTAL feature. This is a python specific method, because for the moment this is not conveniently implementable directly as a libadalang property. Consider it an experimental API endpoint, and use it at your own risk.

p_all_env_elements(seq=True, seq_from=None)[source]

Return all elements in self’s scope that are lexically named like Self. :param seq: :type seq: bool :param seq_from: :type seq_from: AdaNode :rtype: List[AdaNode]

p_as_symbol_array

Turn this name into an array of symbols. For instance, a node with name A.B.C is turned into ['A', 'B', 'C']. :rtype: List[str]

p_called_subp_spec

Return the subprogram specification of the subprogram or subprogram access that is being called by this exact Name, if relevant. :rtype: BaseFormalParamHolder

p_enclosing_defining_name

If this name is part of a defining name, return the enclosing defining name node. :rtype: DefiningName

p_failsafe_referenced_decl(imprecise_fallback=False)[source]

Failsafe version of referenced_decl. Returns a RefdDecl, which can be precise, imprecise, or error. :param imprecise_fallback: :type imprecise_fallback: bool :rtype: RefdDecl

p_failsafe_referenced_def_name(imprecise_fallback=False)[source]

Failsafe version of referenced_defining_name. Returns a RefdDef, which can be precise, imprecise, or error. :param imprecise_fallback: :type imprecise_fallback: bool :rtype: RefdDef

p_is_access_call

Return True iff this name represents a call to subprogram through an access type. :rtype: bool

p_is_call

Returns True if this Name corresponds to a call. :rtype: bool

p_is_defining

Return True if this name is part of a defining name. :rtype: bool

p_is_direct_call

Return True iff this name represents a call to a subprogram which is referred by its defining name. (i.e. not through a subprogram access). :rtype: bool

p_is_dispatching_call(imprecise_fallback=False)[source]

Returns True if this Name corresponds to a dispatching call, including: - calls done through subprogram access types. - calls to dispatching subprograms, in the object-oriented sense. .. note:: This is an experimental feature. There might be some discrepancy with the GNAT concept of “dispatching call”. :param imprecise_fallback: :type imprecise_fallback: bool :rtype: bool

p_is_dot_call(imprecise_fallback=False)[source]

Returns True if this Name corresponds to a dot notation call. :param imprecise_fallback: :type imprecise_fallback: bool :rtype: bool

p_is_operator_name

Return whether the name that Self designates is an operator. :rtype: bool

p_is_static_call(imprecise_fallback=False)[source]

Returns True if this Name corresponds to a static non-dispatching call. In other words, this will return True if and only if the target of the call is known statically. .. note:: This is an experimental feature. There might be some discrepancy with the GNAT concept of “static call”. :param imprecise_fallback: :type imprecise_fallback: bool :rtype: bool

p_is_static_subtype(imprecise_fallback=False)[source]

Returns whether Self denotes a static subtype or not. :param imprecise_fallback: :type imprecise_fallback: bool :rtype: bool

p_is_write_reference(imprecise_fallback=False)[source]

Whether this name is a write reference. For example, X is a write reference in the following cases:: 1. X := 2; 2. X (2) := 2; 3. P(F => X) where F is declared out or in out. 6. X.P where the formal for X is declared out or in out. 4. X’Access. 5. X.C := 2, R.X := 2 .. note:: This is an experimental feature. There might be some discrepancy with the GNAT concept of “write reference”. :param imprecise_fallback: :type imprecise_fallback: bool :rtype: bool

p_name_designated_type

Like SubtypeIndication.designated_type, but on names, since because of Ada’s ambiguous grammar, some subtype indications will be parsed as names. :rtype: BaseTypeDecl

p_name_is(sym)[source]

Helper. Check that this name matches sym. :param sym: :type sym: str :rtype: bool

p_name_matches(n)[source]

Return whether two names match each other. This compares the symbol for Identifier and StringLiteral nodes. We consider that there is no match for all other node kinds. :param n: :type n: Name :rtype: bool

p_referenced_decl(imprecise_fallback=False)[source]

Return the declaration this node references after name resolution. If imprecise_fallback is True, errors raised during resolution of the xref equation are catched and a fallback mechanism is triggered, which tries to find the referenced declaration in an ad-hoc way. :param imprecise_fallback: :type imprecise_fallback: bool :rtype: BasicDecl

p_referenced_decl_internal(imprecise_fallback=False)[source]

Return the declaration this node references. Try not to run name res if already resolved. INTERNAL USE ONLY. :param imprecise_fallback: :type imprecise_fallback: bool :rtype: RefdDecl

p_referenced_defining_name(imprecise_fallback=False)[source]

Like referenced_decl, but will return the defining identifier for the decl, rather than the basic declaration node itself. :param imprecise_fallback: :type imprecise_fallback: bool :rtype: DefiningName

p_relative_name

Returns the relative name of this instance. For example, for a prefix A.B.C, this will return C. :rtype: SingleTokNode

class libadalang.NameList(c_value, node_c_value, metadata, rebindings)[source]

List of Name. This list node can contain one of the following nodes: * AttributeRef * CallExpr * CharLiteral * DottedName * ExplicitDeref * Identifier * QualExpr * StringLiteral * TargetName

is_list_type = True
class libadalang.NamedStmt(c_value, node_c_value, metadata, rebindings)[source]

Wrapper class, used for composite statements that can be named (declare blocks, loops). This allows to both have a BasicDecl for the named entity declared, and a CompositeStmt for the statement hierarchy.

f_decl
f_stmt

This field can contain one of the following nodes: * BaseLoopStmt * BlockStmt :rtype: CompositeStmt

class libadalang.NamedStmtDecl(c_value, node_c_value, metadata, rebindings)[source]

BasicDecl that is always the declaration inside a named statement.

f_name
exception libadalang.NativeException[source]

Exception raised in language bindings when the underlying C API reports an unexpected error that occurred in the library. This kind of exception is raised for internal errors: they should never happen in normal situations and if they are raised at some point, it means the library state is potentially corrupted. Nevertheless, the library does its best not to crash the program, materializing internal errors using this kind of exception.

exception libadalang.NodeDataEvaluationError[source]

Raised when introspection functions (Libadalang.Introspection) are improperly used to evaluate a node data (field or property).

class libadalang.NotNull(c_value, node_c_value, metadata, rebindings)[source]

Qualifier for the not null keywords.

p_as_bool

Return whether this is an instance of NotNullPresent :rtype: bool

class libadalang.NotNullAbsent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.NotNullPresent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.NullComponentDecl(c_value, node_c_value, metadata, rebindings)[source]

Placeholder for the null in lists of components.

class libadalang.NullLiteral(c_value, node_c_value, metadata, rebindings)[source]

The null literal.

class libadalang.NullRecordAggregate(c_value, node_c_value, metadata, rebindings)[source]

Aggregate for null record.

class libadalang.NullRecordDef(c_value, node_c_value, metadata, rebindings)[source]

Record definition for null record.

class libadalang.NullStmt(c_value, node_c_value, metadata, rebindings)[source]

null; statement.

class libadalang.NullSubpDecl(c_value, node_c_value, metadata, rebindings)[source]

Declaration for a null subprogram.

class libadalang.NumLiteral(c_value, node_c_value, metadata, rebindings)[source]

Base class for number literals.

class libadalang.NumberDecl(c_value, node_c_value, metadata, rebindings)[source]

Declaration for a static constant number.

f_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_ids
class libadalang.ObjectDecl(c_value, node_c_value, metadata, rebindings)[source]

Base class for Ada object declarations (RM 3.3.1). Ada object declarations are variables/constants declarations that can be declared in any declarative scope.

f_default_expr
f_has_aliased
f_has_constant
f_ids
f_mode
f_renaming_clause
f_type_expr
p_public_part_decl

If this object decl is the constant completion of an object decl in the public part, return the object decl from the public part. :rtype: BasicDecl

class libadalang.Op(c_value, node_c_value, metadata, rebindings)[source]

Operation in a binary expression. Note that the ARM does not consider “double_dot” (”..”) as a binary operator, but we process it this way here anyway to keep things simple.

class libadalang.OpAbs(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpAnd(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpAndThen(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpConcat(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpDiv(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpDoubleDot(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpEq(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpGt(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpGte(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpIn(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpLt(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpLte(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpMinus(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpMod(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpMult(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpNeq(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpNot(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpNotIn(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpOr(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpOrElse(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpPlus(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpPow(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpRem(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OpXor(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OrdinaryFixedPointDef(c_value, node_c_value, metadata, rebindings)[source]

Type definition for ordinary fixed-point numbers.

f_delta

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * BoxExpr * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_range
class libadalang.OthersDesignator(c_value, node_c_value, metadata, rebindings)[source]

other designator.

class libadalang.OverridingNode(c_value, node_c_value, metadata, rebindings)[source]

Syntactic indicators for subprogram overriding modes.

class libadalang.OverridingNotOverriding(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OverridingOverriding(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.OverridingUnspecified(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.PackageBody(c_value, node_c_value, metadata, rebindings)[source]

Package body.

f_decls
f_end_name
f_package_name
f_stmts
class libadalang.PackageBodyStub(c_value, node_c_value, metadata, rebindings)[source]

Stub for a package body (is separate).

f_name
class libadalang.PackageDecl(c_value, node_c_value, metadata, rebindings)[source]

Non-generic package declarations.

class libadalang.PackageRenamingDecl(c_value, node_c_value, metadata, rebindings)[source]

Declaration for a package renaming.

f_name
f_renames
p_final_renamed_package

Return the declaration of the package that is ultimately renamed by Self, skipping through all intermediate package renamings. :rtype: BasicDecl

p_renamed_package

Return the declaration of the package that is renamed by Self. :rtype: BasicDecl

class libadalang.ParamActual(param, actual)[source]

Data structure used by zip_with_params property. Associates an expression (the actual) to a formal param declaration (the parameter).

actual
param
class libadalang.ParamAssoc(c_value, node_c_value, metadata, rebindings)[source]

Assocation (X => Y) used for aggregates and parameter associations.

f_designator

This field can contain one of the following nodes:

  • Identifier
  • OthersDesignator
  • StringLiteral
Return type:AdaNode
f_r_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * BoxExpr * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

class libadalang.ParamSpec(c_value, node_c_value, metadata, rebindings)[source]

Specification for a parameter.

f_default_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_has_aliased
f_ids
f_mode
f_type_expr

This field can contain one of the following nodes:

  • AnonymousType
  • SubtypeIndication
Return type:TypeExpr
class libadalang.ParamSpecList(c_value, node_c_value, metadata, rebindings)[source]

List of ParamSpec.

is_list_type = True
class libadalang.Params(c_value, node_c_value, metadata, rebindings)[source]

List of parameter specifications.

f_params
class libadalang.ParenExpr(c_value, node_c_value, metadata, rebindings)[source]

Parenthesized expression.

f_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

class libadalang.ParentList(c_value, node_c_value, metadata, rebindings)[source]

List of parents in a type declaration. This list node can contain one of the following nodes: * CharLiteral * DottedName * Identifier * StringLiteral

is_list_type = True
class libadalang.PragmaArgumentAssoc(c_value, node_c_value, metadata, rebindings)[source]

Argument assocation in a pragma.

f_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_id
class libadalang.PragmaNode(c_value, node_c_value, metadata, rebindings)[source]

Class for pragmas (RM 2.8). Pragmas are compiler directives, that can be language or compiler defined.

f_args
f_id
p_associated_decls

Return an array of BasicDecl instances associated with this pragma, or an empty array if non applicable. :rtype: List[BasicDecl]

class libadalang.PragmaNodeList(c_value, node_c_value, metadata, rebindings)[source]

List of Pragma.

is_list_type = True
exception libadalang.PreconditionFailure[source]

Exception raised when an API is called while its preconditions are not satisfied.

class libadalang.PrimTypeAccessor(c_value, node_c_value, metadata, rebindings)[source]

Synthetic node wrapping around a primitive type entity. Used in metadata.

class libadalang.PrivateAbsent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.PrivateNode(c_value, node_c_value, metadata, rebindings)[source]

Qualifier for the private keyword.

p_as_bool

Return whether this is an instance of PrivatePresent :rtype: bool

class libadalang.PrivatePart(c_value, node_c_value, metadata, rebindings)[source]

List of declarations in a private part.

class libadalang.PrivatePresent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.PrivateTypeDef(c_value, node_c_value, metadata, rebindings)[source]

Type definition for a private type.

f_has_abstract
f_has_limited
f_has_tagged
exception libadalang.PropertyError[source]

Exception that is raised when an error occurs while evaluating any AST node method whose name starts with p_. This is the only exceptions that such functions can raise.

class libadalang.ProtectedAbsent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.ProtectedBody(c_value, node_c_value, metadata, rebindings)[source]

Protected object body.

f_decls
f_end_name
f_name
class libadalang.ProtectedBodyStub(c_value, node_c_value, metadata, rebindings)[source]

Stub for a protected object body (is separate).

f_name
class libadalang.ProtectedDef(c_value, node_c_value, metadata, rebindings)[source]

Type definition for a protected object.

f_end_name
f_private_part
f_public_part
class libadalang.ProtectedNode(c_value, node_c_value, metadata, rebindings)[source]

Qualifier for the protected keyword.

p_as_bool

Return whether this is an instance of ProtectedPresent :rtype: bool

class libadalang.ProtectedPresent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.ProtectedTypeDecl(c_value, node_c_value, metadata, rebindings)[source]

Declaration for a protected type.

f_definition
f_discriminants
f_interfaces

This field contains a list that itself contains one of the following nodes: * CharLiteral * DottedName * Identifier * StringLiteral :rtype: ParentList

class libadalang.PublicPart(c_value, node_c_value, metadata, rebindings)[source]

List of declarations in a public part.

class libadalang.QualExpr(c_value, node_c_value, metadata, rebindings)[source]

Qualified expression (...'(...)).

f_prefix

This field can contain one of the following nodes: * AttributeRef * CallExpr * CharLiteral * DottedName * ExplicitDeref * Identifier * QualExpr * StringLiteral * TargetName :rtype: Name

f_suffix

This field can contain one of the following nodes: * BaseAggregate * ParenExpr :rtype: Expr

class libadalang.QuantifiedExpr(c_value, node_c_value, metadata, rebindings)[source]

Quantified expression.

f_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_loop_spec
f_quantifier
class libadalang.Quantifier(c_value, node_c_value, metadata, rebindings)[source]

Type for quantified expressions.

class libadalang.QuantifierAll(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.QuantifierSome(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.RaiseExpr(c_value, node_c_value, metadata, rebindings)[source]

Expression to raise an exception.

f_error_message
f_exception_name
class libadalang.RaiseStmt(c_value, node_c_value, metadata, rebindings)[source]

raise statement.

f_error_message
f_exception_name
class libadalang.RangeConstraint(c_value, node_c_value, metadata, rebindings)[source]

Range-based type constraint.

f_range
class libadalang.RangeSpec(c_value, node_c_value, metadata, rebindings)[source]

Range specification.

f_range

This field can contain one of the following nodes: * AttributeRef * BinOp * BoxExpr * CallExpr * CharLiteral * DottedName * ExplicitDeref * Identifier * QualExpr * StringLiteral * TargetName :rtype: Expr

class libadalang.RealLiteral(c_value, node_c_value, metadata, rebindings)[source]

Literal for a real number.

class libadalang.RealTypeDef(c_value, node_c_value, metadata, rebindings)[source]

Type definition for real numbers.

class libadalang.RecordDef(c_value, node_c_value, metadata, rebindings)[source]

Record definition that contains components (record ... end record).

class libadalang.RecordRepClause(c_value, node_c_value, metadata, rebindings)[source]

Representation clause for a record type.

f_at_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_components

This field contains a list that itself contains one of the following nodes: * ComponentClause * PragmaNode :rtype: AdaNodeList

f_name

This field can contain one of the following nodes:

  • CharLiteral
  • DottedName
  • Identifier
  • StringLiteral
Return type:Name
class libadalang.RecordTypeDef(c_value, node_c_value, metadata, rebindings)[source]

Type definition for a record.

f_has_abstract
f_has_limited
f_has_tagged
f_record_def
class libadalang.RefResult(ref, kind)[source]

Result for a cross reference query returning a reference.

kind
ref
class libadalang.RefResultKind[source]

Kind for the result of a cross reference operation. - NoRef is for no reference, it is the null value for this enum. - Precise is when the reference result is precise. - Imprecise is when there was an error computing the precise result, and a result was gotten in an imprecise fashion. - Error is for unrecoverable errors (either there is no imprecise path for the request you made, or the imprecise path errored out too.

error = 'error'
imprecise = 'imprecise'
noref = 'noref'
precise = 'precise'
class libadalang.RefdDecl(decl, kind)[source]

Result for a cross reference query returning a referenced decl.

decl
kind
class libadalang.RefdDef(def_name, kind)[source]

Result for a cross reference query returning a referenced defining name.

def_name
kind
class libadalang.RelationOp(c_value, node_c_value, metadata, rebindings)[source]

Binary operation that compares two value, producing a boolean.

class libadalang.RenamingClause(c_value, node_c_value, metadata, rebindings)[source]

Renaming clause, used everywhere renamings are valid.

f_renamed_object
class libadalang.RequeueStmt(c_value, node_c_value, metadata, rebindings)[source]

requeue statement.

f_call_name

This field can contain one of the following nodes: * AttributeRef * CallExpr * CharLiteral * DottedName * ExplicitDeref * Identifier * QualExpr * StringLiteral * TargetName :rtype: Name

f_has_abort
class libadalang.ReturnStmt(c_value, node_c_value, metadata, rebindings)[source]

return statement.

f_return_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

class libadalang.ReverseAbsent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.ReverseNode(c_value, node_c_value, metadata, rebindings)[source]

Qualifier for the reverse keyword.

p_as_bool

Return whether this is an instance of ReversePresent :rtype: bool

class libadalang.ReversePresent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.SelectStmt(c_value, node_c_value, metadata, rebindings)[source]

select statements block.

f_abort_stmts

This field contains a list that itself contains one of the following nodes: * PragmaNode * Stmt :rtype: StmtList

f_else_stmts

This field contains a list that itself contains one of the following nodes: * PragmaNode * Stmt :rtype: StmtList

f_guards
class libadalang.SelectWhenPart(c_value, node_c_value, metadata, rebindings)[source]

Alternative part in a select statements block.

f_cond_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_stmts

This field contains a list that itself contains one of the following nodes: * PragmaNode * Stmt :rtype: StmtList

class libadalang.SelectWhenPartList(c_value, node_c_value, metadata, rebindings)[source]

List of SelectWhenPart.

is_list_type = True
class libadalang.Shape(components, discriminants_values)[source]

Represent one of the shapes that a variant record can have, as a list of the available components.

components
discriminants_values
class libadalang.SignedIntTypeDef(c_value, node_c_value, metadata, rebindings)[source]

Type definition for a signed integer type.

f_range
class libadalang.SimpleStmt(c_value, node_c_value, metadata, rebindings)[source]

Base class for simple statements.

class libadalang.SingleProtectedDecl(c_value, node_c_value, metadata, rebindings)[source]

Declaration for a single protected object.

f_definition
f_interfaces

This field contains a list that itself contains one of the following nodes: * CharLiteral * DottedName * Identifier * StringLiteral :rtype: ParentList

f_name
class libadalang.SingleTaskDecl(c_value, node_c_value, metadata, rebindings)[source]

Declaration for a single task.

f_task_type
class libadalang.SingleTaskTypeDecl(c_value, node_c_value, metadata, rebindings)[source]

Type declaration for a single task.

class libadalang.SingleTokNode(c_value, node_c_value, metadata, rebindings)[source]

Base class for nodes that are made up of a single token.

p_canonical_text

Return a canonicalized version of this node’s text. :rtype: str

class libadalang.Sloc(line, column)[source]

Location in a source file. Line and column numbers are one-based.

class libadalang.SlocRange(start, end)[source]

Location of a span of text in a source file.

exception libadalang.StaleReferenceError[source]

Exception raised while trying to access data that was deallocated. This happens when one tries to use a node whose unit has been reparsed, for instance.

class libadalang.Stmt(c_value, node_c_value, metadata, rebindings)[source]

Bass class for statements.

class libadalang.StmtList(c_value, node_c_value, metadata, rebindings)[source]

List of statements. This list node can contain one of the following nodes: * PragmaNode * Stmt

is_list_type = True
class libadalang.StringLiteral(c_value, node_c_value, metadata, rebindings)[source]

String literal.

p_denoted_value

Return the value that this literal denotes. :rtype: str

class libadalang.SubpBody(c_value, node_c_value, metadata, rebindings)[source]

Subprogram body.

f_decls
f_end_name
f_stmts
class libadalang.SubpBodyStub(c_value, node_c_value, metadata, rebindings)[source]

Stub for a subprogram body (is separate).

f_overriding
f_subp_spec
class libadalang.SubpDecl(c_value, node_c_value, metadata, rebindings)[source]

Regular subprogram declaration.

class libadalang.SubpKind(c_value, node_c_value, metadata, rebindings)[source]

Qualifier for a subprogram kind.

class libadalang.SubpKindFunction(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.SubpKindProcedure(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.SubpRenamingDecl(c_value, node_c_value, metadata, rebindings)[source]

Declaration for a subprogram renaming.

f_renames
class libadalang.SubpSpec(c_value, node_c_value, metadata, rebindings)[source]

Subprogram specification.

f_subp_kind
f_subp_name
f_subp_params
f_subp_returns

This field can contain one of the following nodes: * AnonymousType * SubtypeIndication :rtype: TypeExpr

class libadalang.Substitution(from_decl, to_value, value_type)[source]

Represent a substitution of a BasicDecl by a given value. This can then be used as part of an environment in the eval_as_*_in_env property. See the declaration of those properties for more details.

from_decl

The declaration to substitute.

to_value

The value by which to substitute the declaration.

value_type

The type of the substituted value.

class libadalang.SubtypeDecl(c_value, node_c_value, metadata, rebindings)[source]

Subtype declaration.

f_subtype
class libadalang.SubtypeIndication(c_value, node_c_value, metadata, rebindings)[source]

Reference to a type by name.

f_constraint
f_has_not_null
f_name

This field can contain one of the following nodes: * AttributeRef * CharLiteral * DottedName * Identifier * StringLiteral :rtype: Name

p_is_static_subtype(imprecise_fallback=False)[source]

Returns whether Self denotes a static subtype or not. :param imprecise_fallback: :type imprecise_fallback: bool :rtype: bool

class libadalang.Subunit(c_value, node_c_value, metadata, rebindings)[source]

Subunit (separate).

f_body

This field can contain one of the following nodes: * PackageBody * ProtectedBody * SubpBody * TaskBody :rtype: BodyNode

f_name

This field can contain one of the following nodes: * CharLiteral * DottedName * Identifier * StringLiteral :rtype: Name

p_body_root

Return the body in which this subunit is rooted. :rtype: BasicDecl

class libadalang.SynchronizedAbsent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.SynchronizedNode(c_value, node_c_value, metadata, rebindings)[source]

Qualifier for the synchronized keyword.

p_as_bool

Return whether this is an instance of SynchronizedPresent :rtype: bool

class libadalang.SynchronizedPresent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.SynthAnonymousTypeDecl(c_value, node_c_value, metadata, rebindings)[source]

Synthetic anonymous type decl. Used to generate anonymous access types.

class libadalang.SyntheticRenamingClause(c_value, node_c_value, metadata, rebindings)[source]

Synthetic renaming clause. Used to synthesize object decls with renamings. (See to_anonymous_object_decl).

class libadalang.TaggedAbsent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.TaggedNode(c_value, node_c_value, metadata, rebindings)[source]

Qualifier for the tagged keyword.

p_as_bool

Return whether this is an instance of TaggedPresent :rtype: bool

class libadalang.TaggedPresent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.TargetName(c_value, node_c_value, metadata, rebindings)[source]

Name for Ada 2020 @.

class libadalang.TaskBody(c_value, node_c_value, metadata, rebindings)[source]

Task body.

f_decls
f_end_name
f_name
f_stmts
class libadalang.TaskBodyStub(c_value, node_c_value, metadata, rebindings)[source]

Stub for a task body (is separate).

f_name
class libadalang.TaskDef(c_value, node_c_value, metadata, rebindings)[source]

Type definition for a task type.

f_end_name
f_interfaces

This field contains a list that itself contains one of the following nodes: * CharLiteral * DottedName * Identifier * StringLiteral :rtype: ParentList

f_private_part
f_public_part
class libadalang.TaskTypeDecl(c_value, node_c_value, metadata, rebindings)[source]

Declaration for a task type.

f_definition
f_discriminants
exception libadalang.TemplateArgsError[source]

Exception raised when the provided arguments for a template don’t match what the template expects.

exception libadalang.TemplateFormatError[source]

Exception raised when a template has an invalid syntax, such as badly formatted placeholders.

exception libadalang.TemplateInstantiationError[source]

Exception raised when the instantiation of a template cannot be parsed.

class libadalang.TerminateAlternative(c_value, node_c_value, metadata, rebindings)[source]

terminate alternative in a select statement.

class libadalang.Token[source]

Reference to a token in an analysis unit.

index

Zero-based index for this token/trivia. Tokens and trivias get their own index space.

is_equivalent(other)[source]

Return whether L and R are structurally equivalent tokens. This means that their position in the stream won’t be taken into account, only the kind and text of the token.

is_trivia

Return whether this token is a trivia. If it’s not, it’s a regular token.

kind

Kind for this token.

match(other)

Helper for the finditer/find/findall methods, so that a token matches another token even if they are not strictly equivalent.

next

Return a reference to the next token in the corresponding analysis unit.

previous

Return a reference to the previous token in the corresponding analysis unit.

range_until(other)[source]

Return an iterator on the list of tokens that spans between self and other (included). This returns an empty list if the first token appears after the other one in the source code. Raise a ValueError if both tokens come from different analysis units.

sloc_range

Return the source location range of the given token.

text

Return the text of the given token.

classmethod text_range(first, last)[source]

Compute the source buffer slice corresponding to the text that spans between the First and Last tokens (both included). This yields an empty slice if Last actually appears before First. This raises a ValueError if First and Last don’t belong to the same analysis unit.

to_data()[source]

Return a dict representation of this Token.

class libadalang.TypeAccessDef(c_value, node_c_value, metadata, rebindings)[source]

Syntactic type definition for accesses.

f_has_all
f_has_constant
f_subtype_indication
class libadalang.TypeDecl(c_value, node_c_value, metadata, rebindings)[source]

Type declarations that embed a type definition node.

f_discriminants
f_type_def
p_get_primitives(only_inherited=False)[source]

Return the list of all primitive operations that are available on this type. If only_inherited is True, it will only return the primitives that are implicitly inherited by this type, discarding those explicitly defined on this type. :param only_inherited: :type only_inherited: bool :rtype: List[BasicDecl]

class libadalang.TypeDef(c_value, node_c_value, metadata, rebindings)[source]

Base class for type definitions.

class libadalang.TypeExpr(c_value, node_c_value, metadata, rebindings)[source]

A type expression is an abstract node that embodies the concept of a reference to a type. Since Ada has both subtype_indications and anonymous (inline) type declarations, a type expression contains one or the other.

p_designated_type_decl

Returns the type declaration designated by this type expression. :rtype: BaseTypeDecl

p_designated_type_decl_from(origin_node)[source]

Return the type declaration designated by this type expression as viewed from the node given by origin_node. :param origin_node: :type origin_node: AdaNode :rtype: BaseTypeDecl

p_type_name

Return the name node for this type expression, if applicable, else null :rtype: Name

class libadalang.UnOp(c_value, node_c_value, metadata, rebindings)[source]

Unary expression.

f_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

f_op

This field can contain one of the following nodes:

  • OpAbs
  • OpMinus
  • OpNot
  • OpPlus
Return type:Op
class libadalang.UnconstrainedArrayIndex(c_value, node_c_value, metadata, rebindings)[source]

List of unconstrained array indexes.

f_subtype_indication
class libadalang.UnconstrainedArrayIndexList(c_value, node_c_value, metadata, rebindings)[source]

List of UnconstrainedArrayIndex.

is_list_type = True
class libadalang.UnconstrainedArrayIndices(c_value, node_c_value, metadata, rebindings)[source]

Unconstrained specification for array indexes.

f_types
class libadalang.UnitProvider(c_value)[source]

Interface to fetch analysis units from a name and a unit kind. The unit provider mechanism provides an abstraction which assumes that to any couple (unit name, unit kind) we can associate at most one source file. This means that several couples can be associated to the same source file, but on the other hand, only one one source file can be associated to a couple. This is used to make the semantic analysis able to switch from one analysis units to another.

classmethod auto(input_files, charset=None)[source]

Return a unit provider that knows which compilation units are to be found in the given list of source files. This knowledge is built trying to parse all given input files as Ada source files and listing the compilation units found there. Files that cannot be parsed properly are discarded. If two compilation units are found for the same unit, the first that is found in the given input files is taken and the other ones are discarded. Source files are decoded using the given charset. If it is None, the default charset (ISO-8859-1) is used. .. todo:: Find a way to report discarded source files/compilation units.

classmethod for_project(project_file, project=None, scenario_vars=None, target=None, runtime=None)[source]

Load the project file at Project_File and return a unit provider that uses it. If Project is passed, use it to provide units, otherwise, try use the whole project tree. As unit providers must guarantee that there exists at most one source file for each couple (unit name, unit kind), aggregate projects that contains several conflicting units are not supported: trying to load one will yield an error (see below). If provided, Scenario_Vars must be a dict with key strings and key values to describe the set of scenario variables for this project. In order to load the given project with non-default target and runtimes, pass these as strings to the target and runtime arguments. If the requested project is invalid (error while opening the file, error while analysing its syntax, ...), or if it is an unsupported aggregate project, this raises an InvalidProjectError exception.

exception libadalang.UnknownCharset[source]

Raised by lexing functions (Libadalang.Lexer) when the input charset is not supported.

class libadalang.UnknownDiscriminantPart(c_value, node_c_value, metadata, rebindings)[source]

Unknown list of discriminants in type declarations.

class libadalang.UntilAbsent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.UntilNode(c_value, node_c_value, metadata, rebindings)[source]

Qualifier for the until keyword.

p_as_bool

Return whether this is an instance of UntilPresent :rtype: bool

class libadalang.UntilPresent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.UpdateAttributeRef(c_value, node_c_value, metadata, rebindings)[source]

Reference to the Update attribute.

class libadalang.UseClause(c_value, node_c_value, metadata, rebindings)[source]

Base class for use clauses.

class libadalang.UsePackageClause(c_value, node_c_value, metadata, rebindings)[source]

Use clause for packages.

f_packages

This field contains a list that itself contains one of the following nodes: * CharLiteral * DottedName * Identifier * StringLiteral :rtype: NameList

class libadalang.UseTypeClause(c_value, node_c_value, metadata, rebindings)[source]

Use clause for types.

f_has_all
f_types

This field contains a list that itself contains one of the following nodes: * AttributeRef * CallExpr

  • CharLiteral
  • DottedName
  • ExplicitDeref
  • Identifier
  • QualExpr
  • StringLiteral
  • TargetName
Return type:NameList
class libadalang.Variant(c_value, node_c_value, metadata, rebindings)[source]

Single variant in a discriminated type record declaration.

This corresponds to a when ... => ... section in a variant part.

f_choices

This field contains a list that itself contains one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DiscreteSubtypeIndication * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * OthersDesignator * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: AlternativesList

f_components
class libadalang.VariantList(c_value, node_c_value, metadata, rebindings)[source]

List of Variant.

is_list_type = True
class libadalang.VariantPart(c_value, node_c_value, metadata, rebindings)[source]

Variant part in a discriminated type record declaration. This corresponds to the whole case ... is ... end case; block.

f_discr_name
f_variant
class libadalang.WhileLoopSpec(c_value, node_c_value, metadata, rebindings)[source]

Specification for a while loop.

f_expr

This field can contain one of the following nodes: * Allocator * AttributeRef * BaseAggregate * BinOp * CallExpr * CaseExpr * CharLiteral * DeclExpr * DottedName * ExplicitDeref * Identifier * IfExpr * MembershipExpr * NullLiteral * NumLiteral * ParenExpr * QualExpr * QuantifiedExpr * RaiseExpr * StringLiteral * TargetName * UnOp :rtype: Expr

class libadalang.WhileLoopStmt(c_value, node_c_value, metadata, rebindings)[source]

Statement for while loops (while ... loop ... end loop;).

class libadalang.WithClause(c_value, node_c_value, metadata, rebindings)[source]

With clause.

f_has_limited
f_has_private
f_packages

This field contains a list that itself contains one of the following nodes: * CharLiteral * DottedName * Identifier * StringLiteral :rtype: NameList

class libadalang.WithPrivate(c_value, node_c_value, metadata, rebindings)[source]

Qualifier for the private keyword in with private record clauses.

p_as_bool

Return whether this is an instance of WithPrivatePresent :rtype: bool

class libadalang.WithPrivateAbsent(c_value, node_c_value, metadata, rebindings)[source]
class libadalang.WithPrivatePresent(c_value, node_c_value, metadata, rebindings)[source]
libadalang.doc_name

Format this name to be a readable qualified name for the entity designated by it. Meant to be used in documentation context. If the entity is local, it will return the relative name. If it is non-local, return the shortest qualified name not taking use clauses into account.

Warning

This is an EXPERIMENTAL feature. This is a python specific method, because for the moment this is not conveniently implementable directly as a libadalang property. Consider it an experimental API endpoint, and use it at your own risk.

libadalang.token_match(self, other)[source]

Helper for the finditer/find/findall methods, so that a token matches another token even if they are not strictly equivalent.