package mopsa
Install
    
    dune-project
 Dependency
Authors
Maintainers
Sources
md5=9f673f79708b44a7effb3b6bb3618d2c
    
    
  sha512=cb91cb428e43a22f1abbcb8219710d0c10a5b3756d0da392d4084b3b3a6157350776c596983e63def344f617d39964e91f244f60c07958695ee5c8c809a9f0f4
    
    
  doc/python_lang/Python_lang/Lang/Ast/index.html
Module Lang.AstSource
Python AST
Constants
Types
type py_type = - | Bool
- | NotImplemented
- | Complex
- | NoneType
- | Bytes
- | Str
- | Int
- | Float of Universal.Ast.float_prec
Expressions
Python objects
optional value representation
type py_lambda = {- py_lambda_body : Mopsa.expr;(*- Body. *)
- py_lambda_parameters : Mopsa.var list;(*- list of parameters variables *)
- py_lambda_defaults : Mopsa.expr option list;(*- list of default parameters values *)
}Lambda functions.
type Mopsa.expr_kind += - | E_py_undefined of bool
- | E_py_object of py_object
- | E_py_list of Mopsa.expr list
- | E_py_index_subscript of Mopsa.expr * Mopsa.expr(*- index *)
- | E_py_slice_subscript of Mopsa.expr * Mopsa.expr * Mopsa.expr * Mopsa.expr(*- step *)
- | E_py_attribute of Mopsa.expr * string(*- attribute name *)
- | E_py_dict of Mopsa.expr list * Mopsa.expr list(*- values *)
- | E_py_set of Mopsa.expr list
- | E_py_generator_comprehension of Mopsa.expr * (Mopsa.expr * Mopsa.expr * Mopsa.expr list) list(*- list of comprehensions *)
- | E_py_list_comprehension of Mopsa.expr * (Mopsa.expr * Mopsa.expr * Mopsa.expr list) list(*- list of comprehensions *)
- | E_py_set_comprehension of Mopsa.expr * (Mopsa.expr * Mopsa.expr * Mopsa.expr list) list(*- list of comprehensions *)
- | E_py_dict_comprehension of Mopsa.expr * Mopsa.expr * (Mopsa.expr * Mopsa.expr * Mopsa.expr list) list(*- list of comprehensions *)
- | E_py_call of Mopsa.expr * Mopsa.expr list * (string option * Mopsa.expr) list(*- keywords (None id for **kwargs) *)
- | E_py_yield of Mopsa.expr
- | E_py_yield_from of Mopsa.expr
- | E_py_if of Mopsa.expr * Mopsa.expr * Mopsa.expr(*- orelse *)
- | E_py_tuple of Mopsa.expr list
- | E_py_bytes of string
- | E_py_lambda of py_lambda
- | E_py_multi_compare of Mopsa.expr * Mopsa.operator list * Mopsa.expr list
- | E_py_annot of Mopsa.expr
- | E_py_check_annot of Mopsa.expr * Mopsa.expr(*- low-level hasattribute working at the object level only *)
- | E_py_ll_hasattr of Mopsa.expr * Mopsa.expr(*- attribute name *)
- | E_py_ll_getattr of Mopsa.expr * Mopsa.expr(*- attribute name *)
- | E_py_ll_setattr of Mopsa.expr * Mopsa.expr * Mopsa.expr option
Statements
type py_fundec = {- py_func_var : Mopsa.var;(*- function object variable *)
- py_func_parameters : Mopsa.var list;(*- list of parameters variables *)
- py_func_defaults : Mopsa.expr option list;(*- list of default parameters values *)
- py_func_vararg : Mopsa.var option;
- py_func_kwonly_args : Mopsa.var list;
- py_func_kwonly_defaults : Mopsa.expr option list;
- py_func_kwarg : Mopsa.var option;
- py_func_locals : Mopsa.var list;(*- list of local variables *)
- py_func_body : Mopsa.stmt;(*- function body *)
- py_func_is_generator : bool;(*- is the function a generator? *)
- py_func_decors : Mopsa.expr list;
- py_func_types_in : Mopsa.expr option list;
- py_func_type_out : Mopsa.expr option;
- py_func_range : Mopsa.range;(*- range of the function *)
- py_func_ret_var : Mopsa.var;
- py_func_cellvars : Mopsa.var list;
- py_func_freevars : Mopsa.var list;
}Python function descriptor
type py_func_sig = {- py_funcs_parameters : Mopsa.var list;
- py_funcs_defaults : bool list;
- py_funcs_exceptions : Mopsa.expr list;
- py_funcs_types_in : Mopsa.expr option list;
- py_funcs_type_out : Mopsa.expr option;
}type py_func_annot = {- py_funca_var : Mopsa.var;
- py_funca_decors : Mopsa.expr list;
- py_funca_range : Mopsa.range;
- py_funca_ret_var : Mopsa.var;
- py_funca_sig : py_func_sig list;
}type py_clsdec = {- py_cls_var : Mopsa.var;(*- class object variable *)
- py_cls_body : Mopsa.stmt;
- py_cls_static_attributes : Mopsa.var list;(*- list of declared attributes: static variables and methods *)
- py_cls_bases : Mopsa.expr list;(*- base classes *)
- py_cls_decors : Mopsa.expr list;
- py_cls_keywords : (string option * Mopsa.expr) list;(*- keywords (None id for **kwargs) *)
- py_cls_range : Mopsa.range;(*- range of the class *)
}A Python class
type py_cls_annot = {- py_cls_a_var : Mopsa.var;
- py_cls_a_body : Mopsa.stmt;
- py_cls_a_bases : Mopsa.expr list;
- py_cls_a_abases : Mopsa.expr list;
- py_cls_a_static_attributes : Mopsa.var list;
- py_cls_a_range : Mopsa.range;
}type py_excpt = {- py_excpt_type : Mopsa.expr option;(*- exception class. None is used for the default except *)
- py_excpt_name : Mopsa.var option;(*- optional name of exception instance *)
- py_excpt_body : Mopsa.stmt;(*- body of the except handler *)
}Exception handler
type Mopsa.stmt_kind += - | S_py_class of py_clsdec
- | S_py_function of py_fundec
- | S_py_try of Mopsa.stmt * py_excpt list * Mopsa.stmt * Mopsa.stmt(*- final body *)
- | S_py_raise of Mopsa.expr option
- | S_py_if of Mopsa.expr * Mopsa.stmt * Mopsa.stmt
- | S_py_while of Mopsa.expr * Mopsa.stmt * Mopsa.stmt
- | S_py_multi_assign of Mopsa.expr list * Mopsa.expr
- | S_py_aug_assign of Mopsa.expr * Mopsa.operator * Mopsa.expr
- | S_py_annot of Mopsa.expr * Mopsa.expr
- | S_py_check_annot of Mopsa.expr * Mopsa.expr
- | S_py_for of Mopsa.expr * Mopsa.expr * Mopsa.stmt * Mopsa.stmt(*- else *)
- | S_py_import of string * Mopsa.var option * Mopsa.var(*- root module *)
- | S_py_import_from of string * string * Mopsa.var * Mopsa.var(*- module var *)
- | S_py_delete of Mopsa.expr
- | S_py_assert of Mopsa.expr * Mopsa.expr option(*- message *)
- | S_py_with of Mopsa.expr * Mopsa.expr option * Mopsa.stmt(*- body *)
Statements
Programs
module K : sig ... endFlow-insensitive context to keep the analyzed C program
val set_py_program : 
  (string * Mopsa.var list * Mopsa.stmt) ->
  'a Mopsa.Flow.flow ->
  'a Mopsa.Flow.flowSet the Python program in the flow
