blob: a2eb24b1fb74d4bda860efc9cc517bc54d8cd6c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// Copyright (c) 2018 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_UTIL_SPANPARSING_H
#define BITCOIN_UTIL_SPANPARSING_H
#include <span.h>
#include <string>
#include <vector>
namespace spanparsing {
/** Parse a constant. If successful, sp is updated to skip the constant and return true. */
bool Const(const std::string& str, Span<const char>& sp);
/** Parse a function call. If successful, sp is updated to be the function's argument(s). */
bool Func(const std::string& str, Span<const char>& sp);
/** Return the expression that sp begins with, and update sp to skip it. */
Span<const char> Expr(Span<const char>& sp);
/** Split a string on every instance of sep, returning a vector. */
std::vector<Span<const char>> Split(const Span<const char>& sp, char sep);
} // namespace spanparsing
#endif // BITCOIN_UTIL_SPANPARSING_H
|