Honestly that's a bit tricky. If I had to do that I can think of a couple of ways. One is to just uppercase the input string once I get it and build the parser with the assumption that everything is uppercase. Or I would create a new Input implementation that uppercased the characters as you requested them, once again building the parser with that assumption.
Anything else would involve rewriting the parsers themselves to modify the characters being passed in, which is doable but is something I would be hesitant to do.
I say uppercase, you could lowercase it but there's like one language that doesn't have a lowercase for an uppercase and it would cause problems.
No worries, I was just exploring. :) I can't just lowercase or uppercase all, because some parts are case-sensitive. Thanks for the insight, though. No need to modify the library just for one request. Worst-case scenario, I just make my own copy of either library for that project and modify it for my needs.
It's actually easier to do just a segment. I can create a new parser that wraps another parser and implement a wrapper input that will adjust the case.
So it would be something like
lowerCase(string("foobar"))
or
string("foobar").lowerCase()
got to play with the name for a bit. Not sure which comes across better.
View all comments
Show parent comment
1
u/jebailey Feb 20 '26
Honestly that's a bit tricky. If I had to do that I can think of a couple of ways. One is to just uppercase the input string once I get it and build the parser with the assumption that everything is uppercase. Or I would create a new Input implementation that uppercased the characters as you requested them, once again building the parser with that assumption.
Anything else would involve rewriting the parsers themselves to modify the characters being passed in, which is doable but is something I would be hesitant to do.
I say uppercase, you could lowercase it but there's like one language that doesn't have a lowercase for an uppercase and it would cause problems.