Module Ast_go

type tok = Parse_info.t
type 'a wrap = 'a * tok
type 'a bracket = tok * 'a * tok
type ident = string wrap
type qualified_ident = ident list
type type_ =
| TName of qualified_ident
| TPtr of tok * type_
| TArray of expr * type_
| TSlice of type_
| TArrayEllipsis of tok * type_
| TFunc of func_type
| TMap of tok * type_ * type_
| TChan of tok * chan_dir * type_
| TStruct of tok * struct_field list bracket
| TInterface of tok * interface_field list bracket
and chan_dir =
| TSend
| TRecv
| TBidirectional
and func_type = {
fparams : parameter_binding list;
fresults : parameter_binding list;
}
and parameter_binding =
| ParamClassic of parameter
| ParamEllipsis of tok
and parameter = {
pname : ident option;
ptype : type_;
pdots : tok option;
}
and struct_field = struct_field_kind * tag option
and struct_field_kind =
| Field of ident * type_
| EmbeddedField of tok option * qualified_ident
and tag = string wrap
and interface_field =
| Method of ident * func_type
| EmbeddedInterface of qualified_ident
and expr_or_type = (exprtype_) Common.either
and expr =
| BasicLit of literal
| CompositeLit of type_ * init list bracket
| Id of ident * Ast_generic.resolved_name option Stdlib.ref
| Selector of expr * tok * ident
| Index of expr * index
| Slice of expr * expr option * expr option * expr option
| Call of call_expr
| Cast of type_ * expr
| Deref of tok * expr
| Ref of tok * expr
| Receive of tok * expr
| Unary of Ast_generic.arithmetic_operator wrap * expr
| Binary of expr * Ast_generic.arithmetic_operator wrap * expr
| TypeAssert of expr * type_
| TypeSwitchExpr of expr * tok
| Ellipsis of tok
| FuncLit of function_
| ParenType of type_
| Send of expr * tok * expr
and literal =
| Int of string wrap
| Float of string wrap
| Imag of string wrap
| Rune of string wrap
| String of string wrap
and index = expr
and arguments = argument list
and argument =
| Arg of expr
| ArgType of type_
| ArgDots of expr * tok
and init =
| InitExpr of expr
| InitKeyValue of init * tok * init
| InitBraces of init list bracket
and constant_expr = expr
and stmt =
| DeclStmts of decl list
| Block of stmt list
| Empty
| SimpleStmt of simple
| If of tok * simple option * expr * stmt * stmt option
| Switch of tok * simple option * simple option * case_clause list
| Select of tok * comm_clause list
| For of tok * simple option * expr option * simple option * stmt
| Range of tok * (expr list * tok) option * tok * expr * stmt
| Return of tok * expr list option
| Break of tok * ident option
| Continue of tok * ident option
| Goto of tok * ident
| Fallthrough of tok
| Label of ident * stmt
| Go of tok * call_expr
| Defer of tok * call_expr
and case_clause = case_kind * stmt
and case_kind =
| CaseExprs of tok * expr_or_type list
| CaseAssign of tok * expr_or_type list * tok * expr
| CaseDefault of tok
and comm_clause = case_clause
and call_expr = expr * arguments
and simple =
| ExprStmt of expr
| Assign of expr list * tok * expr list
| AssignOp of expr * Ast_generic.arithmetic_operator wrap * expr
| IncDec of expr * Ast_generic.incr_decr wrap * Ast_generic.prefix_postfix
| DShortVars of expr list * tok * expr list
and decl =
| DConst of ident * type_ option * constant_expr option
| DVar of ident * type_ option * expr option
| DTypeAlias of ident * tok * type_
| DTypeDef of ident * type_
and function_ = func_type * stmt
type top_decl =
| DFunc of ident * function_
| DMethod of ident * parameter * function_
| D of decl
type import = {
i_tok : tok;
i_path : string wrap;
i_kind : import_kind;
}
and import_kind =
| ImportOrig
| ImportNamed of ident
| ImportDot of tok
type program = {
package : tok * ident;
imports : import list;
decls : top_decl list;
}
type item =
| ITop of top_decl
| IImport of import
| IStmt of stmt
type any =
| E of expr
| S of stmt
| T of type_
| Decl of decl
| I of import
| P of program
| Ident of ident
| Ss of stmt list
| Item of item
| Items of item list
val stmt1 : stmt list -> stmt
val item1 : item list -> any
val str_of_id : ('a * 'b) -> 'a