Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2018-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#ifndef BITCOIN_SCRIPT_PARSING_H6#define BITCOIN_SCRIPT_PARSING_H8#include <span>9#include <string>11namespace script {13/** Parse a constant.14*15* If sp's initial part matches str, sp is optionally updated to skip that part, and true is returned.16* Otherwise sp is unmodified and false is returned.17*/18bool Const(const std::string& str, std::span<const char>& sp, bool skip = true);20/** Parse a function call.21*22* If sp's initial part matches str + "(", and sp ends with ")", sp is updated to be the23* section between the braces, and true is returned. Otherwise sp is unmodified and false24* is returned.25*/26bool Func(const std::string& str, std::span<const char>& sp);28/** Extract the expression that sp begins with.29*30* This function will return the initial part of sp, up to (but not including) the first31* comma or closing brace, skipping ones that are surrounded by braces. So for example,32* for "foo(bar(1),2),3" the initial part "foo(bar(1),2)" will be returned. sp will be33* updated to skip the initial part that is returned.34*/35std::span<const char> Expr(std::span<const char>& sp);37} // namespace script39#endif // BITCOIN_SCRIPT_PARSING_H
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.