Branch data Line data Source code
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-2025 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::internal { 21 : : 22 : 15 : RegExpRepeat::RegExpRepeat(uint32_t repeatAmount) : d_repeatAmount(repeatAmount) 23 : : { 24 : 15 : } 25 : : 26 : 30 : bool RegExpRepeat::operator==(const RegExpRepeat& r) const 27 : : { 28 : 30 : return d_repeatAmount == r.d_repeatAmount; 29 : : } 30 : : 31 : 161 : RegExpLoop::RegExpLoop(uint32_t l, uint32_t h) 32 : 161 : : d_loopMinOcc(l), d_loopMaxOcc(h) 33 : : { 34 : 161 : } 35 : : 36 : 286 : bool RegExpLoop::operator==(const RegExpLoop& r) const 37 : : { 38 [ + - ][ + - ]: 286 : return d_loopMinOcc == r.d_loopMinOcc && d_loopMaxOcc == r.d_loopMaxOcc; 39 : : } 40 : : 41 : 75 : size_t RegExpRepeatHashFunction::operator()(const RegExpRepeat& r) const 42 : : { 43 : 75 : return r.d_repeatAmount; 44 : : } 45 : : 46 : 661 : size_t RegExpLoopHashFunction::operator()(const RegExpLoop& r) const 47 : : { 48 : 661 : return r.d_loopMinOcc + r.d_loopMaxOcc; 49 : : } 50 : : 51 : 0 : std::ostream& operator<<(std::ostream& os, const RegExpRepeat& r) 52 : : { 53 : 0 : return os << r.d_repeatAmount; 54 : : } 55 : : 56 : 0 : std::ostream& operator<<(std::ostream& os, const RegExpLoop& r) 57 : : { 58 : 0 : return os << "[" << r.d_loopMinOcc << ".." << r.d_loopMaxOcc << "]"; 59 : : } 60 : : 61 : : } // namespace cvc5::internal