feat: Experiments with csv parsing / printing, currently implemented in RoomTests only.
This commit is contained in:
@@ -161,19 +161,29 @@ struct RoomTests {
|
||||
Bed-2,1223,,1123,1
|
||||
"""[...].utf8
|
||||
|
||||
let commaSeparator = ParsePrint {
|
||||
OneOf {
|
||||
",".utf8
|
||||
", ".utf8
|
||||
}
|
||||
}
|
||||
|
||||
let rowParser = ParsePrint {
|
||||
Prefix { $0 != UInt8(ascii: ",") }.map(.string)
|
||||
",".utf8
|
||||
Double.parser()
|
||||
",".utf8
|
||||
Skip { commaSeparator }
|
||||
// ",".utf8
|
||||
Optionally {
|
||||
Double.parser()
|
||||
}
|
||||
",".utf8
|
||||
Skip { commaSeparator }
|
||||
// ",".utf8
|
||||
Optionally {
|
||||
Double.parser()
|
||||
}
|
||||
",".utf8
|
||||
Skip { commaSeparator }
|
||||
// ",".utf8
|
||||
Int.parser()
|
||||
}
|
||||
.map(.memberwise(Row.init))
|
||||
|
||||
Reference in New Issue
Block a user