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 : : * Did-you-mean style suggestions. 11 : : * 12 : : * ``What do you mean? I don't understand.'' An attempt to be more 13 : : * helpful than that. Similar to one in git. 14 : : * 15 : : * There are no dependencies on cvc5 (except namespace). 16 : : */ 17 : : 18 : : #pragma once 19 : : 20 : : #include <cvc5/cvc5_export.h> 21 : : 22 : : #include <string> 23 : : #include <vector> 24 : : 25 : : namespace cvc5::internal { 26 : : 27 : : class CVC5_EXPORT DidYouMean 28 : : { 29 : : public: 30 : 871 : void addWord(const std::string& word) { d_words.emplace_back(word); } 31 : 18 : void addWords(const std::vector<std::string>& words) 32 : : { 33 : 18 : d_words.insert(d_words.end(), words.begin(), words.end()); 34 : 18 : } 35 : : 36 : : std::vector<std::string> getMatch(const std::string& input); 37 : : 38 : : /** 39 : : * This is provided to make it easier to ensure consistency of 40 : : * output. Returned string is empty if there are no matches. 41 : : */ 42 : : std::string getMatchAsString(const std::string& input); 43 : : 44 : : private: 45 : : std::vector<std::string> d_words; 46 : : }; 47 : : 48 : : } // namespace cvc5::internal