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]
and disjdecl d =
match Ast.unwrap d with
- Ast.MetaDecl(_,_,_) | Ast.MetaField(_,_,_) -> [d]
+ Ast.MetaDecl(_,_,_) | Ast.MetaField(_,_,_)
+ | Ast.MetaFieldList(_,_,_,_) -> [d]
| Ast.Init(stg,ty,id,eq,ini,sem) ->
disjmult2 (disjty ty) (disjini ini)
(function ty -> function ini ->
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) ->