MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenShadingLanguage / parseRange

Method parseRange

src/liboslexec/lpeparse.cpp:362–391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

360
361
362std::pair<int, int>
363Parser::parseRange()
364{
365 ASSERT(head() == '{');
366 next();
367 std::string firstnum = "";
368 while (hasInput() && '0' <= head() && head() <= '9') {
369 firstnum += head();
370 next();
371 }
372 std::string secondnum = "";
373 if (hasInput() && head() == ',') {
374 next();
375 while (hasInput() && '0' <= head() && head() <= '9') {
376 secondnum += head();
377 next();
378 }
379 if (!secondnum.size())
380 secondnum = "-1";
381 }
382 if (!hasInput() || head() != '}' || !firstnum.size()) {
383 m_error = "Bad {} range definition";
384 return std::pair<int, int>(-1, -1);
385 }
386 next();
387 if (secondnum.size())
388 return std::pair<int, int>(atoi(firstnum.c_str()), atoi(secondnum.c_str()));
389 else
390 return std::pair<int, int>(atoi(firstnum.c_str()), atoi(firstnum.c_str()));
391}
392
393
394

Callers

nothing calls this directly

Calls 2

c_strMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected