~npalix/coccinelle/upstream

« back to all changes in this revision

Viewing changes to parsing_cocci/visitor_ast0.ml

  • Committer: Sébastien Hinderer
  • Date: 2015-08-10 12:22:12 UTC
  • mto: (4116.2.93)
  • mto: This revision was merged to the branch mainline in revision 4121.
  • Revision ID: git-v1:848f85e256516330c06f5fd8dc782b854ed9aa03
Remove a bunch of trailing whitespaces and blank lines at end of files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
295
295
            let (o_n,o) = opAssign_mcode o in
296
296
            (o_n, Ast0.OpAssign o)
297
297
        | Ast0.MetaAssign (name, c, pure) ->
298
 
          let (name_n,name) = meta_mcode name in 
 
298
          let (name_n,name) = meta_mcode name in
299
299
          (name_n,Ast0.MetaAssign(name,c, pure))) in
300
300
    assignOpfn all_functions k e
301
301
 
310
310
            let (o_n, o) = logicalOp_mcode o in
311
311
            (o_n, Ast0.Logical o)
312
312
        | Ast0.MetaBinary (name, c, pure) ->
313
 
          let (name_n,name) = meta_mcode name in 
 
313
          let (name_n,name) = meta_mcode name in
314
314
          (name_n,Ast0.MetaBinary(name, c, pure))) in
315
 
    binaryOpfn all_functions k e  
 
315
    binaryOpfn all_functions k e
316
316
 
317
317
  and typeC t =
318
318
    let k t =
339
339
            let (star_n,star) = string_mcode star in
340
340
            (bind ty_n star_n, Ast0.Pointer(ty,star))
341
341
        | Ast0.FunctionPointer(ty,lp1,star,rp1,lp2,params,rp2) ->
342
 
            let (t,id) = 
 
342
            let (t,id) =
343
343
              function_pointer (ty,lp1,star,None,rp1,lp2,params,rp2) in t
344
 
        | Ast0.Array(ty,lb,size,rb) -> 
 
344
        | Ast0.Array(ty,lb,size,rb) ->
345
345
            let (t,id) = array_type (ty,None,lb,size,rb) in t
346
346
        | Ast0.Decimal(dec,lp,length,comma,precision_opt,rp) ->
347
347
            let (dec_n,dec) = string_mcode dec in
400
400
    let (ty_n,ty) = typeC ty in
401
401
    let (lp1_n,lp1) = string_mcode lp1 in
402
402
    let (star_n,star) = string_mcode star in
403
 
    let (idl,idu) = (match id with 
 
403
    let (idl,idu) = (match id with
404
404
      | Some a -> let (b,c) = ident a in ([b],Some c)
405
405
      | None -> ([],None)) in
406
406
    let (rp1_n,rp1) = string_mcode rp1 in
414
414
  (* returns ((bind value,original value),id) since id may have been updated*)
415
415
  and array_type (ty,(id : Ast0.ident option),lb,size,rb) =
416
416
    let (ty_n,ty) = typeC ty in
417
 
    let (idl,idu) = (match id with 
 
417
    let (idl,idu) = (match id with
418
418
      | Some a -> let (b,c) = ident a in ([b],Some c)
419
419
      | None -> ([],None)) in
420
420
    let (lb_n,lb) = string_mcode lb in
426
426
  and named_type ty id =
427
427
    match Ast0.unwrap ty with
428
428
      Ast0.FunctionPointer(rty,lp1,star,rp1,lp2,params,rp2) ->
429
 
        let (tyres, idn) = 
 
429
        let (tyres, idn) =
430
430
          function_pointer (rty,lp1,star,Some id,rp1,lp2,params,rp2) in
431
431
        let idn = match idn with Some i -> i | None -> failwith "Impossible" in
432
432
        (rewrap ty tyres, idn)
516
516
        | Ast0.Ddots(dots,whencode) ->
517
517
            let (dots_n,dots) = string_mcode dots in
518
518
            let (whencode_n, whencode) = match whencode with
519
 
              | Some (a,b,c) -> 
 
519
              | Some (a,b,c) ->
520
520
                  let (_,a2) = string_mcode a in
521
521
                  let (_,b2) = string_mcode b in
522
522
                  let (c1,c2) = declaration c in (c1, Some (a2,b2,c2))
566
566
        | Ast0.Idots(d,whencode) ->
567
567
            let (d_n,d) = string_mcode d in
568
568
            let (whencode_n, whencode) = match whencode with
569
 
              | Some (a,b,c) -> 
 
569
              | Some (a,b,c) ->
570
570
                  let (_,a2) = string_mcode a in
571
571
                  let (_,b2) = string_mcode b in
572
572
                  let (c1,c2) = initialiser c in (c1, Some (a2,b2,c2))
949
949
        let (_,w) = string_mcode w in
950
950
        let (_,e) = string_mcode e in
951
951
        let (n,a) = notfn a in (n,Ast0.WhenNot(w,e,a))
952
 
    | Ast0.WhenAlways (w,e,a) -> 
 
952
    | Ast0.WhenAlways (w,e,a) ->
953
953
        let (_,w) = string_mcode w in
954
954
        let (_,e) = string_mcode e in
955
955
        let (n,a) = alwaysfn a in (n,Ast0.WhenAlways(w,e,a))
968
968
  (* for whencodes that do not have any of the above modifiers
969
969
   * returns (the new whencode expression, the updated whencode) *)
970
970
  and whencode_option cfn = function
971
 
    | Some (a,b,c) -> 
 
971
    | Some (a,b,c) ->
972
972
        let (_,a2) = string_mcode a in
973
973
        let (_,b2) = string_mcode b in
974
974
        let (c1,c2) = cfn c in (c1, Some (a2,b2,c2))
1546
1546
    functions.VT0.combiner_rebuilder_casefn
1547
1547
    functions.VT0.combiner_rebuilder_string_fragmentfn
1548
1548
    functions.VT0.combiner_rebuilder_topfn
1549