Navigation Menu

Skip to content

Commit

Permalink
snapshot some changes since we are targeting 4.02.2, we need fix the …
Browse files Browse the repository at this point in the history
…pretty printer backend some time, such changes are not good to be commited
  • Loading branch information
bobzhang committed Jun 20, 2015
1 parent 466f19d commit 55fa3ae
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 148 deletions.
272 changes: 139 additions & 133 deletions src/cold/astfn.ml
@@ -1,169 +1,175 @@
type loc = Locf.t
type ant = [ `Ant of (loc* Tokenf.ant)]
type ant = [ `Ant of (loc* Tokenf.ant) ]
type literal =
[ `Chr of string | `Int of string | `Int32 of string | `Int64 of string
| `Flo of string | `Nativeint of string | `Str of string | `Bool of bool
| `Unit]
type flag = [ `Positive | `Negative | ant]
type position_flag = [ `Positive | `Negative | `Normal | ant]
type strings = [ `App of (strings* strings) | `Str of string | ant]
type lident = [ `Lid of string]
type alident = [ `Lid of string | ant]
type auident = [ `Uid of string | ant]
[ `Chr of string | `Int of string | `Int32 of string | `Int64 of string
| `Flo of string | `Nativeint of string | `Str of string
| `Bool of bool | `Unit ]
type flag = [ `Positive | `Negative | ant]
type position_flag = [ `Positive | `Negative | `Normal | ant]
type strings = [ `App of (strings* strings) | `Str of string | ant]
type lident = [ `Lid of string ]
type alident = [ `Lid of string | ant]
type auident = [ `Uid of string | ant]
type aident = [ alident | auident]
type astring = [ `C of string | ant]
type astring = [ `C of string | ant]
type uident =
[ `Dot of (uident* uident) | `App of (uident* uident) | auident]
[ `Dot of (uident* uident) | `App of (uident* uident) | auident]
type ident =
[ `Dot of (ident* ident) | `Apply of (ident* ident) | alident | auident]
[ `Dot of (ident* ident) | `Apply of (ident* ident) | alident | auident]
type ident' =
[ `Dot of (ident* ident) | `Apply of (ident* ident) | `Lid of string
| `Uid of string]
type vid = [ `Dot of (vid* vid) | `Lid of string | `Uid of string | ant]
type vid' = [ `Dot of (vid* vid) | `Lid of string | `Uid of string]
type dupath = [ `Dot of (dupath* dupath) | auident]
type dlpath = [ `Dot of (dupath* alident) | alident]
type any = [ `Any]
[ `Dot of (ident* ident) | `Apply of (ident* ident) | `Lid of string
| `Uid of string ]
type vid = [ `Dot of (vid* vid) | `Lid of string | `Uid of string | ant]
type vid' = [ `Dot of (vid* vid) | `Lid of string | `Uid of string ]
type dupath = [ `Dot of (dupath* dupath) | auident]
type dlpath = [ `Dot of (dupath* alident) | alident]
type any = [ `Any ]
type ctyp =
[ `Alias of (ctyp* alident) | any | `App of (ctyp* ctyp)
| `Arrow of (ctyp* ctyp) | `ClassPath of ident | `Label of (alident* ctyp)
| `OptLabl of (alident* ctyp) | ident' | `TyObj of (name_ctyp* flag)
| `TyObjEnd of flag | `TyPol of (ctyp* ctyp) | `TyPolEnd of ctyp
| `TyTypePol of (ctyp* ctyp) | `Quote of (position_flag* alident)
| `QuoteAny of position_flag | `Par of ctyp | `Sta of (ctyp* ctyp)
| `PolyEq of row_field | `PolySup of row_field | `PolyInf of row_field
| `Com of (ctyp* ctyp) | `PolyInfSup of (row_field* tag_names)
| `Package of mtyp | ant]
[ `Alias of (ctyp* alident) | any | `App of (ctyp* ctyp)
| `Arrow of (ctyp* ctyp) | `ClassPath of ident
| `Label of (alident* ctyp) | `OptLabl of (alident* ctyp) | ident'
| `TyObj of (name_ctyp* flag) | `TyObjEnd of flag
| `TyPol of (ctyp* ctyp) | `TyPolEnd of ctyp
| `TyTypePol of (ctyp* ctyp) | `Quote of (position_flag* alident)
| `QuoteAny of position_flag | `Par of ctyp | `Sta of (ctyp* ctyp)
| `PolyEq of row_field | `PolySup of row_field | `PolyInf of row_field
| `Com of (ctyp* ctyp) | `PolyInfSup of (row_field* tag_names)
| `Package of mtyp | ant]
and type_parameters =
[ `Com of (type_parameters* type_parameters) | `Ctyp of ctyp | ant]
[ `Com of (type_parameters* type_parameters) | `Ctyp of ctyp | ant]
and row_field =
[ ant | `Bar of (row_field* row_field) | `TyVrn of astring
| `TyVrnOf of (astring* ctyp) | `Ctyp of ctyp]
and tag_names = [ ant | `App of (tag_names* tag_names) | `TyVrn of astring]
[ ant | `Bar of (row_field* row_field) | `TyVrn of astring
| `TyVrnOf of (astring* ctyp) | `Ctyp of ctyp ]
and tag_names = [ ant | `App of (tag_names* tag_names) | `TyVrn of astring ]
and typedecl =
[ `TyDcl of (alident* opt_decl_params* type_info* opt_type_constr)
| `TyAbstr of (alident* opt_decl_params* opt_type_constr)
| `And of (typedecl* typedecl) | ant]
[ `TyDcl of (alident* opt_decl_params* type_info* opt_type_constr)
| `TyAbstr of (alident* opt_decl_params* opt_type_constr)
| `And of (typedecl* typedecl) | ant]
and type_constr =
[ `And of (type_constr* type_constr) | `Eq of (ctyp* ctyp) | ant]
and opt_type_constr = [ `Some of type_constr | `None]
[ `And of (type_constr* type_constr) | `Eq of (ctyp* ctyp) | ant]
and opt_type_constr = [ `Some of type_constr | `None ]
and decl_param =
[ `Quote of (position_flag* alident) | `QuoteAny of position_flag |
`Any
[ `Quote of (position_flag* alident) | `QuoteAny of position_flag |
`Any
| ant]
and decl_params =
[ `Quote of (position_flag* alident) | `QuoteAny of position_flag |
`Any
| `Com of (decl_params* decl_params) | ant]
and opt_decl_params = [ `Some of decl_params | `None]
[ `Quote of (position_flag* alident) | `QuoteAny of position_flag |
`Any
| `Com of (decl_params* decl_params) | ant]
and opt_decl_params = [ `Some of decl_params | `None ]
and type_info =
[ `TyMan of (ctyp* flag* type_repr) | `TyRepr of (flag* type_repr)
| `TyEq of (flag* ctyp) | ant]
and type_repr = [ `Record of name_ctyp | `Sum of or_ctyp | ant]
[ `TyMan of (ctyp* flag* type_repr) | `TyRepr of (flag* type_repr)
| `TyEq of (flag* ctyp) | ant]
and type_repr = [ `Record of name_ctyp | `Sum of or_ctyp | ant]
and name_ctyp =
[ `Sem of (name_ctyp* name_ctyp) | `TyCol of (alident* ctyp)
| `TyColMut of (alident* ctyp) | ant]
[ `Sem of (name_ctyp* name_ctyp) | `TyCol of (alident* ctyp)
| `TyColMut of (alident* ctyp) | ant]
and or_ctyp =
[ `Bar of (or_ctyp* or_ctyp) | `TyCol of (auident* ctyp)
| `Of of (auident* ctyp) | auident]
and of_ctyp = [ `Of of (vid* ctyp) | vid' | ant]
[ `Bar of (or_ctyp* or_ctyp) | `TyCol of (auident* ctyp)
| `Of of (auident* ctyp) | auident]
and of_ctyp = [ `Of of (vid* ctyp) | vid' | ant]
and pat =
[ vid | `App of (pat* pat) | `Vrn of string | `Com of (pat* pat)
| `Sem of (pat* pat) | `Par of pat | any | `Record of rec_pat | literal
| `Alias of (pat* alident) | `ArrayEmpty | `Array of pat
| `LabelS of alident | `Label of (alident* pat)
| `OptLabl of (alident* pat) | `OptLablS of alident
| `OptLablExpr of (alident* pat* exp) | `Bar of (pat* pat)
| `PaRng of (pat* pat) | `Constraint of (pat* ctyp) | `ClassPath of ident
| `Lazy of pat | `ModuleUnpack of auident
| `ModuleConstraint of (auident* ctyp)]
[ vid | `App of (pat* pat) | `Vrn of string | `Com of (pat* pat)
| `Sem of (pat* pat) | `Par of pat | any | `Record of rec_pat |
literal
| `Alias of (pat* alident) | `ArrayEmpty | `Array of pat
| `LabelS of alident | `Label of (alident* pat)
| `OptLabl of (alident* pat) | `OptLablS of alident
| `OptLablExpr of (alident* pat* exp) | `Bar of (pat* pat)
| `PaRng of (pat* pat) | `Constraint of (pat* ctyp)
| `ClassPath of ident | `Lazy of pat | `ModuleUnpack of auident
| `ModuleConstraint of (auident* ctyp) ]
and rec_pat =
[ `RecBind of (vid* pat) | `Sem of (rec_pat* rec_pat) | any | ant]
[ `RecBind of (vid* pat) | `Sem of (rec_pat* rec_pat) | any | ant]
and exp =
[ vid | `App of (exp* exp) | `Vrn of string | `Com of (exp* exp)
| `Sem of (exp* exp) | `Par of exp | any | `Record of rec_exp | literal
| `RecordWith of (rec_exp* exp) | `Field of (exp* vid)
| `ArrayDot of (exp* exp) | `ArrayEmpty | `Array of exp | `Assert of exp
| `Assign of (exp* exp) | `For of (alident* exp* exp* flag* exp)
| `Fun of case | `IfThenElse of (exp* exp* exp) | `IfThen of (exp* exp)
| `LabelS of alident | `Label of (alident* exp) | `Lazy of exp
| `LetIn of (flag* bind* exp) | `LetTryInWith of (flag* bind* exp* case)
| `LetModule of (auident* mexp* exp) | `Match of (exp* case)
| `New of ident | `Obj of clfield | `ObjEnd | `ObjPat of (pat* clfield)
| `ObjPatEnd of pat | `OptLabl of (alident* exp) | `OptLablS of alident
| `OvrInst of rec_exp | `OvrInstEmpty | `Seq of exp
| `Send of (exp* alident) | `StringDot of (exp* exp) | `Try of (exp* case)
| `Constraint of (exp* ctyp) | `Coercion of (exp* ctyp* ctyp)
| `Subtype of (exp* ctyp) | `While of (exp* exp)
| `LetOpen of (flag* ident* exp) | `LocalTypeFun of (alident* exp)
| `Package_exp of mexp]
[ vid | `App of (exp* exp) | `Vrn of string | `Com of (exp* exp)
| `Sem of (exp* exp) | `Par of exp | any | `Record of rec_exp |
literal
| `RecordWith of (rec_exp* exp) | `Field of (exp* vid)
| `ArrayDot of (exp* exp) | `ArrayEmpty | `Array of exp
| `Assert of exp | `Assign of (exp* exp)
| `For of (alident* exp* exp* flag* exp) | `Fun of case
| `IfThenElse of (exp* exp* exp) | `IfThen of (exp* exp)
| `LabelS of alident | `Label of (alident* exp) | `Lazy of exp
| `LetIn of (flag* bind* exp) | `LetTryInWith of (flag* bind* exp* case)
| `LetModule of (auident* mexp* exp) | `Match of (exp* case)
| `New of ident | `Obj of clfield | `ObjEnd | `ObjPat of (pat* clfield)
| `ObjPatEnd of pat | `OptLabl of (alident* exp) | `OptLablS of alident
| `OvrInst of rec_exp | `OvrInstEmpty | `Seq of exp
| `Send of (exp* alident) | `StringDot of (exp* exp)
| `Try of (exp* case) | `Constraint of (exp* ctyp)
| `Coercion of (exp* ctyp* ctyp) | `Subtype of (exp* ctyp)
| `While of (exp* exp) | `LetOpen of (flag* ident* exp)
| `LocalTypeFun of (alident* exp) | `Package_exp of mexp ]
and rec_exp =
[ `Sem of (rec_exp* rec_exp) | `RecBind of (vid* exp) | any | ant]
[ `Sem of (rec_exp* rec_exp) | `RecBind of (vid* exp) | any | ant]
and mtyp =
[ ident' | `Sig of sigi | `SigEnd | `Functor of (auident* mtyp* mtyp)
| `With of (mtyp* constr) | `ModuleTypeOf of mexp | ant]
[ ident' | `Sig of sigi | `SigEnd | `Functor of (auident* mtyp* mtyp)
| `With of (mtyp* constr) | `ModuleTypeOf of mexp | ant]
and sigi =
[ `Val of (alident* ctyp) | `External of (alident* ctyp* strings)
| `Type of typedecl | `Exception of of_ctyp | `Class of cltdecl
| `ClassType of cltdecl | `Module of (auident* mtyp)
| `ModuleTypeEnd of auident | `ModuleType of (auident* mtyp)
| `Sem of (sigi* sigi) | `DirectiveSimple of alident
| `Directive of (alident* exp) | `Open of (flag* ident) | `Include of mtyp
| `RecModule of mbind | ant]
[ `Val of (alident* ctyp) | `External of (alident* ctyp* strings)
| `Type of typedecl | `Exception of of_ctyp | `Class of cltdecl
| `ClassType of cltdecl | `Module of (auident* mtyp)
| `ModuleTypeEnd of auident | `ModuleType of (auident* mtyp)
| `Sem of (sigi* sigi) | `DirectiveSimple of alident
| `Directive of (alident* exp) | `Open of (flag* ident)
| `Include of mtyp | `RecModule of mbind | ant]
and mbind =
[ `And of (mbind* mbind) | `ModuleBind of (auident* mtyp* mexp)
| `Constraint of (auident* mtyp) | ant]
[ `And of (mbind* mbind) | `ModuleBind of (auident* mtyp* mexp)
| `Constraint of (auident* mtyp) | ant]
and constr =
[ `TypeEq of (ctyp* ctyp) | `ModuleEq of (ident* ident)
| `TypeEqPriv of (ctyp* ctyp) | `TypeSubst of (ctyp* ctyp)
| `ModuleSubst of (ident* ident) | `And of (constr* constr) | ant]
and bind = [ `And of (bind* bind) | `Bind of (pat* exp) | ant]
[ `TypeEq of (ctyp* ctyp) | `ModuleEq of (ident* ident)
| `TypeEqPriv of (ctyp* ctyp) | `TypeSubst of (ctyp* ctyp)
| `ModuleSubst of (ident* ident) | `And of (constr* constr) | ant]
and bind = [ `And of (bind* bind) | `Bind of (pat* exp) | ant]
and case =
[ `Bar of (case* case) | `Case of (pat* exp) | `CaseWhen of (pat* exp* exp)
| ant]
[ `Bar of (case* case) | `Case of (pat* exp)
| `CaseWhen of (pat* exp* exp) | ant]
and mexp =
[ vid' | `App of (mexp* mexp) | `Functor of (auident* mtyp* mexp)
| `Struct of stru | `StructEnd | `Constraint of (mexp* mtyp)
| `PackageModule of exp | ant]
[ vid' | `App of (mexp* mexp) | `Functor of (auident* mtyp* mexp)
| `Struct of stru | `StructEnd | `Constraint of (mexp* mtyp)
| `PackageModule of exp | ant]
and stru =
[ `Class of cldecl | `ClassType of cltdecl | `Sem of (stru* stru)
| `DirectiveSimple of alident | `Directive of (alident* exp)
| `Exception of of_ctyp | `StExp of exp
| `External of (alident* ctyp* strings) | `Include of mexp
| `Module of (auident* mexp) | `RecModule of mbind
| `ModuleType of (auident* mtyp) | `Open of (flag* ident)
| `Type of typedecl | `TypeWith of (typedecl* strings)
| `Value of (flag* bind) | ant]
[ `Class of cldecl | `ClassType of cltdecl | `Sem of (stru* stru)
| `DirectiveSimple of alident | `Directive of (alident* exp)
| `Exception of of_ctyp | `StExp of exp
| `External of (alident* ctyp* strings) | `Include of mexp
| `Module of (auident* mexp) | `RecModule of mbind
| `ModuleType of (auident* mtyp) | `Open of (flag* ident)
| `Type of typedecl | `TypeWith of (typedecl* strings)
| `Value of (flag* bind) | ant]
and cltdecl =
[ `And of (cltdecl* cltdecl)
| `CtDecl of (flag* ident* type_parameters* cltyp)
| `CtDeclS of (flag* ident* cltyp) | ant]
[ `And of (cltdecl* cltdecl)
| `CtDecl of (flag* ident* type_parameters* cltyp)
| `CtDeclS of (flag* ident* cltyp) | ant]
and cltyp =
[ vid' | `ClApply of (vid* type_parameters) | `CtFun of (ctyp* cltyp)
| `ObjTy of (ctyp* clsigi) | `ObjTyEnd of ctyp | `Obj of clsigi | `ObjEnd
| `And of (cltyp* cltyp) | ant]
[ vid' | `ClApply of (vid* type_parameters) | `CtFun of (ctyp* cltyp)
| `ObjTy of (ctyp* clsigi) | `ObjTyEnd of ctyp | `Obj of clsigi
| `ObjEnd | `And of (cltyp* cltyp) | ant]
and clsigi =
[ `Sem of (clsigi* clsigi) | `SigInherit of cltyp
| `CgVal of (alident* flag* flag* ctyp) | `Method of (alident* flag* ctyp)
| `VirMeth of (alident* flag* ctyp) | `Eq of (ctyp* ctyp) | ant]
[ `Sem of (clsigi* clsigi) | `SigInherit of cltyp
| `CgVal of (alident* flag* flag* ctyp)
| `Method of (alident* flag* ctyp) | `VirMeth of (alident* flag* ctyp)
| `Eq of (ctyp* ctyp) | ant]
and cldecl =
[ `ClDecl of (flag* ident* type_parameters* clexp)
| `ClDeclS of (flag* ident* clexp) | `And of (cldecl* cldecl) | ant]
[ `ClDecl of (flag* ident* type_parameters* clexp)
| `ClDeclS of (flag* ident* clexp) | `And of (cldecl* cldecl) | ant]
and clexp =
[ `CeApp of (clexp* exp) | vid' | `ClApply of (vid* type_parameters)
| `CeFun of (pat* clexp) | `LetIn of (flag* bind* clexp) | `Obj of clfield
| `ObjEnd | `ObjPat of (pat* clfield) | `ObjPatEnd of pat
| `Constraint of (clexp* cltyp) | ant]
[ `CeApp of (clexp* exp) | vid' | `ClApply of (vid* type_parameters)
| `CeFun of (pat* clexp) | `LetIn of (flag* bind* clexp)
| `Obj of clfield | `ObjEnd | `ObjPat of (pat* clfield)
| `ObjPatEnd of pat | `Constraint of (clexp* cltyp) | ant]
and clfield =
[ `Sem of (clfield* clfield) | `Inherit of (flag* clexp)
| `InheritAs of (flag* clexp* alident)
| `CrVal of (alident* flag* flag* exp) | `VirVal of (alident* flag* ctyp)
| `CrMth of (alident* flag* flag* exp* ctyp)
| `CrMthS of (alident* flag* flag* exp) | `VirMeth of (alident* flag* ctyp)
| `Eq of (ctyp* ctyp) | `Initializer of exp | ant]
[ `Sem of (clfield* clfield) | `Inherit of (flag* clexp)
| `InheritAs of (flag* clexp* alident)
| `CrVal of (alident* flag* flag* exp) | `VirVal of (alident* flag* ctyp)
| `CrMth of (alident* flag* flag* exp* ctyp)
| `CrMthS of (alident* flag* flag* exp)
| `VirMeth of (alident* flag* ctyp) | `Eq of (ctyp* ctyp)
| `Initializer of exp | ant]
type ep =
[ vid | `App of (ep* ep) | `Vrn of string | `Com of (ep* ep)
| `Sem of (ep* ep) | `Par of ep | `Constraint of (ep* ctyp) | any
| `ArrayEmpty | `Array of ep | `Record of rec_bind | literal]
[ vid | `App of (ep* ep) | `Vrn of string | `Com of (ep* ep)
| `Sem of (ep* ep) | `Par of ep | `Constraint of (ep* ctyp) | any
| `ArrayEmpty | `Array of ep | `Record of rec_bind | literal]
and rec_bind =
[ `RecBind of (vid* ep) | `Sem of (rec_bind* rec_bind) | any | ant]
[ `RecBind of (vid* ep) | `Sem of (rec_bind* rec_bind) | any | ant]
12 changes: 6 additions & 6 deletions src/cold/ctyp.ml
Expand Up @@ -21,8 +21,8 @@ type ty_info =
id_ep: ep;
id_eps: ep list;
ty: ctyp;}
type vbranch = [ `variant of (string* ctyp list) | `abbrev of ident]
type branch = [ `branch of (string* ctyp list)]
type vbranch = [ `variant of (string* ctyp list) | `abbrev of ident ]
type branch = [ `branch of (string* ctyp list) ]
type destination =
| Obj of kind
| Str_item
Expand All @@ -49,11 +49,11 @@ type record_col = {
info: ty_info;}
type record_info = record_col list
type basic_id_transform =
[ `Pre of string | `Post of string | `Fun of string -> string]
type rhs_basic_id_transform = [ basic_id_transform | `Exp of string -> exp]
[ `Pre of string | `Post of string | `Fun of string -> string ]
type rhs_basic_id_transform = [ basic_id_transform | `Exp of string -> exp ]
type full_id_transform =
[ basic_id_transform | `Idents of vid list -> vid | `Id of vid -> vid
| `Last of string -> vid | `Obj of string -> string]
[ basic_id_transform | `Idents of vid list -> vid | `Id of vid -> vid
| `Last of string -> vid | `Obj of string -> string ]
let arrow_of_list = function | f -> Listf.reduce_right arrow f
let app_arrow =
function | lst -> (function | acc -> List.fold_right arrow lst acc)
Expand Down
5 changes: 3 additions & 2 deletions src/cold/gram_def.ml
Expand Up @@ -4,8 +4,9 @@ type name = {
tvar: string;
loc: loc;}
type styp =
[ vid' | `App of (loc* styp* styp)
| `Quote of (loc* position_flag* alident) | `Self of loc | `Type of ctyp]
[ vid' | `App of (loc* styp* styp)
| `Quote of (loc* position_flag* alident) | `Self of loc
| `Type of ctyp ]
type entry = {
name: name;
pos: exp option;
Expand Down
9 changes: 4 additions & 5 deletions src/cold/gram_pat.ml
Expand Up @@ -12,12 +12,11 @@ class mapbase =
method string = function | (x : string) -> x
method ant = function | (x : ant) -> x
end
type lident = [ `Lid of (loc* string)]
type lident = [ `Lid of (loc* string) ]
and t =
[ `Vrn of (loc* string) | `App of (loc* t* t) | `Lid of (loc* string) |
ant
| `Com of (loc* t* t) | `Alias of (loc* t* lident) | `Str of (loc* string)
| `Any of loc]
[ `Vrn of (loc* string) | `App of (loc* t* t) | `Lid of (loc* string)
| ant | `Com of (loc* t* t) | `Alias of (loc* t* lident)
| `Str of (loc* string) | `Any of loc ]
class map =
object (self : 'self_type)
inherit mapbase
Expand Down
2 changes: 1 addition & 1 deletion src/cold/parse_parse.ml
Expand Up @@ -30,7 +30,7 @@ let qualuid: vid Gramf.t = Gramf.mk "qualuid"
let qualid: vid Gramf.t = Gramf.mk "qualid"
let t_qualid: vid Gramf.t = Gramf.mk "t_qualid"
let entry_name:
([ `name of Tokenf.name option | `non]* Gram_def.name) Gramf.t =
([ `name of Tokenf.name option | `non ]* Gram_def.name) Gramf.t =
Gramf.mk "entry_name"
let position = Gramf.mk "position"
let assoc = Gramf.mk "assoc"
Expand Down
2 changes: 1 addition & 1 deletion src/cold/sigs_util.ml
Expand Up @@ -4,7 +4,7 @@ open StdFan
let pp_print_typedecl = ObjsN.pp_print_typedecl
type named_type = (string* typedecl)
and and_types = named_type list
and types = [ `Mutual of and_types | `Single of named_type]
and types = [ `Mutual of and_types | `Single of named_type ]
and mtyps = types list
let rec pp_print_named_type: Format.formatter -> named_type -> unit =
function
Expand Down

0 comments on commit 55fa3ae

Please sign in to comment.