|
18 | 18 | #include "diatest.h" |
19 | 19 | #include "ebmc_base.h" |
20 | 20 | #include "ebmc_error.h" |
| 21 | +#include "ebmc_language.h" |
21 | 22 | #include "ebmc_version.h" |
22 | 23 | #include "format_hooks.h" |
23 | 24 | #include "instrument_buechi.h" |
|
46 | 47 | #include "coverage/coverage.h" |
47 | 48 | #endif |
48 | 49 |
|
| 50 | +class ebmc_languagest : public ebmc_languaget |
| 51 | +{ |
| 52 | +public: |
| 53 | + ebmc_languagest(cmdlinet &_cmdline, message_handlert &_message_handler) |
| 54 | + : ebmc_languaget{_cmdline, _message_handler} |
| 55 | + { |
| 56 | + } |
| 57 | + |
| 58 | + std::optional<transition_systemt> transition_system() override |
| 59 | + { |
| 60 | + if(cmdline.isset("preprocess")) |
| 61 | + { |
| 62 | + preprocess(cmdline, message_handler); |
| 63 | + return {}; |
| 64 | + } |
| 65 | + |
| 66 | + if(cmdline.isset("show-parse")) |
| 67 | + { |
| 68 | + show_parse(cmdline, message_handler); |
| 69 | + return {}; |
| 70 | + } |
| 71 | + |
| 72 | + if( |
| 73 | + cmdline.isset("show-modules") || cmdline.isset("modules-xml") || |
| 74 | + cmdline.isset("json-modules")) |
| 75 | + { |
| 76 | + show_modules(cmdline, message_handler); |
| 77 | + return {}; |
| 78 | + } |
| 79 | + |
| 80 | + if(cmdline.isset("show-module-hierarchy")) |
| 81 | + { |
| 82 | + show_module_hierarchy(cmdline, message_handler); |
| 83 | + return {}; |
| 84 | + } |
| 85 | + |
| 86 | + if(cmdline.isset("show-symbol-table")) |
| 87 | + { |
| 88 | + show_symbol_table(cmdline, message_handler); |
| 89 | + return {}; |
| 90 | + } |
| 91 | + |
| 92 | + return get_transition_system(cmdline, message_handler); |
| 93 | + } |
| 94 | +}; |
| 95 | + |
49 | 96 | /*******************************************************************\ |
50 | 97 |
|
51 | 98 | Function: ebmc_parse_optionst::doit |
@@ -107,23 +154,6 @@ int ebmc_parse_optionst::doit() |
107 | 154 | return 0; |
108 | 155 | } |
109 | 156 |
|
110 | | - if(cmdline.isset("preprocess")) |
111 | | - return preprocess(cmdline, ui_message_handler); |
112 | | - |
113 | | - if(cmdline.isset("show-parse")) |
114 | | - return show_parse(cmdline, ui_message_handler); |
115 | | - |
116 | | - if( |
117 | | - cmdline.isset("show-modules") || cmdline.isset("modules-xml") || |
118 | | - cmdline.isset("json-modules")) |
119 | | - return show_modules(cmdline, ui_message_handler); |
120 | | - |
121 | | - if(cmdline.isset("show-module-hierarchy")) |
122 | | - return show_module_hierarchy(cmdline, ui_message_handler); |
123 | | - |
124 | | - if(cmdline.isset("show-symbol-table")) |
125 | | - return show_symbol_table(cmdline, ui_message_handler); |
126 | | - |
127 | 157 | if(cmdline.isset("coverage")) |
128 | 158 | { |
129 | 159 | throw ebmc_errort() << "This option is currently disabled"; |
@@ -207,7 +237,15 @@ int ebmc_parse_optionst::doit() |
207 | 237 | } |
208 | 238 |
|
209 | 239 | // get the transition system |
210 | | - auto transition_system = get_transition_system(cmdline, ui_message_handler); |
| 240 | + ebmc_languagest ebmc_languages{cmdline, ui_message_handler}; |
| 241 | + |
| 242 | + auto transition_system_opt = ebmc_languages.transition_system(); |
| 243 | + |
| 244 | + // Did we produce diagnostics instead? |
| 245 | + if(!transition_system_opt.has_value()) |
| 246 | + return 0; |
| 247 | + |
| 248 | + auto &transition_system = transition_system_opt.value(); |
211 | 249 |
|
212 | 250 | // get the properties |
213 | 251 | auto properties = ebmc_propertiest::from_command_line( |
|
0 commit comments