Scala parser combinators and newline-delimited text
问题 I am writing a Scala parser combinator grammar that reads newline-delimited word lists, where lists are separated by one or more blank lines. Given the following string: cat mouse horse apple orange pear I would like to have it return List(List(cat, mouse, horse), List(apple, orange, pear)) . I wrote this basic grammar which treats word lists as newline-delimited words. Note that I had to override the default definition of whitespace . import util.parsing.combinator.RegexParsers object