File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -427,6 +427,39 @@ exprt smt2_parsert::function_application()
427
427
throw error (msg.str ());
428
428
}
429
429
}
430
+ else if (buffer == " !" )
431
+ {
432
+ // these are "term attributes"
433
+ const auto term = expression ();
434
+
435
+ while (peek () == KEYWORD)
436
+ {
437
+ next_token (); // eat the keyword
438
+ if (buffer == " named" )
439
+ {
440
+ // 'named terms' must be Boolean
441
+ if (term.type ().id () != ID_bool)
442
+ throw error (" named terms must be Boolean" );
443
+
444
+ if (next_token () == SYMBOL)
445
+ {
446
+ const symbol_exprt symbol_expr (buffer, bool_typet ());
447
+ auto &named_term = named_terms[symbol_expr.get_identifier ()];
448
+ named_term.term = term;
449
+ named_term.name = symbol_expr;
450
+ }
451
+ else
452
+ throw error (" invalid name attribute, expected symbol" );
453
+ }
454
+ else
455
+ throw error (" unknown term attribute" );
456
+ }
457
+
458
+ if (next_token () != CLOSE)
459
+ throw error (" expected ')' at end of term attribute" );
460
+ else
461
+ return term;
462
+ }
430
463
else
431
464
{
432
465
// non-indexed symbol; hash it
Original file line number Diff line number Diff line change @@ -42,6 +42,15 @@ class smt2_parsert:public smt2_tokenizert
42
42
using id_mapt=std::map<irep_idt, idt>;
43
43
id_mapt id_map;
44
44
45
+ struct named_termt
46
+ {
47
+ exprt term;
48
+ symbol_exprt name;
49
+ };
50
+
51
+ using named_termst = std::map<irep_idt, named_termt>;
52
+ named_termst named_terms;
53
+
45
54
bool exit;
46
55
47
56
// / This skips tokens until all bracketed expressions are closed
You can’t perform that action at this time.
0 commit comments