~ubuntu-branches/ubuntu/trusty/coccinelle/trusty

« back to all changes in this revision

Viewing changes to parsing_cocci/insert_plus.ml

  • Committer: Package Import Robot
  • Author(s): Євгеній Мещеряков
  • Date: 2012-08-19 20:40:52 UTC
  • mfrom: (7.2.8 experimental)
  • Revision ID: package-import@ubuntu.com-20120819204052-8cujknwy6cn8a6h6
Tags: 1.0.0~rc15.deb-1
* New upstream RC 
  - Do not build-depend on libsexplib-camlp4-dev and libextlib-ocaml-dev
    anymore

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
      (donothing Ast0.dotsDecl) (donothing Ast0.dotsCase)
102
102
      (donothing Ast0.ident) expression (donothing Ast0.typeC) initialiser
103
103
      (donothing Ast0.param) (donothing Ast0.decl) statement
104
 
      (donothing Ast0.case_line) topfn in
 
104
      (donothing Ast0.forinfo) (donothing Ast0.case_line) topfn in
105
105
  res.VT0.combiner_rec_top_level e
106
106
 
107
107
(* --------------------------------------------------------------------- *)
141
141
          | Ast0.InitTag(d) -> Ast0.get_index d
142
142
          | Ast0.DeclTag(d) -> Ast0.get_index d
143
143
          | Ast0.StmtTag(d) -> Ast0.get_index d
 
144
          | Ast0.ForInfoTag(d) -> Ast0.get_index d
144
145
          | Ast0.CaseLineTag(d) -> Ast0.get_index d
145
146
          | Ast0.TopTag(d) -> Ast0.get_index d
146
147
          | Ast0.IsoWhenTag(_) -> failwith "only within iso phase"
237
238
 (*     Ast0.IfThen(_,_,_,_,_,aft)
238
239
    | Ast0.IfThenElse(_,_,_,_,_,_,_,aft)
239
240
    | Ast0.While(_,_,_,_,_,aft)
240
 
    | Ast0.For(_,_,_,_,_,_,_,_,_,aft)
 
241
    | Ast0.For(_,_,_,_,_,_,_,_,aft)
241
242
    | Ast0.Iterator(_,_,_,_,_,aft) ->
242
243
        redo_branched (do_nothing r k s) aft*)
243
244
    | Ast0.FunDecl((info,bef),fninfo,name,lp,params,rp,lbrace,body,rbrace) ->
244
245
        (Toplevel,info,bef)::(k s)
245
 
    | Ast0.Decl((info,bef),decl) -> (Decl,info,bef)::(k s)
 
246
    | Ast0.Decl((info,bef),decl) ->
 
247
        (Decl,info,bef)::(k s)
246
248
    | Ast0.Nest(starter,stmt_dots,ender,whencode,multi) ->
247
249
        mcode starter @ r.VT0.combiner_rec_statement_dots stmt_dots @
248
250
        mcode ender
253
255
        r.VT0.combiner_rec_statement s
254
256
    | _ -> do_nothing r k s in
255
257
 
 
258
  let forinfo r k s =
 
259
    match Ast0.unwrap s with
 
260
      Ast0.ForDecl((info,bef),decl) ->
 
261
        (Decl,info,bef)::(k s)
 
262
    | _ -> k s in
 
263
 
256
264
  let expression r k e =
257
265
    match Ast0.unwrap e with
258
266
      Ast0.NestExpr(starter,expr_dots,ender,whencode,multi) ->
313
321
  V0.flat_combiner bind option_default
314
322
    mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode
315
323
    edots idots pdots sdots ddots cdots
316
 
    ident expression typeC initialiser param decl statement case_line do_top
 
324
    ident expression typeC initialiser param decl statement forinfo
 
325
    case_line do_top
317
326
 
318
327
 
319
328
let call_collect_minus context_nodes :
362
371
      | Ast0.StmtTag(e) ->
