Release of coccinelle 1.0.0-rc9
[bpt/coccinelle.git] / parsing_c / lexer_parser.mli
index 2f6287f..1f2527a 100644 (file)
@@ -13,6 +13,7 @@ val _typedef : (string, identkind) Common.scoped_h_env ref
 
 val add_ident   : string -> unit
 val add_typedef : string -> unit
+
 val add_typedef_root : string -> unit
 
 val new_scope : unit -> unit
@@ -20,20 +21,32 @@ val del_scope : unit -> unit
 
 val is_typedef : string -> bool
 
-val lexer_reset_typedef : unit -> unit
+val lexer_reset_typedef :
+    (string, identkind) Common.scoped_h_env option (* known typedefs *) -> unit
 
 val _old_state : (string, identkind) Common.scoped_h_env ref
 val save_typedef_state : unit -> unit
 val restore_typedef_state : unit -> unit
 
 
-type lexer_hint = { 
-    mutable parameterDeclaration: bool;
-    mutable structDefinition: int; (* depth in struct def, 0 = not in struct *)
-(*    mutable statements: bool; *)
-    mutable toplevel: bool;
-  }
+type context =
+  | InTopLevel
+  | InFunction
+  | InStruct
+  | InParameter
+  | InInitializer
+  | InEnum
+
+type lexer_hint = {
+  mutable context_stack: context Common.stack;
+ }
 
 val _lexer_hint : lexer_hint ref
+val current_context: unit -> context
+val push_context: context -> unit
+val pop_context: unit -> unit
 
 val default_hint : unit -> lexer_hint
+
+val is_top_or_struct : context -> bool
+