(function ty -> function size ->
Ast.rewrap bty (Ast.Array(ty,lb,size,rb)))
| Ast.EnumName(_,_) | Ast.StructUnionName(_,_) -> [bty]
+ | Ast.EnumDef(ty,lb,ids,rb) ->
+ disjmult2 (disjty ty) (disjdots disjexp ids)
+ (function ty -> function ids ->
+ Ast.rewrap bty (Ast.EnumDef(ty,lb,ids,rb)))
| Ast.StructUnionDef(ty,lb,decls,rb) ->
disjmult2 (disjty ty) (disjdots disjdecl decls)
(function ty -> function decls ->
Ast.rewrap bty (Ast.StructUnionDef(ty,lb,decls,rb)))
| Ast.TypeName(_) | Ast.MetaType(_,_,_) -> [bty]
+and disjident e =
+ match Ast.unwrap e with
+ Ast.DisjId(id_list) -> List.concat (List.map disjident id_list)
+ | Ast.OptIdent(id) ->
+ let id = disjident id in
+ List.map (function id -> Ast.rewrap e (Ast.OptIdent(id))) id
+ | Ast.UniqueIdent(id) ->
+ let id = disjident id in
+ List.map (function id -> Ast.rewrap e (Ast.UniqueIdent(id))) id
+ | _ -> [e]
+
and disjexp e =
match Ast.unwrap e with
- Ast.Ident(_) | Ast.Constant(_) -> [e]
+ Ast.Ident(_) | Ast.Constant(_) -> [e] (* even Ident can't contain disj *)
| Ast.FunCall(fn,lp,args,rp) ->
disjmult2 (disjexp fn) (disjdots disjexp args)
(function fn -> function args ->
List.map (function ty -> Ast.rewrap e (Ast.TypeExp(ty))) ty
| Ast.MetaErr(_,_,_,_) | Ast.MetaExpr(_,_,_,_,_,_)
| Ast.MetaExprList(_,_,_,_) | Ast.EComma(_) -> [e]
- | Ast.DisjExpr(exp_list) ->
- List.concat (List.map disjexp exp_list)
+ | Ast.DisjExpr(exp_list) -> List.concat (List.map disjexp exp_list)
| Ast.NestExpr(starter,expr_dots,ender,whencode,multi) ->
(* not sure what to do here, so ambiguities still possible *)
[e]
| Ast.InitExpr(exp) ->
let exp = disjexp exp in
List.map (function exp -> Ast.rewrap i (Ast.InitExpr(exp))) exp
- | Ast.InitList(allminus,lb,initlist,rb,whencode) ->
+ | Ast.ArInitList(lb,initlist,rb) ->
+ List.map
+ (function initlist ->
+ Ast.rewrap i (Ast.ArInitList(lb,initlist,rb)))
+ (disjdots disjini initlist)
+ | Ast.StrInitList(allminus,lb,initlist,rb,whencode) ->
List.map
(function initlist ->
- Ast.rewrap i (Ast.InitList(allminus,lb,initlist,rb,whencode)))
+ Ast.rewrap i (Ast.StrInitList(allminus,lb,initlist,rb,whencode)))
(disjmult disjini initlist)
| Ast.InitGccExt(designators,eq,ini) ->
let designators = disjmult designator designators in
(function ini -> Ast.rewrap i (Ast.InitGccName(name,eq,ini)))
ini
| Ast.IComma(comma) -> [i]
+ | Ast.Idots(dots,_) -> [i]
| Ast.OptIni(ini) ->
let ini = disjini ini in
List.map (function ini -> Ast.rewrap i (Ast.OptIni(ini))) ini
and disjdecl d =
match Ast.unwrap d with
- Ast.Init(stg,ty,id,eq,ini,sem) ->
+ Ast.MetaDecl(_,_,_) | Ast.MetaField(_,_,_)
+ | Ast.MetaFieldList(_,_,_,_) -> [d]
+ | Ast.Init(stg,ty,id,eq,ini,sem) ->
disjmult2 (disjty ty) (disjini ini)
(function ty -> function ini ->
Ast.rewrap d (Ast.Init(stg,ty,id,eq,ini,sem)))
let ty = disjty ty in (* disj not allowed in id *)
List.map (function ty -> Ast.rewrap d (Ast.Typedef(stg,ty,id,sem))) ty
| Ast.DisjDecl(decls) -> List.concat (List.map disjdecl decls)
- | Ast.Ddots(_,_) | Ast.MetaDecl(_,_,_) -> [d]
+ | Ast.Ddots(_,_) -> [d]
| Ast.OptDecl(decl) ->
let decl = disjdecl decl in
List.map (function decl -> Ast.rewrap d (Ast.OptDecl(decl))) decl
orify_rule_elem_ini re init
(function init -> Ast.rewrap init (Ast.TopInit(init)))
| Ast.Include(inc,s) -> re
+ | Ast.Undef(def,id) -> re
| Ast.DefineHeader(def,id,params) -> re
| Ast.Default(def,colon) -> re
| Ast.Case(case,exp,colon) ->
let donothing r k e = k e in
V.rebuilder
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 donothing
disj_rule_elem donothing donothing donothing donothing
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 doanything
+ donothing donothing doanything
let collect_iso_info =
let mcode x = x in
V.rebuilder
mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode
donothing donothing donothing donothing donothing donothing donothing
+ donothing
donothing donothing donothing donothing rule_elem donothing donothing
donothing donothing