Attributes are wrapped in the SmPL AST. Assign the Attribute variant an
index.

Signed-off-by: Jaskaran Singh <[email protected]>
---
 parsing_cocci/index.ml  | 6 +++++-
 parsing_cocci/index.mli | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/parsing_cocci/index.ml b/parsing_cocci/index.ml
index 8df048dd..cb3ac7ec 100644
--- a/parsing_cocci/index.ml
+++ b/parsing_cocci/index.ml
@@ -5,7 +5,7 @@
  *)
 
 (* create an index for each constructor *)
-(* current max is 192, also unused: 8-9, 15, 39, 40, 42, 46, 57, 65, 85-86,
+(* current max is 192, also unused: 8-9, 15, 40, 42, 46, 57, 65, 85-86,
  113-115, 140, 162 *)
 
 (* doesn't really work - requires that identical terms with no token
@@ -229,6 +229,10 @@ let string_fragment f =
   | Ast0.Strdots(dots) -> [168]
   | Ast0.MetaFormatList(pct,name,cstr,lenname) -> [169]
 
+let attribute a =
+  match Ast0.unwrap a with
+    Ast0.Attribute(attr) -> [39]
+
 let top_level t =
   match Ast0.unwrap t with
     Ast0.NONDECL(stmt) -> [90]
diff --git a/parsing_cocci/index.mli b/parsing_cocci/index.mli
index 4f86f5ba..e3c10177 100644
--- a/parsing_cocci/index.mli
+++ b/parsing_cocci/index.mli
@@ -28,4 +28,5 @@ val forinfo : Ast0_cocci.forinfo -> int list
 val pragmainfo : Ast0_cocci.pragmainfo -> int list
 val case_line : Ast0_cocci.case_line -> int list
 val string_fragment : Ast0_cocci.string_fragment -> int list
+val attribute : Ast0_cocci.attr -> int list
 val top_level : Ast0_cocci.top_level -> int list
-- 
2.21.3

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to