chumsky
chumsky copied to clipboard
Find a way to unify select! and select_ref!
Currently, zero-copy
differentiates between select!
and select_ref!
: the former selects upon tokens by-value, the other by-ref.
The former is required for inputs that do not implement BorrowInput
(i.e: those from which tokens cannot be borrowed, such as char
from &str
or T
from Stream<T>
), while the latter is required for cases where a reference to the original input is required (such as for parsing nested inputs).
It would be nice to unify these two cases into a single macro, ideally without requiring users to understand the intricate details.