I am attempting to implement a parser for a simple query language. The goal is to generate operations
from the text and then evaluate them before passing them up the tree. If I understand correctly, I'll have to implement some of the nom traits (InputLength
, InputTake
, Slice
).
Part way through implementing the InputTake
trait, I realize that I'm expected to return subslices of the enums which represent my query operations where a split may be made part way through an identifier. For example, I may parse an identifier name_of_var
and this take_split()
method could produce 2 slices which doesn't make sense to me.
What should I be doing here? I don't like the idea of slicing a bool/number since they only make sense as a whole.
What do you think about returning None
in the case where I consider a byte slice invalid?