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

« back to all changes in this revision

Viewing changes to parsing_cocci/parse_aux.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:
28
28
 
29
29
(* types for metavariable tokens *)
30
30
type info = Ast.meta_name * Ast0.pure * Data.clt
 
31
type midinfo =
 
32
    Ast.meta_name * Data.iconstraints * Ast.seed * Ast0.pure * Data.clt
31
33
type idinfo = Ast.meta_name * Data.iconstraints * Ast0.pure * Data.clt
32
34
type expinfo = Ast.meta_name * Data.econstraints * Ast0.pure * Data.clt
33
35
type tyinfo = Ast.meta_name * Ast0.typeC list * Ast0.pure * Data.clt
60
62
let drop_aft (arity,line,lline,offset,col,strbef,straft,pos) =
61
63
  (arity,line,lline,offset,col,strbef,[],pos)
62
64
 
 
65
(* used for #define, to put aft on ident/( *)
 
66
let get_aft (arity,line,lline,offset,col,strbef,straft,pos) = straft
 
67
 
 
68
let set_aft aft (arity,line,lline,offset,col,strbef,_,pos) =
 
69
  (arity,line,lline,offset,col,strbef,aft,pos)
 
70
 
63
71
let drop_pos (arity,line,lline,offset,col,strbef,straft,pos) =
64
 
  (arity,line,lline,offset,col,strbef,straft,Ast0.NoMetaPos)
 
72
  (arity,line,lline,offset,col,strbef,straft,[])
65
73
 
66
74
let clt2mcode str = function
67
75
    (Data.MINUS,line,lline,offset,col,strbef,straft,pos)       ->
68
76
      (str,Ast0.NONE,make_info line lline offset col strbef straft,
69
 
       Ast0.MINUS(ref([],Ast0.default_token_info)),ref pos,-1)
 
77
       Ast0.MINUS(ref(Ast.NOREPLACEMENT,Ast0.default_token_info)),ref pos,-1)
70
78
  | (Data.OPTMINUS,line,lline,offset,col,strbef,straft,pos)    ->
71
79
      (str,Ast0.OPT,make_info line lline offset col strbef straft,
72
 
       Ast0.MINUS(ref([],Ast0.default_token_info)),ref pos,-1)
 
80
       Ast0.MINUS(ref(Ast.NOREPLACEMENT,Ast0.default_token_info)),ref pos,-1)
73
81
  | (Data.UNIQUEMINUS,line,lline,offset,col,strbef,straft,pos) ->
74
82
      (str,Ast0.UNIQUE,make_info line lline offset col strbef straft,
75
 
       Ast0.MINUS(ref([],Ast0.default_token_info)),ref pos,-1)
 
83
       Ast0.MINUS(ref(Ast.NOREPLACEMENT,Ast0.default_token_info)),ref pos,-1)
76
84
  | (Data.PLUS,line,lline,offset,col,strbef,straft,pos)        ->
77
85
      (str,Ast0.NONE,make_info line lline offset col strbef straft,
78
86
       Ast0.PLUS(Ast.ONE),ref pos,-1)
251
259
          raise
252
260
            (Semantic_cocci.Semantic
253
261
               ("incompatible inheritance declaration "^name)))
 
262
  | Ast.MetaInitListDecl(Ast.NONE,(rule,name),len_name) ->
 
263
      (match lookup rule name with
 
264
        Ast.MetaInitListDecl(_,_,_) -> ()
 
265
      | _ ->
 
266
          raise
 
267
            (Semantic_cocci.Semantic
 
268
               ("incompatible inheritance declaration "^name)))
254
269
  | Ast.MetaParamDecl(Ast.NONE,(rule,name)) ->
255
270
      (match lookup rule name with
256
271
        Ast.MetaParamDecl(_,_) -> ()
607
622
      Ast0.InitGccExt _ -> true
608
623
    | Ast0.InitGccName _ -> true
609
624
    | Ast0.OptIni i | Ast0.UniqueIni i -> loop i
610
 
    | Ast0.MetaInit _ -> true (* ambiguous... *)
 
625
    | Ast0.MetaInit _ | Ast0.MetaInitList _ -> false (* ambiguous... *)
611
626
    | _ -> false in
612
627
  let l = Ast0.undots initlist in
613
628
  (l = []) or (List.exists loop l)