MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / skipToClose

Function skipToClose

src/function/cast_from_string_functions.cpp:223–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221}
222
223static bool skipToClose(const char*& input, const char* end, uint64_t& lvl, char target,
224 const CSVOption* option) {
225 input++;
226 while (input != end) {
227 if (*input == '\'') {
228 if (!skipToCloseQuotes(input, end)) {
229 return false;
230 }
231 } else if (*input == '{') { // must have closing brackets {, ] if they are not quoted
232 if (!skipToClose(input, end, lvl, '}', option)) {
233 return false;
234 }
235 } else if (*input == CopyConstants::DEFAULT_CSV_LIST_BEGIN_CHAR) {
236 if (!skipToClose(input, end, lvl, CopyConstants::DEFAULT_CSV_LIST_END_CHAR, option)) {
237 return false;
238 }
239 lvl++; // nested one more level
240 } else if (*input == target) {
241 if (target == CopyConstants::DEFAULT_CSV_LIST_END_CHAR) {
242 lvl--;
243 }
244 return true;
245 }
246 input++;
247 }
248 return false; // no corresponding closing bracket
249}
250
251static bool isNull(std::string_view& str) {
252 auto start = str.data();

Callers 3

splitCStringListFunction · 0.85
parseKeyOrValueFunction · 0.85
parseStructFieldValueFunction · 0.85

Calls 1

skipToCloseQuotesFunction · 0.85

Tested by

no test coverage detected