I've just started using Scala a few days ago and wanted to write my first parser.
the problematic code is as follows:
val withoutZero: Parser[List[String]] = ("1" | "2" | "3" | "4").+
val withZero: Parser[String] = "0" | withoutZero
the number string I'd like to parse can have multiple zeros and other numbers but I want to define two functions for it.
the combined withZero has to stay String (not List[String] or whatever else). at the moment I'm only parsing one zero because ("0").+ didn't work out.
my question: how am I able to adjust the withZero Parser to multiple zeros AND combining it with the withoutZero Parser still staying a Parser[String]
|has to be the same type, so I still don't understand—it guess I'd still like to see actual strings.