| 252 | |
| 253 | |
| 254 | bool 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 | |
| 273 | bool parser_isValidComplex(string str) { |
no outgoing calls
no test coverage detected