Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case-insensitive string parsers #46

Merged

Conversation

stephenjudkins
Copy link
Contributor

Some grammars, like SQL, unfortunately need case-insensitive token matching. This adds this functionality.

@johnynek
Copy link
Collaborator

johnynek commented Nov 6, 2020

This is great, one minor nit. If you have time, follow up with a PR, but in the spirit of merge often, I'll merge this.

* this is an error if the string is empty
*/
def stringCI1(str: String): Parser1[Unit] =
if (str.length == 1) charIn(str.charAt(0).toLower, str.charAt(0).toUpper).void
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, can we call charAt once and capture in a val? It makes it a bit easier to read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants