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

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