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/char matches? #49

Open
jottinger opened this issue Sep 9, 2024 · 5 comments
Open

case insensitive string/char matches? #49

jottinger opened this issue Sep 9, 2024 · 5 comments
Assignees

Comments

@jottinger
Copy link

Is there a way to match such that "ThIS" and "this" both match string("this")?

@mpe85 mpe85 self-assigned this Sep 10, 2024
@mpe85
Copy link
Owner

mpe85 commented Sep 10, 2024

Hi @jottinger, there are ignoreCase(String), ignoreCase(Char) and ignoreCase(int) that ignore the case of the provided string/char/codepoint.

@jottinger
Copy link
Author

Yeah, I found those. IMO, having an analog to string() be ignoreCase is insufficient naming; I'd think the two methods would be string("foo") and stringIgnoreCase("foo"). I'd found the variant by the time you'd commented, by accident, purely from crawling through AbstractGrammar's source code. (This happened for another issue, too, issue #50).

@mpe85
Copy link
Owner

mpe85 commented Sep 11, 2024

Some history: when I initially started work on grampa I have taken over the naming mainly from parboiled1. Just have a look at this: https://www.javadoc.io/doc/org.parboiled/parboiled-java/latest/org/parboiled/BaseParser.html :-)

I can change the names of these rule functions to be more precise, probably in the next major release (since this would be a breaking change).

@jottinger
Copy link
Author

jottinger commented Sep 11, 2024 via email

@mpe85
Copy link
Owner

mpe85 commented Sep 11, 2024

Yeah, introduce stringIgnoreCase() and deprecate ignoreCase() would be the way to go I think.

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

No branches or pull requests

2 participants