~npalix/coccinelle/upstream

« back to all changes in this revision

Viewing changes to parsing_c/unparse_cocci.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:
304
304
(* Expression *)
305
305
 
306
306
let rec expression e =
307
 
  let top = 0 in 
 
307
  let top = 0 in
308
308
  let assign = 1 in
309
309
  let cond = 2 in
310
310
  let log_or = 3 in
371
371
      | Ast.Or -> bit_or
372
372
      | Ast.Xor -> bit_xor in
373
373
    let left_prec_of_logical op =
374
 
      match Ast.unwrap_mcode op with      
 
374
      match Ast.unwrap_mcode op with
375
375
        Ast.Inf | Ast.Sup | Ast.InfEq | Ast.SupEq -> relat
376
376
      | Ast.Eq | Ast.NotEq -> equal
377
377
      | Ast.AndLog -> log_and
378
378
      | Ast.OrLog -> log_or in
379
379
    match Ast.unwrap op with
380
380
      Ast.Arith op' -> left_prec_of_arith op'
381
 
    | Ast.Logical op' -> left_prec_of_logical op' 
 
381
    | Ast.Logical op' -> left_prec_of_logical op'
382
382
    | Ast.MetaBinary (mv,_,_,_) ->
383
383
        let (res,name_string,line,lcol,rcol) = lookup_metavar mv in
384
384
        (match res with
397
397
      | Ast.Or -> bit_xor
398
398
      | Ast.Xor -> bit_and in
399
399
    let right_prec_of_logical op =
400
 
      match Ast.unwrap_mcode op with      
 
400
      match Ast.unwrap_mcode op with
401
401
        Ast.Inf -> shift
402
402
      | Ast.Sup -> shift
403
403
      | Ast.InfEq -> shift
408
408
      | Ast.OrLog -> log_and in
409
409
    match Ast.unwrap op with
410
410
      Ast.Arith op' -> right_prec_of_arith op'
411
 
    | Ast.Logical op' -> right_prec_of_logical op'    
 
411
    | Ast.Logical op' -> right_prec_of_logical op'
412
412
    | Ast.MetaBinary (mv,_,_,_) ->
413
413
        let (res,name_string,line,lcol,rcol) = lookup_metavar mv in
414
414
        (match res with
461
461
    | Ast_c.Defined _ -> primary
462
462
  in
463
463
 
464
 
  let rec loop e prec = 
 
464
  let rec loop e prec =
465
465
  match Ast.unwrap e with
466
466
    Ast.Ident(id) -> ident id
467
467
  | Ast.Constant(const) -> mcode constant const
638
638
  | Ast.Logical(lop) -> mcode logicalOp lop
639
639
  | Ast.MetaBinary(name,_,_,_) ->
640
640
      handle_metavar name (function
641
 
          Ast_c.MetaBinaryOpVal bop -> 
 
641
          Ast_c.MetaBinaryOpVal bop ->
642
642
            pretty_print_c.Pretty_print_c.binaryOp bop
643
643
        | _ -> raise (Impossible 160))
644
644
 
686
686
        Ast.Pointer(_,_) ->
687
687
          typeC ty; print_option_prespace (mcode const_vol) cv
688
688
      | _ -> print_option_space (mcode const_vol) cv; typeC ty)
689
 
      
 
689
 
690
690
  | Ast.AsType(ty, asty) -> fullType ty
691
691
  | Ast.DisjType _ -> failwith "can't be in plus"
692
692
  | Ast.OptType(_) | Ast.UniqueType(_) ->
842
842
        | _ -> false in
843
843
      if isptr then () else pr_space()
844
844
  | _ -> pr_space()
845
 
        
 
845
 
846
846
and declaration d =
847
847
  match Ast.unwrap d with
848
848
    Ast.MetaDecl(name,_,_) ->