MCPcopy Index your code
hub / github.com/GJDuck/e9patch / parseStrings

Function parseStrings

src/e9patch/e9json.cpp:1012–1036  ·  view source on GitHub ↗

* Parse strings. */

Source from the content-addressed store, hash-verified

1010 * Parse strings.
1011 */
1012static char * const *parseStrings(Parser &parser, const char *first = nullptr)
1013{
1014 std::vector<const char *> strings;
1015 if (first != nullptr)
1016 strings.push_back(dupString(first));
1017
1018 expectToken(parser, '[');
1019 char token = expectToken2(parser, ']', TOKEN_STRING);
1020 while (token != ']')
1021 {
1022 if (token != TOKEN_STRING)
1023 unexpectedToken(parser, "strings entry", token);
1024 strings.push_back(dupString(parser.s));
1025 token = expectToken2(parser, ',', ']');
1026 if (token == ',')
1027 token = getToken(parser);
1028 }
1029
1030 char **ss = new char *[strings.size()+1];
1031 size_t i;
1032 for (i = 0; i < strings.size(); i++)
1033 ss[i] = (char *)strings[i];
1034 ss[i] = nullptr;
1035 return (char * const *)ss;
1036}
1037
1038/*
1039 * Parse a protection.

Callers 1

parseParamsFunction · 0.85

Calls 6

dupStringFunction · 0.85
expectTokenFunction · 0.85
expectToken2Function · 0.85
unexpectedTokenFunction · 0.85
getTokenFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected