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

« back to all changes in this revision

Viewing changes to parsing_cocci/insert_plus.ml

  • Committer: Package Import Robot
  • Author(s): Євгеній Мещеряков
  • Date: 2011-12-06 23:17:50 UTC
  • mfrom: (7.2.4 experimental) (7.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20111206231750-m6n4b9jh0d48dlxo
Tags: 1.0.0~rc7.deb-5
Merge Build-Depends-Indep into Build-Depends, the package does not build
on autobuilders otherwise

Show diffs side-by-side

added added

removed removed

Lines of Context:
529
529
 
530
530
  let toplevel r k e =
531
531
    match Ast0.unwrap e with
532
 
      Ast0.DECL(s) -> r.VT0.combiner_rec_statement s
 
532
      Ast0.NONDECL(s) -> r.VT0.combiner_rec_statement s
533
533
    | Ast0.CODE(sdots) -> r.VT0.combiner_rec_statement_dots sdots
534
534
    | _ -> do_nothing mk_code r k e in
535
535
 
781
781
     Ast0.left_offset = info.Ast0.pos_info.Ast0.offset;
782
782
     Ast0.right_offset = info.Ast0.pos_info.Ast0.offset})
783
783
 
 
784
let it2c = function Ast.ONE -> "one" | Ast.MANY -> "many"
 
785
 
784
786
let attachbefore (infop,c,p) = function
785
787
    Ast0.MINUS(replacements) ->
786
788
      let (repl,ti) = !replacements in
787
 
      let (bef,ti) =
788
 
        match repl with
789
 
          [] -> init p infop
790
 
        | repl -> insert p infop repl ti in
791
 
      replacements := (bef,ti)
 
789
      (match repl with
 
790
        Ast.NOREPLACEMENT ->
 
791
          let (bef,ti) = init p infop in
 
792
          replacements := (Ast.REPLACEMENT(bef,c),ti)
 
793
      | Ast.REPLACEMENT(repl,it) ->
 
794
          let it = Ast.lub_count it c in
 
795
          let (bef,ti) = insert p infop repl ti in
 
796
          replacements := (Ast.REPLACEMENT(bef,it),ti))
792
797
  | Ast0.CONTEXT(neighbors) ->
793
798
      let (repl,ti1,ti2) = !neighbors in
794
799
      (match repl with
812
817
let attachafter (infop,c,p) = function
813
818
    Ast0.MINUS(replacements) ->
814
819
       let (repl,ti) = !replacements in
815
 
       let (aft,ti) =
816
 
        match repl with
817
 
          [] -> init p infop
818
 
        | repl -> insert p infop repl ti in
819
 
       replacements := (aft,ti)
 
820
       (match repl with
 
821
        Ast.NOREPLACEMENT ->
 
822
          let (aft,ti) = init p infop in
 
823
          replacements := (Ast.REPLACEMENT(aft,c),ti)
 
824
      | Ast.REPLACEMENT(repl,it) ->
 
825
          let it = Ast.lub_count it c in
 
826
          let (aft,ti) = insert p infop repl ti in
 
827
          replacements := (Ast.REPLACEMENT(aft,it),ti))
820
828
  | Ast0.CONTEXT(neighbors) ->
821
829
      let (repl,ti1,ti2) = !neighbors in
822
830
      (match repl with
963
971
  Printf.printf "minus code\n";
964
972
  List.iter
965
973
    (function (_,info,_) ->
966
 
      Printf.printf "start %d end %d real_start %d real_end %d\n"
 
974
      Printf.printf
 
975
        "start %d end %d real_start %d real_end %d attachable start %b attachable end %b\n"
967
976
        info.Ast0.pos_info.Ast0.logical_start
968
977
        info.Ast0.pos_info.Ast0.logical_end
969
978
        info.Ast0.pos_info.Ast0.line_start
970
 
        info.Ast0.pos_info.Ast0.line_end)
 
979
        info.Ast0.pos_info.Ast0.line_end
 
980
        info.Ast0.attachable_start
 
981
        info.Ast0.attachable_end)
971
982
    m;
972
983
  Printf.printf "plus code\n";
973
984
  List.iter