GCC Code Coverage Report
Directory: . Exec Total Coverage
File: build-coverage/src/options/strings_options.cpp Lines: 1 37 2.7 %
Date: 2021-11-07 Branches: 2 61 3.3 %

Line Exec Source
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::ALL: return os << "all";
34
    case RegExpInterMode::NONE: return os << "none";
35
    case RegExpInterMode::CONSTANT: return os << "constant";
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 == "all") return RegExpInterMode::ALL;
44
  else if (optarg == "none") return RegExpInterMode::NONE;
45
  else if (optarg == "constant") return RegExpInterMode::CONSTANT;
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
+ all
55
  Compute intersections for all regular expressions.
56
+ none
57
  Do not compute intersections for regular expressions.
58
+ constant (default)
59
  Compute intersections only between regular expressions that do not contain
60
  re.allchar or re.range.
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::SIMPLE: return os << "simple";
72
    case ProcessLoopMode::SIMPLE_ABORT: return os << "simple-abort";
73
    case ProcessLoopMode::NONE: return os << "none";
74
    case ProcessLoopMode::FULL: return os << "full";
75
    case ProcessLoopMode::ABORT: return os << "abort";
76
    default: Unreachable();
77
  }
78
  return os;
79
}
80
ProcessLoopMode stringToProcessLoopMode(const std::string& optarg)
81
{
82
  if (optarg == "simple") return ProcessLoopMode::SIMPLE;
83
  else if (optarg == "simple-abort") return ProcessLoopMode::SIMPLE_ABORT;
84
  else if (optarg == "none") return ProcessLoopMode::NONE;
85
  else if (optarg == "full") return ProcessLoopMode::FULL;
86
  else if (optarg == "abort") return ProcessLoopMode::ABORT;
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
+ simple
93
  Omit normal loop breaking (default with --strings-fmf).
94
+ simple-abort
95
  Abort when normal loop breaking is required.
96
+ none
97
  Omit loop processing.
98
+ full (default)
99
  Perform full processing of looping word equations.
100
+ abort
101
  Abort if looping word equations are encountered.
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