(***********************************************************************)
(*                                                                     *)
(*                                 GALAX                               *)
(*                            XML Query Engine                         *)
(*                                                                     *)
(*  Copyright 2000, Lucent Technologies.                               *)
(*  Distributed only by permission.                                    *)
(*                                                                     *)
(***********************************************************************)

(* $Id: xquery_astutil.mli,v 1.5 2002/06/27 17:40:26 gsur Exp $ *)

open Xquery_ast

(**************************)
(* AST creation functions *)
(**************************)

(* New types AST creation *)

val mkdatatype : datatype_desc -> datatype
val fmkdatatype : datatype_desc -> Finfo.finfo -> datatype

val mkmodel : model_desc -> model
val mktyped_model : typed_model_desc -> typed_model
val mksort_decl : sort_decl_desc -> sort_decl

val fmkmodel : model_desc -> Finfo.finfo -> model
val fmktyped_model : typed_model_desc -> Finfo.finfo -> typed_model
val fmksort_decl : sort_decl_desc -> Finfo.finfo -> sort_decl

val mkanonymous_type : Xquery_ast.model -> Xquery_ast.typed_model

(* Common data structures AST creation *)

val mkpattern : pattern_desc -> pattern

val fmkpattern : pattern_desc -> Finfo.finfo -> pattern

(* XQuery AST creation *)

val mkexpr : expr_desc -> expr
val mkstep_qualifier : step_qualifier_desc -> step_qualifier
val mkfl_expr : fl_expr_desc -> fl_expr
val mkfunction_def : function_def_desc -> function_def
val mkvar_decl : var_decl_desc -> var_decl
val mkcontext_decl : context_decl_desc -> context_decl

val fmkexpr : expr_desc -> Finfo.finfo -> expr
val fmkstep_qualifier : step_qualifier_desc -> Finfo.finfo -> step_qualifier
val fmkfl_expr : fl_expr_desc -> Finfo.finfo -> fl_expr
val fmkfunction_def : function_def_desc -> Finfo.finfo -> function_def
val fmkvar_decl : var_decl_desc -> Finfo.finfo -> var_decl
val fmkcontext_decl : context_decl_desc -> Finfo.finfo -> context_decl

(* The empty query *)

val empty_query_module : query_module

(* Core AST creation *)

val mkcexpr : cexpr_desc -> cexpr
val mkcfunction_def : cfunction_def_desc -> cfunction_def
val mkcvar_decl : cvar_decl_desc -> cvar_decl

val fmkcexpr : cexpr_desc -> model_handle -> expr_handle -> Finfo.finfo -> cexpr
val fmkcfunction_def : cfunction_def_desc -> Finfo.finfo -> cfunction_def
val fmkcvar_decl : cvar_decl_desc -> Finfo.finfo -> cvar_decl

(**************************)
(* AST accessor functions *)
(**************************)

(* Processes NS attributes of an element *)

val get_ns_attributes : Xquery_ast.expr list -> ((Namespace.prefix * Namespace.uri) list * Xquery_ast.expr list)

