MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / Func

Function Func

src/script/descriptor.cpp:387–394  ·  view source on GitHub ↗

Parse a function call. If succesful, sp is updated to be the function's argument(s). */

Source from the content-addressed store, hash-verified

385
386/** Parse a function call. If succesful, sp is updated to be the function's argument(s). */
387bool Func(const std::string& str, Span<const char>& sp)
388{
389 if ((size_t)sp.size() >= str.size() + 2 && sp[str.size()] == '(' && sp[sp.size() - 1] == ')' && std::equal(str.begin(), str.end(), sp.begin())) {
390 sp = sp.subspan(str.size() + 1, sp.size() - str.size() - 2);
391 return true;
392 }
393 return false;
394}
395
396/** Return the expression that sp begins with, and update sp to skip it. */
397Span<const char> Expr(Span<const char>& sp)

Callers 1

ParseScriptFunction · 0.85

Calls 4

subspanMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected