Capturing all characters from a terminator's list
Bobini1 opened this issue · 0 comments
Bobini1 commented
I've got the following bit of code:
struct TextTag
{
static constexpr auto value = lexy::as_string<std::string> >> lexy::callback<std::string>(trimR);
static constexpr auto rule = []{
auto end =
dsl::terminator(dsl::peek(dsl::eol));
auto value = end.list(dsl::capture(dsl::unicode::character)); // this line is important
return value;
}();
};
It gets all characters in a line and then trims the result.
However, dsl::capture
discards whitespace. I don't want that. dsl::identifier
doesn't accept dsl::peek(dsl::eol)
as the end condition so I can't use it either and I need to handle eof correctly. If I use neither of those and simply make a list of characters, nothing gets added to the sink.
I have spent like 5 hours on this already, is it really so hard to just get all characters in the sink literally?