I use parboiled to write a parser. I have defined some methods as:
def InlineCharsBefore(sep: String)
= rule { zeroOrMore(!str(sep) ~ InlineChar) }
def InlineCharsBefore(sep1: String, sep2: String)
= rule { zeroOrMore((!str(sep1) | !str(sep2)) ~ InlineChar) }
def InlineCharsBefore(sep1: String, sep2: String, sep3: String)
= rule { zeroOrMore((!str(sep1) | !str(sep2) | !str(sep3)) ~ InlineChar) }
You can see that they are very similar. I want to combine them into one, but I do not know how to do it. Maybe it should be:
def InlineCharsBefore(seps: String*) = rule { ??? }
source
share