Trivial:
object MyParsers extends scala.util.parsing.combinator.RegexParsers {
val parser: Parser[String] = "abc"
// or more explicit: val parser = literal("abc")
}
However, you may need a Stream[Char]
instead of a Stream[Character]
.
You can also use acceptSeq("abc")
, since String
is implicitly convertable to Iterable[Char]
, but it will be significantly less efficient.