Branch data Line data Source code
1 : : /****************************************************************************** 2 : : * This file is part of the cvc5 project. 3 : : * 4 : : * Copyright (c) 2009-2026 by the authors listed in the file AUTHORS 5 : : * in the top-level source directory and their institutional affiliations. 6 : : * All rights reserved. See the file COPYING in the top-level source 7 : : * directory for licensing information. 8 : : * **************************************************************************** 9 : : * 10 : : * Implementation of data structures for regular expression operators. 11 : : */ 12 : : 13 : : #include "util/regexp.h" 14 : : 15 : : #include <ostream> 16 : : 17 : : namespace cvc5::internal { 18 : : 19 : 55 : RegExpRepeat::RegExpRepeat(uint32_t repeatAmount) : d_repeatAmount(repeatAmount) 20 : : { 21 : 55 : } 22 : : 23 : 86 : bool RegExpRepeat::operator==(const RegExpRepeat& r) const 24 : : { 25 : 86 : return d_repeatAmount == r.d_repeatAmount; 26 : : } 27 : : 28 : 211 : RegExpLoop::RegExpLoop(uint32_t l, uint32_t h) 29 : 211 : : d_loopMinOcc(l), d_loopMaxOcc(h) 30 : : { 31 : 211 : } 32 : : 33 : 356 : bool RegExpLoop::operator==(const RegExpLoop& r) const 34 : : { 35 [ + - ][ + - ]: 356 : return d_loopMinOcc == r.d_loopMinOcc && d_loopMaxOcc == r.d_loopMaxOcc; 36 : : } 37 : : 38 : 179 : size_t RegExpRepeatHashFunction::operator()(const RegExpRepeat& r) const 39 : : { 40 : 179 : return r.d_repeatAmount; 41 : : } 42 : : 43 : 791 : size_t RegExpLoopHashFunction::operator()(const RegExpLoop& r) const 44 : : { 45 : 791 : return r.d_loopMinOcc + r.d_loopMaxOcc; 46 : : } 47 : : 48 : 0 : std::ostream& operator<<(std::ostream& os, const RegExpRepeat& r) 49 : : { 50 : 0 : return os << r.d_repeatAmount; 51 : : } 52 : : 53 : 0 : std::ostream& operator<<(std::ostream& os, const RegExpLoop& r) 54 : : { 55 : 0 : return os << "[" << r.d_loopMinOcc << ".." << r.d_loopMaxOcc << "]"; 56 : : } 57 : : 58 : : } // namespace cvc5::internal