MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / CreateArgumentItems

Function CreateArgumentItems

formatter/generic/genericformatter.cpp:309–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307
308
309static vector<Item> CreateArgumentItems(const vector<Item>& items, bool inContainer)
310{
311 vector<Item> result, pending;
312 bool hasArgs = false;
313 for (auto& i : items)
314 {
315 if (i.type == ArgumentSeparator)
316 {
317 if (pending.empty())
318 {
319 result.push_back(Item {Atom, {}, {i.tokens}, 0});
320 }
321 else
322 {
323 for (auto& j : i.tokens)
324 pending.back().AddTokenToLastAtom(j);
325 result.push_back(Item {inContainer ? Argument : Group, pending, {}, 0});
326 }
327 pending.clear();
328 hasArgs = true;
329 }
330 else if (i.type == StartOfContainer && pending.empty())
331 {
332 result.push_back(i);
333 }
334 else if (i.type == EndOfContainer && hasArgs && !pending.empty())
335 {
336 result.push_back(Item {inContainer ? Argument : Group, pending, {}, 0});
337 result.push_back(i);
338 pending.clear();
339 }
340 else
341 {
342 pending.push_back(Item {i.type, CreateArgumentItems(i.items, i.type == Container), i.tokens, 0});
343 }
344 }
345
346 if (!pending.empty())
347 {
348 if (hasArgs)
349 result.push_back(Item {inContainer ? Argument : Group, pending, {}, 0});
350 else
351 result.insert(result.end(), pending.begin(), pending.end());
352 }
353
354 return result;
355}
356
357
358static vector<Item> CreateOperatorGroups(const vector<Item>& items)

Callers 1

FormatLinesMethod · 0.85

Calls 7

push_backMethod · 0.80
AddTokenToLastAtomMethod · 0.80
emptyMethod · 0.45
clearMethod · 0.45
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected