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: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AbortNode.

This node type has no derivation.

class libadalang.AbortNode(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Qualifier for the abort keyword.

Derived nodes: AbortAbsent, AbortPresent

property p_as_bool: bool

Return whether this node is present

class libadalang.AbortPresent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AbortNode.

This node type has no derivation.

class libadalang.AbortStmt(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of SimpleStmt.

abort statement (RM 9.8).

This node type has no derivation.

property f_names: NameList

This field contains a list that itself contains one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

class libadalang.AbstractAbsent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AbstractNode.

This node type has no derivation.

class libadalang.AbstractFormalSubpDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of FormalSubpDecl.

Formal declaration for an abstract subprogram (RM 12.6).

This node type has no derivation.

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

Subclass of AdaNode.

Qualifier for the abstract keyword.

Derived nodes: AbstractAbsent, AbstractPresent

property p_as_bool: bool

Return whether this node is present

class libadalang.AbstractPresent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AbstractNode.

This node type has no derivation.

class libadalang.AbstractStateDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BasicDecl.

Contained (directly or indirectly) in an AbstractStateDeclExpr, and is used to represent the BasicDecl associated with the abstract state introduced by the Abstract_State aspect. This node is necessary because all of our name resolution routines expect BasicDecls as environments’ values.

The only purpose of this node is to populate the env with the abstract state declared through this node, so it can be referred in SPARK aspects such as Global, Depends, Refined_State, etc.

This node type has no derivation.

property f_name: DefiningName

When there are no parsing errors, this field is never null.

class libadalang.AbstractStateDeclExpr(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Expr.

Directly corresponds to the right-hand side of the Abstract_State aspect. Only exists because the RHS of an AspectAssoc must be an expression: the actual logic is in AbstractStateDecl.

This node type has no derivation.

property f_state_decl: AdaNode

This field can contain one of the following nodes: AbstractStateDecl, MultiAbstractStateDecl, ParenAbstractStateDecl

When there are no parsing errors, this field is never null.

class libadalang.AbstractStateDeclList(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNodeList.

List of AbstractStateDecls.

This list node can contain one of the following nodes: AbstractStateDecl, ParenAbstractStateDecl

This node type has no derivation.

is_list_type = True
class libadalang.AbstractSubpDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of ClassicSubpDecl.

Declaration for an abstract subprogram (RM 3.9.3).

This node type has no derivation.

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

Subclass of CompositeStmt.

accept statement (RM 9.5.2).

Derived nodes: AcceptStmtWithStmts

property f_body_decl: AcceptStmtBody

When there are no parsing errors, this field is never null.

property f_entry_index_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

This field may be null even when there are no parsing errors.

property f_params: EntryCompletionFormalParams

When there are no parsing errors, this field is never null.

p_corresponding_entry(origin: AdaNode = None) EntryDecl[source]

Return the entry which corresponds to this accept statement.

Origin: Origin for this property’s request. See The origin parameter for more details.

class libadalang.AcceptStmtBody(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BodyNode.

BasicDecl that is always the declaration of an AcceptStmt. This is nested inside of the accept statement.

This node type has no derivation.

property f_name: DefiningName

When there are no parsing errors, this field is never null.

class libadalang.AcceptStmtWithStmts(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AcceptStmt.

Extended accept statement (RM 9.5.2).

This node type has no derivation.

property f_end_name: EndName

This field may be null even when there are no parsing errors.

property f_stmts: HandledStmts

When there are no parsing errors, this field is never null.

class libadalang.AccessDef(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of TypeDef.

Base class for access type definitions (RM 3.10).

Derived nodes: AccessToSubpDef, BaseTypeAccessDef

property f_has_not_null: NotNull

This field may be null even when there are no parsing errors.

class libadalang.AccessToSubpDef(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AccessDef.

Type definition for accesses to subprograms (RM 3.10).

This node type has no derivation.

property f_has_protected: ProtectedNode

When there are no parsing errors, this field is never null.

property f_subp_spec: SubpSpec

When there are no parsing errors, this field is never null.

class libadalang.AdaList(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Derived nodes: AdaNodeList, AspectAssocList, BaseAssocList, BasicAssocList, CaseExprAlternativeList, CaseStmtAlternativeList, CompilationUnitList, ConcatOperandList, ContractCaseAssocList, DefiningNameList, DiscriminantSpecList, ElsifExprPartList, ElsifStmtPartList, EnumLiteralDeclList, ExprList, FormatStringChunkList, IdentifierList, NameList, ParamSpecList, PragmaNodeList, SelectWhenPartList, UnconstrainedArrayIndexList, VariantList

class libadalang.AdaNode(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Root node class for the Ada syntax tree.

Derived nodes: AbortNode, AbstractNode, AdaList, AliasedNode, AllNode, ArrayIndices, AspectAssoc, AspectClause, AspectSpec, BaseAssoc, BaseFormalParamHolder, BaseRecordDef, BasicAssoc, BasicDecl, CaseStmtAlternative, CompilationUnit, ComponentClause, ComponentDef, ConstantNode, Constraint, DeclarativePart, ElsePart, ElsifExprPart, ElsifStmtPart, Expr, ForLoopIterFilter, FormatStringChunk, FormatStringTokNode, HandledStmts, InterfaceKind, IterType, LibraryItem, LimitedNode, LoopSpec, Mode, MultiAbstractStateDecl, NotNull, NullComponentDecl, OthersDesignator, OverridingNode, Params, ParenAbstractStateDecl, PpDirective, PpThenKw, PragmaNode, PrivateNode, ProtectedDef, ProtectedNode, Quantifier, RangeSpec, RenamingClause, ReverseNode, SelectWhenPart, Stmt, SubpKind, Subunit, SynchronizedNode, TaggedNode, TaskDef, ThenAbortPart, TypeAttributesRepository, TypeDef, TypeExpr, UnconstrainedArrayIndex, UntilNode, UseClause, ValueSequence, VariantPart, Variant, WithClause, WithPrivate

cast(typ: Type[T]) T[source]

Fluent interface style method. Return self, raise an error if self is not of type typ.

property child_index: int

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

property children: List[AdaNode]

Return an array that contains the direct lexical children.

Warning

This constructs a whole array every-time you call it, and as such is less efficient than calling the Child built-in.

completion_item_kind_to_int(kind: str) int[source]

Convert a CompletionItemKind enum to its corresponding integer value.

dump(indent: str = '', file: ~typing.IO[str] = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>) None[source]

Dump the sub-tree in a human-readable format on the given file.

Parameters:
  • indent (str) – Prefix printed on each line during the dump.

  • file (file) – File in which the dump must occur.

dump_str() str[source]

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

find(ast_type_or_pred: Type[AdaNode] | Callable[[AdaNode], bool], **kwargs: Any) AdaNode | None[source]

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

findall(ast_type_or_pred: Type[AdaNode] | Callable[[AdaNode], bool], **kwargs: Any) List[AdaNode][source]

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

finditer(ast_type_or_pred: Type[AdaNode] | Callable[[AdaNode], bool], **kwargs: Any) Iterator[AdaNode][source]

Find every node corresponding to the passed predicates.

Parameters:
  • 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.

  • kwargs – 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.

property full_sloc_image: str

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

property image: str

Return a representation of this node as a string.

is_a(*types: Type[AdaNode]) bool[source]

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

property is_ghost: bool

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. Both the token_start and the token_end of all ghost nodes is the token right after this logical position.

is_list_type = False
property is_synthetic: bool

Return whether this node is synthetic.

property is_token_node: bool

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

iter_fields() Iterator[Tuple[str, AdaNode | None]][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.

property kind_name: str

Return the kind of this node.

lookup(sloc: Sloc) AdaNode | None[source]

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

property next_sibling: AdaNode

Return the node’s next sibling, or null if there is no such sibling.

property p_bool_type: BaseTypeDecl

Static method. Return the standard Boolean type.

p_choice_match(value: int) bool[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.

property p_complete: CompletionItemIterator

Return possible completions at this point in the file.

property p_declarative_scope: DeclarativePart

Return the scope of definition of this basic declaration.

property p_enclosing_compilation_unit: CompilationUnit

Return the compilation unit containing this node.

Note

This returns the CompilationUnit node, which is different from the AnalysisUnit. In particular, an analysis unit can contain multiple compilation units.

p_filter_is_imported_by(units: List[AnalysisUnit], transitive: bool) List[AnalysisUnit][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.

property p_generic_instantiations: List[GenericInstantiation]

Return the potentially empty list of generic package/subprogram instantiations that led to the creation of this entity. Outer-most instantiations appear last.

property p_get_uninstantiated_node: AdaNode

Assuming this node comes from an instantiated generic declaration, return its non-instantiated counterpart lying in the generic declaration.

p_gnat_xref(imprecise_fallback: bool = False) DefiningName[source]

Return a cross reference from this name to a defining identifier, trying to mimic GNAT’s xrefs as much as possible.

property p_has_spark_mode_on: bool

Returns whether this subprogram has explicitly been set as having Spark_Mode to On, directly or indirectly.

Doesn’t include subprograms that can be inferred by GNATprove as being SPARK.

property p_int_type: BaseTypeDecl

Static method. Return the standard Integer type.

p_is_keyword(token: Token | None, language_version: str) bool[source]

Static method. Return whether the given token is considered a keyword in the given version of Ada. Supported values for the language version argument are: “Ada_83”, “Ada_95”, “Ada_2005”, “Ada_2012”, “Ada_2022”.

property p_is_subject_to_proof: bool

Returns whether this subprogram body is subject to proof in the context of the SPARK/GNATprove tools.

property p_matching_with_use_clause: bool

Return whether this node is a UsePackageClause that follows a WithClause for the same unit.

property p_nameres_diagnostics: List[SolverDiagnostic]

If name resolution on this xref entry point fails, this returns all the diagnostics that were produced while resolving it.

property p_parent_basic_decl: BasicDecl

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. This also applies to bodies of generic declarations.

Note

When called on a subunit’s body, this property will return its corresponding body stub.

Note

When called on a node lying outside of a library item’s declaration or subunit’s body this property will return null.

property p_resolve_names: bool

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.

property p_semantic_parent: AdaNode

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

Note

A node lying outside of a library item’s declaration or subunit’s body does not have a parent environment, meaning that this property will return null.

property p_spark_mode_aspect: Aspect

Helper for the has_spark_mode_on and is_subject_to_proof properties.

This property will get the applicable aspect defining the SPARK_Mode for the given node, recursing syntactically and taking into account configuration files.

This only implements the base logic for recursing up the tree: nodes that need a specific logic must override it. See for example BasicDecl.spark_mode_aspect.

property p_standard_unit: AnalysisUnit

Static method. Return the analysis unit corresponding to the Standard package.

property p_std_char_type: BaseTypeDecl

Static method. Return the standard Character type.

p_std_entity(sym: str) AdaNode[source]

Static property. Return an entity from the standard package with name sym.

property p_std_string_type: BaseTypeDecl

Static method. Return the standard String type.

property p_std_wide_char_type: BaseTypeDecl

Static method. Return the standard Wide_Character type.

property p_std_wide_string_type: BaseTypeDecl

Static method. Return the standard Wide_String type.

property p_std_wide_wide_char_type: BaseTypeDecl

Static method. Return the standard Wide_Wide_Character type.

property p_std_wide_wide_string_type: BaseTypeDecl

Static method. Return the standard Wide_Wide_String type.

p_top_level_decl(unit: AnalysisUnit) BasicDecl[source]

Static method. Get the top-level decl in unit. This is the body of a Subunit, or the item of a LibraryItem.

property p_universal_int_type: BaseTypeDecl

Static method. Return the standard Universal Integer type.

property p_universal_real_type: BaseTypeDecl

Static method. Return the standard Universal Real type.

property p_valid_keywords: List[str]

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.

property p_xref_entry_point: bool

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.

property parent: AdaNode

Return the syntactic parent for this node. Return null for the root node.

property parent_chain: List[AdaNode]

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

parents(with_self: bool = True) List[AdaNode][source]

Return an array that contains the lexical parents, this node included iff with_self is True. Nearer parents are first in the list.

property previous_sibling: AdaNode

Return the node’s previous sibling, or null if there is no such sibling.

property sloc_range: SlocRange

Return the spanning source location range for this node.

Note that this returns the sloc of the parent for synthetic nodes.

property text: str

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() list | dict[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() str[source]

Return a JSON representation of this node.

property token_end: Token | None

Return the last token used to parse this node.

property token_start: Token | None

Return the first token used to parse this node.

property tokens: Iterator[Token]

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

property unit: AnalysisUnit

Return the analysis unit owning this node.

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

Subclass of AdaList.

List of AdaNode.

This list node can contain one of the following nodes: AbstractStateDecl, AbstractSubpDecl, Allocator, ArraySubcomponentChoiceName, AspectClause, AttributeRef, BaseAggregate, BaseSubpBody, BinOp, BodyStub, CallExpr, CharLiteral, ComponentClause, ComponentDecl, ConcatOp, ConcreteTypeDecl, CondExpr, DeclExpr, DottedName, EntryBody, EntryDecl, ErrorDecl, ExceptionDecl, ExceptionHandler, ExplicitDeref, FormatStringLiteral, GenericDecl, GenericFormal, GenericInstantiation, GenericRenamingDecl, Identifier, IncompleteTypeDecl, MembershipExpr, NullComponentDecl, NullLiteral, NumLiteral, NumberDecl, ObjectDecl, OthersDesignator, PackageBody, PackageDecl, PackageRenamingDecl, ParenAbstractStateDecl, ParenExpr, PragmaNode, ProtectedBody, ProtectedTypeDecl, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, SingleProtectedDecl, SingleTaskDecl, Stmt, StringLiteral, SubpDecl, SubtypeDecl, SubtypeIndication, TargetName, TaskBody, TaskTypeDecl, UnOp, UpdateAttributeRef, UseClause, WithClause

Derived nodes: AbstractStateDeclList, AlternativesList, ConstraintList, DeclList, StmtList

is_list_type = True
class libadalang.Aggregate(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseAggregate.

Aggregate that is not a null record aggregate (RM 4.3).

Derived nodes: BracketAggregate

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

Subclass of BasicAssoc.

Association (X => Y) used for aggregates associations (RM 4.3).

Derived nodes: MultiDimArrayAssoc

property f_designators: AlternativesList

This field contains a list that itself contains one of the following nodes: Allocator, ArraySubcomponentChoiceName, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DiscreteSubtypeIndication, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, OthersDesignator, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_r_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, BoxExpr, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

class libadalang.AliasedAbsent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AliasedNode.

This node type has no derivation.

class libadalang.AliasedNode(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Qualifier for the aliased keyword.

Derived nodes: AliasedAbsent, AliasedPresent

property p_as_bool: bool

Return whether this node is present

class libadalang.AliasedPresent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AliasedNode.

This node type has no derivation.

class libadalang.AllAbsent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AllNode.

This node type has no derivation.

class libadalang.AllNode(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Qualifier for the all keyword.

Derived nodes: AllAbsent, AllPresent

property p_as_bool: bool

Return whether this node is present

class libadalang.AllPresent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AllNode.

This node type has no derivation.

class libadalang.Allocator(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Expr.

Allocator expression (new ...) (RM 4.8).

This node type has no derivation.

property f_subpool: Name

This field can contain one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

This field may be null even when there are no parsing errors.

property f_type_or_expr: AdaNode

This field can contain one of the following nodes: QualExpr, SubtypeIndication

When there are no parsing errors, this field is never null.

property p_get_allocated_type: BaseTypeDecl

Return the allocated type for this allocator.

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

Subclass of AdaNodeList.

List of alternatives in a when ... clause.

This list node can contain one of the following nodes: Allocator, ArraySubcomponentChoiceName, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DiscreteSubtypeIndication, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, OthersDesignator, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

This node type has no derivation.

is_list_type = True
class libadalang.AnalysisContext(charset: str | None = None, file_reader: FileReader | None = None, unit_provider: UnitProvider | None = None, event_handler: EventHandler | None = None, with_trivia: bool = True, tab_stop: int = 8, *, _c_value: Any = 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: bool) None[source]

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

get_from_buffer(filename: AnyStr, buffer: AnyStr, charset: str | None = None, reparse: bool = False, rule: str = 'compilation_rule') AnalysisUnit[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: AnyStr, charset: str | None = None, reparse: bool = False, rule: str = 'compilation_rule') AnalysisUnit[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: AnyStr, kind: str, charset: str | None = None, reparse: bool = False) AnalysisUnit[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 the on-disk source file.

The Name and Kind arguments are forwarded directly to query the context’s unit provider and get the filename for the returned unit. Name must be a string, while Kind must be an AnalysisUnitKind enumeration value. See the documentation of the relevant unit provider for their exact semantics.

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.

set_config_pragmas_mapping(global_pragmas: AnalysisUnit | None = None, local_pragmas: Dict[AnalysisUnit, AnalysisUnit] | None = None)[source]

Assign in Context configuration pragmas files to analysis units as described in Global_Pragmas (configuration pragmas file that applies to all analysis units, or null) and Local_Pragmas (mapping that associates an analysis unit to the local configuration pragmas file that applies to it).

This raises a Precondition_Failure exception if any analysis unit in Mapping does not belong to Context or if an analysis unit appears twice as a key in Mapping.

set_target_information(target_info: TargetInformation) None[source]

Assign target information to self. This will affect specific bound values for types defined in the built in Standard package.

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

This type represents the analysis of a single file.

class TokenIterator(first: Token | None)[source]

Iterator over the tokens in an analysis unit.

next() Token
property context: AnalysisContext

Return the context that owns this unit.

property diagnostics: List[Diagnostic]

Diagnostics for this unit.

property filename: str

Return the filename this unit is associated to.

property first_token: Token | None

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

format_gnu_diagnostic(d: Diagnostic) str[source]

Format a diagnostic in a GNU fashion. See <https://www.gnu.org/prep/standards/html_node/Errors.html>.

iter_tokens() TokenIterator[source]

Iterator over the tokens in an analysis unit.

property last_token: Token | None

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

lookup_token(sloc: Sloc) Token | None[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.

populate_lexical_env(ple_root_index: int) None[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.

reparse(buffer: AnyStr | None = None, charset: str | None = None) 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.

property root: AdaNode

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

property text: str

Return the source buffer associated to this unit.

property token_count: int

Return the number of tokens in this unit.

property trivia_count: int

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.AnonymousExprDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BasicDecl.

Represents a anonymous declaration that holds an expression.

This is used to store the results of queries such as referenced_decl called on references to object formals from inside a instantiated generic in order to return the relevant actual.

Indeed, referenced_decl must return a BasicDecl, but actuals of generic instantiations are Expr. This wrapper node is therefore a way to both satisfy the BasicDecl interface, and provide to the user the expression of the actual through the expr field.

This node type has no derivation.

property f_expr: Expr

The expression wrapped by this declaration.

When there are no parsing errors, this field is never null.

property f_name: SyntheticDefiningName

When there are no parsing errors, this field is never null.

p_get_formal(imprecise_fallback: bool = False) DefiningName[source]

Return the generic formal object declaration corresponding to this actual.

class libadalang.AnonymousType(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of TypeExpr.

Container for inline anonymous array and access types declarations.

This node type has no derivation.

property f_type_decl: AnonymousTypeDecl

When there are no parsing errors, this field is never null.

class libadalang.AnonymousTypeAccessDef(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseTypeAccessDef.

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

This node type has no derivation.

property f_type_decl: BaseTypeDecl

When there are no parsing errors, this field is never null.

class libadalang.AnonymousTypeDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of TypeDecl.

Anonymous type declaration (for anonymous array or access types). This class has no RM existence, and anonymous (sub)types are referred to implicitly in the RM.

Derived nodes: SynthAnonymousTypeDecl

class libadalang.App(args: List[str] | None = None)[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:

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()
class CommandLineEventHandler(keep_going_on_missing_file: bool)[source]

Event handler to warn for each missing file.

report_missing_file(filename: str) None[source]
unit_requested_callback(context: AnalysisContext, name: str, from_unit: AnalysisUnit, found: bool, is_not_found_error: bool) None[source]

Callback that will be called when a unit is requested from the context Context.

Name is the name of the requested unit.

From is the unit from which the unit was requested.

Found indicates whether the requested unit was found or not.

Is_Not_Found_Error indicates whether the fact that the unit was not found is an error or not.

Warning

The interface of this callback is probably subject to change, so should be treated as experimental.

add_arguments()[source]
args: Namespace
create_event_handler() EventHandler | None[source]
create_unit_provider()[source]
ctx: AnalysisContext
default_get_files()[source]
property description: str

Description for this app. Empty by default.

main() None[source]

Default implementation for App.main: just iterates on every units and call process_unit on it.

on_parsing_errors(unit: AnalysisUnit) None[source]

Callback invoked during App initialization, when a requested unit has a parsing error. By default, print the error on the standard output, but subclasses can override this behavior.

parser: ArgumentParser
process_unit(unit: AnalysisUnit) None[source]

Abstract method that processes one unit. Needs to be subclassed by implementors.

classmethod run(args: List[str] | None = None) None[source]

Instantiate and run this application.

u: AnalysisUnit
units: Dict[str, AnalysisUnit]
class libadalang.ArrayIndices(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Specification for array indexes (RM 3.6).

Derived nodes: ConstrainedArrayIndices, UnconstrainedArrayIndices

class libadalang.ArraySubcomponentChoiceName(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Name.

Name for an array subcomponent choice of a deep delta aggregate.

This node type has no derivation.

property f_name: Name

This field can contain one of the following nodes: ArraySubcomponentChoiceName, DottedName

This field may be null even when there are no parsing errors.

property f_suffix: AdaNode

This field can contain one of the following nodes: AttributeRef, BasicAssocList, BinOp, CallExpr, CharLiteral, DiscreteSubtypeIndication, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

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

Subclass of TypeDef.

Type definition for an array (RM 3.6).

This node type has no derivation.

property f_component_type: ComponentDef

When there are no parsing errors, this field is never null.

property f_indices: ArrayIndices

When there are no parsing errors, this field is never null.

class libadalang.Aspect(exists: bool, node: AdaNode, value: Expr, inherited: bool)[source]

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

property exists: bool

Whether the aspect is defined or not

property inherited: bool

Whether the aspect is inherited (it has been defined by a parent)

property node: AdaNode

Syntactic node that defines the aspect

property value: Expr

Expr node defining the value of the aspect

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

Subclass of AdaNode.

Name/expression association in an aspect.

This node type has no derivation.

property f_expr: Expr

This field can contain one of the following nodes: AbstractStateDeclExpr, Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, ContractCases, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

This field may be null even when there are no parsing errors.

property f_id: Name

This field can contain one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property p_is_ghost_code: bool

Return whether this aspect is ghost code or not. See SPARK RM 6.9.

class libadalang.AspectAssocList(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaList.

List of AspectAssoc.

This node type has no derivation.

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

Subclass of AdaNode.

Base class for aspect clauses.

Derived nodes: AtClause, AttributeDefClause, EnumRepClause, RecordRepClause

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

Subclass of AdaNode.

List of aspects in a declaration (RM 13.1.1).

This node type has no derivation.

property f_aspect_assocs: AspectAssocList

When there are no parsing errors, this field is never null.

class libadalang.AssignStmt(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of SimpleStmt.

Statement for assignments (RM 5.2).

This node type has no derivation.

property f_dest: Name

This field can contain one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

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

Subclass of BasicAssocList.

List of associations.

This node type has no derivation.

is_list_type = True
p_zip_with_params(imprecise_fallback: bool = False) List[ParamActual][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.

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

Subclass of AspectClause.

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

This node type has no derivation.

property f_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_name: BaseId

This field can contain one of the following nodes: CharLiteral, Identifier, StringLiteral

When there are no parsing errors, this field is never null.

class libadalang.AttributeDefClause(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AspectClause.

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

This node type has no derivation.

property f_attribute_expr: Name

This field can contain one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

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

Subclass of Name.

Expression to reference an attribute (RM 4.1.4).

This node type has no derivation.

property f_args: AssocList

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

When there are no parsing errors, this field is never null.

property f_attribute: Identifier

When there are no parsing errors, this field is never null.

property f_prefix: Name

This field can contain one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

exception libadalang.BadTypeError[source]

Raised when introspection functions (Libadalang.Introspection) are provided mismatching types/values.

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

Subclass of Expr.

Base class for aggregates (RM 4.3).

Derived nodes: Aggregate, DeltaAggregate, NullRecordAggregate

property f_ancestor_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

This field may be null even when there are no parsing errors.

property f_assocs: AssocList

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

When there are no parsing errors, this field is never null.

property p_aggregate_params: List[ParamActual]

Returns an array of pairs, associating formal parameters to actual expressions. See zip_with_params.

property p_is_subaggregate: bool

Return whether this aggregate is actually a subaggregate of a multidimensional array aggregate, as described in RM 4.3.3.

property p_subaggregate_array_type: BaseTypeDecl

If this aggregate instance is a subaggregate of a multidimensional array aggregate, return the overall array type.

property p_subaggregate_dimension: int

If this aggregate instance is a subaggregate of a multidimensional array aggregate, return the index of its matching dimension.

Note

the returned index is 0-based, where index 0 designates the the first dimension of the array type. However, since this property works on subaggregates, the returned index will necessarily always be greater or equal to 1.

class libadalang.BaseAssoc(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

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

Derived nodes: ContractCaseAssoc, PragmaArgumentAssoc

property p_assoc_expr: Expr

Returns the expression side of this assoc node.

class libadalang.BaseAssocList(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaList.

List of BaseAssoc.

This node type has no derivation.

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

Subclass of BasicDecl.

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.

Derived nodes: ComponentDecl, DiscriminantSpec, GenericFormal, ParamSpec, SyntheticFormalParamDecl

p_formal_type(origin: AdaNode = None) BaseTypeDecl[source]

Return the type for this formal.

Origin: Origin for this property’s request. See The origin parameter for more details.

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

Subclass of AdaNode.

Base class for lists of formal parameters. This is used in every case a list of “formals” can be called or instantiated, so in all the following cases:

  • Subprogram specifications (and subprogram calls).

  • Component lists (and aggregates).

  • Generic formals (and generic instantiations).

This allows to share the parameter unpacking/matching logic.

This is a Libadalang abstraction that has no existence in the Ada reference manual.

Derived nodes: BaseSubpSpec, ComponentList, DiscriminantPart, EntryCompletionFormalParams, GenericFormalPart

property p_abstract_formal_params: List[BaseFormalParamDecl]

Return the list of abstract formal parameters for this holder.

property p_formal_params: List[DefiningName]

Return all parameters as a DefiningName array. This property doesn’t return record discriminants nor variants when called on a record component list.

property p_nb_max_params: int

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

property p_nb_min_params: int

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

p_param_types(origin: AdaNode = None) List[BaseTypeDecl][source]

Returns the type of each parameter of self.

Origin: Origin for this property’s request. See The origin parameter for more details.

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

Subclass of SingleTokNode.

Base class for identifiers.

Derived nodes: CharLiteral, Identifier, Op, StringLiteral

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

Subclass of CompositeStmt.

Base class for loop statements (RM 5.5).

Derived nodes: ForLoopStmt, LoopStmt, WhileLoopStmt

property f_end_name: EndName

This field may be null even when there are no parsing errors.

property f_spec: LoopSpec

This field may be null even when there are no parsing errors.

property f_stmts: StmtList

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

When there are no parsing errors, this field is never null.

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

Subclass of BasicDecl.

Base class for package declarations. This will be used both for non-generic package declarations (via PackageDecl) and for generic ones (via GenericPackageInternal).

Derived nodes: GenericPackageInternal, PackageDecl

property f_end_name: EndName

This field may be null even when there are no parsing errors.

property f_package_name: DefiningName

When there are no parsing errors, this field is never null.

property f_private_part: PrivatePart

This field may be null even when there are no parsing errors.

property f_public_part: PublicPart

When there are no parsing errors, this field is never null.

property p_body_part: PackageBody

Return the PackageBody corresponding to this node.

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

Subclass of AdaNode.

Base class for record definitions (RM 3.8).

Derived nodes: NullRecordDef, RecordDef

property f_components: ComponentList

When there are no parsing errors, this field is never null.

class libadalang.BaseSubpBody(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BodyNode.

Base class for subprogram bodies (RM 6.3).

Derived nodes: ExprFunction, NullSubpDecl, SubpBody, SubpRenamingDecl

property f_overriding: OverridingNode

When there are no parsing errors, this field is never null.

property f_subp_spec: SubpSpec

When there are no parsing errors, this field is never null.

class libadalang.BaseSubpSpec(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseFormalParamHolder.

Base class for subprogram specifications (RM 6.1).

Derived nodes: EntrySpec, EnumSubpSpec, SubpSpec, SyntheticBinarySpec, SyntheticUnarySpec

property p_name: DefiningName

Syntax property. Return the name of the subprogram defined by this specification.

property p_params: List[ParamSpec]

Returns the array of parameters specification for this subprogram spec.

p_primitive_subp_first_type(imprecise_fallback: bool = False) BaseTypeDecl[source]

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

p_primitive_subp_tagged_type(imprecise_fallback: bool = False) BaseTypeDecl[source]

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

p_primitive_subp_types(imprecise_fallback: bool = False) List[BaseTypeDecl][source]

Return the types of which this subprogram is a primitive of.

p_return_type(origin: AdaNode = None) BaseTypeDecl[source]

Returns the return type of self, if applicable (e.g. if self is a subprogram). Else, returns null.

Origin: Origin for this property’s request. See The origin parameter for more details.

property p_returns: TypeExpr

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

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

Subclass of BaseTypeDecl.

Base class for subtype declarations (RM 3.2.2).

Derived nodes: DiscreteBaseSubtypeDecl, SubtypeDecl

p_get_type(origin: AdaNode = None) BaseTypeDecl[source]

Get the type for this subtype.

Origin: Origin for this property’s request. See The origin parameter for more details.

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

Subclass of AccessDef.

Base class for access type definitions (RM 3.10).

Derived nodes: AnonymousTypeAccessDef, TypeAccessDef

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

Subclass of BasicDecl.

Base class for type declarations. It unifies every kind of type that exists in Ada, including types that have no source existence like classwide types.

Derived nodes: BaseSubtypeDecl, ClasswideTypeDecl, IncompleteTypeDecl, ProtectedTypeDecl, TaskTypeDecl, TypeDecl

property f_name: DefiningName

This field may be null even when there are no parsing errors.

p_accessed_type(origin: AdaNode = None) BaseTypeDecl[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.

Origin: Origin for this property’s request. See The origin parameter for more details.

p_attribute_subprogram(attr_name: str) BasicDecl[source]

Return the subprogram declaration denoted by this attribute name and defined on this type.

p_base_subtype(origin: AdaNode = None) BaseTypeDecl[source]

If this type decl is a subtype decl, return the base subtype. If not, return self.

Origin: Origin for this property’s request. See The origin parameter for more details.

p_base_type(origin: AdaNode = None) BaseTypeDecl[source]

Return the base type entity for this derived type declaration

Origin: Origin for this property’s request. See The origin parameter for more details.

p_base_types(origin: AdaNode = None) List[BaseTypeDecl][source]

Return the list of base types for self.

Origin: Origin for this property’s request. See The origin parameter for more details.

p_canonical_type(origin: AdaNode = None) BaseTypeDecl[source]

Return the canonical type declaration for this type declaration. For subtypes, it will return the base type declaration.

Origin: Origin for this property’s request. See The origin parameter for more details.

property p_classwide_type: ClasswideTypeDecl

Return the classwide type for this type, if applicable

p_comp_type(is_subscript: bool = False, origin: AdaNode = None) BaseTypeDecl[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.

Origin: Origin for this property’s request. See The origin parameter for more details.

property p_discrete_range: DiscreteRange

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

p_discriminants_list(stop_recurse_at: BaseTypeDecl = None, origin: AdaNode = None) List[BaseFormalParamDecl][source]

Return the list of all discriminants of this type. If this type has no discriminant or only unknown discriminants, an empty list is returned.

In order to obtain all the discriminants of an extended type, this property looks on parents, recursively.

Extended aggregates can be build from any intermediate parent of an extended type. In that case, this property shouldn’t recurse to the root type, but the one used as the aggregate’s ancestor, designated by stop_recurse_at.

Origin: Origin for this property’s request. See The origin parameter for more details.

p_find_all_derived_types(units: List[AnalysisUnit], imprecise_fallback: bool = False) List[TypeDecl][source]

Return the list of all types that inherit (directly or indirectly) from self among the given units.

p_find_derived_types(root: AdaNode, origin: AdaNode, imprecise_fallback: bool = False) List[TypeDecl][source]

Find types derived from self in the given root and its children. Self is assumed to be canonicalized.

Origin: Origin for this property’s request. See The origin parameter for more details.

property p_full_view: BaseTypeDecl

Return the full completion of this type.

p_get_enum_representation_clause(imprecise_fallback: bool = False) EnumRepClause[source]

Return the enum representation clause associated to this type decl, if applicable (i.e. this type decl defines an enum type).

p_get_primitives(only_inherited: bool = False, include_predefined_operators: bool = False) List[BasicDecl][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. Predefined operators are included in the result iff include_predefined_operators is True. It defaults to False.

p_get_record_representation_clause(imprecise_fallback: bool = False) RecordRepClause[source]

Return the record representation clause associated to this type decl, if applicable (i.e. this type decl defines a record type).

p_index_type(dim: int, origin: AdaNode = None) BaseTypeDecl[source]

Return the index type for dimension dim for this type, if applicable.

Warning

dim is 0-based, so the first index_type is at index 0.

Origin: Origin for this property’s request. See The origin parameter for more details.

p_is_access_type(origin: AdaNode = None) bool[source]

Whether self is an access type or not

Origin: Origin for this property’s request. See The origin parameter for more details.

p_is_array_type(origin: AdaNode = None) bool[source]

Return whether this type is an array type.

Origin: Origin for this property’s request. See The origin parameter for more details.

p_is_char_type(origin: AdaNode = None) bool[source]

Whether type is a character type or not

Origin: Origin for this property’s request. See The origin parameter for more details.

p_is_definite_subtype(origin: AdaNode = None) bool[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”.

Origin: Origin for this property’s request. See The origin parameter for more details.

p_is_derived_type(other_type: BaseTypeDecl, origin: AdaNode = None) bool[source]

Whether self is derived from other_type.

Origin: Origin for this property’s request. See The origin parameter for more details.

p_is_discrete_type(origin: AdaNode = None) bool[source]

Whether type is a discrete type or not.

Origin: Origin for this property’s request. See The origin parameter for more details.

p_is_enum_type(origin: AdaNode = None) bool[source]

Whether type is an enum type

Origin: Origin for this property’s request. See The origin parameter for more details.

p_is_fixed_point(origin: AdaNode = None) bool[source]

Whether type is a fixed point type or not.

Origin: Origin for this property’s request. See The origin parameter for more details.

p_is_float_type(origin: AdaNode = None) bool[source]

Whether type is a float type or not.

Origin: Origin for this property’s request. See The origin parameter for more details.

p_is_inherited_primitive(p: BasicDecl) bool[source]

Assuming that P is a primitive of self, return whether the given primitive P is inherited from one of self’s parents.

p_is_int_type(origin: AdaNode = None) bool[source]

Whether type is an integer type or not.

Origin: Origin for this property’s request. See The origin parameter for more details.

p_is_interface_type(origin: AdaNode = None) bool[source]

Return True iff this type declaration is an interface definition.

Origin: Origin for this property’s request. See The origin parameter for more details.

property p_is_limited_type: bool

Return True iff this type is limited, either because it is explicitly marked as such, or because it inherits from a limited type or has a component of a limited type. Also note that protected types and task types are limited by definition. Moreover, note that Ada requires all parts of a type to agree of its limitedness (e.g. the public view of a type must indicate that it is limited if its private completion ends up being limited), hence this property does not require looking at any other part of the type to determine its limitedness, excepted for incomplete type declarations. This implies that for illegal code where several parts don’t agree, this property will return the result for the particular view of the type on which this property is called.

property p_is_private: bool

Whether node is a private view of corresponding type.

p_is_real_type(origin: AdaNode = None) bool[source]

Whether type is a real type or not.

Origin: Origin for this property’s request. See The origin parameter for more details.

p_is_record_type(origin: AdaNode = None) bool[source]

Return whether this type is a record type.

Attention

Private tagged types extending public tagged records are not considered as record types.

Origin: Origin for this property’s request. See The origin parameter for more details.

p_is_scalar_type(origin: AdaNode = None) bool[source]

Whether type is a scalar type.

Origin: Origin for this property’s request. See The origin parameter for more details.

property p_is_statically_constrained: bool

Returns whether this is a statically constained subtype (i.e., its size is known at compile time).

All types are statically constrained, expect for records and arrays when they are unconstrained.

For convenience, this will return False for incomplete types, even though the correct answer is more akin to “non applicable”.

p_is_tagged_type(origin: AdaNode = None) bool[source]

Whether type is tagged or not

Origin: Origin for this property’s request. See The origin parameter for more details.

p_matching_type(expected_type: BaseTypeDecl, origin: AdaNode = None) bool[source]

Return whether self matches expected_type.

Origin: Origin for this property’s request. See The origin parameter for more details.

property p_next_part: BaseTypeDecl

Returns the next part for this type decl.

Note

Since this property returns a BaseTypeDecl, it cannot be used to retrieve the next part of TaskTypeDecl and ProtectedTypeDecl nodes as their next part is actually a Body. Use BasicDecl.next_part_for_decl for those instead.

p_previous_part(go_to_incomplete: bool = True) BaseTypeDecl[source]

Returns the previous part for this type decl.

property p_private_completion: BaseTypeDecl

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

p_root_type(origin: AdaNode = None) BaseTypeDecl[source]

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

Origin: Origin for this property’s request. See The origin parameter for more details.

p_shapes(include_discriminants: bool = True, origin: AdaNode = None) List[Shape][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:

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:

[
    [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.

Origin: Origin for this property’s request. See The origin parameter for more details.

property p_specific_type: BaseTypeDecl

Return the specific type under a class-wide type. Consider for example:

subtype S1 is T'Class
subtype S2 is S1'Class

Calling this property on S2 will return T.

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

Subclass of AdaNode.

Association of one or several names to an expression.

Derived nodes: AggregateAssoc, CompositeConstraintAssoc, IteratedAssoc, ParamAssoc

p_get_params(imprecise_fallback: bool = False) List[DefiningName][source]

Return the list of parameters that this association refers to.

class libadalang.BasicAssocList(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaList.

List of BasicAssoc.

Derived nodes: AssocList

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

Subclass of AdaNode.

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.

Derived nodes: AbstractStateDecl, AnonymousExprDecl, BaseFormalParamDecl, BasePackageDecl, BaseTypeDecl, BasicSubpDecl, BodyNode, EntryIndexSpec, ErrorDecl, ExceptionDecl, ExceptionHandler, ForLoopVarDecl, GenericDecl, GenericInstantiation, GenericRenamingDecl, LabelDecl, NamedStmtDecl, NumberDecl, ObjectDecl, PackageRenamingDecl, SingleProtectedDecl, SingleTaskDecl, SyntheticObjectDecl

property f_aspects: AspectSpec

This field may be null even when there are no parsing errors.

p_all_parts(imprecise_fallback: bool = False) List[BasicDecl][source]

Return all parts that define this entity, sorted from first part to last part.

p_base_subp_declarations(imprecise_fallback: bool = False) List[BasicDecl][source]

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

p_body_part_for_decl(imprecise_fallback: bool = False) BodyNode[source]

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)

property p_canonical_fully_qualified_name: str

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

Note

See BasicDecl.fully_qualified_name to know which kind of declarations are supported.

p_canonical_part(imprecise_fallback: bool = False) BasicDecl[source]

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

property p_defining_name: DefiningName

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

property p_defining_names: List[DefiningName]

Get all the names of this basic declaration.

property p_doc: str

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.

property p_doc_annotations: List[DocAnnotation]

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.

p_find_all_overrides(units: List[AnalysisUnit], imprecise_fallback: bool = False) List[BasicDecl][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.

property p_fully_qualified_name: str

Return the fully qualified name corresponding to this declaration.

Note

This property should only be called on declarations that have exactly one defining name (excepted for anonymous declarations of access types), otherwise a PreconditionFailure will be raised.

p_fully_qualified_name_array(include_profile: bool = False) List[str][source]

Return the fully qualified name corresponding to this declaration, as an array of symbols.

Note

See BasicDecl.fully_qualified_name to know which kind of declarations are supported.

p_get_annotations(imprecise_fallback: bool = False) List[Aspect][source]

Return all the Annotate aspects defined on this entity, both through pragmas and aspect specifications. For a type declaration, this also includes all annotations defined on its from a base type, when relevant (the field inherited will be set for those). See DefiningName.P_Get_Annotations for more details.

p_get_aspect(name: str, previous_parts_only: bool = False, imprecise_fallback: bool = False) Aspect[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.

See DefiningName.P_Get_Aspect for more details.

p_get_aspect_assoc(name: str) AspectAssoc[source]

Return the aspect with name name for this entity.

p_get_aspect_spec_expr(name: str) Expr[source]

Return the expression associated to the aspect with name name for this entity.

p_get_at_clause(imprecise_fallback: bool = False) AtClause[source]

Return the at clause associated to this declaration.

p_get_pragma(name: str) PragmaNode[source]

Return the pragma with name name associated to this entity.

Please use the p_get_aspect property instead if you are interested in aspects, i.e. information that can be represented by either aspect specification nodes, pragma nodes or attribute definition nodes.

p_get_representation_clause(name: str, imprecise_fallback: bool = False) AttributeDefClause[source]

Return the representation clause associated to this type decl that defines the given attribute name.

p_has_aspect(name: str, previous_parts_only: bool = False, imprecise_fallback: bool = False) bool[source]

Returns whether the boolean aspect named name is set on the entity represented by this node.

Aspects are properties of entities that can be specified by the Ada program, either via aspect specifications, pragmas, or attributes.

“Aspect” is used as in RM terminology (see RM 13).

property p_is_compilation_unit_root: bool

Whether a BasicDecl is the root decl for its unit.

property p_is_constant_object: bool

Return whether this object is constant or not.

property p_is_formal: bool

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

property p_is_ghost_code: bool

Return whether this declaration is ghost code or not. See SPARK RM 6.9.

property p_is_imported: bool

Whether this declaration is imported from another language.

property p_is_predefined_operator: bool

Return whether this declaration corresponds to a subprogram that represents a predefined operator.

p_is_static_decl(imprecise_fallback: bool = False) bool[source]

Return whether this declaration is static.

property p_is_subprogram: bool

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.

p_is_visible(from_node: AdaNode) bool[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.

p_most_visible_part(origin: AdaNode, imprecise_fallback: bool = False) BasicDecl[source]

Given an origin node and the entity represented by self, this property returns the most visible completion of self that can be seen by origin, according to Ada’s visibility rules.

Origin: Origin for this property’s request. See The origin parameter for more details.

p_next_part_for_decl(imprecise_fallback: bool = False) BasicDecl[source]

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)

p_previous_part_for_decl(imprecise_fallback: bool = False) BasicDecl[source]

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)

property p_relative_name: Name

Return the relative name for self. If self’s defining name is A.B.C, return C as a node.

property p_relative_name_text: str

Return the relative name for self, as text.

p_root_subp_declarations(origin: AdaNode = None, imprecise_fallback: bool = False) List[BasicDecl][source]

If self declares a primitive subprogram of some 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.

Origin: Origin for this property’s request. See The origin parameter for more details.

p_subp_spec_or_null(follow_generic: bool = True) BaseSubpSpec[source]

If self is a Subp, returns the specification of this subprogram.

If follow_generic is True, will also work for instances of GenericSubpDecl.

property p_type_expression: TypeExpr

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

property p_unique_identifying_name: str

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.

Note

This property should only be called on declarations that have exactly one defining name (excepted for anonymous declarations of access types), otherwise a PreconditionFailure will be raised.

Attention

This will only return a unique name for public declarations. Notably, anything nested in an unnamed declare block won’t be handled correctly.

class libadalang.BasicSubpDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BasicDecl.

Base class for subprogram declarations.

Derived nodes: ClassicSubpDecl, EntryDecl, EnumLiteralDecl, GenericSubpInternal, SyntheticSubpDecl

property p_subp_decl_spec: BaseSubpSpec

Return the specification for this subprogram

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

Subclass of BlockStmt.

Statement block with no declarative part (RM 5.6).

This node type has no derivation.

property f_end_name: EndName

This field may be null even when there are no parsing errors.

property f_stmts: HandledStmts

When there are no parsing errors, this field is never null.

class libadalang.BinOp(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Expr.

Binary expression.

This encompasses several ARM expressions, because it is used for every binary expression in Ada, all documented in :RM 4.4.

Derived nodes: RelationOp

property f_left: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_op: Op

This field can contain one of the following nodes: OpAndThen, OpAnd, OpDiv, OpDoubleDot, OpEq, OpGt, OpGte, OpLt, OpLte, OpMinus, OpMod, OpMult, OpNeq, OpOrElse, OpOr, OpPlus, OpPow, OpRem, OpXor

When there are no parsing errors, this field is never null.

property f_right: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, BoxExpr, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

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

Subclass of CompositeStmt.

Base class for statement blocks (RM 5.6).

Derived nodes: BeginBlock, DeclBlock

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

Subclass of BasicDecl.

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

Derived nodes: AcceptStmtBody, BaseSubpBody, BodyStub, EntryBody, PackageBody, ProtectedBody, TaskBody

p_decl_part(imprecise_fallback: bool = False) BasicDecl[source]

Return the decl corresponding to this node if applicable.

p_previous_part(imprecise_fallback: bool = False) BasicDecl[source]

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

property p_subunit_root: BasicDecl

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

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

Subclass of BodyNode.

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

Derived nodes: PackageBodyStub, ProtectedBodyStub, SubpBodyStub, TaskBodyStub

property p_syntactic_fully_qualified_name: List[str]

Return the syntactic fully qualified name to refer to this body.

Note that this can raise a Property_Error when the stub is in an illegal place (too nested, in a declare block, etc.).

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

Subclass of Expr.

Box expression (<>).

This is not an expression per-se in Ada, but treating it as one helps us keep coherent types in some cases, like aggregates expressions.

This node type has no derivation.

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

Subclass of Aggregate.

Bracket array or container aggregate (Ada 2020, RM 4.3).

This node type has no derivation.

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

Subclass of DeltaAggregate.

Bracket delta aggregate (Ada 2020, RM 4.3).

This node type has no derivation.

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

Subclass of Name.

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, all described in RM 4.1, except for subprogram call statements, described in RM 6.4.

This node type has no derivation.

property f_name: Name

This field can contain one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_suffix: AdaNode

This field can contain one of the following nodes: AttributeRef, BasicAssocList, BinOp, CallExpr, CharLiteral, DiscreteSubtypeIndication, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property p_is_array_slice: bool

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

property p_kind: str

Return whether this expression is a subprogram call, an array subcomponent access expression, an array slice or a type conversion.

class libadalang.CallExprKind[source]

Kind of CallExpr type.

  • call is when the CallExpr is a procedure or function call.

  • array_slice, array_index is when the CallExpr is in fact an array slice or an array subcomponent access expression, respectively.

  • type_conversion is when the CallExpr is a type conversion.

  • family_index is for entry calls using a family index.

array_index = 'array_index'
array_slice = 'array_slice'
call = 'call'
family_index = 'family_index'
type_conversion = 'type_conversion'
class libadalang.CallStmt(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of SimpleStmt.

Statement for entry or procedure calls (RM 6.4).

This node type has no derivation.

property f_call: Name

This field can contain one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

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

Subclass of CondExpr.

case expression (RM 4.5.7).

This node type has no derivation.

property f_cases: CaseExprAlternativeList

When there are no parsing errors, this field is never null.

property f_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

class libadalang.CaseExprAlternative(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Expr.

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

This node type has no derivation.

property f_choices: AlternativesList

This field contains a list that itself contains one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DiscreteSubtypeIndication, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, OthersDesignator, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

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

Subclass of AdaList.

List of CaseExprAlternative.

This node type has no derivation.

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

Subclass of CompositeStmt.

case statement (RM 5.4).

This node type has no derivation.

property f_alternatives: CaseStmtAlternativeList

When there are no parsing errors, this field is never null.

property f_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_pragmas: PragmaNodeList

When there are no parsing errors, this field is never null.

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

Subclass of AdaNode.

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

This node type has no derivation.

property f_choices: AlternativesList

This field contains a list that itself contains one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DiscreteSubtypeIndication, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, OthersDesignator, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_stmts: StmtList

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

When there are no parsing errors, this field is never null.

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

Subclass of AdaList.

List of CaseStmtAlternative.

This node type has no derivation.

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

Subclass of BaseId.

Character literal (RM 4.1).

This node type has no derivation.

property p_denoted_value: str

Return the value that this literal denotes.

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

Subclass of BasicSubpDecl.

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

Derived nodes: AbstractSubpDecl, FormalSubpDecl, SubpDecl

property f_overriding: OverridingNode

When there are no parsing errors, this field is never null.

property f_subp_spec: SubpSpec

When there are no parsing errors, this field is never null.

p_body_part(imprecise_fallback: bool = False) BaseSubpBody[source]

Return the BaseSubpBody corresponding to this node.

class libadalang.ClasswideTypeDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseTypeDecl.

Synthetic node (not parsed, generated from a property call). Refers to the classwide type for a given tagged type (RM 3.4.1).

This node type has no derivation.

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

Subclass of AdaNode.

Root node for all Ada analysis units (RM 10.1.1).

This node type has no derivation.

property f_body: AdaNode

This field can contain one of the following nodes: LibraryItem, Subunit

When there are no parsing errors, this field is never null.

property f_pragmas: PragmaNodeList

When there are no parsing errors, this field is never null.

property f_prelude: AdaNodeList

with, use or pragma statements.

This field contains a list that itself contains one of the following nodes: PragmaNode, UseClause, WithClause

When there are no parsing errors, this field is never null.

property p_all_config_pragmas: List[PragmaNode]

Return the list of configuration pragmas that apply to the current unit.

p_config_pragmas(name: str) List[PragmaNode][source]

Return the list of configuration pragmas with the given name that apply to the current unit.

property p_decl: BasicDecl

Get the root basic decl defined in this compilation unit.

p_has_restriction(name: str) bool[source]

Whether this compilation unit is affected by the restriction with the given name.

Warning

This property only supports the No_Elaboration_Code restriction for now.

p_imported_units(include_privates: bool = True) List[CompilationUnit][source]

Return all the compilation units that are directly imported by this one. This includes “with”ed units as well as the direct parent unit. Units imported with a “private with” are included in this list only if include_privates is True.

p_is_preelaborable(imprecise_fallback: bool = False) bool[source]

Whether this compilation unit is preelaborable or not.

property p_other_part: CompilationUnit

If this compilation unit is of kind UnitSpecification, return its corresponding body unit, and conversely.

property p_syntactic_fully_qualified_name: List[str]

Return the syntactic fully qualified name of this compilation unit.

property p_unit_dependencies: List[CompilationUnit]

Return the list of all the compilation units that are (direct and indirect) dependencies of this one. See the withed_units/imported_units properties to only get the direct dependencies of this unit.

property p_unit_kind: str

Return the kind corresponding to this analysis unit.

p_withed_units(include_privates: bool = True) List[CompilationUnit][source]

Look for all “with” clauses at the top of this compilation unit and return all the compilation units designated by them. For the complete dependencies list of compilation units, see the unit_dependencies property. Units imported with a “private with” are included in this list only if include_privates is True.

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

Subclass of AdaList.

List of CompilationUnit.

This node type has no derivation.

is_list_type = True
class libadalang.CompletionItem(decl: BasicDecl, is_dot_call: bool, is_visible: bool, weight: int)[source]
property decl: BasicDecl
property is_dot_call: bool
property is_visible: bool
property weight: int

The higher the weight, the more relevant the completion item is

class libadalang.CompletionItemIterator(c_value: Any)[source]

Iterator over InternalCompletionItem.

This class is not meant to be directly instantiated: it is only used for for the return values of properties returning iterators.

class libadalang.CompletionItemKind[source]

Type of completion item. Refer to the official LSP specification.

class_kind = 'class_kind'
color_kind = 'color_kind'
constant_kind = 'constant_kind'
constructor_kind = 'constructor_kind'
enum_kind = 'enum_kind'
enum_member_kind = 'enum_member_kind'
event_kind = 'event_kind'
field_kind = 'field_kind'
file_kind = 'file_kind'
folder_kind = 'folder_kind'
function_kind = 'function_kind'
interface_kind = 'interface_kind'
keyword_kind = 'keyword_kind'
method_kind = 'method_kind'
module_kind = 'module_kind'
operator_kind = 'operator_kind'
property_kind = 'property_kind'
reference_kind = 'reference_kind'
snippet_kind = 'snippet_kind'
struct_kind = 'struct_kind'
text_kind = 'text_kind'
type_parameter_kind = 'type_parameter_kind'
unit_kind = 'unit_kind'
value_kind = 'value_kind'
variable_kind = 'variable_kind'
class libadalang.ComponentClause(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Representation clause for a single component (RM 13.5.1).

This node type has no derivation.

property f_id: Identifier

When there are no parsing errors, this field is never null.

property f_position: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_range: RangeSpec

When there are no parsing errors, this field is never null.

class libadalang.ComponentDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseFormalParamDecl.

Declaration for a component (RM 3.8).

This node type has no derivation.

property f_component_def: ComponentDef

When there are no parsing errors, this field is never null.

property f_default_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

This field may be null even when there are no parsing errors.

property f_ids: DefiningNameList

When there are no parsing errors, this field is never null.

class libadalang.ComponentDef(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Definition for a component (RM 3.6).

This node type has no derivation.

property f_has_aliased: AliasedNode

When there are no parsing errors, this field is never null.

property f_has_constant: ConstantNode

When there are no parsing errors, this field is never null.

property f_type_expr: TypeExpr

This field can contain one of the following nodes: AnonymousType, SubtypeIndication

When there are no parsing errors, this field is never null.

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

Subclass of BaseFormalParamHolder.

List of component declarations (RM 3.8).

This node type has no derivation.

property f_components: AdaNodeList

This field contains a list that itself contains one of the following nodes: AspectClause, ComponentDecl, NullComponentDecl, PragmaNode

When there are no parsing errors, this field is never null.

property f_variant_part: VariantPart

This field may be null even when there are no parsing errors.

class libadalang.CompositeConstraint(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Constraint.

Constraint for a composite type (RM 3.6.1). Due to ambiguities in the Ada grammar, this could be either a list of index constraints, if the owning type is an array type, or a list of discriminant constraints, if the owning type is a discriminated record type.

This node type has no derivation.

property f_constraints: AssocList

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

When there are no parsing errors, this field is never null.

property p_discriminant_params: List[ParamActual]

Returns an array of pairs, associating each discriminant to its actual or default expression.

property p_is_discriminant_constraint: bool

Whether this composite constraint is a discriminant constraint.

property p_is_index_constraint: bool

Whether this composite constraint is an index constraint.

class libadalang.CompositeConstraintAssoc(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BasicAssoc.

Association of discriminant names to an expression (RM 3.7.1).

This node type has no derivation.

property f_constraint_expr: AdaNode

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DiscreteSubtypeIndication, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_ids: DiscriminantChoiceList

This field can contain one of the following nodes: IdentifierList

When there are no parsing errors, this field is never null.

class libadalang.CompositeStmt(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Stmt.

Base class for composite statements (RM 5.1).

Derived nodes: AcceptStmt, BaseLoopStmt, BlockStmt, CaseStmt, ExtendedReturnStmt, IfStmt, NamedStmt, SelectStmt

class libadalang.ConcatOp(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Expr.

Concatenation expression.

Since concatenation expression can be huge in practice, this node handles them as a list of operands rather than a deep tree of binary operators, in order to avoid crashes while parsing of running name resolution on such huge expression.

The purpose of this node is to replace the arbitrarily too deep tree of binary operators (which can lead to a stack overflow), as for example with "A & B & C & D & E":

BinOp(
  Binop(
    BinOp(
      BinOp(A, &, B), & , C), &, D), &, E)

by a single operator, handling a list of operands that can be processed without having to perform deep recursions:

ConcatOp(A,
  ConcatOperand(&, B),
  ConcatOperand(&, C),
  ConcatOperand(&, D),
  ConcatOperand(&, E))

This node type has no derivation.

property f_first_operand: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_other_operands: ConcatOperandList

When there are no parsing errors, this field is never null.

property p_operands: List[Expr]

Return the operands of this concatenation expression

class libadalang.ConcatOperand(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Expr.

A concatenation operator and its RHS operand.

This node is used to represent the tuple (”&”, operand) used by the ConcatOp node to store its other_operands list.

This node type has no derivation.

property f_operand: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_operator: OpConcat

When there are no parsing errors, this field is never null.

class libadalang.ConcatOperandList(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaList.

List of ConcatOperand.

This node type has no derivation.

is_list_type = True
class libadalang.ConcreteFormalSubpDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of FormalSubpDecl.

Formal declaration for a concrete subprogram (RM 12.6).

This node type has no derivation.

class libadalang.ConcreteTypeDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of TypeDecl.

A concrete type declaration.

This node type has no derivation.

class libadalang.CondExpr(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Expr.

Base class for a conditional expressions (RM 4.5.7).

Derived nodes: CaseExpr, IfExpr

property p_dependent_exprs: List[Expr]

Return the dependent expressions for this conditional expression.

class libadalang.ConstantAbsent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of ConstantNode.

This node type has no derivation.

class libadalang.ConstantNode(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Qualifier for the constant keyword.

Derived nodes: ConstantAbsent, ConstantPresent

property p_as_bool: bool

Return whether this node is present

class libadalang.ConstantPresent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of ConstantNode.

This node type has no derivation.

class libadalang.ConstrainedArrayIndices(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of ArrayIndices.

Constrained specification for array indexes (RM 3.6).

This node type has no derivation.

property f_list: ConstraintList

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

When there are no parsing errors, this field is never null.

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

Subclass of SubtypeIndication.

Reference to a type with a range constraint.

This node type has no derivation.

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

Subclass of AdaNode.

Base class for type constraints (RM 3.2.2).

Derived nodes: CompositeConstraint, DeltaConstraint, DigitsConstraint, RangeConstraint

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

Subclass of AdaNodeList.

List of constraints.

This list node can contain one of the following nodes: AttributeRef, BinOp, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, SubtypeIndication, TargetName, UpdateAttributeRef

This node type has no derivation.

is_list_type = True
class libadalang.ContractCaseAssoc(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseAssoc.

Single association for the Contract_Case aspect.

This node type has no derivation.

property f_consequence: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_guard: AdaNode

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, OthersDesignator, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

class libadalang.ContractCaseAssocList(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaList.

List of ContractCaseAssoc.

This node type has no derivation.

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

Subclass of Expr.

List of associations for the Contract_Case aspect.

Contract cases is a non standard Ada extension that’s mainly useful in SPARK. See the SPARK RM for more details.

This node type has no derivation.

property f_contract_cases: ContractCaseAssocList

When there are no parsing errors, this field is never null.

class libadalang.DecimalFixedPointDef(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of RealTypeDef.

Type definition for decimal fixed-point numbers (RM 3.5.9).

This node type has no derivation.

property f_delta: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, BoxExpr, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_digits: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, BoxExpr, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_range: RangeSpec

This field may be null even when there are no parsing errors.

class libadalang.DeclBlock(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BlockStmt.

Statement block with a declarative part (RM 5.6).

This node type has no derivation.

property f_decls: DeclarativePart

When there are no parsing errors, this field is never null.

property f_end_name: EndName

This field may be null even when there are no parsing errors.

property f_stmts: HandledStmts

When there are no parsing errors, this field is never null.

class libadalang.DeclExpr(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Expr.

Declare expression (Ada 2022, RM 4.5.9).

This node type has no derivation.

property f_decls: AdaNodeList

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

When there are no parsing errors, this field is never null.

property f_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

class libadalang.DeclList(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNodeList.

List of declarations.

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

This node type has no derivation.

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

Subclass of AdaNode.

List of declarations (RM 3.11).

Derived nodes: PrivatePart, PublicPart

property f_decls: AdaNodeList

This field contains a list that itself contains one of the following nodes: AbstractSubpDecl, AspectClause, BaseSubpBody, BodyStub, ComponentDecl, ConcreteTypeDecl, EntryBody, EntryDecl, ErrorDecl, ExceptionDecl, GenericDecl, GenericInstantiation, GenericRenamingDecl, IncompleteTypeDecl, NumberDecl, ObjectDecl, PackageBody, PackageDecl, PackageRenamingDecl, PragmaNode, ProtectedBody, ProtectedTypeDecl, SingleProtectedDecl, SingleTaskDecl, SubpDecl, SubtypeDecl, TaskBody, TaskTypeDecl, UseClause

When there are no parsing errors, this field is never null.

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

Subclass of Name.

Name that defines an entity (RM 3.1).

Derived nodes: SyntheticDefiningName

property f_name: Name

This field can contain one of the following nodes: CharLiteral, DottedName, Identifier, StringLiteral, SyntheticIdentifier

When there are no parsing errors, this field is never null.

p_all_parts(imprecise_fallback: bool = False) List[DefiningName][source]

Return all parts that define this entity, sorted from first part to last part.

property p_basic_decl: BasicDecl

Return this DefiningName’s basic declaration, discarding internal nodes such as Generic*Internal wrappers.

property p_canonical_fully_qualified_name: str

Return a canonical representation of the fully qualified name corresponding to this defining name.

p_canonical_part(imprecise_fallback: bool = False) DefiningName[source]

Like BasicDecl.canonical_part on a defining name

p_find_all_calls(units: List[AnalysisUnit], follow_renamings: bool = False, imprecise_fallback: bool = False) List[RefResult][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.

p_find_all_references(units: List[AnalysisUnit], follow_renamings: bool = False, imprecise_fallback: bool = False) List[RefResult][source]

Searches all references to this defining name in the given list of units.

If follow_renamings is True, also this also includes references that ultimately refer to this defining name, by unwinding renaming clauses.

p_find_refs(root: AdaNode, imprecise_fallback: bool = False) List[RefResult][source]

Find all references to this defining name in the given root and its children.

property p_fully_qualified_name: str

Return the fully qualified name corresponding to this defining name.

property p_fully_qualified_name_array: List[str]

Return the fully qualified name corresponding to this defining name, as an array of symbols.

p_get_annotations(imprecise_fallback: bool = False) List[Aspect][source]

Return all the Annotate aspects defined on this entity, both through pragmas and aspect specifications. For a type declaration, this also includes all annotations defined on its base type, when relevant (the field inherited will be set for those).

The value field of each returned Aspect will be set to be the identifier that designates the tool which is concerned by the annotation.

Note: Libadalang will look for the Annotate aspects on any part of the entity.

p_get_aspect(name: str, previous_parts_only: bool = False, imprecise_fallback: bool = False) Aspect[source]

Return the aspect with name name associated to entity that this name defines.

Aspects are properties of entities that can be specified by the Ada program, either via aspect specifications, pragmas, or attributes.

Note: by default, Libadalang will check if the aspect is defined on any part of the entity. However, the previous_parts_only parameter can be set to True to limit the search to the current entity and its previous parts in order to comply with visibilily rules. That way, if an aspect is defined on the private part of a type, calling this property on its corresponding public view won’t return the aspect unlike the call on the private view.

Moreover, since aspects can be inherited, if none was found for the current entity, Libadalang will also search for the aspect on the parents of entity (in that case the inherited field will be set to True in the returned result).

p_get_at_clause(imprecise_fallback: bool = False) AtClause[source]

Return the at clause associated to this entity.

p_get_pragma(name: str) PragmaNode[source]

Return the pragma with name name associated to this entity.

Please use the p_get_aspect property instead if you are interested in aspects, i.e. information that can be represented by either aspect specification nodes, pragma nodes or attribute definition nodes.

p_get_representation_clause(name: str, imprecise_fallback: bool = False) AttributeDefClause[source]

Return the representation clause associated to this entity that defines the given attribute name.

p_has_aspect(name: str, previous_parts_only: bool = False, imprecise_fallback: bool = False) bool[source]

Returns whether the boolean aspect named name is set on the entity represented by this node.

Note: The previous_parts_only parameter controls how aspects are retrieved. See DefiningName.get_aspect for more information.

Aspects are properties of entities that can be specified by the Ada program, either via aspect specifications, pragmas, or attributes.

“Aspect” is used as in RM terminology (see RM 13.1).

property p_is_ghost_code: bool

Return whether the entity defined by this name is ghost or not. See SPARK RM 6.9.

property p_is_imported: bool

Whether this entity defined by this name is imported from another language.

p_most_visible_part(origin: AdaNode, imprecise_fallback: bool = False) DefiningName[source]

Given an origin node and the entity represented by self, this property returns the most visible completion of self that can be seen by origin, according to Ada’s visibility rules.

Origin: Origin for this property’s request. See The origin parameter for more details.

p_next_part(imprecise_fallback: bool = False) DefiningName[source]

Like BasicDecl.next_part_for_decl on a defining name

p_previous_part(imprecise_fallback: bool = False) DefiningName[source]

Like BasicDecl.previous_part_for_decl on a defining name

property p_unique_identifying_name: str

Return a unique identifying name for this defining name, 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.

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

Subclass of AdaList.

List of DefiningName.

This node type has no derivation.

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

Subclass of SimpleStmt.

delay statement (RM 9.6).

This node type has no derivation.

property f_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_has_until: UntilNode

When there are no parsing errors, this field is never null.

class libadalang.DeltaAggregate(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseAggregate.

Aggregate for delta aggregate (Ada 2022, RM 4.3).

Derived nodes: BracketDeltaAggregate

class libadalang.DeltaConstraint(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Constraint.

Delta and range type constraint (RM J.3).

This node type has no derivation.

property f_delta: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_range: RangeSpec

This field may be null even when there are no parsing errors.

class libadalang.DerivedTypeDef(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of TypeDef.

Type definition for a derived type (RM 3.4).

This node type has no derivation.

property f_has_abstract: AbstractNode

When there are no parsing errors, this field is never null.

property f_has_limited: LimitedNode

When there are no parsing errors, this field is never null.

property f_has_synchronized: SynchronizedNode

When there are no parsing errors, this field is never null.

property f_has_with_private: WithPrivate

When there are no parsing errors, this field is never null.

property f_interfaces: ParentList

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

When there are no parsing errors, this field is never null.

property f_record_extension: BaseRecordDef

This field may be null even when there are no parsing errors.

property f_subtype_indication: SubtypeIndication

When there are no parsing errors, this field is never null.

class libadalang.DesignatedEnvKind[source]

Discriminant for DesignatedEnv structures.

current_env = 'current_env'
direct_env = 'direct_env'
named_env = 'named_env'
none = 'none'
class libadalang.Diagnostic(sloc_range: SlocRange, message: str)[source]

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

property as_text: str
class libadalang.DigitsConstraint(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Constraint.

Digits and range type constraint (RM 3.5.9).

This node type has no derivation.

property f_digits: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_range: RangeSpec

This field may be null even when there are no parsing errors.

class libadalang.DiscreteBaseSubtypeDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseSubtypeDecl.

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

This node type has no derivation.

class libadalang.DiscreteRange(range_type: BaseTypeDecl, low_bound: Expr, high_bound: Expr)[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.

property high_bound: Expr
property low_bound: Expr
property range_type: BaseTypeDecl
class libadalang.DiscreteSubtypeIndication(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of SubtypeIndication.

Reference to a type with a general constraint.

This node type has no derivation.

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

Subclass of Name.

Subtype name for membership test expressions (RM 3.6).

This node type has no derivation.

property f_subtype: DiscreteSubtypeIndication

When there are no parsing errors, this field is never null.

class libadalang.DiscriminantChoiceList(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of IdentifierList.

List of discriminant associations.

This node type has no derivation.

is_list_type = True
class libadalang.DiscriminantPart(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseFormalParamHolder.

Specification for discriminants in type declarations.

Derived nodes: KnownDiscriminantPart, UnknownDiscriminantPart

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

Subclass of BaseFormalParamDecl.

Known list of discriminants in type declarations (RM 3.7).

This node type has no derivation.

property f_default_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

This field may be null even when there are no parsing errors.

property f_ids: DefiningNameList

When there are no parsing errors, this field is never null.

property f_type_expr: TypeExpr

This field can contain one of the following nodes: AnonymousType, SubtypeIndication

When there are no parsing errors, this field is never null.

class libadalang.DiscriminantSpecList(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaList.

List of DiscriminantSpec.

This node type has no derivation.

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

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

property discriminant: Identifier
property values: AlternativesList
class libadalang.DocAnnotation(key: str, value: str)[source]

Documentation annotation.

property key: str

Annotation key

property value: str

Annotation value

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

Subclass of Name.

Name to select a suffix in a prefix (RM 4.1.3).

This node type has no derivation.

property f_prefix: Name

This field can contain one of the following nodes: ArraySubcomponentChoiceName, AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_suffix: BaseId

This field can contain one of the following nodes: CharLiteral, Identifier, StringLiteral

When there are no parsing errors, this field is never null.

class libadalang.ElsePart(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

else part in an if or select statement block.

This node type has no derivation.

property f_stmts: StmtList

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

When there are no parsing errors, this field is never null.

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

Subclass of AdaNode.

elsif block, part of an if expression.

This node type has no derivation.

property f_cond_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_then_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

class libadalang.ElsifExprPartList(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaList.

List of ElsifExprPart.

This node type has no derivation.

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

Subclass of AdaNode.

elsif part in an if statement block.

This node type has no derivation.

property f_cond_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_stmts: StmtList

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

When there are no parsing errors, this field is never null.

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

Subclass of AdaList.

List of ElsifStmtPart.

This node type has no derivation.

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

Subclass of Name.

self name in end ...; syntactic constructs.

This node type has no derivation.

property f_name: Name

This field can contain one of the following nodes: CharLiteral, DottedName, Identifier, StringLiteral

When there are no parsing errors, this field is never null.

property p_basic_decl: BasicDecl

Returns this EndName’s basic declaration

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

Subclass of BodyNode.

Entry body (RM 9.5.2).

This node type has no derivation.

property f_barrier: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_decls: DeclarativePart

When there are no parsing errors, this field is never null.

property f_end_name: EndName

This field may be null even when there are no parsing errors.

property f_entry_name: DefiningName

When there are no parsing errors, this field is never null.

property f_index_spec: EntryIndexSpec

This field may be null even when there are no parsing errors.

property f_params: EntryCompletionFormalParams

When there are no parsing errors, this field is never null.

property f_stmts: HandledStmts

When there are no parsing errors, this field is never null.

class libadalang.EntryCompletionFormalParams(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseFormalParamHolder.

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

This node type has no derivation.

property f_params: Params

This field may be null even when there are no parsing errors.

class libadalang.EntryDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BasicSubpDecl.

Entry declaration (RM 9.4).

This node type has no derivation.

property f_overriding: OverridingNode

When there are no parsing errors, this field is never null.

property f_spec: EntrySpec

When there are no parsing errors, this field is never null.

property p_accept_stmts: List[AcceptStmt]

Return an array of accept statements corresponding to this entry.

p_body_part(imprecise_fallback: bool = False) BodyNode[source]

Return the entry body associated to this entry declaration.

class libadalang.EntryIndexSpec(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BasicDecl.

Index specification for an entry body (RM 9.5.2).

This node type has no derivation.

property f_id: DefiningName

When there are no parsing errors, this field is never null.

property f_subtype: AdaNode

This field can contain one of the following nodes: AttributeRef, BinOp, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, SubtypeIndication, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

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

Subclass of BaseSubpSpec.

Entry specification.

This node does not have ARM existence, because in the RM subprogram specifications don’t encompass the ad-hoc specifications that happen in entry declarations. Entry declarations are described in RM 9.5.2.

This node type has no derivation.

property f_entry_name: DefiningName

When there are no parsing errors, this field is never null.

property f_entry_params: Params

This field may be null even when there are no parsing errors.

property f_family_type: AdaNode

This field can contain one of the following nodes: AttributeRef, BinOp, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, SubtypeIndication, TargetName, UpdateAttributeRef

This field may be null even when there are no parsing errors.

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

Subclass of TypeExpr.

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

This node type has no derivation.

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

Subclass of BasicSubpDecl.

Declaration for an enumeration literal (RM 3.5.1).

Derived nodes: SyntheticCharEnumLit

property f_name: DefiningName

This field may be null even when there are no parsing errors.

property p_enum_rep: int

Return the integer used to encode this enum literal.

Note

This property is equivalent to GNAT’s Enum_Rep attribute.

property p_enum_type: TypeDecl

Return the enum type corresponding to this enum literal.

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

Subclass of AdaList.

List of EnumLiteralDecl.

This node type has no derivation.

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

Subclass of AspectClause.

Representation clause for enumeration types (RM 13.4).

This node type has no derivation.

property f_aggregate: BaseAggregate

When there are no parsing errors, this field is never null.

property f_type_name: Name

This field can contain one of the following nodes: CharLiteral, DottedName, Identifier, StringLiteral

When there are no parsing errors, this field is never null.

property p_params: List[ParamActual]

Returns an array of pairs, associating enum literals to representation clause actuals.

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

Subclass of BaseSubpSpec.

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.

This node type has no derivation.

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

Subclass of TypeDef.

Type definition for enumerations (RM 3.5.1).

This node type has no derivation.

property f_enum_literals: EnumLiteralDeclList

When there are no parsing errors, this field is never null.

class libadalang.ErrorDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BasicDecl.

Placeholder node for syntax errors in lists of declarations.

This node type has no derivation.

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

Subclass of Stmt.

Placeholder node for syntax errors in lists of statements.

This node type has no derivation.

class libadalang.EventHandler[source]

Interface to handle events sent by the analysis context.

unit_parsed_callback(context: AnalysisContext, unit: AnalysisUnit, reparsed: bool) None[source]

Callback that will be called when any unit is parsed from the context Context.

Unit is the resulting unit.

Reparsed indicates whether the unit was reparsed, or whether it was the first parse.

unit_requested_callback(context: AnalysisContext, name: str, from_unit: AnalysisUnit, found: bool, is_not_found_error: bool) None[source]

Callback that will be called when a unit is requested from the context Context.

Name is the name of the requested unit.

From is the unit from which the unit was requested.

Found indicates whether the requested unit was found or not.

Is_Not_Found_Error indicates whether the fact that the unit was not found is an error or not.

Warning

The interface of this callback is probably subject to change, so should be treated as experimental.

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

Subclass of BasicDecl.

Exception declarations (RM 11.1).

This node type has no derivation.

property f_ids: DefiningNameList

When there are no parsing errors, this field is never null.

property f_renames: RenamingClause

This field may be null even when there are no parsing errors.

class libadalang.ExceptionHandler(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BasicDecl.

Exception handler (RM 11.2).

This node type has no derivation.

property f_exception_name: DefiningName

This field may be null even when there are no parsing errors.

property f_handled_exceptions: AlternativesList

This field contains a list that itself contains one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, OthersDesignator, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_stmts: StmtList

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

When there are no parsing errors, this field is never null.

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

Subclass of SimpleStmt.

exit statement (RM 5.7).

This node type has no derivation.

property f_cond_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

This field may be null even when there are no parsing errors.

property f_loop_name: Name

This field can contain one of the following nodes: CharLiteral, DottedName, Identifier, StringLiteral

This field may be null even when there are no parsing errors.

class libadalang.ExplicitDeref(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Name.

Explicit dereference expression (.all) (RM 4.1).

This node type has no derivation.

property f_prefix: Name

This field can contain one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

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

Subclass of AdaNode.

Base class for expressions (RM 4.4).

Derived nodes: AbstractStateDeclExpr, Allocator, BaseAggregate, BinOp, BoxExpr, CaseExprAlternative, ConcatOp, ConcatOperand, CondExpr, ContractCases, DeclExpr, FormatStringLiteral, MembershipExpr, Name, ParenExpr, QuantifiedExpr, RaiseExpr, UnOp

property p_eval_as_int: 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 RM 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.

p_eval_as_int_in_env(env: List[Substitution]) int[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 RM 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.

property p_eval_as_string: str

Statically evaluates self, and returns the value of the evaluation as a string.

Note

In order for a call to this not to raise, the expression needs to be a static expression, as specified in RM 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.

p_eval_as_string_in_env(env: List[Substitution]) str[source]

Statically evaluates self, and returns the value of the evaluation as a string. 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 RM 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.

property p_expected_expression_type: BaseTypeDecl

Return the declaration corresponding to the expected type of this expression after name resolution.

property p_expression_type: BaseTypeDecl

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

property p_first_corresponding_decl: BasicDecl

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

p_is_dispatching_call(imprecise_fallback: bool = False) bool[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”.

Note

This should only be called on a Name and UnOp or a BinOp.

Attention

There is a known bug, where the ConcatOp node is not supported, so calling is_dispatching_call on operators nested inside of a concat operator will always return false. (Internal TN: VC08-029)

p_is_dynamically_tagged(imprecise_fallback: bool = False) bool[source]

Returns whether this expression is dynamically tagged (See RM 3.9.2).

p_is_static_expr(imprecise_fallback: bool = False) bool[source]

Return whether this expression is static according to the ARM definition of static. See RM 4.9.

property p_matching_nodes: List[AdaNode]

Return the list of AST nodes that can be a match for this expression before overloading analysis.

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

Subclass of ExprList.

List of alternatives in a membership test expression.

This list node can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DiscreteSubtypeName, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

This node type has no derivation.

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

Subclass of BaseSubpBody.

Expression function (RM 6.8).

This node type has no derivation.

property f_expr: Expr

This field can contain one of the following nodes: BaseAggregate, ParenExpr

When there are no parsing errors, this field is never null.

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

Subclass of AdaList.

List of Expr.

This list node can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DiscreteSubtypeName, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

Derived nodes: ExprAlternativesList

is_list_type = True
class libadalang.ExtendedReturnStmt(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of CompositeStmt.

Extended return statement (RM 6.5).

This node type has no derivation.

property f_decl: ExtendedReturnStmtObjectDecl

When there are no parsing errors, this field is never null.

property f_stmts: HandledStmts

This field may be null even when there are no parsing errors.

class libadalang.ExtendedReturnStmtObjectDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of ObjectDecl.

Object declaration that is part of an extended return statement (RM 6.5).

This node type has no derivation.

exception libadalang.FileReadError[source]

Subprograms may raise this when they cannot open a source file. Note that this does not concern analysis unit getters, which create diagnostic vectors for such errors.

class libadalang.FileReader(c_value: Any)[source]

Interface to override how source files are fetched and decoded.

class LineMode[source]

Determine how the preprocessor treats directives and disabled lines in the output.

delete_lines

Just delete these lines: this breaks line number correspondance between the original source and the preprocessed one. This corresponds to GNATprep’s default mode.

blank_lines

Replace these lines with empty lines. This corresponds to GNATprep’s -b option.

comment_lines

Preserve these lines and emit a --! comment marker in front of them. This corresponds to GNATprep’s -c option.

blank_lines = 'blank_lines'
comment_lines = 'comment_lines'
delete_lines = 'delete_lines'
classmethod create_preprocessor_from_file(filename: str, path: List[str], line_mode: FileReader.LineMode | None) FileReader[source]

Load the preprocessor data file at filename, using directory names in path to look for for it and the definition files it references.

If line_mode is passed, use it to force the line mode for source files on which the preprocessor is enabled. Forcing the line mode is often needed as the default is to remove lines that contain preprocessor directives and disabled code, which breaks the line number correspondence between original source code and preprocessed one. Forcing to blank_lines or comment_lines preserves this correspondence.

Return a file reader that preprocesses sources accordingly.

class libadalang.FloatingPointDef(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of RealTypeDef.

Type definition for floating-point numbers (RM 3.5.7).

This node type has no derivation.

property f_num_digits: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, BoxExpr, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_range: RangeSpec

This field may be null even when there are no parsing errors.

class libadalang.ForLoopIterFilter(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Represent the when ... filter after a for loop specification. This class has no RM existence, it is used internally to wrap the filtering expression, so as to have a dedicated name resolution entry point for it and make sure it is resolved separatly from the ForLoopSpec itself (which it cannot influence anyway).

This node type has no derivation.

property f_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

class libadalang.ForLoopSpec(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of LoopSpec.

Specification for a for loop (RM 5.5).

This node type has no derivation.

property f_has_reverse: ReverseNode

When there are no parsing errors, this field is never null.

property f_iter_expr: AdaNode

This field can contain one of the following nodes: AttributeRef, BinOp, CallExpr, CharLiteral, DiscreteSubtypeIndication, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_iter_filter: ForLoopIterFilter

This field may be null even when there are no parsing errors.

property f_loop_type: IterType

When there are no parsing errors, this field is never null.

property f_var_decl: ForLoopVarDecl

When there are no parsing errors, this field is never null.

class libadalang.ForLoopStmt(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseLoopStmt.

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

This node type has no derivation.

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

Subclass of BasicDecl.

Declaration for the controlling variable in a for loop (RM 5.5).

This node type has no derivation.

property f_id: DefiningName

When there are no parsing errors, this field is never null.

property f_id_type: TypeExpr

This field can contain one of the following nodes: AnonymousType, SubtypeIndication

This field may be null even when there are no parsing errors.

class libadalang.FormalDiscreteTypeDef(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of TypeDef.

Type definition for discrete types in generic formals (RM 12.5.2).

This node type has no derivation.

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

Subclass of ClassicSubpDecl.

Formal subprogram declarations, in generic declarations formal parts (RM 12.6).

Derived nodes: AbstractFormalSubpDecl, ConcreteFormalSubpDecl

property f_default_expr: Expr

This field can contain one of the following nodes: AttributeRef, BoxExpr, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, NullLiteral, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

This field may be null even when there are no parsing errors.

class libadalang.FormalTypeDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of TypeDecl.

A formal type declaration.

This node type has no derivation.

property f_default_type: Name

This field can contain one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

This field may be null even when there are no parsing errors.

class libadalang.FormatStringChunk(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Chunk of a format string literal.

This node type has no derivation.

property f_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_string_tok: FormatStringTokNode

This field can contain one of the following nodes: FormatStringTokEnd, FormatStringTokMid

When there are no parsing errors, this field is never null.

property p_image_subprogram: BasicDecl

Return the Image subprogram declaration referred by this format string chunk expression.

class libadalang.FormatStringChunkList(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaList.

List of FormatStringChunk.

This node type has no derivation.

is_list_type = True
class libadalang.FormatStringLiteral(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Expr.

Interpolated string expression.

See https://docs.adacore.com/gnat_rm-docs/html/gnat_rm/gnat_rm/gnat_language_extensions.html#string-interpolation for more details.

This node type has no derivation.

property f_mid_exprs: FormatStringChunkList

When there are no parsing errors, this field is never null.

property f_opening_chunk: FormatStringTokStart

When there are no parsing errors, this field is never null.

property f_trailing_expr: FormatStringChunk

This field may be null even when there are no parsing errors.

class libadalang.FormatStringTokEnd(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of FormatStringTokNode.

Node holding a formatting “end” token.

This node type has no derivation.

class libadalang.FormatStringTokMid(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of FormatStringTokNode.

Node holding a formatting “middle” token.

This node type has no derivation.

class libadalang.FormatStringTokNode(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Node holding a format string token.

Derived nodes: FormatStringTokEnd, FormatStringTokMid, FormatStringTokStart

property p_denoted_value: str

Return the value that this literal denotes.

class libadalang.FormatStringTokStart(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of FormatStringTokNode.

Node holding a formatting “start” token.

Derived nodes: FormatStringTokString

class libadalang.FormatStringTokString(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of FormatStringTokStart.

Node holding a formatting “string” token. This token is used when the corresponding interpolated string doesn’t have any expression to expand.

This node type has no derivation.

class libadalang.GPRProject(project_file: str, scenario_vars: Dict[str, str] = {}, target: str | None = None, runtime: str | None = None, config_file: str | None = None, ada_only: bool = False, print_errors: bool = True)[source]

Load a GPR project file.

create_context(project: str | None = None, event_handler: EventHandler | None = None, with_trivia: bool = True, tab_stop: int = 8) AnalysisContext[source]

Wrapper around Initialize_Context_From_Project to initialize Context (an already allocated but not yet initialized analysis context) from Self.

create_preprocessor(project: Opt[str] = None, line_mode: FileReader.LineMode | None = None) FileReader[source]

Create preprocessor data from compiler arguments found in the given GPR project (-gnatep and -gnateD arguments), or from the project sub-project (if the argument is passed).

Note that this function collects all arguments and returns an approximation from them: it does not replicates exactly gprbuild’s behavior. This may raise a File_Read_Error exception if this fails to read a preprocessor data file and a Syntax_Error exception if one such file has invalid syntax.

create_unit_provider(project: str | None = None) UnitProvider[source]

Return a unit provider that uses this GPR project.

Parameters:

project

If None, let the unit provider use the whole project tree. Otherwise, restrict the unit provider to the project with the given name in the 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 use one will yield an InvalidProjectError exception.

default_charset(project: str | None = None) str[source]

Try to detect the default charset to use for the given project.

Restrict the detection to the subproject project, or to self’s root project if project is left to None.

Note that, as of today, this detection only looks for the -gnatW8 compiler switch: other charsets are not supported.

property errors: List[str]

Possibly empty list of non-critical error messages emitted during project loading.

source_files(mode: SourceFilesMode = SourceFilesMode.default, projects: List[str] = [])[source]

Return the list of source files in this project according to mode:

  • default: sources in the root project and its non-externally built dependencies;

  • root_project: sources in the root project only;

  • whole_project: sources in the whole project tree (i.e. including externally built dependencies);

  • whole_project_with_runtime: sources in the whole project tree plus runtime sources.

If projects is not empty, return instead the list for the sources in all the sub-projects that projects designates, still applying the given mode to the search.

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

Subclass of BasicDecl.

Base class for generic declarations (RM 12.1).

Derived nodes: GenericPackageDecl, GenericSubpDecl

property f_formal_part: GenericFormalPart

When there are no parsing errors, this field is never null.

class libadalang.GenericFormal(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseFormalParamDecl.

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

Derived nodes: GenericFormalObjDecl, GenericFormalPackage, GenericFormalSubpDecl, GenericFormalTypeDecl

property f_decl: BasicDecl

This field can contain one of the following nodes: ExprFunction, FormalSubpDecl, FormalTypeDecl, GenericInstantiation, IncompleteFormalTypeDecl, ObjectDecl

When there are no parsing errors, this field is never null.

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

Subclass of GenericFormal.

Formal declaration for an object.

This node type has no derivation.

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

Subclass of GenericFormal.

Formal declaration for a package (RM 12.1).

This node type has no derivation.

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

Subclass of BaseFormalParamHolder.

List of declaration for generic formals (RM 12.1).

This node type has no derivation.

property f_decls: AdaNodeList

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

When there are no parsing errors, this field is never null.

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

Subclass of GenericFormal.

Formal declaration for a subprogram (RM 12.1).

This node type has no derivation.

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

Subclass of GenericFormal.

Formal declaration for a type (RM 12.1).

This node type has no derivation.

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

Subclass of BasicDecl.

Instantiations of generics (RM 12.3).

Derived nodes: GenericPackageInstantiation, GenericSubpInstantiation

property p_designated_generic_decl: GenericDecl

Return the generic decl entity designated by this instantiation, including instantiation information. This is equivalent to the expanded generic unit in GNAT.

property p_inst_params: List[ParamActual]

Returns an array of pairs, associating formal parameters to actual or default expressions.

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

Subclass of GenericDecl.

Generic package declaration (RM 12.1).

This node type has no derivation.

property f_package_decl: GenericPackageInternal

When there are no parsing errors, this field is never null.

property p_body_part: PackageBody

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

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

Subclass of GenericInstantiation.

Instantiations of a generic package.

This node type has no derivation.

property f_generic_pkg_name: Name

This field can contain one of the following nodes: CharLiteral, DottedName, Identifier, StringLiteral

When there are no parsing errors, this field is never null.

property f_name: DefiningName

When there are no parsing errors, this field is never null.

property f_params: AssocList

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

When there are no parsing errors, this field is never null.

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

Subclass of BasePackageDecl.

This class denotes the internal package contained by a GenericPackageDecl.

This node type has no derivation.

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

Subclass of GenericRenamingDecl.

Declaration for a generic package renaming (RM 8.5.5).

This node type has no derivation.

property f_name: DefiningName

When there are no parsing errors, this field is never null.

property f_renames: RenamingClause

When there are no parsing errors, this field is never null.

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

Subclass of BasicDecl.

Base node for all generic renaming declarations (RM 8.5.5).

Derived nodes: GenericPackageRenamingDecl, GenericSubpRenamingDecl

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

Subclass of GenericDecl.

Generic subprogram declaration (RM 12.1).

This node type has no derivation.

property f_subp_decl: GenericSubpInternal

When there are no parsing errors, this field is never null.

p_body_part(imprecise_fallback: bool = False) BaseSubpBody[source]

Return the BaseSubpBody corresponding to this node.

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

Subclass of GenericInstantiation.

Instantiations of a generic subprogram .

This node type has no derivation.

property f_generic_subp_name: Name

This field can contain one of the following nodes: CharLiteral, DottedName, Identifier, StringLiteral

When there are no parsing errors, this field is never null.

property f_kind: SubpKind

When there are no parsing errors, this field is never null.

property f_overriding: OverridingNode

When there are no parsing errors, this field is never null.

property f_params: AssocList

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

When there are no parsing errors, this field is never null.

property f_subp_name: DefiningName

When there are no parsing errors, this field is never null.

property p_designated_subp: BasicSubpDecl

Return the subprogram decl designated by this instantiation.

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

Subclass of BasicSubpDecl.

Internal node for generic subprograms.

This node type has no derivation.

property f_subp_spec: SubpSpec

When there are no parsing errors, this field is never null.

class libadalang.GenericSubpRenamingDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of GenericRenamingDecl.

Declaration for a generic subprogram renaming.

This node type has no derivation.

property f_kind: SubpKind

When there are no parsing errors, this field is never null.

property f_name: DefiningName

When there are no parsing errors, this field is never null.

property f_renames: RenamingClause

When there are no parsing errors, this field is never null.

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

Subclass of SimpleStmt.

goto statement (RM 5.8).

This node type has no derivation.

property f_label_name: Name

This field can contain one of the following nodes: CharLiteral, DottedName, Identifier, StringLiteral

When there are no parsing errors, this field is never null.

class libadalang.GrammarRule[source]

Gramar rule to use for parsing.

abort_stmt_rule = 'abort_stmt_rule'
abstract_state_decl_rule = 'abstract_state_decl_rule'
abstract_subp_decl_rule = 'abstract_subp_decl_rule'
accept_stmt_rule = 'accept_stmt_rule'
access_def_rule = 'access_def_rule'
add_term_rule = 'add_term_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_subcomponent_choice_rule = 'array_subcomponent_choice_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'
attr_suffix_rule = 'attr_suffix_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'
composite_constraint_assoc_rule = 'composite_constraint_assoc_rule'
composite_constraint_rule = 'composite_constraint_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_choice_list_rule = 'delta_choice_list_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_part_rule = 'discriminant_part_rule'
discriminant_spec_rule = 'discriminant_spec_rule'
elsif_part_rule = 'elsif_part_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'
formal_type_decl_rule = 'formal_type_decl_rule'
format_string_literal_rule = 'format_string_literal_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'
incomplete_type_decl_rule = 'incomplete_type_decl_rule'
int_literal_rule = 'int_literal_rule'
interface_type_def_rule = 'interface_type_def_rule'
iterated_assoc_rule = 'iterated_assoc_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'
multi_abstract_state_decl_rule = 'multi_abstract_state_decl_rule'
multidim_array_assoc_rule = 'multidim_array_assoc_rule'
name_rule = 'name_rule'
no_type_object_renaming_decl_rule = 'no_type_object_renaming_decl_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'
pp_directive_rule = 'pp_directive_rule'
pp_expr_rule = 'pp_expr_rule'
pp_term_rule = 'pp_term_rule'
pp_then_rule = 'pp_then_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_decl_stmt_rule = 'simple_decl_stmt_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'
value_sequence_rule = 'value_sequence_rule'
variant_part_rule = 'variant_part_rule'
variant_rule = 'variant_rule'
while_loop_spec_rule = 'while_loop_spec_rule'
with_clause_rule = 'with_clause_rule'
class libadalang.HandledStmts(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

List of statements, with optional exception handlers (RM 11.2).

This node type has no derivation.

property f_exceptions: AdaNodeList

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

When there are no parsing errors, this field is never null.

property f_stmts: StmtList

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

When there are no parsing errors, this field is never null.

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

Subclass of BaseId.

Regular identifier (RM 2.3).

This node type has no derivation.

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

Subclass of AdaList.

List of Identifier.

Derived nodes: DiscriminantChoiceList

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

Subclass of CondExpr.

if expression (:rmlink`4.5.7`).

This node type has no derivation.

property f_alternatives: ElsifExprPartList

When there are no parsing errors, this field is never null.

property f_cond_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_else_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

This field may be null even when there are no parsing errors.

property f_then_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

class libadalang.IfStmt(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of CompositeStmt.

if statement block (RM 5.3).

This node type has no derivation.

property f_alternatives: ElsifStmtPartList

When there are no parsing errors, this field is never null.

property f_cond_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_else_part: ElsePart

This field may be null even when there are no parsing errors.

property f_then_stmts: StmtList

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

When there are no parsing errors, this field is never null.

class libadalang.IncompleteFormalTypeDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of IncompleteTypeDecl.

A formal incomplete type declaration.

This node type has no derivation.

property f_default_type: Name

This field can contain one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

This field may be null even when there are no parsing errors.

property f_is_tagged: TaggedNode

This field may be null even when there are no parsing errors.

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

Subclass of IncompleteTypeDecl.

Incomplete declaration for a tagged type.

This node type has no derivation.

property f_has_abstract: AbstractNode

When there are no parsing errors, this field is never null.

class libadalang.IncompleteTypeDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseTypeDecl.

Incomplete declaration for a type (RM 12.5).

Derived nodes: IncompleteFormalTypeDecl, IncompleteTaggedTypeDecl

property f_discriminants: DiscriminantPart

This field may be null even when there are no parsing errors.

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

Subclass of NumLiteral.

Literal for an integer (RM 2.4).

This node type has no derivation.

property p_denoted_value: int

Return the value that this literal denotes.

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

Subclass of AdaNode.

Kind of interface type.

Derived nodes: InterfaceKindLimited, InterfaceKindProtected, InterfaceKindSynchronized, InterfaceKindTask

class libadalang.InterfaceKindLimited(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of InterfaceKind.

This node type has no derivation.

class libadalang.InterfaceKindProtected(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of InterfaceKind.

This node type has no derivation.

class libadalang.InterfaceKindSynchronized(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of InterfaceKind.

This node type has no derivation.

class libadalang.InterfaceKindTask(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of InterfaceKind.

This node type has no derivation.

class libadalang.InterfaceTypeDef(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of TypeDef.

Type definition for an interface (RM 3.9.4).

This node type has no derivation.

property f_interface_kind: InterfaceKind

This field may be null even when there are no parsing errors.

property f_interfaces: ParentList

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

When there are no parsing errors, this field is never null.

exception libadalang.InvalidInput[source]

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

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: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Iteration type for for loops.

Derived nodes: IterTypeIn, IterTypeOf

class libadalang.IterTypeIn(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of IterType.

This node type has no derivation.

class libadalang.IterTypeOf(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of IterType.

This node type has no derivation.

class libadalang.IteratedAssoc(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BasicAssoc.

Iterated association (Ada 2020, RM 4.3.3).

This node type has no derivation.

property f_key_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

This field may be null even when there are no parsing errors.

property f_r_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_spec: ForLoopSpec

When there are no parsing errors, this field is never null.

class libadalang.KnownDiscriminantPart(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of DiscriminantPart.

Known list of discriminants in type declarations (RM 3.7).

This node type has no derivation.

property f_discr_specs: DiscriminantSpecList

When there are no parsing errors, this field is never null.

class libadalang.Label(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of SimpleStmt.

Statement to declare a code label (RM 5.1).

This node type has no derivation.

property f_decl: LabelDecl

When there are no parsing errors, this field is never null.

class libadalang.LabelDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BasicDecl.

Declaration for a code label (RM 5.1).

This node type has no derivation.

property f_name: DefiningName

When there are no parsing errors, this field is never null.

class libadalang.LibraryItem(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Library item in a compilation unit (RM 10.1.1).

This node type has no derivation.

property f_has_private: PrivateNode

When there are no parsing errors, this field is never null.

property f_item: BasicDecl

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

When there are no parsing errors, this field is never null.

class libadalang.LimitedAbsent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of LimitedNode.

This node type has no derivation.

class libadalang.LimitedNode(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Qualifier for the limited keyword.

Derived nodes: LimitedAbsent, LimitedPresent

property p_as_bool: bool

Return whether this node is present

class libadalang.LimitedPresent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of LimitedNode.

This node type has no derivation.

class libadalang.LogicContext(ref_node: AdaNode, decl_node: AdaNode)[source]

Describes an interpretation of a reference. Can be attached to logic atoms (e.g. Binds) to indicate under which interpretation this particular atom was produced, which can in turn be used to produce informative diagnostics for resolution failures.

property decl_node: AdaNode
property ref_node: AdaNode
class libadalang.LookupKind[source]
flat = 'flat'
minimal = 'minimal'
recursive = 'recursive'
class libadalang.LoopSpec(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Base class for loop specifications (RM 5.5).

Derived nodes: ForLoopSpec, WhileLoopSpec

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

Subclass of BaseLoopStmt.

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

This node type has no derivation.

exception libadalang.MalformedTreeError[source]

Raised when unparsing functions working on rewritten trees (Libadalang.Rewriting) are called on malformed trees.

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

Subclass of Expr.

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

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

This node type has no derivation.

property f_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_membership_exprs: ExprAlternativesList

This field contains a list that itself contains one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DiscreteSubtypeName, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_op: Op

This field can contain one of the following nodes: OpIn, OpNotIn

When there are no parsing errors, this field is never null.

class libadalang.ModIntTypeDef(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of TypeDef.

Type definition for a modular integer type (RM 3.5.4).

This node type has no derivation.

property f_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, BoxExpr, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

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

Subclass of AdaNode.

Syntactic indicators for passing modes in formals (RM 6.1).

Derived nodes: ModeDefault, ModeInOut, ModeIn, ModeOut

class libadalang.ModeDefault(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Mode.

This node type has no derivation.

class libadalang.ModeIn(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Mode.

This node type has no derivation.

class libadalang.ModeInOut(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Mode.

This node type has no derivation.

class libadalang.ModeOut(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Mode.

This node type has no derivation.

class libadalang.MultiAbstractStateDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Node that holds several AbstractStateDecl nodes, which is necessary when the Abstract_State aspect is associated with an aggregate in order to declare a list of abstract states.

This node type has no derivation.

property f_decls: AbstractStateDeclList

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

When there are no parsing errors, this field is never null.

class libadalang.MultiDimArrayAssoc(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AggregateAssoc.

Association used for multi-dimension array aggregates.

This node type has no derivation.

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

Subclass of Expr.

Base class for names (RM 4.1).

Derived nodes: ArraySubcomponentChoiceName, AttributeRef, CallExpr, DefiningName, DiscreteSubtypeName, DottedName, EndName, ExplicitDeref, QualExpr, ReduceAttributeRef, SingleTokNode, SyntheticIdentifier, TargetName, UpdateAttributeRef

property 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: bool = True, seq_from: AdaNode = None) List[AdaNode][source]

Return all elements in self’s scope that are lexically named like self.

property p_as_symbol_array: List[str]

Turn this name into an array of symbols.

For instance, a node with name A.B.C is turned into ['A', 'B', 'C'].

Only simple name kinds are allowed: Identifier, DottedName and DefiningName. Any other kind will trigger a PreconditionFailure.

property p_call_params: List[ParamActual]

Returns an array of pairs, associating formal parameters to actual or default expressions.

property p_called_subp_spec: BaseFormalParamHolder

Return the subprogram specification of the subprogram or subprogram access that is being called by this exact Name, if relevant. Note that when inside an instantiated generic, this will return the spec of the actual subprogram.

property p_canonical_text: str

Return a canonicalized version of this name’s text.

Only simple name kinds are allowed: Identifier, DottedName and DefiningName. Any other kind will trigger a PreconditionFailure.

property p_enclosing_defining_name: DefiningName

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

p_failsafe_referenced_decl(imprecise_fallback: bool = False) RefdDecl[source]

Failsafe version of referenced_decl. Returns a RefdDecl, which can be precise, imprecise, or error.

p_failsafe_referenced_def_name(imprecise_fallback: bool = False) RefdDef[source]

Failsafe version of referenced_defining_name. Returns a RefdDef, which can be precise, imprecise, or error.

property p_is_access_call: bool

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

property p_is_call: bool

Returns True if this Name corresponds to a call.

property p_is_constant: bool

Return whether this name denotes a constant value.

property p_is_defining: bool

Return True if this name is part of a defining name.

property p_is_direct_call: bool

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).

p_is_dot_call(imprecise_fallback: bool = False) bool[source]

Returns True if this Name corresponds to a dot notation call.

property p_is_operator_name: bool

Return whether the name that self designates is an operator.

p_is_static_call(imprecise_fallback: bool = False) bool[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”.

p_is_static_subtype(imprecise_fallback: bool = False) bool[source]

Returns whether self denotes a static subtype or not.

p_is_write_reference(imprecise_fallback: bool = False) bool[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.

  4. P(F => T (X)) where F is declared out or in out

  5. X'Access.

  6. X.C := 2, R.X := 2

  7. X.P where the formal for X is declared out or in out.

Note

This is an experimental feature. There might be some discrepancy with the GNAT concept of “write reference”.

property p_name_designated_type: BaseTypeDecl

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

p_name_is(sym: str) bool[source]

Helper. Check that this name matches sym.

p_name_matches(n: Name) bool[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.

p_referenced_decl(imprecise_fallback: bool = False) BasicDecl[source]

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

p_referenced_defining_name(imprecise_fallback: bool = False) DefiningName[source]

Like referenced_decl, but will return the defining identifier for the decl, rather than the basic declaration node itself.

property p_relative_name: Name

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

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

Subclass of AdaList.

List of Name.

This list node can contain one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

Derived nodes: ParentList

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

Subclass of CompositeStmt.

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.

This node type has no derivation.

property f_decl: NamedStmtDecl

When there are no parsing errors, this field is never null.

property f_stmt: CompositeStmt

This field can contain one of the following nodes: BaseLoopStmt, BlockStmt

When there are no parsing errors, this field is never null.

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

Subclass of BasicDecl.

BasicDecl that is always the declaration inside a named statement.

This node type has no derivation.

property f_name: DefiningName

When there are no parsing errors, this field is never null.

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.

class libadalang.NoTypeObjectRenamingDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of ObjectDecl.

Object declaration without subtype indication. This node has been introduced to cover a special case for ObjectDecl, where type_expr is made optional (AI12-0275), and therefore cannot fit in an ObjectDecl.

This node type has no derivation.

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

Subclass of AdaNode.

Qualifier for the not null keywords.

Derived nodes: NotNullAbsent, NotNullPresent

property p_as_bool: bool

Return whether this node is present

class libadalang.NotNullAbsent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of NotNull.

This node type has no derivation.

class libadalang.NotNullPresent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of NotNull.

This node type has no derivation.

class libadalang.NullComponentDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Placeholder for the null in lists of components (RM 3.8).

This node type has no derivation.

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

Subclass of SingleTokNode.

The null literal (RM 4.4).

This node type has no derivation.

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

Subclass of BaseAggregate.

Aggregate for null record (RM 4.3).

This node type has no derivation.

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

Subclass of BaseRecordDef.

Record definition for null record.

This node type has no derivation.

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

Subclass of SimpleStmt.

null; statement (RM 5.1).

This node type has no derivation.

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

Subclass of BaseSubpBody.

Declaration for a null subprogram (RM 6.1).

This node type has no derivation.

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

Subclass of SingleTokNode.

Base class for number literals (RM 2.4).

Derived nodes: IntLiteral, RealLiteral

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

Subclass of BasicDecl.

Declaration for a static constant number (RM 3.3.2).

This node type has no derivation.

property f_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_ids: DefiningNameList

When there are no parsing errors, this field is never null.

class libadalang.ObjectDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BasicDecl.

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.

Derived nodes: ExtendedReturnStmtObjectDecl, NoTypeObjectRenamingDecl

property f_default_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

This field may be null even when there are no parsing errors.

property f_has_aliased: AliasedNode

When there are no parsing errors, this field is never null.

property f_has_constant: ConstantNode

When there are no parsing errors, this field is never null.

property f_ids: DefiningNameList

When there are no parsing errors, this field is never null.

property f_mode: Mode

This field may be null even when there are no parsing errors.

property f_renaming_clause: RenamingClause

This field may be null even when there are no parsing errors.

property f_type_expr: TypeExpr

This field can contain one of the following nodes: AnonymousType, SubtypeIndication

This field may be null even when there are no parsing errors.

property p_is_statically_constrained: bool

Returns whether this designates a statically constrained object. An object is statically constrained if its nominal subtype is statically constrained, or if it is a static string constant.

property p_private_part_decl: BasicDecl

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

property p_public_part_decl: BasicDecl

If this object decl is the incomplete declaration of a constant in a public part, return its completion in the private part.

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

Subclass of BaseId.

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.

Derived nodes: OpAbs, OpAndThen, OpAnd, OpConcat, OpDiv, OpDoubleDot, OpEq, OpGt, OpGte, OpIn, OpLt, OpLte, OpMinus, OpMod, OpMult, OpNeq, OpNotIn, OpNot, OpOrElse, OpOr, OpPlus, OpPow, OpRem, OpXor

class libadalang.OpAbs(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpAnd(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpAndThen(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpConcat(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpDiv(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpDoubleDot(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpEq(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpGt(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpGte(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpIn(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpLt(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpLte(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpMinus(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpMod(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpMult(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpNeq(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpNot(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpNotIn(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpOr(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpOrElse(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpPlus(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpPow(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpRem(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OpXor(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Op.

This node type has no derivation.

class libadalang.OrdinaryFixedPointDef(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of RealTypeDef.

Type definition for ordinary fixed-point numbers (RM 3.5.9).

This node type has no derivation.

property f_delta: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, BoxExpr, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_range: RangeSpec

This field may be null even when there are no parsing errors.

class libadalang.OthersDesignator(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

other designator.

This node type has no derivation.

exception libadalang.OutOfBoundsError[source]

Raised when introspection functions (Libadalang.Introspection) are passed an out of bounds index.

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

Subclass of AdaNode.

Syntactic indicators for subprogram overriding modes.

Derived nodes: OverridingNotOverriding, OverridingOverriding, OverridingUnspecified

class libadalang.OverridingNotOverriding(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of OverridingNode.

This node type has no derivation.

class libadalang.OverridingOverriding(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of OverridingNode.

This node type has no derivation.

class libadalang.OverridingUnspecified(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of OverridingNode.

This node type has no derivation.

class libadalang.PackageBody(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BodyNode.

Package body (RM 7.2).

This node type has no derivation.

property f_decls: DeclarativePart

When there are no parsing errors, this field is never null.

property f_end_name: EndName

This field may be null even when there are no parsing errors.

property f_package_name: DefiningName

When there are no parsing errors, this field is never null.

property f_stmts: HandledStmts

This field may be null even when there are no parsing errors.

class libadalang.PackageBodyStub(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BodyStub.

Stub for a package body (is separate) (RM 10.1.3).

This node type has no derivation.

property f_name: DefiningName

When there are no parsing errors, this field is never null.

class libadalang.PackageDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BasePackageDecl.

Non-generic package declarations (RM 7.1).

This node type has no derivation.

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

Subclass of BasicDecl.

Declaration for a package renaming (RM 8.5.3).

This node type has no derivation.

property f_name: DefiningName

When there are no parsing errors, this field is never null.

property f_renames: RenamingClause

When there are no parsing errors, this field is never null.

property p_final_renamed_package: BasicDecl

Return the declaration of the package that is ultimately renamed by self, skipping through all intermediate package renamings.

property p_renamed_package: BasicDecl

Return the declaration of the package that is renamed by self.

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

Data structure used by zip_with_params, Name.call_params, GenericInstantiation.inst_params, BaseAggregate.aggregate_params, SubtypeIndication.subtype_constraints, and EnumRepClause.params properties. Associates an expression (the actual) to a formal param declaration (the parameter).

property actual: Expr
property param: DefiningName
class libadalang.ParamAssoc(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BasicAssoc.

Association (X => Y) used for parameter associations (RM 6.4).

This node type has no derivation.

property f_designator: AdaNode

This field can contain one of the following nodes: Identifier, OthersDesignator, StringLiteral

This field may be null even when there are no parsing errors.

property f_r_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, BoxExpr, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

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

Subclass of BaseFormalParamDecl.

Specification for a parameter (RM 6.1).

This node type has no derivation.

property f_default_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

This field may be null even when there are no parsing errors.

property f_has_aliased: AliasedNode

When there are no parsing errors, this field is never null.

property f_ids: DefiningNameList

When there are no parsing errors, this field is never null.

property f_mode: Mode

This field may be null even when there are no parsing errors.

property f_type_expr: TypeExpr

This field can contain one of the following nodes: AnonymousType, SubtypeIndication

When there are no parsing errors, this field is never null.

class libadalang.ParamSpecList(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaList.

List of ParamSpec.

This node type has no derivation.

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

Subclass of AdaNode.

List of parameter specifications.

This node type has no derivation.

property f_params: ParamSpecList

When there are no parsing errors, this field is never null.

class libadalang.ParenAbstractStateDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Holds an AbstractStateDecl between parentheses. Needed to support the syntax:

package Pkg
    with Abstract_State => (A, (B with Some_Aspect))

This node type has no derivation.

property f_decl: AdaNode

This field can contain one of the following nodes: AbstractStateDecl, ParenAbstractStateDecl

When there are no parsing errors, this field is never null.

class libadalang.ParenExpr(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Expr.

Parenthesized expression.

This node type has no derivation.

property f_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

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

Subclass of NameList.

List of parents in a type declaration.

This list node can contain one of the following nodes: CharLiteral, DottedName, Identifier, StringLiteral

This node type has no derivation.

is_list_type = True
class libadalang.PpDirective(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Base node for all preprocessor directives.

Derived nodes: PpElseDirective, PpElsifDirective, PpEndIfDirective, PpIfDirective

class libadalang.PpElseDirective(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of PpDirective.

else preprocessor directive.

This node type has no derivation.

class libadalang.PpElsifDirective(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of PpDirective.

elsif ... [then] preprocessor directive.

This node type has no derivation.

property f_expr: Expr

This field can contain one of the following nodes: AttributeRef, BinOp, Identifier, ParenExpr, UnOp

When there are no parsing errors, this field is never null.

property f_then_kw: PpThenKw

This field may be null even when there are no parsing errors.

class libadalang.PpEndIfDirective(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of PpDirective.

end if; preprocessor directive.

This node type has no derivation.

class libadalang.PpIfDirective(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of PpDirective.

if ... [then] preprocessor directive.

This node type has no derivation.

property f_expr: Expr

This field can contain one of the following nodes: AttributeRef, BinOp, Identifier, ParenExpr, UnOp

When there are no parsing errors, this field is never null.

property f_then_kw: PpThenKw

This field may be null even when there are no parsing errors.

class libadalang.PpThenKw(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

then keyword in preprocessor directives.

This node type has no derivation.

class libadalang.PragmaArgumentAssoc(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseAssoc.

Argument association in a pragma.

This node type has no derivation.

property f_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_name: Name

This field can contain one of the following nodes: AttributeRef, Identifier

This field may be null even when there are no parsing errors.

class libadalang.PragmaNode(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

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

This node type has no derivation.

property f_args: BaseAssocList

When there are no parsing errors, this field is never null.

property f_id: Identifier

When there are no parsing errors, this field is never null.

property p_associated_entities: List[DefiningName]

Return an array of BasicDecl instances associated with this pragma, or an empty array if non applicable.

property p_is_ghost_code: bool

Return whether this pragma is ghost code or not. See SPARK RM 6.9.

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

Subclass of AdaList.

List of Pragma.

This node type has no derivation.

is_list_type = True
exception libadalang.PreconditionFailure[source]

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

class libadalang.PrivateAbsent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of PrivateNode.

This node type has no derivation.

class libadalang.PrivateNode(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Qualifier for the private keyword.

Derived nodes: PrivateAbsent, PrivatePresent

property p_as_bool: bool

Return whether this node is present

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

Subclass of DeclarativePart.

List of declarations in a private part.

This node type has no derivation.

class libadalang.PrivatePresent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of PrivateNode.

This node type has no derivation.

class libadalang.PrivateTypeDef(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of TypeDef.

Type definition for a private type.

Libadalang diverges from the ARM here, treating private types like regular type declarations that have an embedded type definition. This type definition hence corresponds to RM 7.3.

This node type has no derivation.

property f_has_abstract: AbstractNode

When there are no parsing errors, this field is never null.

property f_has_limited: LimitedNode

When there are no parsing errors, this field is never null.

property f_has_tagged: TaggedNode

When there are no parsing errors, this field is never null.

exception libadalang.ProjectError[source]

Raised when an error occurs while loading a project file.

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: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of ProtectedNode.

This node type has no derivation.

class libadalang.ProtectedBody(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BodyNode.

Protected object body (RM 9.4).

This node type has no derivation.

property f_decls: DeclarativePart

When there are no parsing errors, this field is never null.

property f_end_name: EndName

This field may be null even when there are no parsing errors.

property f_name: DefiningName

When there are no parsing errors, this field is never null.

class libadalang.ProtectedBodyStub(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BodyStub.

Stub for a protected object body (is separate) (RM 10.1.3).

This node type has no derivation.

property f_name: DefiningName

When there are no parsing errors, this field is never null.

class libadalang.ProtectedDef(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Type definition for a protected object (RM 9.4).

This node type has no derivation.

property f_end_name: EndName

This field may be null even when there are no parsing errors.

property f_private_part: PrivatePart

This field may be null even when there are no parsing errors.

property f_public_part: PublicPart

When there are no parsing errors, this field is never null.

class libadalang.ProtectedNode(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Qualifier for the protected keyword.

Derived nodes: ProtectedAbsent, ProtectedPresent

property p_as_bool: bool

Return whether this node is present

class libadalang.ProtectedPresent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of ProtectedNode.

This node type has no derivation.

class libadalang.ProtectedTypeDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseTypeDecl.

Declaration for a protected type (RM 9.4).

This node type has no derivation.

property f_definition: ProtectedDef

When there are no parsing errors, this field is never null.

property f_discriminants: DiscriminantPart

This field may be null even when there are no parsing errors.

property f_interfaces: ParentList

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

When there are no parsing errors, this field is never null.

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

Subclass of DeclarativePart.

List of declarations in a public part.

This node type has no derivation.

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

Subclass of Name.

Qualified expression (...'(...)) .(RM 4.7).

This node type has no derivation.

property f_prefix: Name

This field can contain one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_suffix: Expr

This field can contain one of the following nodes: BaseAggregate, ParenExpr

When there are no parsing errors, this field is never null.

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

Subclass of Expr.

Quantified expression (RM 4.5.8).

This node type has no derivation.

property f_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_loop_spec: ForLoopSpec

When there are no parsing errors, this field is never null.

property f_quantifier: Quantifier

When there are no parsing errors, this field is never null.

class libadalang.Quantifier(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Type for quantified expressions.

Derived nodes: QuantifierAll, QuantifierSome

class libadalang.QuantifierAll(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Quantifier.

This node type has no derivation.

class libadalang.QuantifierSome(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Quantifier.

This node type has no derivation.

class libadalang.RaiseExpr(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Expr.

Expression to raise an exception (RM 4.4).

This node type has no derivation.

property f_error_message: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

This field may be null even when there are no parsing errors.

property f_exception_name: Name

This field can contain one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

This field may be null even when there are no parsing errors.

class libadalang.RaiseStmt(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of SimpleStmt.

raise statement (RM 11.3).

This node type has no derivation.

property f_error_message: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

This field may be null even when there are no parsing errors.

property f_exception_name: Name

This field can contain one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

This field may be null even when there are no parsing errors.

class libadalang.RangeConstraint(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Constraint.

Range-based type constraint (RM 3.5).

This node type has no derivation.

property f_range: RangeSpec

When there are no parsing errors, this field is never null.

class libadalang.RangeSpec(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Range specification (RM 3.5.7).

This node type has no derivation.

property f_range: Expr

This field can contain one of the following nodes: AttributeRef, BinOp, BoxExpr, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

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

Subclass of NumLiteral.

Literal for a real number (RM 2.4).

This node type has no derivation.

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

Subclass of TypeDef.

Type definition for real numbers (RM 3.5.6).

Derived nodes: DecimalFixedPointDef, FloatingPointDef, OrdinaryFixedPointDef

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

Subclass of BaseRecordDef.

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

This node type has no derivation.

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

Subclass of AspectClause.

Representation clause for a record type (RM 13.5.1).

This node type has no derivation.

property f_at_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

This field may be null even when there are no parsing errors.

property f_components: AdaNodeList

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

When there are no parsing errors, this field is never null.

property f_name: Name

This field can contain one of the following nodes: CharLiteral, DottedName, Identifier, StringLiteral

When there are no parsing errors, this field is never null.

class libadalang.RecordTypeDef(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of TypeDef.

Type definition for a record (RM 3.8).

This node type has no derivation.

property f_has_abstract: AbstractNode

When there are no parsing errors, this field is never null.

property f_has_limited: LimitedNode

When there are no parsing errors, this field is never null.

property f_has_tagged: TaggedNode

When there are no parsing errors, this field is never null.

property f_record_def: BaseRecordDef

When there are no parsing errors, this field is never null.

class libadalang.ReduceAttributeRef(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Name.

Reduction expression (Reduce attribute). Ada 2022, RM 4.5.10.

This node type has no derivation.

property f_args: AssocList

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

When there are no parsing errors, this field is never null.

property f_attribute: Identifier

When there are no parsing errors, this field is never null.

property f_prefix: AdaNode

This field can contain one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef, ValueSequence

When there are no parsing errors, this field is never null.

class libadalang.RefResult(ref: BaseId, kind: str)[source]

Result for a cross reference query returning a reference.

property kind: str
property ref: BaseId
class libadalang.RefResultKind[source]

Kind for the result of a cross reference operation.

  • no_ref 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'
no_ref = 'no_ref'
precise = 'precise'
class libadalang.RefdDecl(decl: BasicDecl, kind: str)[source]

Result for a cross reference query returning a referenced decl.

property decl: BasicDecl
property kind: str
class libadalang.RefdDef(def_name: DefiningName, kind: str)[source]

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

property def_name: DefiningName
property kind: str
class libadalang.RelationOp(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BinOp.

Binary operation that compares two value, producing a boolean (RM 4.4).

This node type has no derivation.

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

Subclass of AdaNode.

Renaming clause, used everywhere renamings are valid.

Derived nodes: SyntheticRenamingClause

property f_renamed_object: Name

This field can contain one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

class libadalang.RequeueStmt(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of SimpleStmt.

requeue statement (RM 9.5.4).

This node type has no derivation.

property f_call_name: Name

This field can contain one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_has_abort: AbortNode

When there are no parsing errors, this field is never null.

class libadalang.ReturnStmt(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of SimpleStmt.

return statement (RM 6.5).

This node type has no derivation.

property f_return_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

This field may be null even when there are no parsing errors.

class libadalang.ReverseAbsent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of ReverseNode.

This node type has no derivation.

class libadalang.ReverseNode(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Qualifier for the reverse keyword.

Derived nodes: ReverseAbsent, ReversePresent

property p_as_bool: bool

Return whether this node is present

class libadalang.ReversePresent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of ReverseNode.

This node type has no derivation.

class libadalang.SelectStmt(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of CompositeStmt.

select statements block (RM 9.7).

This node type has no derivation.

property f_else_part: ElsePart

This field may be null even when there are no parsing errors.

property f_guards: SelectWhenPartList

When there are no parsing errors, this field is never null.

property f_then_abort_part: ThenAbortPart

This field may be null even when there are no parsing errors.

class libadalang.SelectWhenPart(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Alternative part in a select statements block (RM 9.7).

This node type has no derivation.

property f_cond_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

This field may be null even when there are no parsing errors.

property f_stmts: StmtList

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

When there are no parsing errors, this field is never null.

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

Subclass of AdaList.

List of SelectWhenPart.

This node type has no derivation.

is_list_type = True
class libadalang.Shape(components: List[BaseFormalParamDecl], discriminants_values: List[DiscriminantValues])[source]

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

property components: List[BaseFormalParamDecl]
property discriminants_values: List[DiscriminantValues]
class libadalang.SignedIntTypeDef(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of TypeDef.

Type definition for a signed integer type (RM 3.5.4).

This node type has no derivation.

property f_range: RangeSpec

When there are no parsing errors, this field is never null.

class libadalang.SimpleDeclStmt(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of SimpleStmt.

Statement wrapping a simple object declaration.

This node type has no derivation.

property f_decl: ObjectDecl

When there are no parsing errors, this field is never null.

class libadalang.SimpleStmt(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Stmt.

Base class for simple statements (RM 5.1).

Derived nodes: AbortStmt, AssignStmt, CallStmt, DelayStmt, ExitStmt, GotoStmt, Label, NullStmt, RaiseStmt, RequeueStmt, ReturnStmt, SimpleDeclStmt, TerminateAlternative

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

Subclass of BasicDecl.

Declaration for a single protected object (RM 9.4).

This node type has no derivation.

property f_definition: ProtectedDef

When there are no parsing errors, this field is never null.

property f_interfaces: ParentList

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

When there are no parsing errors, this field is never null.

property f_name: DefiningName

When there are no parsing errors, this field is never null.

class libadalang.SingleTaskDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BasicDecl.

Declaration for a single task (RM 9.1).

This node type has no derivation.

property f_task_type: SingleTaskTypeDecl

When there are no parsing errors, this field is never null.

class libadalang.SingleTaskTypeDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of TaskTypeDecl.

Type declaration for a single task (RM 9.1).

This node type has no derivation.

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

Subclass of Name.

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

Derived nodes: BaseId, NullLiteral, NumLiteral

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

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

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

Location of a span of text in a source file.

class libadalang.SolverDiagnostic(message_template: str, args: List[AdaNode], location: AdaNode, contexts: List[LogicContext], round: int)[source]

A raw diagnostic produced by a solver resolution failure. This contains as much information as possible to allow formatters down the chain to filter/choose which diagnostics to show among a set of diagnostics produced for a single equation.

  • Message_Template is a string explaining the error, which may contain holes represented by the {} characters. Literal opening braces are encoded as {{.

  • Args is an array of nodes, which are to be plugged in the holes of the template in the same order (i.e. the first argument goes into the first hole of the template, etc.).

  • Location is a node which indicates the location of the error.

  • Contexts is the array of contexts that were deemed relevant for this error.

  • Round is the solver round during which this diagnostic was emitted.

property args: List[AdaNode]
property contexts: List[LogicContext]
property location: AdaNode
property message_template: str
property round: int
class libadalang.SourceFilesMode(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Mode to get a list of source files from a project file.

See SourceFiles.for_project.

default = 0
root_project = 1
whole_project = 2
whole_project_with_runtime = 3
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: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Bass class for statements (RM 5.1).

Derived nodes: CompositeStmt, ErrorStmt, SimpleStmt

property p_is_ghost_code: bool

Return whether this statement is ghost code or not. See SPARK RM 6.9.

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

Subclass of AdaNodeList.

List of statements.

This list node can contain one of the following nodes: PragmaNode, Stmt

This node type has no derivation.

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

Subclass of BaseId.

String literal (RM 2.6).

This node type has no derivation.

property p_denoted_value: str

Return the value that this literal denotes.

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

Subclass of BaseSubpBody.

Subprogram body(RM 6.3) .

This node type has no derivation.

property f_decls: DeclarativePart

When there are no parsing errors, this field is never null.

property f_end_name: EndName

This field may be null even when there are no parsing errors.

property f_stmts: HandledStmts

When there are no parsing errors, this field is never null.

class libadalang.SubpBodyStub(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BodyStub.

Stub for a subprogram body (is separate) (RM 10.1.3).

This node type has no derivation.

property f_overriding: OverridingNode

When there are no parsing errors, this field is never null.

property f_subp_spec: SubpSpec

When there are no parsing errors, this field is never null.

class libadalang.SubpDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of ClassicSubpDecl.

Regular subprogram declaration (RM 6.1).

This node type has no derivation.

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

Subclass of AdaNode.

Qualifier for a subprogram kind.

Derived nodes: SubpKindFunction, SubpKindProcedure

class libadalang.SubpKindFunction(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of SubpKind.

This node type has no derivation.

class libadalang.SubpKindProcedure(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of SubpKind.

This node type has no derivation.

class libadalang.SubpRenamingDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseSubpBody.

Declaration for a subprogram renaming (RM 8.5.4).

This node type has no derivation.

property f_renames: RenamingClause

When there are no parsing errors, this field is never null.

class libadalang.SubpSpec(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseSubpSpec.

Subprogram specification (RM 6.1).

This node type has no derivation.

property f_subp_kind: SubpKind

When there are no parsing errors, this field is never null.

property f_subp_name: DefiningName

This field may be null even when there are no parsing errors.

property f_subp_params: Params

This field may be null even when there are no parsing errors.

property f_subp_returns: TypeExpr

This field can contain one of the following nodes: AnonymousType, SubtypeIndication

This field may be null even when there are no parsing errors.

class libadalang.Substitution(from_decl: BasicDecl, to_value: int, value_type: BaseTypeDecl)[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.

property from_decl: BasicDecl

The declaration to substitute.

property to_value: int

The value by which to substitute the declaration.

property value_type: BaseTypeDecl

The type of the substituted value.

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

Subclass of BaseSubtypeDecl.

Subtype declaration (RM 3.2.2).

This node type has no derivation.

property f_subtype: SubtypeIndication

When there are no parsing errors, this field is never null.

class libadalang.SubtypeIndication(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of TypeExpr.

Reference to a type by name (RM 3.2.2).

Derived nodes: ConstrainedSubtypeIndication, DiscreteSubtypeIndication

property f_constraint: Constraint

This field may be null even when there are no parsing errors.

property f_has_not_null: NotNull

When there are no parsing errors, this field is never null.

property f_name: Name

This field can contain one of the following nodes: AttributeRef, CharLiteral, DottedName, Identifier, StringLiteral

When there are no parsing errors, this field is never null.

p_is_static_subtype(imprecise_fallback: bool = False) bool[source]

Returns whether self denotes a static subtype or not (i.e. determinable at compile time, see RM 4.9).

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

Subclass of AdaNode.

Subunit (separate) (RM 10.1.3).

This node type has no derivation.

property f_body: BodyNode

This field can contain one of the following nodes: PackageBody, ProtectedBody, SubpBody, TaskBody

When there are no parsing errors, this field is never null.

property f_name: Name

This field can contain one of the following nodes: CharLiteral, DottedName, Identifier, StringLiteral

When there are no parsing errors, this field is never null.

property p_body_root: BasicDecl

Return the body in which this subunit is rooted.

class libadalang.SynchronizedAbsent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of SynchronizedNode.

This node type has no derivation.

class libadalang.SynchronizedNode(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Qualifier for the synchronized keyword.

Derived nodes: SynchronizedAbsent, SynchronizedPresent

property p_as_bool: bool

Return whether this node is present

class libadalang.SynchronizedPresent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of SynchronizedNode.

This node type has no derivation.

exception libadalang.SyntaxError[source]

Subprograms may raise this when they try to parse invalid syntax. Note that this does not concern analysis unit getters, which create diagnostic vectors for such errors.

class libadalang.SynthAnonymousTypeDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AnonymousTypeDecl.

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

This node type has no derivation.

class libadalang.SyntheticBinarySpec(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseSubpSpec.

Synthetic subprogram specification for binary operators.

This node type has no derivation.

property f_left_param: SyntheticFormalParamDecl

When there are no parsing errors, this field is never null.

property f_return_type_expr: TypeExpr

This field may be null even when there are no parsing errors.

property f_right_param: SyntheticFormalParamDecl

When there are no parsing errors, this field is never null.

class libadalang.SyntheticCharEnumLit(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of EnumLiteralDecl.

Synthetic character enum literal declaration.

This node type has no derivation.

property p_expr: DefiningName

Return the CharLiteral expression corresponding to this enum literal.

class libadalang.SyntheticDefiningName(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of DefiningName.

Synthetic DefiningName.

This node type has no derivation.

class libadalang.SyntheticFormalParamDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseFormalParamDecl.

Synthetic parameter declaration.

This node type has no derivation.

property f_param_type: TypeExpr

When there are no parsing errors, this field is never null.

class libadalang.SyntheticIdentifier(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Name.

Synthetic identifier.

This node type has no derivation.

class libadalang.SyntheticObjectDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BasicDecl.

SyntheticObjectDecl is a declaration that holds a virtual object. This is for example used in type predicates to refer to an object of the enclosing type, as in:

subtype Odd is Natural with
   Dynamic_Predicate => Odd mod 2 = 1;

where we have to create an object named Odd, and of type Odd so that the name in the aspect expression refers to it and can be properly resolved to the type identifier.

This node has no existance in the Ada RM, it’s only used for internal name resolution purposes.

This node type has no derivation.

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

Subclass of RenamingClause.

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

This node type has no derivation.

class libadalang.SyntheticSubpDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BasicSubpDecl.

Synthetic subprogram declaration.

Is used to represent predefined operators. This should also be usable for synthesizing function attributes.

This node type has no derivation.

property f_spec: BaseSubpSpec

This field can contain one of the following nodes: SyntheticBinarySpec, SyntheticUnarySpec

When there are no parsing errors, this field is never null.

class libadalang.SyntheticTypeExpr(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of TypeExpr.

Synthetic type expression. The designated type is already known at instantiation time and is to be given in the target_type field.

This node type has no derivation.

property f_target_type: BaseTypeDecl

When there are no parsing errors, this field is never null.

class libadalang.SyntheticUnarySpec(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseSubpSpec.

Synthetic subprogram specification for unary operators.

This node type has no derivation.

property f_return_type_expr: SyntheticTypeExpr

When there are no parsing errors, this field is never null.

property f_right_param: SyntheticFormalParamDecl

When there are no parsing errors, this field is never null.

class libadalang.TaggedAbsent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of TaggedNode.

This node type has no derivation.

class libadalang.TaggedNode(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Qualifier for the tagged keyword.

Derived nodes: TaggedAbsent, TaggedPresent

property p_as_bool: bool

Return whether this node is present

class libadalang.TaggedPresent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of TaggedNode.

This node type has no derivation.

class libadalang.TargetInformation(filename: str)[source]

Built in types characteristics for a given target platform.

class libadalang.TargetName(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Name.

Name for Ada 2020 @ (RM 5.2.1).

This node type has no derivation.

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

Subclass of BodyNode.

Task body (RM 9.1).

This node type has no derivation.

property f_decls: DeclarativePart

When there are no parsing errors, this field is never null.

property f_end_name: EndName

This field may be null even when there are no parsing errors.

property f_name: DefiningName

When there are no parsing errors, this field is never null.

property f_stmts: HandledStmts

When there are no parsing errors, this field is never null.

class libadalang.TaskBodyStub(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BodyStub.

Stub for a task body (is separate) (RM 10.1.3).

This node type has no derivation.

property f_name: DefiningName

When there are no parsing errors, this field is never null.

class libadalang.TaskDef(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Type definition for a task type (RM 9.1).

This node type has no derivation.

property f_end_name: EndName

This field may be null even when there are no parsing errors.

property f_interfaces: ParentList

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

When there are no parsing errors, this field is never null.

property f_private_part: PrivatePart

This field may be null even when there are no parsing errors.

property f_public_part: PublicPart

When there are no parsing errors, this field is never null.

class libadalang.TaskTypeDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseTypeDecl.

Declaration for a task type (RM 9.1).

Derived nodes: SingleTaskTypeDecl

property f_definition: TaskDef

This field may be null even when there are no parsing errors.

property f_discriminants: DiscriminantPart

This field may be null even when there are no parsing errors.

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: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of SimpleStmt.

terminate alternative in a select statement (RM 9.7).

This node type has no derivation.

class libadalang.ThenAbortPart(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

then abort part in a select statement block

This node type has no derivation.

property f_stmts: StmtList

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

When there are no parsing errors, this field is never null.

class libadalang.Token(c_value: Any)[source]

Reference to a token in an analysis unit.

property index: int

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

is_equivalent(other: Token) bool[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.

property is_trivia: bool

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

property kind: str

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.

property next: Token | None

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

property previous: Token | None

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

range_until(other: Token) Iterator[Token][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.

property sloc_range: SlocRange

Return the source location range of the given token.

property text: str

Return the text of the given token.

classmethod text_range(first: Token, last: Token) str[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() dict[source]

Return a dict representation of this Token.

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

Subclass of BaseTypeAccessDef.

Syntactic type definition for accesses.

This node type has no derivation.

property f_has_all: AllNode

When there are no parsing errors, this field is never null.

property f_has_constant: ConstantNode

When there are no parsing errors, this field is never null.

property f_subtype_indication: SubtypeIndication

When there are no parsing errors, this field is never null.

class libadalang.TypeAttributesRepository(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Synthetic node that contains the lazy fields for the attribute subprograms of a given type. The lazy fields are not directly on the BaseTypeDecl node itself to minimize its size in memory: with this indirection, a type for which no function attribute is ever synthesized will not waste any memory.

This node type has no derivation.

class libadalang.TypeDecl(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of BaseTypeDecl.

Type declarations that embed a type definition node. Corresponds to the ARM’s full type declarations (RM 3.2.1).

Derived nodes: AnonymousTypeDecl, ConcreteTypeDecl, FormalTypeDecl

property f_discriminants: DiscriminantPart

This field may be null even when there are no parsing errors.

property f_type_def: TypeDef

When there are no parsing errors, this field is never null.

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

Subclass of AdaNode.

Base class for type definitions (RM 3.2.1).

Derived nodes: AccessDef, ArrayTypeDef, DerivedTypeDef, EnumTypeDef, FormalDiscreteTypeDef, InterfaceTypeDef, ModIntTypeDef, PrivateTypeDef, RealTypeDef, RecordTypeDef, SignedIntTypeDef

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

Subclass of AdaNode.

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.

This node has no ARM correspondence.

Derived nodes: AnonymousType, EnumLitSynthTypeExpr, SubtypeIndication, SyntheticTypeExpr

property p_designated_type_decl: BaseTypeDecl

Returns the type declaration designated by this type expression.

p_designated_type_decl_from(origin_node: AdaNode) BaseTypeDecl[source]

Return the type declaration designated by this type expression as viewed from the node given by origin_node.

property p_discriminant_constraints: List[ParamActual]

If this type expression designates a constrained discriminated type, return an array of pairs, associating each discriminant to its actual or default expression.

property p_is_definite_subtype: bool

Returns whether this designates a definite subtype.

property p_is_statically_constrained: bool

Returns whether this designates a statically constrained subtype.

p_subtype_constraint(origin: AdaNode = None) Constraint[source]

Return the constraint that this type expression defines on its designated subtype, if any.

Origin: Origin for this property’s request. See The origin parameter for more details.

property p_type_name: Name

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

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

Subclass of Expr.

Unary expression.

This encompasses several ARM expressions, because it is used for every unary operator in Ada. Those expressions are all documented in RM 4.4.

This node type has no derivation.

property f_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_op: Op

This field can contain one of the following nodes: OpAbs, OpMinus, OpNot, OpPlus

When there are no parsing errors, this field is never null.

class libadalang.UnconstrainedArrayIndex(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

List of unconstrained array indexes.

This node type has no derivation.

property f_lower_bound: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

This field may be null even when there are no parsing errors.

property f_subtype_name: Name

This field can contain one of the following nodes: AttributeRef, CharLiteral, DottedName, Identifier, StringLiteral

When there are no parsing errors, this field is never null.

class libadalang.UnconstrainedArrayIndexList(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaList.

List of UnconstrainedArrayIndex.

This node type has no derivation.

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

Subclass of ArrayIndices.

Unconstrained specification for array indexes (RM 3.6).

This node type has no derivation.

property f_types: UnconstrainedArrayIndexList

When there are no parsing errors, this field is never null.

class libadalang.UnitProvider(c_value: Any)[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.

See the documentation of each unit provider for the exact semantics of the unit name/kind information.

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.

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: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of DiscriminantPart.

Unknown list of discriminants in type declarations (RM 3.7).

This node type has no derivation.

exception libadalang.UnsupportedViewError[source]

Raised when creating a project unit provider for an unsupported project view (for instance, a view with conflicting aggregated projects).

class libadalang.UntilAbsent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of UntilNode.

This node type has no derivation.

class libadalang.UntilNode(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Qualifier for the until keyword.

Derived nodes: UntilAbsent, UntilPresent

property p_as_bool: bool

Return whether this node is present

class libadalang.UntilPresent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of UntilNode.

This node type has no derivation.

class libadalang.UpdateAttributeRef(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of Name.

Reference to the Update attribute, which is a non standard GNAT attribute.

This node type has no derivation.

property f_attribute: Identifier

When there are no parsing errors, this field is never null.

property f_prefix: Name

This field can contain one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_values: BaseAggregate

When there are no parsing errors, this field is never null.

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

Subclass of AdaNode.

Base class for use clauses (RM 10.1.2).

Derived nodes: UsePackageClause, UseTypeClause

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

Subclass of UseClause.

Use clause for packages (RM 8.4).

This node type has no derivation.

property f_packages: NameList

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

When there are no parsing errors, this field is never null.

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

Subclass of UseClause.

Use clause for types (RM 8.4).

This node type has no derivation.

property f_has_all: AllNode

When there are no parsing errors, this field is never null.

property f_types: NameList

This field contains a list that itself contains one of the following nodes: AttributeRef, CallExpr, CharLiteral, DottedName, ExplicitDeref, Identifier, QualExpr, ReduceAttributeRef, StringLiteral, TargetName, UpdateAttributeRef

When there are no parsing errors, this field is never null.

class libadalang.ValueSequence(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

The value sequence of a reduction expression (see ReduceAttributeRef). Ada 2022, RM 4.5.10.

This node type has no derivation.

property f_iter_assoc: IteratedAssoc

When there are no parsing errors, this field is never null.

class libadalang.Variant(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaNode.

Single variant in a discriminated type record declaration.

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

This node type has no derivation.

property f_choices: AlternativesList

This field contains a list that itself contains one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DiscreteSubtypeIndication, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, OthersDesignator, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

property f_components: ComponentList

When there are no parsing errors, this field is never null.

class libadalang.VariantList(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of AdaList.

List of Variant.

This node type has no derivation.

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

Subclass of AdaNode.

Variant part in a discriminated type record declaration (RM 3.8.1).

This corresponds to the whole case ... is ... end case; block.

This node type has no derivation.

property f_discr_name: Identifier

When there are no parsing errors, this field is never null.

property f_variant: VariantList

When there are no parsing errors, this field is never null.

class libadalang.WhileLoopSpec(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of LoopSpec.

Specification for a while loop (RM 5.5).

This node type has no derivation.

property f_expr: Expr

This field can contain one of the following nodes: Allocator, AttributeRef, BaseAggregate, BinOp, CallExpr, CharLiteral, ConcatOp, CondExpr, DeclExpr, DottedName, ExplicitDeref, FormatStringLiteral, Identifier, MembershipExpr, NullLiteral, NumLiteral, ParenExpr, QualExpr, QuantifiedExpr, RaiseExpr, ReduceAttributeRef, StringLiteral, TargetName, UnOp, UpdateAttributeRef

When there are no parsing errors, this field is never null.

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

Subclass of BaseLoopStmt.

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

This node type has no derivation.

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

Subclass of AdaNode.

With clause (RM 10.1.2).

This node type has no derivation.

property f_has_limited: LimitedNode

When there are no parsing errors, this field is never null.

property f_has_private: PrivateNode

When there are no parsing errors, this field is never null.

property f_packages: NameList

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

When there are no parsing errors, this field is never null.

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

Subclass of AdaNode.

Qualifier for the private keyword in with private record clauses.

Derived nodes: WithPrivateAbsent, WithPrivatePresent

property p_as_bool: bool

Return whether this node is present

class libadalang.WithPrivateAbsent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of WithPrivate.

This node type has no derivation.

class libadalang.WithPrivatePresent(c_value: Any, node_c_value: Any, rebindings: Any)[source]

Subclass of WithPrivate.

This node type has no derivation.

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.