foonathan / lexy

C++ parsing DSL
https://lexy.foonathan.net
Boost Software License 1.0
991 stars 66 forks source link

Support std::filesystem::path for input file #167

Closed EmmanuelMess closed 1 year ago

EmmanuelMess commented 1 year ago

Support std::filesystem::path for input file:

const std::filesystem::path& path = ...;
const auto input = lexy::read_file<lexy::utf8_encoding>(path);
const auto result = lexy::parse<...>(input.buffer(), lexy_ext::report_error.path(path));
Life4gal commented 1 year ago

I don't think all users want to be burdened with the large number of dependencies that filesystem will bring.

And it's a clear violation of: image

I think it should be a trivial thing for you to convert std::filesystem::path to std::string (just for me, which I do), as opposed to adding filesystem as a dependency to lexy.