Get the Python program from the flow
Utility functions
val mk_py_in : 
  ?strict:bool ->
  ?left_strict:bool ->
  ?right_strict:bool ->
  Mopsa.expr ->
  Mopsa.expr ->
  Mopsa.expr ->
  Mopsa_utils.Location.range ->
  Mopsa.exprval mk_try : 
  Mopsa.stmt ->
  py_excpt list ->
  Mopsa.stmt ->
  Mopsa.stmt ->
  Mopsa_utils.Location.range ->
  Mopsa.stmtval mk_py_kall : 
  Mopsa.expr ->
  Mopsa.expr list ->
  (string option * Mopsa.expr) list ->
  Mopsa_utils.Location.range ->
  Mopsa.exprval mk_py_attr : 
  Mopsa.expr ->
  string ->
  ?etyp:Mopsa.typ ->
  Mopsa_utils.Location.range ->
  Mopsa.exprval mk_py_index_subscript : 
  Mopsa.expr ->
  Mopsa.expr ->
  ?etyp:Mopsa.typ ->
  Mopsa_utils.Location.range ->
  Mopsa.exprval mk_py_object : 
  (Mopsa.addr * Mopsa.expr option) ->
  Mopsa_utils.Location.range ->
  Mopsa.exprval mk_py_object_attr : 
  (Mopsa.addr * Mopsa.expr option) ->
  string ->
  ?etyp:Mopsa.typ ->
  Mopsa_utils.Location.range ->
  Mopsa.exprDecorators
val py_or : 
  Mopsa.expr ->
  Mopsa.expr ->
  ?etyp:Mopsa.typ ->
  Mopsa_utils.Location.range ->
  Mopsa.exprval py_and : 
  Mopsa.expr ->
  Mopsa.expr ->
  ?etyp:Mopsa.typ ->
  Mopsa_utils.Location.range ->
  Mopsa.exprval mk_py_ll_setattr : 
  Mopsa.expr ->
  Mopsa.expr ->
  Mopsa.expr ->
  Mopsa_utils.Location.range ->
  Mopsa.expr