112
112
Ast.Dots(_,_,_,_) | Ast.Circles(_,_,_,_) | Ast.Stars(_,_,_,_) -> true
116
match Ast.unwrap e with
117
Ast.Idots(_,_) -> true
115
120
(* --------------------------------------------------------------------- *)
118
and unify_ident i1 i2 =
123
let rec unify_ident i1 i2 =
119
124
match (Ast.unwrap i1,Ast.unwrap i2) with
120
125
(Ast.Id(i1),Ast.Id(i2)) -> return (unify_mcode i1 i2)
126
131
| (_,Ast.MetaFunc(_,_,_,_))
127
132
| (_,Ast.MetaLocalFunc(_,_,_,_)) -> return true
134
| (Ast.DisjId(i1),_) ->
135
disjunct_all_bindings (List.map (function x -> unify_ident x i2) i1)
136
| (_,Ast.DisjId(i2)) ->
137
disjunct_all_bindings (List.map (function x -> unify_ident i1 x) i2)
129
139
| (Ast.OptIdent(_),_)
130
140
| (Ast.UniqueIdent(_),_)
131
141
| (_,Ast.OptIdent(_))
134
144
(* --------------------------------------------------------------------- *)
137
let rec unify_expression e1 e2 =
147
and unify_expression e1 e2 =
138
148
match (Ast.unwrap e1,Ast.unwrap e2) with
139
149
(Ast.Ident(i1),Ast.Ident(i2)) -> unify_ident i1 i2
140
150
| (Ast.Constant(c1),Ast.Constant(c2))-> return (unify_mcode c1 c2)
254
264
| (Ast.Array(ty1,lb1,e1,rb1),Ast.Array(ty2,lb2,e2,rb2)) ->
255
265
conjunct_bindings
256
266
(unify_fullType ty1 ty2) (unify_option unify_expression e1 e2)
257
| (Ast.EnumName(s1,ts1),Ast.EnumName(s2,ts2)) ->
267
| (Ast.EnumName(s1,Some ts1),Ast.EnumName(s2,Some ts2)) ->
258
268
if unify_mcode s1 s2 then unify_ident ts1 ts2 else return false
269
| (Ast.EnumName(s1,None),Ast.EnumName(s2,None)) ->
271
| (Ast.EnumDef(ty1,lb1,ids1,rb1),Ast.EnumDef(ty2,lb2,ids2,rb2)) ->
272
conjunct_bindings (unify_fullType ty1 ty2)
273
(unify_dots unify_expression edots ids1 ids2)
259
274
| (Ast.StructUnionName(s1,Some ts1),Ast.StructUnionName(s2,Some ts2)) ->
260
275
if unify_mcode s1 s2 then unify_ident ts1 ts2 else return false
261
276
| (Ast.StructUnionName(s1,None),Ast.StructUnionName(s2,None)) ->
277
return (unify_mcode s1 s2)
263
278
| (Ast.StructUnionDef(ty1,lb1,decls1,rb1),
264
279
Ast.StructUnionDef(ty2,lb2,decls2,rb2)) ->
265
280
conjunct_bindings (unify_fullType ty1 ty2)
278
293
and unify_declaration d1 d2 =
279
294
match (Ast.unwrap d1,Ast.unwrap d2) with
280
(Ast.Init(stg1,ft1,id1,eq1,i1,s1),Ast.Init(stg2,ft2,id2,eq2,i2,s2)) ->
295
(Ast.MetaDecl(_,_,_),_) | (_,Ast.MetaDecl(_,_,_)) -> return true
296
| (Ast.MetaField(_,_,_),_) | (_,Ast.MetaField(_,_,_)) -> return true
297
| (Ast.MetaFieldList(_,_,_,_),_) | (_,Ast.MetaFieldList(_,_,_,_)) ->
299
| (Ast.Init(stg1,ft1,id1,eq1,i1,s1),Ast.Init(stg2,ft2,id2,eq2,i2,s2)) ->
281
300
if bool_unify_option unify_mcode stg1 stg2
283
302
conjunct_bindings (unify_fullType ft1 ft2)
317
336
(Ast.MetaInit(_,_,_),_) | (_,Ast.MetaInit(_,_,_)) -> return true
318
337
| (Ast.InitExpr(expa),Ast.InitExpr(expb)) ->
319
338
unify_expression expa expb
320
| (Ast.InitList(_,_,initlista,_,whena),
321
Ast.InitList(_,_,initlistb,_,whenb)) ->
339
| (Ast.ArInitList(_,initlista,_),
340
Ast.ArInitList(_,initlistb,_)) ->
341
(* ignore whencode - returns true safely *)
342
unify_dots unify_initialiser idots initlista initlistb
343
| (Ast.StrInitList(_,_,initlista,_,whena),
344
Ast.StrInitList(_,_,initlistb,_,whenb)) ->
322
345
(* ignore whencode - returns true safely *)
323
346
unify_lists unify_initialiser (function _ -> false) initlista initlistb
324
347
| (Ast.InitGccExt(designatorsa,_,inia),
437
460
Ast.IteratorHeader(nm2,lp2,args2,rp2)) ->
438
461
conjunct_bindings (unify_ident nm1 nm2)
439
462
(unify_dots unify_expression edots args1 args2)
463
| (Ast.Undef(_,n1),Ast.Undef(_,n2)) -> unify_ident n1 n2
440
464
| (Ast.DefineHeader(_,n1,p1),Ast.DefineHeader(_,n2,p2)) ->
441
465
conjunct_bindings (unify_ident n1 n2)
442
466
(unify_define_parameters p1 p2)
504
528
let donothing r k e = k e in
505
529
let recursor = V.combiner bind option_default
506
530
mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode
507
donothing donothing donothing donothing
531
donothing donothing donothing donothing donothing
508
532
donothing expr donothing donothing donothing donothing donothing
509
533
donothing donothing donothing donothing donothing in
510
534
recursor.V.combiner_rule_elem
517
541
let donothing r k e = k e in
518
542
let recursor = V.combiner bind option_default
519
543
mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode
520
donothing donothing donothing donothing
544
donothing donothing donothing donothing donothing
521
545
donothing donothing fullType donothing donothing donothing donothing
522
546
donothing donothing donothing donothing donothing in
523
547
recursor.V.combiner_rule_elem