by derdi · 3mo ago · 0 comments
> StringView has no operator bool, so a successful match reads as !scanner.accept('=').isEmpty(). Noisier than returning a bool, but the matched text comes back with the answer instead of requiring a second call to go get it.
Clearly there is a second call, it's the call to isEmpty. Plus, the actual text is lost in this particual example (though we know what it was).
An actual ergonomic way of using this would set things up so that the INI parser's inner code could be written something like this:
bool success =
(name = trim(acceptUntil('='))) &&
accept('=') &&
accept(Space) &&
(property = acceptAll());No comments yet.