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

« back to all changes in this revision

Viewing changes to parsing_cocci/visitor_ast.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:
110
110
      | Ast.MetaId(name,_,_,_) -> meta_mcode name
111
111
      | Ast.MetaFunc(name,_,_,_) -> meta_mcode name
112
112
      | Ast.MetaLocalFunc(name,_,_,_) -> meta_mcode name
 
113
      | Ast.AsIdent(id,asid) -> bind (ident id) (ident asid)
113
114
      | Ast.DisjId(id_list) -> multibind (List.map ident id_list)
114
115
      | Ast.OptIdent(id) -> ident id
115
116
      | Ast.UniqueIdent(id) -> ident id in
360
361
      | Ast.WhileTail(whl,lp,exp,rp,sem) ->
361
362
          multibind [string_mcode whl; string_mcode lp; expression exp;
362
363
                      string_mcode rp; string_mcode sem]
363
 
      | Ast.ForHeader(fr,lp,e1,sem1,e2,sem2,e3,rp) ->
364
 
          multibind [string_mcode fr; string_mcode lp;
365
 
                      get_option expression e1; string_mcode sem1;
 
364
      | Ast.ForHeader(fr,lp,first,e2,sem2,e3,rp) ->
 
365
          let first = forinfo first in
 
366
          multibind [string_mcode fr; string_mcode lp; first;
366
367
                      get_option expression e2; string_mcode sem2;
367
368
                      get_option expression e3; string_mcode rp]
368
369
      | Ast.IteratorHeader(nm,lp,args,rp) ->
397
398
      | Ast.DisjRuleElem(res) -> multibind (List.map rule_elem res) in
398
399
    rulefn all_functions k re
399
400
 
 
401
  (* not parameterisable, for now *)
 
402
  and forinfo fi =
 
403
    let k = function
 
404
        Ast.ForExp(e1,sem1) ->
 
405
          bind (get_option expression e1) (string_mcode sem1)
 
406
      | Ast.ForDecl (_,_,decl) -> declaration decl in
 
407
    k fi
 
408
 
400
409
  (* not parameterizable for now... *)
401
410
  and define_parameters p =
402
411
    let k p =
533
542
      | Ast.IncFileTag(stg) -> option_default
534
543
      | Ast.Rule_elemTag(rule) -> rule_elem rule
535
544
      | Ast.StatementTag(rule) -> statement rule
 
545
      | Ast.ForInfoTag(rule) -> forinfo rule
536
546
      | Ast.CaseLineTag(case) -> case_line case
537
547
      | Ast.ConstVolTag(cv) -> option_default
538
548
      | Ast.Token(tok,info) -> option_default
635
645
            Ast.MetaFunc(meta_mcode name,constraints,keep,inherited)
636
646
        | Ast.MetaLocalFunc(name,constraints,keep,inherited) ->
637
647
            Ast.MetaLocalFunc(meta_mcode name,constraints,keep,inherited)
 
648
        | Ast.AsIdent(id,asid) -> Ast.AsIdent(ident id,ident asid)
638
649
        | Ast.DisjId(id_list) -> Ast.DisjId(List.map ident id_list)
639
650
        | Ast.OptIdent(id) -> Ast.OptIdent(ident id)
640
651
        | Ast.UniqueIdent(id) -> Ast.UniqueIdent(ident id)) in
877
888
        | Ast.WhileTail(whl,lp,exp,rp,sem) ->
878
889
            Ast.WhileTail(string_mcode whl, string_mcode lp, expression exp,
879
890
                          string_mcode rp, string_mcode sem)
880
 
        | Ast.ForHeader(fr,lp,e1,sem1,e2,sem2,e3,rp) ->
881
 
            Ast.ForHeader(string_mcode fr, string_mcode lp,
882
 
                          get_option expression e1, string_mcode sem1,
 
891
        | Ast.ForHeader(fr,lp,first,e2,sem2,e3,rp) ->
 
892
            let first = forinfo first in
 
893
            Ast.ForHeader(string_mcode fr, string_mcode lp, first,
883
894
                          get_option expression e2, string_mcode sem2,
884
895
                          get_option expression e3, string_mcode rp)
885
896
        | Ast.IteratorHeader(whl,lp,args,rp) ->
924
935
    rulefn all_functions k re
925
936
 
926
937
  (* not parameterizable for now... *)
 
938
  and forinfo fi =
 
939
    let k = function
 
940
      Ast.ForExp(e1,sem1) ->
 
941
        Ast.ForExp(get_option expression e1,string_mcode sem1)
 
942
    | Ast.ForDecl (bef,allminus,decl) ->
 
943
        Ast.ForDecl(bef,allminus,declaration decl) in
 
944
    k fi
 
945
 
 
946
  (* not parameterizable for now... *)
927
947
  and define_parameters p =
928
948
    let k p =
929
949
      Ast.rewrap p
1076
1096
      | Ast.IncFileTag(stg) as x -> x
1077
1097
      | Ast.Rule_elemTag(rule) -> Ast.Rule_elemTag(rule_elem rule)
1078
1098
      | Ast.StatementTag(rule) -> Ast.StatementTag(statement rule)
 
1099
      | Ast.ForInfoTag(rule) -> Ast.ForInfoTag(forinfo rule)
1079
1100
      | Ast.CaseLineTag(case) -> Ast.CaseLineTag(case_line case)
1080
1101
      | Ast.ConstVolTag(cv) as x -> x
1081
1102
      | Ast.Token(tok,info) as x -> x