MCPcopy Create free account
hub / github.com/QuEST-Kit/QuEST / parser_isAnySizedComplex

Function parser_isAnySizedComplex

quest/src/core/parser.cpp:254–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252
253
254bool parser_isAnySizedComplex(string str) {
255
256 // we assume that all strings which match the regex can be parsed to
257 // a qcomp (once whitespace is removed) EXCEPT strings which contain a
258 // number too large to store in the qcomp type (as is separately checked
259 // below). Note it is insufficient to merely duck-type each component using
260 // using stold() et al because such functions permit non-numerical chars to
261 // follow the contained number (grr!)
262 smatch match;
263
264 // must match real, imaginary or complex number regex
265 if (regex_match(str, match, regexes::real)) return true;
266 if (regex_match(str, match, regexes::imag)) return true;
267 if (regex_match(str, match, regexes::comp)) return true;
268
269 return false;
270}
271
272
273bool parser_isValidComplex(string str) {

Callers 1

parser_isValidComplexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected