- let mcode (_,_,info,mcodekind,_) =
+ let mcode (_,_,info,mcodekind,_,_) =
mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode
donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing donothing donothing
donothing donothing in
mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode
donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing donothing donothing
donothing donothing in
let option_default = (*Bind(Neutral,[],[],[],[],[])*)
Recursor(Neutral,[],[],[])
let option_default = (*Bind(Neutral,[],[],[],[],[])*)
Recursor(Neutral,[],[],[])
-let mcode (_,_,info,mcodekind,pos) =
+let mcode (_,_,info,mcodekind,pos,_) =
let offset = info.Ast0.pos_info.Ast0.offset in
match mcodekind with
Ast0.MINUS(_) -> Token(AllMarked,offset,mcodekind,[])
let offset = info.Ast0.pos_info.Ast0.offset in
match mcodekind with
Ast0.MINUS(_) -> Token(AllMarked,offset,mcodekind,[])
| Ast0.CONTEXT(_) -> Token(NotAllMarked,offset,mcodekind,[offset])
| _ -> failwith "not possible"
| Ast0.CONTEXT(_) -> Token(NotAllMarked,offset,mcodekind,[offset])
| _ -> failwith "not possible"
-let neutral_mcode (_,_,info,mcodekind,pos) =
+let neutral_mcode (_,_,info,mcodekind,pos,_) =
let offset = info.Ast0.pos_info.Ast0.offset in
match mcodekind with
Ast0.MINUS(_) -> Token(Neutral,offset,mcodekind,[])
let offset = info.Ast0.pos_info.Ast0.offset in
match mcodekind with
Ast0.MINUS(_) -> Token(Neutral,offset,mcodekind,[])
-let nc_mcode (_,_,info,mcodekind,pos) =
- let offset = info.Ast0.pos_info.Ast0.offset in
+let nc_mcode (_,_,info,mcodekind,pos,_) =
+ (* distinguish from the offset of some real token *)
+ let offset = (-1) * info.Ast0.pos_info.Ast0.offset in
match mcodekind with
Ast0.MINUS(_) -> Token(AllMarked,offset,mcodekind,[])
| Ast0.PLUS -> Token(AllMarked,offset,mcodekind,[])
match mcodekind with
Ast0.MINUS(_) -> Token(AllMarked,offset,mcodekind,[])
| Ast0.PLUS -> Token(AllMarked,offset,mcodekind,[])
- | Ast0.CONTEXT(_) -> Token(Neutral,offset,mcodekind,[offset])
+ | Ast0.CONTEXT(_) ->
+ (* Unlike the other mcode cases, we drop the offset from the context
+ offsets. This is because we don't know whether the term this is
+ associated with is - or context. In any case, the context offsets are
+ used for identification, and this invisible node should not be needed
+ for this purpose. *)
+ Token(Neutral,offset,mcodekind,[])
| Ast0.Estars(dots,whencode) ->
k (Ast0.rewrap e (Ast0.Estars(dots,None)))
| Ast0.DisjExpr(starter,expr_list,_,ender) ->
| Ast0.Estars(dots,whencode) ->
k (Ast0.rewrap e (Ast0.Estars(dots,None)))
| Ast0.DisjExpr(starter,expr_list,_,ender) ->
compute_result Ast0.decl e
(match Ast0.unwrap e with
Ast0.DisjDecl(starter,decls,_,ender) ->
compute_result Ast0.decl e
(match Ast0.unwrap e with
Ast0.DisjDecl(starter,decls,_,ender) ->
| Ast0.Ddots(dots,whencode) ->
k (Ast0.rewrap e (Ast0.Ddots(dots,None)))
(* Need special cases for the following so that the type will be
| Ast0.Ddots(dots,whencode) ->
k (Ast0.rewrap e (Ast0.Ddots(dots,None)))
(* Need special cases for the following so that the type will be
reordering their components. *)
| Ast0.Init(stg,ty,id,eq,ini,sem) ->
bind (match stg with Some stg -> mcode stg | _ -> option_default)
reordering their components. *)
| Ast0.Init(stg,ty,id,eq,ini,sem) ->
bind (match stg with Some stg -> mcode stg | _ -> option_default)
| Ast0.UnInit(stg,ty,id,sem) ->
bind (match stg with Some stg -> mcode stg | _ -> option_default)
| Ast0.UnInit(stg,ty,id,sem) ->
bind (match stg with Some stg -> mcode stg | _ -> option_default)
(match Ast0.unwrap e with
Ast0.Param(ty,Some id) ->
(* needed for the same reason as in the Init and UnInit cases *)
(match Ast0.unwrap e with
Ast0.Param(ty,Some id) ->
(* needed for the same reason as in the Init and UnInit cases *)
| _ -> k e) in
let typeC r k e =
compute_result Ast0.typeC e
(match Ast0.unwrap e with
Ast0.DisjType(starter,types,_,ender) ->
| _ -> k e) in
let typeC r k e =
compute_result Ast0.typeC e
(match Ast0.unwrap e with
Ast0.DisjType(starter,types,_,ender) ->
+ let case_line r k e =
+ compute_result Ast0.case_line e
+ (match Ast0.unwrap e with
+ Ast0.DisjCase(starter,case_list,_,ender) ->
+ disj_cases e starter case_list r.VT0.combiner_rec_case_line ender
+ | _ -> k e) in
+
| Ast0.Stars(dots,whencode) ->
k (Ast0.rewrap s (Ast0.Stars(dots,[])))
| Ast0.Disj(starter,statement_dots_list,_,ender) ->
| Ast0.Stars(dots,whencode) ->
k (Ast0.rewrap s (Ast0.Stars(dots,[])))
| Ast0.Disj(starter,statement_dots_list,_,ender) ->
ender
(* cases for everything with extra mcode *)
| Ast0.FunDecl((info,bef),_,_,_,_,_,_,_,_)
| Ast0.Decl((info,bef),_) ->
ender
(* cases for everything with extra mcode *)
| Ast0.FunDecl((info,bef),_,_,_,_,_,_,_,_)
| Ast0.Decl((info,bef),_) ->
- bind (nc_mcode ((),(),info,bef,())) (k s)
+ bind (nc_mcode ((),(),info,bef,(),-1)) (k s)
| Ast0.IfThen(_,_,_,_,_,(info,aft))
| Ast0.IfThenElse(_,_,_,_,_,_,_,(info,aft))
| Ast0.Iterator(_,_,_,_,_,(info,aft))
| Ast0.While(_,_,_,_,_,(info,aft))
| Ast0.For(_,_,_,_,_,_,_,_,_,(info,aft)) ->
| Ast0.IfThen(_,_,_,_,_,(info,aft))
| Ast0.IfThenElse(_,_,_,_,_,_,_,(info,aft))
| Ast0.Iterator(_,_,_,_,_,(info,aft))
| Ast0.While(_,_,_,_,_,(info,aft))
| Ast0.For(_,_,_,_,_,_,_,_,_,(info,aft)) ->
- bind (k s) (nc_mcode ((),(),info,aft,()))
+ bind (k s) (nc_mcode ((),(),info,aft,(),-1))
mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode
(do_nothing Ast0.dotsExpr) (do_nothing Ast0.dotsInit)
(do_nothing Ast0.dotsParam) (do_nothing Ast0.dotsStmt)
(do_nothing Ast0.dotsDecl) (do_nothing Ast0.dotsCase)
(do_nothing Ast0.ident) expression typeC initialiser param declaration
mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode
(do_nothing Ast0.dotsExpr) (do_nothing Ast0.dotsInit)
(do_nothing Ast0.dotsParam) (do_nothing Ast0.dotsStmt)
(do_nothing Ast0.dotsDecl) (do_nothing Ast0.dotsCase)
(do_nothing Ast0.ident) expression typeC initialiser param declaration
-let equal_mcode (_,_,info1,_,_) (_,_,info2,_,_) =
+let equal_mcode (_,_,info1,_,_,_) (_,_,info2,_,_,_) =
equal_mcode rp1 rp2
| (Ast0.Iterator(nm1,lp1,_,rp1,_,_),Ast0.Iterator(nm2,lp2,_,rp2,_,_)) ->
equal_mcode lp1 lp2 && equal_mcode rp1 rp2
equal_mcode rp1 rp2
| (Ast0.Iterator(nm1,lp1,_,rp1,_,_),Ast0.Iterator(nm2,lp2,_,rp2,_,_)) ->
equal_mcode lp1 lp2 && equal_mcode rp1 rp2
- | (Ast0.Switch(switch1,lp1,_,rp1,lb1,case1,rb1),
- Ast0.Switch(switch2,lp2,_,rp2,lb2,case2,rb2)) ->
+ | (Ast0.Switch(switch1,lp1,_,rp1,lb1,_,_,rb1),
+ Ast0.Switch(switch2,lp2,_,rp2,lb2,_,_,rb2)) ->
equal_mcode def1 def2 && equal_mcode colon1 colon2
| (Ast0.Case(case1,_,colon1,_),Ast0.Case(case2,_,colon2,_)) ->
equal_mcode case1 case2 && equal_mcode colon1 colon2
equal_mcode def1 def2 && equal_mcode colon1 colon2
| (Ast0.Case(case1,_,colon1,_),Ast0.Case(case2,_,colon2,_)) ->
equal_mcode case1 case2 && equal_mcode colon1 colon2
+ | (Ast0.DisjCase(starter1,_,mids1,ender1),
+ Ast0.DisjCase(starter2,_,mids2,ender2)) ->
+ equal_mcode starter1 starter2 &&
+ List.for_all2 equal_mcode mids1 mids2 &&
+ equal_mcode ender1 ender2
mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode
do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing
do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing
mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode
do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing
do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing
| Ast0.Edots(_,Some whencode)
| Ast0.Ecircles(_,Some whencode)
| Ast0.Estars(_,Some whencode) ->
| Ast0.Edots(_,Some whencode)
| Ast0.Ecircles(_,Some whencode)
| Ast0.Estars(_,Some whencode) ->
- mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode
- do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing
- do_nothing
- expression
- do_nothing initialiser do_nothing do_nothing statement do_nothing
- do_nothing in
- combiner.V0.combiner_top_level
+ {V0.combiner_functions with
+ VT0.combiner_exprfn = expression;
+ VT0.combiner_initfn = initialiser;
+ VT0.combiner_stmtfn = statement} in
+ combiner.VT0.combiner_rec_top_level