363
372
          (Ast0.get_index e,
364
373
           (collect_minus_join_points e).VT0.combiner_rec_statement e)
 
374
      | Ast0.ForInfoTag(e) ->
 
375
          (Ast0.get_index e,
 
376
           (collect_minus_join_points e).VT0.combiner_rec_forinfo e)
365
377
      | Ast0.CaseLineTag(e) ->
366
378
          (Ast0.get_index e,
367
379
           (collect_minus_join_points e).VT0.combiner_rec_case_line e)
437
449
let mk_storage x          = Ast.StorageTag x
438
450
let mk_inc_file x         = Ast.IncFileTag x
439
451
let mk_statement x        = Ast.StatementTag (Ast0toast.statement x)
 
452
let mk_forinfo x          = Ast.ForInfoTag (Ast0toast.forinfo x)
440
453
let mk_case_line x        = Ast.CaseLineTag (Ast0toast.case_line x)
441
454
let mk_const_vol x        = Ast.ConstVolTag x
442
455
let mk_token x info       = Ast.Token (x,Some info)
518
531
        (do_nothing mk_statement r k e) @ (info aft)
519
532
    | Ast0.While(whl,lp,exp,rp,body,aft) ->
520
533
        (do_nothing mk_statement r k e) @ (info aft)
521
 
    | Ast0.For(fr,lp,e1,sem1,e2,sem2,e3,rp,body,aft) ->
 
534
    | Ast0.For(fr,lp,first,e2,sem2,e3,rp,body,aft) ->
522
535
        (do_nothing mk_statement r k e) @ (info aft)
523
536
    | Ast0.Iterator(nm,lp,args,rp,body,aft) ->
524
537
        (do_nothing mk_statement r k e) @ (info aft)
552
565
    (do_nothing mk_ident) (do_nothing mk_expression)
553
566
    (do_nothing mk_typeC) (do_nothing mk_init) (do_nothing mk_param)
554
567
    (do_nothing mk_declaration)
555
 
    stmt (do_nothing mk_case_line) toplevel
 
568
    stmt (do_nothing mk_forinfo) (do_nothing mk_case_line) toplevel
556
569
 
557
570
let call_collect_plus context_nodes :
558
571
    (int * (Ast0.info * Ast.count * Ast.anything) list) list =
600
613
      | Ast0.StmtTag(e) ->
601
614
          (Ast0.get_index e,
602
615
           (collect_plus_nodes e).VT0.combiner_rec_statement e)
 
616
      | Ast0.ForInfoTag(e) ->
 
617
          (Ast0.get_index e,
 
618
           (collect_plus_nodes e).VT0.combiner_rec_forinfo e)
603
619
      | Ast0.CaseLineTag(e) ->
604
620
          (Ast0.get_index e,
605
621
           (collect_plus_nodes e).VT0.combiner_rec_case_line e)
1059
1075
         (donothing r k e) @ (info aft)
1060
1076
     | Ast0.While(whl,lp,exp,rp,body,aft) ->
1061
1077
         (donothing r k e) @ (info aft)
1062
 
     | Ast0.For(fr,lp,e1,sem1,e2,sem2,e3,rp,body,aft) ->
 
1078
     | Ast0.For(fr,lp,first,e2,sem2,e3,rp,body,aft) ->
1063
1079
         (donothing r k e) @ (info aft)
1064
1080
     | Ast0.Iterator(nm,lp,args,rp,body,aft) ->
1065
1081
         (donothing r k e) @ (info aft)
1069
1085
    V0.flat_combiner bind option_default
1070
1086
      mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode
1071
1087
      donothing donothing donothing donothing donothing donothing donothing
1072
 
      donothing
1073
 
      donothing donothing donothing donothing stmt donothing donothing in
 
1088
      donothing donothing
 
1089
      donothing donothing donothing stmt donothing donothing donothing in
1074
1090
  res.VT0.combiner_rec_top_level
1075
1091
 
1076
1092
(* --------------------------------------------------------------------- *)