MCPcopy Create free account
hub / github.com/ElementsProject/elements / Expr

Function Expr

src/util/spanparsing.cpp:32–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32Span<const char> Expr(Span<const char>& sp)
33{
34 int level = 0;
35 auto it = sp.begin();
36 while (it != sp.end()) {
37 if (*it == '(' || *it == '{') {
38 ++level;
39 } else if (level && (*it == ')' || *it == '}')) {
40 --level;
41 } else if (level == 0 && (*it == ')' || *it == '}' || *it == ',')) {
42 break;
43 }
44 ++it;
45 }
46 Span<const char> ret = sp.first(it - sp.begin());
47 sp = sp.subspan(it - sp.begin());
48 return ret;
49}
50
51std::vector<Span<const char>> Split(const Span<const char>& sp, char sep)
52{

Callers 3

ParseScriptFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
FUZZ_TARGETFunction · 0.85

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.68
FUZZ_TARGETFunction · 0.68