1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Mathias Preiner, Aina Niemetz |
4 |
|
* |
5 |
|
* This file is part of the cvc5 project. |
6 |
|
* |
7 |
|
* Copyright (c) 2009-2021 by the authors listed in the file AUTHORS |
8 |
|
* in the top-level source directory and their institutional affiliations. |
9 |
|
* All rights reserved. See the file COPYING in the top-level source |
10 |
|
* directory for licensing information. |
11 |
|
* **************************************************************************** |
12 |
|
* |
13 |
|
* Option template for option modules. |
14 |
|
* |
15 |
|
* For each <module>_options.toml configuration file, mkoptions.py |
16 |
|
* expands this template and generates a <module>_options.cpp file. |
17 |
|
*/ |
18 |
|
#include "options/strings_options.h" |
19 |
|
|
20 |
|
#include <iostream> |
21 |
|
|
22 |
|
#include "base/check.h" |
23 |
|
#include "options/option_exception.h" |
24 |
|
|
25 |
|
// clang-format off |
26 |
|
namespace cvc5 { |
27 |
|
|
28 |
|
template <> options::regExpElim__option_t::type& Options::ref( |
29 |
|
options::regExpElim__option_t) |
30 |
|
{ |
31 |
|
return strings().regExpElim; |
32 |
|
} |
33 |
87010 |
template <> const options::regExpElim__option_t::type& Options::operator[]( |
34 |
|
options::regExpElim__option_t) const |
35 |
|
{ |
36 |
87010 |
return strings().regExpElim; |
37 |
|
} |
38 |
|
template <> bool Options::wasSetByUser(options::regExpElim__option_t) const |
39 |
|
{ |
40 |
|
return strings().regExpElim__setByUser__; |
41 |
|
} |
42 |
|
template <> options::regExpElimAgg__option_t::type& Options::ref( |
43 |
|
options::regExpElimAgg__option_t) |
44 |
|
{ |
45 |
|
return strings().regExpElimAgg; |
46 |
|
} |
47 |
8954 |
template <> const options::regExpElimAgg__option_t::type& Options::operator[]( |
48 |
|
options::regExpElimAgg__option_t) const |
49 |
|
{ |
50 |
8954 |
return strings().regExpElimAgg; |
51 |
|
} |
52 |
|
template <> bool Options::wasSetByUser(options::regExpElimAgg__option_t) const |
53 |
|
{ |
54 |
|
return strings().regExpElimAgg__setByUser__; |
55 |
|
} |
56 |
|
template <> options::stringRegExpInterMode__option_t::type& Options::ref( |
57 |
|
options::stringRegExpInterMode__option_t) |
58 |
|
{ |
59 |
|
return strings().stringRegExpInterMode; |
60 |
|
} |
61 |
1295 |
template <> const options::stringRegExpInterMode__option_t::type& Options::operator[]( |
62 |
|
options::stringRegExpInterMode__option_t) const |
63 |
|
{ |
64 |
1295 |
return strings().stringRegExpInterMode; |
65 |
|
} |
66 |
|
template <> bool Options::wasSetByUser(options::stringRegExpInterMode__option_t) const |
67 |
|
{ |
68 |
|
return strings().stringRegExpInterMode__setByUser__; |
69 |
|
} |
70 |
|
template <> options::stringCheckEntailLen__option_t::type& Options::ref( |
71 |
|
options::stringCheckEntailLen__option_t) |
72 |
|
{ |
73 |
|
return strings().stringCheckEntailLen; |
74 |
|
} |
75 |
2527 |
template <> const options::stringCheckEntailLen__option_t::type& Options::operator[]( |
76 |
|
options::stringCheckEntailLen__option_t) const |
77 |
|
{ |
78 |
2527 |
return strings().stringCheckEntailLen; |
79 |
|
} |
80 |
|
template <> bool Options::wasSetByUser(options::stringCheckEntailLen__option_t) const |
81 |
|
{ |
82 |
|
return strings().stringCheckEntailLen__setByUser__; |
83 |
|
} |
84 |
|
template <> options::stringEager__option_t::type& Options::ref( |
85 |
|
options::stringEager__option_t) |
86 |
|
{ |
87 |
|
return strings().stringEager; |
88 |
|
} |
89 |
17082 |
template <> const options::stringEager__option_t::type& Options::operator[]( |
90 |
|
options::stringEager__option_t) const |
91 |
|
{ |
92 |
17082 |
return strings().stringEager; |
93 |
|
} |
94 |
|
template <> bool Options::wasSetByUser(options::stringEager__option_t) const |
95 |
|
{ |
96 |
|
return strings().stringEager__setByUser__; |
97 |
|
} |
98 |
|
template <> options::stringEagerEval__option_t::type& Options::ref( |
99 |
|
options::stringEagerEval__option_t) |
100 |
|
{ |
101 |
|
return strings().stringEagerEval; |
102 |
|
} |
103 |
8954 |
template <> const options::stringEagerEval__option_t::type& Options::operator[]( |
104 |
|
options::stringEagerEval__option_t) const |
105 |
|
{ |
106 |
8954 |
return strings().stringEagerEval; |
107 |
|
} |
108 |
|
template <> bool Options::wasSetByUser(options::stringEagerEval__option_t) const |
109 |
|
{ |
110 |
|
return strings().stringEagerEval__setByUser__; |
111 |
|
} |
112 |
|
template <> options::stringEagerLen__option_t::type& Options::ref( |
113 |
|
options::stringEagerLen__option_t) |
114 |
|
{ |
115 |
|
return strings().stringEagerLen; |
116 |
|
} |
117 |
44721 |
template <> const options::stringEagerLen__option_t::type& Options::operator[]( |
118 |
|
options::stringEagerLen__option_t) const |
119 |
|
{ |
120 |
44721 |
return strings().stringEagerLen; |
121 |
|
} |
122 |
|
template <> bool Options::wasSetByUser(options::stringEagerLen__option_t) const |
123 |
|
{ |
124 |
|
return strings().stringEagerLen__setByUser__; |
125 |
|
} |
126 |
665 |
template <> options::stringExp__option_t::type& Options::ref( |
127 |
|
options::stringExp__option_t) |
128 |
|
{ |
129 |
665 |
return strings().stringExp; |
130 |
|
} |
131 |
130058 |
template <> const options::stringExp__option_t::type& Options::operator[]( |
132 |
|
options::stringExp__option_t) const |
133 |
|
{ |
134 |
130058 |
return strings().stringExp; |
135 |
|
} |
136 |
|
template <> bool Options::wasSetByUser(options::stringExp__option_t) const |
137 |
|
{ |
138 |
|
return strings().stringExp__setByUser__; |
139 |
|
} |
140 |
|
template <> options::stringFlatForms__option_t::type& Options::ref( |
141 |
|
options::stringFlatForms__option_t) |
142 |
|
{ |
143 |
|
return strings().stringFlatForms; |
144 |
|
} |
145 |
8541 |
template <> const options::stringFlatForms__option_t::type& Options::operator[]( |
146 |
|
options::stringFlatForms__option_t) const |
147 |
|
{ |
148 |
8541 |
return strings().stringFlatForms; |
149 |
|
} |
150 |
|
template <> bool Options::wasSetByUser(options::stringFlatForms__option_t) const |
151 |
|
{ |
152 |
|
return strings().stringFlatForms__setByUser__; |
153 |
|
} |
154 |
|
template <> options::stringFMF__option_t::type& Options::ref( |
155 |
|
options::stringFMF__option_t) |
156 |
|
{ |
157 |
|
return strings().stringFMF; |
158 |
|
} |
159 |
97354 |
template <> const options::stringFMF__option_t::type& Options::operator[]( |
160 |
|
options::stringFMF__option_t) const |
161 |
|
{ |
162 |
97354 |
return strings().stringFMF; |
163 |
|
} |
164 |
|
template <> bool Options::wasSetByUser(options::stringFMF__option_t) const |
165 |
|
{ |
166 |
|
return strings().stringFMF__setByUser__; |
167 |
|
} |
168 |
|
template <> options::stringGuessModel__option_t::type& Options::ref( |
169 |
|
options::stringGuessModel__option_t) |
170 |
|
{ |
171 |
|
return strings().stringGuessModel; |
172 |
|
} |
173 |
7934 |
template <> const options::stringGuessModel__option_t::type& Options::operator[]( |
174 |
|
options::stringGuessModel__option_t) const |
175 |
|
{ |
176 |
7934 |
return strings().stringGuessModel; |
177 |
|
} |
178 |
|
template <> bool Options::wasSetByUser(options::stringGuessModel__option_t) const |
179 |
|
{ |
180 |
|
return strings().stringGuessModel__setByUser__; |
181 |
|
} |
182 |
|
template <> options::stringInferAsLemmas__option_t::type& Options::ref( |
183 |
|
options::stringInferAsLemmas__option_t) |
184 |
|
{ |
185 |
|
return strings().stringInferAsLemmas; |
186 |
|
} |
187 |
13893 |
template <> const options::stringInferAsLemmas__option_t::type& Options::operator[]( |
188 |
|
options::stringInferAsLemmas__option_t) const |
189 |
|
{ |
190 |
13893 |
return strings().stringInferAsLemmas; |
191 |
|
} |
192 |
|
template <> bool Options::wasSetByUser(options::stringInferAsLemmas__option_t) const |
193 |
|
{ |
194 |
|
return strings().stringInferAsLemmas__setByUser__; |
195 |
|
} |
196 |
|
template <> options::stringInferSym__option_t::type& Options::ref( |
197 |
|
options::stringInferSym__option_t) |
198 |
|
{ |
199 |
|
return strings().stringInferSym; |
200 |
|
} |
201 |
75332 |
template <> const options::stringInferSym__option_t::type& Options::operator[]( |
202 |
|
options::stringInferSym__option_t) const |
203 |
|
{ |
204 |
75332 |
return strings().stringInferSym; |
205 |
|
} |
206 |
|
template <> bool Options::wasSetByUser(options::stringInferSym__option_t) const |
207 |
|
{ |
208 |
|
return strings().stringInferSym__setByUser__; |
209 |
|
} |
210 |
|
template <> options::stringIgnNegMembership__option_t::type& Options::ref( |
211 |
|
options::stringIgnNegMembership__option_t) |
212 |
|
{ |
213 |
|
return strings().stringIgnNegMembership; |
214 |
|
} |
215 |
352 |
template <> const options::stringIgnNegMembership__option_t::type& Options::operator[]( |
216 |
|
options::stringIgnNegMembership__option_t) const |
217 |
|
{ |
218 |
352 |
return strings().stringIgnNegMembership; |
219 |
|
} |
220 |
|
template <> bool Options::wasSetByUser(options::stringIgnNegMembership__option_t) const |
221 |
|
{ |
222 |
|
return strings().stringIgnNegMembership__setByUser__; |
223 |
|
} |
224 |
|
template <> options::stringLazyPreproc__option_t::type& Options::ref( |
225 |
|
options::stringLazyPreproc__option_t) |
226 |
|
{ |
227 |
|
return strings().stringLazyPreproc; |
228 |
|
} |
229 |
19568 |
template <> const options::stringLazyPreproc__option_t::type& Options::operator[]( |
230 |
|
options::stringLazyPreproc__option_t) const |
231 |
|
{ |
232 |
19568 |
return strings().stringLazyPreproc; |
233 |
|
} |
234 |
|
template <> bool Options::wasSetByUser(options::stringLazyPreproc__option_t) const |
235 |
|
{ |
236 |
|
return strings().stringLazyPreproc__setByUser__; |
237 |
|
} |
238 |
|
template <> options::stringLenNorm__option_t::type& Options::ref( |
239 |
|
options::stringLenNorm__option_t) |
240 |
|
{ |
241 |
|
return strings().stringLenNorm; |
242 |
|
} |
243 |
8541 |
template <> const options::stringLenNorm__option_t::type& Options::operator[]( |
244 |
|
options::stringLenNorm__option_t) const |
245 |
|
{ |
246 |
8541 |
return strings().stringLenNorm; |
247 |
|
} |
248 |
|
template <> bool Options::wasSetByUser(options::stringLenNorm__option_t) const |
249 |
|
{ |
250 |
|
return strings().stringLenNorm__setByUser__; |
251 |
|
} |
252 |
|
template <> options::stringLenPropCsp__option_t::type& Options::ref( |
253 |
|
options::stringLenPropCsp__option_t) |
254 |
|
{ |
255 |
|
return strings().stringLenPropCsp; |
256 |
|
} |
257 |
|
template <> const options::stringLenPropCsp__option_t::type& Options::operator[]( |
258 |
|
options::stringLenPropCsp__option_t) const |
259 |
|
{ |
260 |
|
return strings().stringLenPropCsp; |
261 |
|
} |
262 |
|
template <> bool Options::wasSetByUser(options::stringLenPropCsp__option_t) const |
263 |
|
{ |
264 |
|
return strings().stringLenPropCsp__setByUser__; |
265 |
|
} |
266 |
|
template <> options::stringMinPrefixExplain__option_t::type& Options::ref( |
267 |
|
options::stringMinPrefixExplain__option_t) |
268 |
|
{ |
269 |
|
return strings().stringMinPrefixExplain; |
270 |
|
} |
271 |
17502 |
template <> const options::stringMinPrefixExplain__option_t::type& Options::operator[]( |
272 |
|
options::stringMinPrefixExplain__option_t) const |
273 |
|
{ |
274 |
17502 |
return strings().stringMinPrefixExplain; |
275 |
|
} |
276 |
|
template <> bool Options::wasSetByUser(options::stringMinPrefixExplain__option_t) const |
277 |
|
{ |
278 |
|
return strings().stringMinPrefixExplain__setByUser__; |
279 |
|
} |
280 |
42 |
template <> options::stringProcessLoopMode__option_t::type& Options::ref( |
281 |
|
options::stringProcessLoopMode__option_t) |
282 |
|
{ |
283 |
42 |
return strings().stringProcessLoopMode; |
284 |
|
} |
285 |
1584 |
template <> const options::stringProcessLoopMode__option_t::type& Options::operator[]( |
286 |
|
options::stringProcessLoopMode__option_t) const |
287 |
|
{ |
288 |
1584 |
return strings().stringProcessLoopMode; |
289 |
|
} |
290 |
42 |
template <> bool Options::wasSetByUser(options::stringProcessLoopMode__option_t) const |
291 |
|
{ |
292 |
42 |
return strings().stringProcessLoopMode__setByUser__; |
293 |
|
} |
294 |
|
template <> options::stringRExplainLemmas__option_t::type& Options::ref( |
295 |
|
options::stringRExplainLemmas__option_t) |
296 |
|
{ |
297 |
|
return strings().stringRExplainLemmas; |
298 |
|
} |
299 |
14562 |
template <> const options::stringRExplainLemmas__option_t::type& Options::operator[]( |
300 |
|
options::stringRExplainLemmas__option_t) const |
301 |
|
{ |
302 |
14562 |
return strings().stringRExplainLemmas; |
303 |
|
} |
304 |
|
template <> bool Options::wasSetByUser(options::stringRExplainLemmas__option_t) const |
305 |
|
{ |
306 |
|
return strings().stringRExplainLemmas__setByUser__; |
307 |
|
} |
308 |
|
template <> options::stringUnifiedVSpt__option_t::type& Options::ref( |
309 |
|
options::stringUnifiedVSpt__option_t) |
310 |
|
{ |
311 |
|
return strings().stringUnifiedVSpt; |
312 |
|
} |
313 |
5094 |
template <> const options::stringUnifiedVSpt__option_t::type& Options::operator[]( |
314 |
|
options::stringUnifiedVSpt__option_t) const |
315 |
|
{ |
316 |
5094 |
return strings().stringUnifiedVSpt; |
317 |
|
} |
318 |
|
template <> bool Options::wasSetByUser(options::stringUnifiedVSpt__option_t) const |
319 |
|
{ |
320 |
|
return strings().stringUnifiedVSpt__setByUser__; |
321 |
|
} |
322 |
|
|
323 |
|
namespace options { |
324 |
|
|
325 |
|
thread_local struct regExpElim__option_t regExpElim; |
326 |
|
thread_local struct regExpElimAgg__option_t regExpElimAgg; |
327 |
|
thread_local struct stringRegExpInterMode__option_t stringRegExpInterMode; |
328 |
|
thread_local struct stringCheckEntailLen__option_t stringCheckEntailLen; |
329 |
|
thread_local struct stringEager__option_t stringEager; |
330 |
|
thread_local struct stringEagerEval__option_t stringEagerEval; |
331 |
|
thread_local struct stringEagerLen__option_t stringEagerLen; |
332 |
|
thread_local struct stringExp__option_t stringExp; |
333 |
|
thread_local struct stringFlatForms__option_t stringFlatForms; |
334 |
|
thread_local struct stringFMF__option_t stringFMF; |
335 |
|
thread_local struct stringGuessModel__option_t stringGuessModel; |
336 |
|
thread_local struct stringInferAsLemmas__option_t stringInferAsLemmas; |
337 |
|
thread_local struct stringInferSym__option_t stringInferSym; |
338 |
|
thread_local struct stringIgnNegMembership__option_t stringIgnNegMembership; |
339 |
|
thread_local struct stringLazyPreproc__option_t stringLazyPreproc; |
340 |
|
thread_local struct stringLenNorm__option_t stringLenNorm; |
341 |
|
thread_local struct stringLenPropCsp__option_t stringLenPropCsp; |
342 |
|
thread_local struct stringMinPrefixExplain__option_t stringMinPrefixExplain; |
343 |
|
thread_local struct stringProcessLoopMode__option_t stringProcessLoopMode; |
344 |
|
thread_local struct stringRExplainLemmas__option_t stringRExplainLemmas; |
345 |
|
thread_local struct stringUnifiedVSpt__option_t stringUnifiedVSpt; |
346 |
|
|
347 |
|
|
348 |
|
std::ostream& operator<<(std::ostream& os, RegExpInterMode mode) |
349 |
|
{ |
350 |
|
switch(mode) { |
351 |
|
case RegExpInterMode::NONE: |
352 |
|
return os << "RegExpInterMode::NONE"; |
353 |
|
case RegExpInterMode::ONE_CONSTANT: |
354 |
|
return os << "RegExpInterMode::ONE_CONSTANT"; |
355 |
|
case RegExpInterMode::CONSTANT: |
356 |
|
return os << "RegExpInterMode::CONSTANT"; |
357 |
|
case RegExpInterMode::ALL: |
358 |
|
return os << "RegExpInterMode::ALL"; |
359 |
|
default: |
360 |
|
Unreachable(); |
361 |
|
} |
362 |
|
return os; |
363 |
|
} |
364 |
|
|
365 |
|
RegExpInterMode stringToRegExpInterMode(const std::string& optarg) |
366 |
|
{ |
367 |
|
if (optarg == "none") |
368 |
|
{ |
369 |
|
return RegExpInterMode::NONE; |
370 |
|
} |
371 |
|
else if (optarg == "one-constant") |
372 |
|
{ |
373 |
|
return RegExpInterMode::ONE_CONSTANT; |
374 |
|
} |
375 |
|
else if (optarg == "constant") |
376 |
|
{ |
377 |
|
return RegExpInterMode::CONSTANT; |
378 |
|
} |
379 |
|
else if (optarg == "all") |
380 |
|
{ |
381 |
|
return RegExpInterMode::ALL; |
382 |
|
} |
383 |
|
else if (optarg == "help") |
384 |
|
{ |
385 |
|
std::cerr << "Regular expression intersection modes.\n" |
386 |
|
"Available modes for --re-inter-mode are:\n" |
387 |
|
"+ none\n" |
388 |
|
" Do not compute intersections for regular expressions.\n" |
389 |
|
"+ one-constant\n" |
390 |
|
" Compute intersections only between regular expressions such that at least one\n" |
391 |
|
" side does not contain re.allchar or re.range.\n" |
392 |
|
"+ constant (default)\n" |
393 |
|
" Compute intersections only between regular expressions that do not contain\n" |
394 |
|
" re.allchar or re.range.\n" |
395 |
|
"+ all\n" |
396 |
|
" Compute intersections for all regular expressions.\n"; |
397 |
|
std::exit(1); |
398 |
|
} |
399 |
|
throw OptionException(std::string("unknown option for --re-inter-mode: `") + |
400 |
|
optarg + "'. Try --re-inter-mode=help."); |
401 |
|
} |
402 |
|
|
403 |
|
std::ostream& operator<<(std::ostream& os, ProcessLoopMode mode) |
404 |
|
{ |
405 |
|
switch(mode) { |
406 |
|
case ProcessLoopMode::SIMPLE: |
407 |
|
return os << "ProcessLoopMode::SIMPLE"; |
408 |
|
case ProcessLoopMode::SIMPLE_ABORT: |
409 |
|
return os << "ProcessLoopMode::SIMPLE_ABORT"; |
410 |
|
case ProcessLoopMode::ABORT: |
411 |
|
return os << "ProcessLoopMode::ABORT"; |
412 |
|
case ProcessLoopMode::FULL: |
413 |
|
return os << "ProcessLoopMode::FULL"; |
414 |
|
case ProcessLoopMode::NONE: |
415 |
|
return os << "ProcessLoopMode::NONE"; |
416 |
|
default: |
417 |
|
Unreachable(); |
418 |
|
} |
419 |
|
return os; |
420 |
|
} |
421 |
|
|
422 |
|
ProcessLoopMode stringToProcessLoopMode(const std::string& optarg) |
423 |
|
{ |
424 |
|
if (optarg == "simple") |
425 |
|
{ |
426 |
|
return ProcessLoopMode::SIMPLE; |
427 |
|
} |
428 |
|
else if (optarg == "simple-abort") |
429 |
|
{ |
430 |
|
return ProcessLoopMode::SIMPLE_ABORT; |
431 |
|
} |
432 |
|
else if (optarg == "abort") |
433 |
|
{ |
434 |
|
return ProcessLoopMode::ABORT; |
435 |
|
} |
436 |
|
else if (optarg == "full") |
437 |
|
{ |
438 |
|
return ProcessLoopMode::FULL; |
439 |
|
} |
440 |
|
else if (optarg == "none") |
441 |
|
{ |
442 |
|
return ProcessLoopMode::NONE; |
443 |
|
} |
444 |
|
else if (optarg == "help") |
445 |
|
{ |
446 |
|
std::cerr << "Loop processing modes.\n" |
447 |
|
"Available modes for --strings-process-loop-mode are:\n" |
448 |
|
"+ simple\n" |
449 |
|
" Omit normal loop breaking (default with --strings-fmf).\n" |
450 |
|
"+ simple-abort\n" |
451 |
|
" Abort when normal loop breaking is required.\n" |
452 |
|
"+ abort\n" |
453 |
|
" Abort if looping word equations are encountered.\n" |
454 |
|
"+ full (default)\n" |
455 |
|
" Perform full processing of looping word equations.\n" |
456 |
|
"+ none\n" |
457 |
|
" Omit loop processing.\n"; |
458 |
|
std::exit(1); |
459 |
|
} |
460 |
|
throw OptionException(std::string("unknown option for --strings-process-loop-mode: `") + |
461 |
|
optarg + "'. Try --strings-process-loop-mode=help."); |
462 |
|
} |
463 |
|
|
464 |
|
|
465 |
|
} // namespace options |
466 |
27735 |
} // namespace cvc5 |
467 |
|
// clang-format on |