let identifier =
let all_kw = Hashtbl.create 37 in
let c_kw = Hashtbl.create 37 in
let type_kw = Hashtbl.create 3 in
List.iter
(fun (i,t,flag) ->
Hashtbl.add all_kw i t;
if flag then Hashtbl.add c_kw i t
)
[
"assert", ASSERT, false;
"assigns", ASSIGNS, false;
"assumes", ASSUMES, false;
"at", EXT_AT, false;
"axiom", AXIOM, false;
"axiomatic", AXIOMATIC, false;
"behavior", BEHAVIOR, false;
"behaviors", BEHAVIORS, false;
"breaks", BREAKS, false;
"case", CASE, true;
"char", CHAR, true;
"complete", COMPLETE, false;
"const", CONST, true;
"continues", CONTINUES, false;
"contract", CONTRACT, false;
"decreases", DECREASES, false;
"disjoint", DISJOINT, false;
"double", DOUBLE, true;
"else", ELSE, true;
"ensures", ENSURES, false ;
"enum", ENUM, true;
"exits", EXITS, false;
"function", FUNCTION, false;
"float", FLOAT, true;
"for", FOR, true;
"global", GLOBAL, false;
"if", IF, true;
"impact", IMPACT, false;
"inductive", INDUCTIVE, false;
"include", INCLUDE, false;
"int", INT, true;
"invariant", INVARIANT, false;
"label", LABEL, false;
"lemma", LEMMA, false;
"let", EXT_LET, false;
"logic", LOGIC, false;
"long", LONG, true;
"loop", LOOP, false;
"module", MODULE, false;
"pragma", PRAGMA, false;
"predicate", PREDICATE, false;
"reads", READS, false;
"requires", REQUIRES, false;
"returns", RETURNS, false;
"short", SHORT, true;
"signed", SIGNED, true;
"sizeof", SIZEOF, true;
"slice", SLICE, false;
"struct", STRUCT, true;
"terminates", TERMINATES, false;
"type", TYPE, false;
"union", UNION, true;
"unsigned", UNSIGNED, true;
"variant", VARIANT, false;
"void", VOID, true;
"volatile", VOLATILE, true;
"writes", WRITES, false;
];
List.iter (fun (x, y) -> Hashtbl.add type_kw x y)
["integer", INTEGER; "real", REAL; "boolean", BOOLEAN; ];
fun s ->
try
Hashtbl.find (if Logic_utils.is_kw_c_mode () then c_kw else all_kw) s
with Not_found ->
if Logic_env.typename_status s then TYPENAME s
else
(try
Hashtbl.find type_kw s
with Not_found ->
if Logic_utils.is_rt_type_mode () then TYPENAME s
else IDENTIFIER s)