GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/util/regexp.cpp Lines: 13 17 76.5 %
Date: 2021-09-07 Branches: 2 4 50.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Andrew Reynolds
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
 * Implementation of data structures for regular expression operators.
14
 */
15
16
#include "util/regexp.h"
17
18
#include <ostream>
19
20
namespace cvc5 {
21
22
6
RegExpRepeat::RegExpRepeat(uint32_t repeatAmount) : d_repeatAmount(repeatAmount)
23
{
24
6
}
25
26
12
bool RegExpRepeat::operator==(const RegExpRepeat& r) const
27
{
28
12
  return d_repeatAmount == r.d_repeatAmount;
29
}
30
31
38
RegExpLoop::RegExpLoop(uint32_t l, uint32_t h)
32
38
    : d_loopMinOcc(l), d_loopMaxOcc(h)
33
{
34
38
}
35
36
74
bool RegExpLoop::operator==(const RegExpLoop& r) const
37
{
38
74
  return d_loopMinOcc == r.d_loopMinOcc && d_loopMaxOcc == r.d_loopMaxOcc;
39
}
40
41
30
size_t RegExpRepeatHashFunction::operator()(const RegExpRepeat& r) const
42
{
43
30
  return r.d_repeatAmount;
44
}
45
46
182
size_t RegExpLoopHashFunction::operator()(const RegExpLoop& r) const
47
{
48
182
  return r.d_loopMinOcc + r.d_loopMaxOcc;
49
}
50
51
std::ostream& operator<<(std::ostream& os, const RegExpRepeat& r)
52
{
53
  return os << r.d_repeatAmount;
54
}
55
56
std::ostream& operator<<(std::ostream& os, const RegExpLoop& r)
57
{
58
  return os << "[" << r.d_loopMinOcc << ".." << r.d_loopMaxOcc << "]";
59
}
60
61
}  // namespace cvc5