2002-03-27 08:20:32 -08:00
|
|
|
(***********************************************************************)
|
|
|
|
(* OCamldoc *)
|
|
|
|
(* *)
|
|
|
|
(* Maxence Guesdon, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
|
|
|
(* Copyright 2001 Institut National de Recherche en Informatique et *)
|
|
|
|
(* en Automatique. All rights reserved. This file is distributed *)
|
|
|
|
(* under the terms of the Q Public License version 1.0. *)
|
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
2003-11-24 02:44:07 -08:00
|
|
|
(* $Id$ *)
|
2002-03-27 08:20:32 -08:00
|
|
|
|
|
|
|
(** The module for analysing the typed abstract syntax tree and source code and creating modules, classes, ..., elements.*)
|
|
|
|
|
|
|
|
type typedtree = Typedtree.structure * Typedtree.module_coercion
|
|
|
|
|
|
|
|
(** This module is used to search for structure items by name in a [Typedtree.structure]. *)
|
|
|
|
module Typedtree_search :
|
|
|
|
sig
|
2002-04-19 09:28:08 -07:00
|
|
|
type ele
|
|
|
|
|
|
|
|
type tab = (ele, Typedtree.structure_item) Hashtbl.t
|
|
|
|
type tab_values = (Odoc_name.t, Typedtree.pattern * Typedtree.expression) Hashtbl.t
|
|
|
|
|
|
|
|
(** Create hash tables used to search by some of the functions below. *)
|
|
|
|
val tables : Typedtree.structure_item list -> tab * tab_values
|
|
|
|
|
2002-03-27 08:20:32 -08:00
|
|
|
(** This function returns the [Typedtree.module_expr] associated to the given module name,
|
2002-07-23 07:12:03 -07:00
|
|
|
in the given table.
|
|
|
|
@raise Not_found if the module was not found.*)
|
2002-04-19 09:28:08 -07:00
|
|
|
val search_module : tab -> string -> Typedtree.module_expr
|
2002-03-27 08:20:32 -08:00
|
|
|
|
|
|
|
(** This function returns the [Types.module_type] associated to the given module type name,
|
2002-07-23 07:12:03 -07:00
|
|
|
in the given table.
|
|
|
|
@raise Not_found if the module type was not found.*)
|
2002-04-19 09:28:08 -07:00
|
|
|
val search_module_type : tab -> string -> Types.module_type
|
2002-03-27 08:20:32 -08:00
|
|
|
|
|
|
|
(** This function returns the [Types.exception_declaration] associated to the given exception name,
|
2002-07-23 07:12:03 -07:00
|
|
|
in the given table.
|
|
|
|
@raise Not_found if the exception was not found.*)
|
2002-04-19 09:28:08 -07:00
|
|
|
val search_exception : tab -> string -> Types.exception_declaration
|
2002-03-27 08:20:32 -08:00
|
|
|
|
|
|
|
(** This function returns the [Path.t] associated to the given exception rebind name,
|
2002-07-23 07:12:03 -07:00
|
|
|
in the table.
|
|
|
|
@raise Not_found if the exception rebind was not found.*)
|
2002-04-19 09:28:08 -07:00
|
|
|
val search_exception_rebind : tab -> string -> Path.t
|
2002-03-27 08:20:32 -08:00
|
|
|
|
|
|
|
(** This function returns the [Typedtree.type_declaration] associated to the given type name,
|
2002-07-23 07:12:03 -07:00
|
|
|
in the given table.
|
|
|
|
@raise Not_found if the type was not found. *)
|
2002-04-19 09:28:08 -07:00
|
|
|
val search_type_declaration : tab -> string -> Types.type_declaration
|
2002-03-27 08:20:32 -08:00
|
|
|
|
|
|
|
(** This function returns the [Typedtree.class_expr] and type parameters
|
2002-07-23 07:12:03 -07:00
|
|
|
associated to the given class name, in the given table.
|
|
|
|
@raise Not_found if the class was not found. *)
|
2002-04-19 09:28:08 -07:00
|
|
|
val search_class_exp : tab -> string -> (Typedtree.class_expr * (Types.type_expr list))
|
2002-03-27 08:20:32 -08:00
|
|
|
|
|
|
|
(** This function returns the [Types.cltype_declaration] associated to the given class type name,
|
2002-07-23 07:12:03 -07:00
|
|
|
in the given table.
|
|
|
|
@raise Not_found if the class type was not found. *)
|
2002-04-19 09:28:08 -07:00
|
|
|
val search_class_type_declaration : tab -> string -> Types.cltype_declaration
|
2002-03-27 08:20:32 -08:00
|
|
|
|
|
|
|
(** This function returns the couple (pat, exp) for the given value name, in the
|
2002-07-23 07:12:03 -07:00
|
|
|
given table of values.
|
|
|
|
@raise Not found if no value matches the name.*)
|
2002-04-19 09:28:08 -07:00
|
|
|
val search_value : tab_values -> string -> Typedtree.pattern * Typedtree.expression
|
2002-03-27 08:20:32 -08:00
|
|
|
|
|
|
|
(** This function returns the [type_expr] for the given primitive name, in the
|
2002-07-23 07:12:03 -07:00
|
|
|
given table.
|
|
|
|
@raise Not found if no value matches the name.*)
|
2002-04-19 09:28:08 -07:00
|
|
|
val search_primitive : tab -> string -> Types.type_expr
|
2002-03-27 08:20:32 -08:00
|
|
|
|
|
|
|
(** This function returns the [Typedtree.class_expr] associated to
|
2002-07-23 07:12:03 -07:00
|
|
|
the n'th inherit in the given class structure of typed tree.
|
|
|
|
@raise Not_found if the class expression could not be found.*)
|
2002-03-27 08:20:32 -08:00
|
|
|
val get_nth_inherit_class_expr :
|
2002-07-23 07:12:03 -07:00
|
|
|
Typedtree.class_structure -> int -> Typedtree.class_expr
|
2002-03-27 08:20:32 -08:00
|
|
|
|
|
|
|
(** This function returns the [Types.type_expr] of the attribute
|
2002-07-23 07:12:03 -07:00
|
|
|
whose name is given, in a given class structure.
|
|
|
|
@raise Not_found if the class attribute could not be found.*)
|
2002-03-27 08:20:32 -08:00
|
|
|
val search_attribute_type :
|
2002-07-23 07:12:03 -07:00
|
|
|
Typedtree.class_structure -> string -> Types.type_expr
|
2002-03-27 08:20:32 -08:00
|
|
|
|
|
|
|
(** This function returns the [Types.expression] of the method whose name is given, in a given class structure.
|
2002-07-23 07:12:03 -07:00
|
|
|
@raise Not_found if the class method could not be found.*)
|
2002-03-27 08:20:32 -08:00
|
|
|
val search_method_expression :
|
2002-07-23 07:12:03 -07:00
|
|
|
Typedtree.class_structure -> string -> Typedtree.expression
|
2002-03-27 08:20:32 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
(** The module which performs the analysis of a typed tree.
|
|
|
|
The module uses the module {!Odoc_sig.Analyser}.
|
|
|
|
@param My_ir The module used to retrieve comments and special comments.*)
|
|
|
|
module Analyser :
|
|
|
|
functor (My_ir : Odoc_sig.Info_retriever) ->
|
|
|
|
sig
|
|
|
|
(** This function takes a file name, a file containg the code and
|
2002-07-23 07:12:03 -07:00
|
|
|
the typed tree obtained from the compiler.
|
|
|
|
It goes through the tree, creating values for encountered
|
|
|
|
functions, modules, ..., and looking in the source file for comments.*)
|
2002-03-27 08:20:32 -08:00
|
|
|
val analyse_typed_tree :
|
|
|
|
string -> string -> Parsetree.structure -> typedtree -> Odoc_module.t_module
|
|
|
|
end
|