Skip to content

Commit a93aa31

Browse files
authored
Merge pull request #1209 from diffblue/format_hooks
`format_hook` for `next_symbol` expressions
2 parents ff4221b + 6fe3b4c commit a93aa31

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed

src/ebmc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ SRC = \
1717
ebmc_properties.cpp \
1818
ebmc_solver_factory.cpp \
1919
ebmc_version.cpp \
20+
format_hooks.cpp \
2021
instrument_past.cpp \
2122
instrument_buechi.cpp \
2223
k_induction.cpp \

src/ebmc/ebmc_parse_options.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Author: Daniel Kroening, [email protected]
1919
#include "ebmc_base.h"
2020
#include "ebmc_error.h"
2121
#include "ebmc_version.h"
22+
#include "format_hooks.h"
2223
#include "instrument_buechi.h"
2324
#include "liveness_to_safety.h"
2425
#include "netlist.h"
@@ -71,6 +72,7 @@ int ebmc_parse_optionst::doit()
7172
}
7273

7374
register_languages();
75+
format_hooks();
7476

7577
if(cmdline.isset("version"))
7678
{

src/ebmc/format_hooks.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*******************************************************************\
2+
3+
Module:
4+
5+
Author: Daniel Kroening, [email protected]
6+
7+
\*******************************************************************/
8+
9+
#include "format_hooks.h"
10+
11+
#include <util/format_expr.h>
12+
13+
#include <trans-word-level/next_symbol.h>
14+
15+
void format_hooks()
16+
{
17+
add_format_hook(
18+
ID_next_symbol,
19+
[](std::ostream &os, const exprt &expr) -> std::ostream &
20+
{
21+
const auto &next_symbol_expr = to_next_symbol_expr(expr);
22+
os << "next(" << next_symbol_expr.identifier() << ')';
23+
return os;
24+
});
25+
}

src/ebmc/format_hooks.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*******************************************************************\
2+
3+
Module:
4+
5+
Author: Daniel Kroening, [email protected]
6+
7+
\*******************************************************************/
8+
9+
#ifndef EBMC_FORMAT_HOOKS_H
10+
#define EBMC_FORMAT_HOOKS_H
11+
12+
void format_hooks();
13+
14+
#endif // EBMC_FORMAT_HOOKS_H

0 commit comments

Comments
 (0)