As suggested here: #16800 (comment).
This moves the Span parsing functions out of the descriptor module, making them more easily usable for other parsers (in particular, in preparation for miniscript parsing).
As suggested here: #16800 (comment).
This moves the Span parsing functions out of the descriptor module, making them more easily usable for other parsers (in particular, in preparation for miniscript parsing).
ACK c072446b5c7fbaabcd17494d1b593b1cb5ebc314, verified it's mostly moved code - new code is just forward declarations, license and include guards.
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
7 | + 8 | +#include <string> 9 | +#include <span.h> 10 | + 11 | +/** Parse a constant. If successful, sp is updated to skip the constant and return true. */ 12 | +bool Const(const std::string& str, Span<const char>& sp);
with C++ throwing everything into the global namespace by default, I think these functions names (Const, Func, Expr) are too general
Make it a namespace span :) ?
I've moved them into a namespace spanparsing, and added some documentation.
Concept ACK.
Now that these functions are public, would be nice to have unit tests.
utACK 230d43f 5e69aee
Now that these functions are public, would be nice to have unit tests.
I would be interested to work on that.
Will do next week.
tests the following four functions:
- Const() [parse constant]
- Func() [parse function]
- Expr() [parse expression]
- Split() [split up a string]The parsing heavy functions Const, Func, Expr and Split all seem like good candidates for fuzz testing (in addition to the ordinary unit testing)?
ACK bb36372b8f2bd675313ae8553ceb61f28c2c1afd
<details><summary>Show signature and timestamp</summary>
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
ACK bb36372b8f2bd675313ae8553ceb61f28c2c1afd
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUjmOwwAi3Ad7AG9map87wVhJiT68gHzVlnpfujDXkepHRMoqt3E2T9zQuFk1QvW
m11WLTcf7VpTrn+zgGJ90w9HW3ovvNivHCCqwds5R+Rh2MW3u2cQJ7DkRQH7VePJ
B+VLLRXXuCq98kzF7XGqViyqmIA10tA+0rZ2DcIH8jguRsg9mLPybDlN1z+8j2c/
CHvb99LxnKiCHd0z7NgWXr1JsPsh97W5pnDABMybEfG3Oblh0DD/JdVf/w6cdWQD
vD/zuy54Re0CEA8Y4CUviw0OtlfHdiRsqepumXACMxJTvA/EzxOIHpaQZpj/pDOL
YzxHjBmrV/I4fYekscpA+uaPVwKvzHnOEQtZIBFs2/jK1FoaXfBdzSYvorj9V4q5
+DwFPa4aye0lVslBo9sED6ehUzLsP50tF80XrLudTAEKTWjUAaIUf0Mfe/6y4Op3
+XeEvhjOr33N7f6w3a+jdX2DR0MsRMCLZ4FPlLatGVGCfqgPtIWcxi5Bxitmdrla
Gagqrt9v
=NYw8
-----END PGP SIGNATURE-----
Timestamp of file with hash fb19a80d964f70a8c4b0e02b5fb1088d6d3c529398648e56d30d9e2f6fb4ba33 -
</details>
Pretty straightforward move-only commit and then a commit adding tests, going to merge now.
reACK 230d43fdbc41b356700b0d8a6984d69e00279ade, utACK bb36372b8f2bd675313ae8553ceb61f28c2c1afd.