MCPcopy Create free account
hub / github.com/dhbloo/rapfi / parse_escape_code

Function parse_escape_code

Rapfi/external/cpptoml/include/cpptoml.h:2520–2565  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2518 }
2519
2520 std::string parse_escape_code(std::string::iterator& it,
2521 const std::string::iterator& end)
2522 {
2523 ++it;
2524 if (it == end)
2525 throw_parse_exception("Invalid escape sequence");
2526 char value;
2527 if (*it == 'b')
2528 {
2529 value = '\b';
2530 }
2531 else if (*it == 't')
2532 {
2533 value = '\t';
2534 }
2535 else if (*it == 'n')
2536 {
2537 value = '\n';
2538 }
2539 else if (*it == 'f')
2540 {
2541 value = '\f';
2542 }
2543 else if (*it == 'r')
2544 {
2545 value = '\r';
2546 }
2547 else if (*it == '"')
2548 {
2549 value = '"';
2550 }
2551 else if (*it == '\\')
2552 {
2553 value = '\\';
2554 }
2555 else if (*it == 'u' || *it == 'U')
2556 {
2557 return parse_unicode(it, end);
2558 }
2559 else
2560 {
2561 throw_parse_exception("Invalid escape sequence");
2562 }
2563 ++it;
2564 return std::string(1, value);
2565 }
2566
2567 std::string parse_unicode(std::string::iterator& it,
2568 const std::string::iterator& end)

Callers 2

parse_multiline_stringFunction · 0.85
string_literalFunction · 0.85

Calls 2

throw_parse_exceptionFunction · 0.85
parse_unicodeFunction · 0.85

Tested by

no test coverage detected