I would like to create a parser using Superpower to match strings like:
<<This is my text>>
That is, a string delimited by a pair of strings (left and right). In this case, the delimiting strings are <<
and >>
.
For now, all I've got is a parser that only works when delimiters are single chars:
public static TextParser<TextSpan> SpanBetween(char left, char right)
{
return Span
.MatchedBy(Character.Except(right).Many())
Between(Character.EqualTo(left), Character.EqualTo(right));
}
How should I modify it with left
and right
being strings instead?