Coccinelle release-1.0.0-rc11
[bpt/coccinelle.git] / parsing_cocci / parse_aux.ml
index 2544269..6f300f3 100644 (file)
@@ -1,5 +1,7 @@
 (*
- * Copyright 2010, INRIA, University of Copenhagen
+ * Copyright 2012, INRIA
+ * Julia Lawall, Gilles Muller
+ * Copyright 2010-2011, INRIA, University of Copenhagen
  * Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix
  * Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
  * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
@@ -241,13 +243,6 @@ let check_meta_tyopt type_irrelevant = function
       raise
        (Semantic_cocci.Semantic
           "can't inherit the freshness of an identifier")
-  | Ast.MetaListlenDecl((rule,name)) ->
-      (match lookup rule name with
-       Ast.MetaListlenDecl(_) -> ()
-      | _ ->
-         raise
-           (Semantic_cocci.Semantic
-              ("incompatible inheritance declaration "^name)))
   | Ast.MetaTypeDecl(Ast.NONE,(rule,name)) ->
       (match lookup rule name with
        Ast.MetaTypeDecl(_,_) -> ()
@@ -269,6 +264,13 @@ let check_meta_tyopt type_irrelevant = function
          raise
            (Semantic_cocci.Semantic
               ("incompatible inheritance declaration "^name)))
+  | Ast.MetaListlenDecl((rule,name)) ->
+      (match lookup rule name with
+       Ast.MetaListlenDecl(_) -> ()
+      | _ ->
+         raise
+           (Semantic_cocci.Semantic
+              ("incompatible inheritance declaration "^name)))
   | Ast.MetaParamDecl(Ast.NONE,(rule,name)) ->
       (match lookup rule name with
        Ast.MetaParamDecl(_,_) -> ()
@@ -283,6 +285,13 @@ let check_meta_tyopt type_irrelevant = function
          raise
            (Semantic_cocci.Semantic
               ("incompatible inheritance declaration "^name)))
+  | Ast.MetaConstDecl(Ast.NONE,(rule,name),ty) ->
+      (match lookup rule name with
+       Ast.MetaConstDecl(_,_,ty1) when type_irrelevant or ty = ty1 -> ()
+      | _ ->
+         raise
+           (Semantic_cocci.Semantic
+              ("incompatible inheritance declaration "^name)))
   | Ast.MetaErrDecl(Ast.NONE,(rule,name)) ->
       (match lookup rule name with
        Ast.MetaErrDecl(_,_) -> ()
@@ -319,6 +328,27 @@ let check_meta_tyopt type_irrelevant = function
          raise
            (Semantic_cocci.Semantic
               ("incompatible inheritance declaration "^name)))
+  | Ast.MetaDeclDecl(Ast.NONE,(rule,name)) ->
+      (match lookup rule name with
+       Ast.MetaDeclDecl(_,_) -> ()
+      | _ ->
+         raise
+           (Semantic_cocci.Semantic
+              ("incompatible inheritance declaration "^name)))
+  | Ast.MetaFieldDecl(Ast.NONE,(rule,name)) ->
+      (match lookup rule name with
+       Ast.MetaFieldDecl(_,_) -> ()
+      | _ ->
+         raise
+           (Semantic_cocci.Semantic
+              ("incompatible inheritance declaration "^name)))
+  | Ast.MetaFieldListDecl(Ast.NONE,(rule,name),len_name) ->
+      (match lookup rule name with
+       Ast.MetaFieldListDecl(_,_,_) -> ()
+      | _ ->
+         raise
+           (Semantic_cocci.Semantic
+              ("incompatible inheritance declaration "^name)))
   | Ast.MetaStmDecl(Ast.NONE,(rule,name)) ->
       (match lookup rule name with
        Ast.MetaStmDecl(_,_) -> ()
@@ -347,13 +377,6 @@ let check_meta_tyopt type_irrelevant = function
          raise
            (Semantic_cocci.Semantic
               ("incompatible inheritance declaration "^name)))
-  | Ast.MetaConstDecl(Ast.NONE,(rule,name),ty) ->
-      (match lookup rule name with
-       Ast.MetaConstDecl(_,_,ty1) when type_irrelevant or ty = ty1 -> ()
-      | _ ->
-         raise
-           (Semantic_cocci.Semantic
-              ("incompatible inheritance declaration "^name)))
   | Ast.MetaPosDecl(Ast.NONE,(rule,name)) ->
       (match lookup rule name with
        Ast.MetaPosDecl(_,_) ->