~ubuntu-branches/ubuntu/karmic/coccinelle/karmic

« back to all changes in this revision

Viewing changes to parsing_cocci/iso_pattern.ml

  • Committer: Bazaar Package Importer
  • Author(s): Євгеній Мещеряков
  • Date: 2009-05-11 15:32:24 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090511153224-1odv41d4dkr3y80v
Tags: 0.1.8.deb-2
Use common install Makefile target for both native and bytecode
build. This hopefully fixes FTBFS on bytecode archs 

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
    Ast_cocci.metavar list * Ast0_cocci.anything list list * string (* name *)
44
44
 
45
45
let strip_info =
46
 
  let mcode (term,_,_,_,_) =
47
 
    (term,Ast0.NONE,Ast0.default_info(),Ast0.PLUS,ref Ast0.NoMetaPos) in
 
46
  let mcode (term,_,_,_,_,_) =
 
47
    (term,Ast0.NONE,Ast0.default_info(),Ast0.PLUS,ref Ast0.NoMetaPos,-1) in
48
48
  let donothing r k e =
49
49
    let x = k e in
50
50
    {(Ast0.wrap (Ast0.unwrap x)) with
108
108
      failwith "only for isos within iso phase"
109
109
  | _ -> false
110
110
 
111
 
let term (var1,_,_,_,_) = var1
112
 
let dot_term (var1,_,info,_,_) =
 
111
let term (var1,_,_,_,_,_) = var1
 
112
let dot_term (var1,_,info,_,_,_) =
113
113
  ("", var1 ^ (string_of_int info.Ast0.pos_info.Ast0.offset))
114
114
 
115
115
 
227
227
  | [x] -> x
228
228
  | x::xs -> conjunct_bindings x (conjunct_many_bindings xs)
229
229
 
230
 
let mcode_equal (x,_,_,_,_) (y,_,_,_,_) = x = y
 
230
let mcode_equal (x,_,_,_,_,_) (y,_,_,_,_,_) = x = y
231
231
 
232
232
let return b binding = if b then OK binding else Fail NonMatch
233
233
let return_false reason binding = Fail reason
1197
1197
(* make an entire tree MINUS *)
1198
1198
 
1199
1199
let make_minus =
1200
 
  let mcode (term,arity,info,mcodekind,pos) =
 
1200
  let mcode (term,arity,info,mcodekind,pos,adj) =
1201
1201
    let new_mcodekind =
1202
1202
     match mcodekind with
1203
1203
       Ast0.CONTEXT(mc) ->
1206
1206
         | _ -> failwith "make_minus: unexpected befaft")
1207
1207
     | Ast0.MINUS(mc) -> mcodekind (* in the part copied from the src term *)
1208
1208
     | _ -> failwith "make_minus mcode: unexpected mcodekind" in
1209
 
    (term,arity,info,new_mcodekind,pos) in
 
1209
    (term,arity,info,new_mcodekind,pos,adj) in
1210
1210
 
1211
1211
  let update_mc mcodekind e =
1212
1212
    match !mcodekind with
1331
1331
           indices, and so we allow PLUS code as well *)
1332
1332
        Ast0.PLUS in
1333
1333
 
1334
 
  let mcode (term,arity,info,mcodekind,pos) =
 
1334
  let mcode (term,arity,info,mcodekind,pos,adj) =
1335
1335
    let info =
1336
1336
      match start_line with
1337
1337
        Some x ->
1341
1341
              Ast0.line_end = x; } in
1342
1342
          {info with Ast0.pos_info = new_pos_info}
1343
1343
      | None -> info in
1344
 
    (term,arity,info,copy_mcodekind mcodekind,pos) in
 
1344
    (term,arity,info,copy_mcodekind mcodekind,pos,adj) in
1345
1345
 
1346
1346
  let copy_one x =
1347
1347
    let old_info = Ast0.get_info x in
1562
1562
                    let rec renamer = function
1563
1563
                        Type_cocci.MetaType(name,keep,inherited) ->
1564
1564
                          (match
1565
 
                            lookup (name,(),(),(),None) bindings mv_bindings
 
1565
                            lookup (name,(),(),(),None,-1) bindings mv_bindings
1566
1566
                          with
1567
1567
                            Common.Left(Ast0.TypeCTag(t)) ->
1568
1568
                              Ast0.ast0_type_to_type t
2356
2356
 
2357
2357
(* should be done by functorizing the parser to use wrap or context_wrap *)
2358
2358
let rewrap =
2359
 
  let mcode (x,a,i,mc,pos) = (x,a,i,Ast0.context_befaft(),pos) in
 
2359
  let mcode (x,a,i,mc,pos,adj) = (x,a,i,Ast0.context_befaft(),pos,adj) in
2360
2360
  let donothing r k e = Ast0.context_wrap(Ast0.unwrap(k e)) in
2361
2361
  V0.flat_rebuilder
2362
2362
    mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode