lexy
lexy copied to clipboard
Location tracking.
Lexy already offers lexy::dsl::position to obtain the current input position. It would be nice to also have a rule to obtain where a rule starts and ends.
namespace lexy::dsl
{
constexpr rule auto location(rule auto rule);
constexpr branch-rule auto location(branch-rule auto rule);
}
The semantic value of location should be a pair of positions. The first should be the iterator before the rule as would also be obtained with lexy::dsl::position and the second the position right after the rule.
Currently, it is a bit complicated to obtain something like this. Especially with automatic white space skipping.