3 ms·
I've look for a while at this, and have come to this conclusion: At the time I need a multi-line pattern language, I just whip up a FSM-like program in code. A
by paulddraper 7y ago
I've look for a while at this, and have come to this conclusion:
At the time I need a multi-line pattern language, I just whip up a FSM-like program in code. And I'll continue to do that.
- s_kilk 7y ago> At the time I need a multi-line pattern language, I just whip up a FSM-like program in code. And I'll continue to do that. Not that this is an invalid approach, not at all, but I feel like there's a load-bearing "just" here that indicates this project could be useful for a lot of people :)
- paulddraper 7y agoIt's true. I've written a number of lexers/parsers, and it feels really natural to me make a big loop with switch/case. If I started from "scratch", perhaps the overhead of learning Rosie would be worth it.
- ken 7y agoIt's also a command line tool, and a library of useful patterns. curl -sL news.ycombinator.com | rosie grep -o subs net.url How many LOC is your ad-hoc "FSM-like program", and have you done correctness and performance testing on it? If I had a nickel for every incorrect email validity checker I ran across, I'd have an awful lot of nickels.
- paulddraper 7y ago> If I had a nickel for every incorrect email validity checker I ran across, I'd have an awful lot of nickels. I won't argue with that. Email is a clusterf---. To make a validator to be truly "correct" is essentially impossible. Three RFCs have successively created standardized regexes and the latest RFC 5322 still has a bug. [1] You'd have to convince me that you'd be significantly fewer nickles had they used Rosie. > library of useful patterns That's cool. I certainly use a library if I need to validate emails. [1] https://stackoverflow.com/a/201378 https://stackoverflow.com/a/201378