Skip to content
Snippets Groups Projects
Commit bd9be0d6 authored by Virgile Prevosto's avatar Virgile Prevosto
Browse files

[logic] allow empty list of arguments after an extension keyword.

parent 876a96c4
No related branches found
No related tags found
No related merge requests found
...@@ -1189,14 +1189,23 @@ ne_simple_clauses: ...@@ -1189,14 +1189,23 @@ ne_simple_clauses:
| post_cond_kind full_lexpr clause_kw { missing 2 ";" $3 } | post_cond_kind full_lexpr clause_kw { missing 2 ";" $3 }
| allocation clause_kw { missing 1 ";" $2 } | allocation clause_kw { missing 1 ";" $2 }
| ASSIGNS full_assigns clause_kw { missing 2 ";" $3 } | ASSIGNS full_assigns clause_kw { missing 2 ";" $3 }
| EXT_CONTRACT grammar_extension clause_kw { missing 1 ";" $3 } | EXT_CONTRACT ne_grammar_extension clause_kw { missing 1 ";" $3 }
; ;
grammar_extension: ne_grammar_extension:
/* Grammar Extensibility for plugins */
| full_zones { $1 } | full_zones { $1 }
; ;
/* possibly empty list of terms, for ACSL extensions registered by plugins. */
grammar_extension:
| enter_kw_c_mode extension_content exit_kw_c_mode { $2 }
;
extension_content:
| /* epsilon */ { [] }
| zones { $1 }
;
post_cond_kind: post_cond_kind:
| post_cond { fst $1 } | post_cond { fst $1 }
; ;
......
...@@ -48,6 +48,7 @@ void loop (void) { ...@@ -48,6 +48,7 @@ void loop (void) {
//@ for ca_foo: ca_foo \true; //@ for ca_foo: ca_foo \true;
//@ ns_foo \true; //@ ns_foo \true;
//@ baz \true; //@ baz \true;
//@ empty_extension;
/*@ loop invariant \true; */ /*@ loop invariant \true; */
while (0) { } while (0) { }
} }
...@@ -104,6 +104,10 @@ let type_bla typing_context _loc l = ...@@ -104,6 +104,10 @@ let type_bla typing_context _loc l =
in in
Ext_preds l Ext_preds l
let type_empty _ loc = function
| [] -> Ext_terms [];
| _ -> Kernel.abort ~loc "empty_extension should not have arguments"
let () = let () =
Acsl_extension.register_behavior "foo" type_foo false ; Acsl_extension.register_behavior "foo" type_foo false ;
Acsl_extension.register_code_annot_next_loop "lfoo" type_foo false ; Acsl_extension.register_code_annot_next_loop "lfoo" type_foo false ;
...@@ -113,7 +117,8 @@ let () = ...@@ -113,7 +117,8 @@ let () =
Acsl_extension.register_behavior Acsl_extension.register_behavior
"bar" type_bar ~printer:print_bar ~visitor:visit_bar false ; "bar" type_bar ~printer:print_bar ~visitor:visit_bar false ;
Acsl_extension.register_behavior "bla" type_bla false ; Acsl_extension.register_behavior "bla" type_bla false ;
Acsl_extension.register_code_annot_next_both "baz" type_baz false Acsl_extension.register_code_annot_next_both "baz" type_baz false;
Acsl_extension.register_code_annot "empty_extension" type_empty false
let run () = let run () =
Ast.compute (); Ast.compute ();
......
...@@ -55,6 +55,7 @@ void loop(void) ...@@ -55,6 +55,7 @@ void loop(void)
/*@ for ca_foo: ca_foo \true; */ ; /*@ for ca_foo: ca_foo \true; */ ;
/*@ ns_foo \true; */ /*@ ns_foo \true; */
/*@ baz \true; */ /*@ baz \true; */
/*@ empty_extension ; */
/*@ loop invariant \true; */ /*@ loop invariant \true; */
while (1) break; while (1) break;
return; return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment