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 |
|
namespace cvc5::options { |
26 |
|
|
27 |
|
// clang-format off |
28 |
|
std::ostream& operator<<(std::ostream& os, RegExpInterMode mode) |
29 |
|
{ |
30 |
|
switch(mode) |
31 |
|
{ |
32 |
|
case RegExpInterMode::ONE_CONSTANT: return os << "one-constant"; |
33 |
|
case RegExpInterMode::CONSTANT: return os << "constant"; |
34 |
|
case RegExpInterMode::NONE: return os << "none"; |
35 |
|
case RegExpInterMode::ALL: return os << "all"; |
36 |
|
default: Unreachable(); |
37 |
|
} |
38 |
|
return os; |
39 |
|
} |
40 |
|
RegExpInterMode stringToRegExpInterMode(const std::string& optarg) |
41 |
|
{ |
42 |
|
if (optarg == "one-constant") return RegExpInterMode::ONE_CONSTANT; |
43 |
|
else if (optarg == "constant") return RegExpInterMode::CONSTANT; |
44 |
|
else if (optarg == "none") return RegExpInterMode::NONE; |
45 |
|
else if (optarg == "all") return RegExpInterMode::ALL; |
46 |
|
else if (optarg == "help") |
47 |
|
{ |
48 |
|
std::cerr << R"FOOBAR( |
49 |
|
Regular expression intersection modes. |
50 |
|
Available modes for --re-inter-mode are: |
51 |
|
+ one-constant |
52 |
|
Compute intersections only between regular expressions such that at least one |
53 |
|
side does not contain re.allchar or re.range. |
54 |
|
+ constant (default) |
55 |
|
Compute intersections only between regular expressions that do not contain |
56 |
|
re.allchar or re.range. |
57 |
|
+ none |
58 |
|
Do not compute intersections for regular expressions. |
59 |
|
+ all |
60 |
|
Compute intersections for all regular expressions. |
61 |
|
)FOOBAR"; |
62 |
|
std::exit(1); |
63 |
|
} |
64 |
|
throw OptionException(std::string("unknown option for --re-inter-mode: `") + |
65 |
|
optarg + "'. Try --re-inter-mode=help."); |
66 |
|
} |
67 |
|
std::ostream& operator<<(std::ostream& os, ProcessLoopMode mode) |
68 |
|
{ |
69 |
|
switch(mode) |
70 |
|
{ |
71 |
|
case ProcessLoopMode::NONE: return os << "none"; |
72 |
|
case ProcessLoopMode::SIMPLE: return os << "simple"; |
73 |
|
case ProcessLoopMode::ABORT: return os << "abort"; |
74 |
|
case ProcessLoopMode::SIMPLE_ABORT: return os << "simple-abort"; |
75 |
|
case ProcessLoopMode::FULL: return os << "full"; |
76 |
|
default: Unreachable(); |
77 |
|
} |
78 |
|
return os; |
79 |
|
} |
80 |
|
ProcessLoopMode stringToProcessLoopMode(const std::string& optarg) |
81 |
|
{ |
82 |
|
if (optarg == "none") return ProcessLoopMode::NONE; |
83 |
|
else if (optarg == "simple") return ProcessLoopMode::SIMPLE; |
84 |
|
else if (optarg == "abort") return ProcessLoopMode::ABORT; |
85 |
|
else if (optarg == "simple-abort") return ProcessLoopMode::SIMPLE_ABORT; |
86 |
|
else if (optarg == "full") return ProcessLoopMode::FULL; |
87 |
|
else if (optarg == "help") |
88 |
|
{ |
89 |
|
std::cerr << R"FOOBAR( |
90 |
|
Loop processing modes. |
91 |
|
Available modes for --strings-process-loop-mode are: |
92 |
|
+ none |
93 |
|
Omit loop processing. |
94 |
|
+ simple |
95 |
|
Omit normal loop breaking (default with --strings-fmf). |
96 |
|
+ abort |
97 |
|
Abort if looping word equations are encountered. |
98 |
|
+ simple-abort |
99 |
|
Abort when normal loop breaking is required. |
100 |
|
+ full (default) |
101 |
|
Perform full processing of looping word equations. |
102 |
|
)FOOBAR"; |
103 |
|
std::exit(1); |
104 |
|
} |
105 |
|
throw OptionException(std::string("unknown option for --strings-process-loop-mode: `") + |
106 |
|
optarg + "'. Try --strings-process-loop-mode=help."); |
107 |
|
} |
108 |
|
// clang-format on |
109 |
|
|
110 |
31137 |
} // namespace cvc5::options |