3 ms·
By basics I really mean extreme basics. The level of instruction I'm thinking is: <begin> A parser is a function that looks something like "optional<Foo> parse
by SamReidHughes 5y ago
By basics I really mean extreme basics. The level of instruction I'm thinking is: <begin> A parser is a function that looks something like "optional<Foo> parse_foo(const std::string& data, size_t *pos)", which increases the value of *pos. It chews off objects from the front of the string and returns std::nullopt upon error. It's easy to recursively invoke smaller parsers this way. <end>
Just that alone would really help people out and avoid problems I've seen encountered, where a dev needs to parse something, and just kind of spastically traipses around the string.
- ZeroCool2u 5y agoAh, well I’ve got that bit covered at the very least :)