Replies: 1 comment 1 reply
-
Hey @elfenlaid one option could be to use let linesToUser = Many(1...) {
PrefixThrough("\n")
} separator: {
Not { user }
}
let users = Many {
user
} separator: {
linesToUser
} I'm not sure if this works for all of your use cases but it should work for the example above. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello 👋 Hope all is well
During logs parsing I've stumbled upon malformed entries that sorta break
Many
.In my case it was okay to skip such entries and continue parsing. We can simulate such scenario by the following example:
As you can see, we stopped parsing at the second line and produced out only one element, which is totally expected.
Let's see what it takes to come up with such
Many
that ignores malformed entries and continues with parsing:Let's generalize it a bit by cooking up a small helper
and its usage looks like this:
There are certain downsides to it. Like one needs to be extremely mindful while constructing a separator parser. But overall I think it looks okay-ish 🤔
Maybe I'm reinventing the wheel here and there are more simple ways of baking a "graceful"
Many
?Beta Was this translation helpful? Give feedback.
All reactions