-
Notifications
You must be signed in to change notification settings - Fork 66
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 keywords? #46
Comments
Right. Moo combines all the tokens into a single RegExp, so supporting both case-sensitive and insensitive tokens is difficult. Can you tell me more about the language? That might help :-) One suggestion would be to do e.g. |
Ah, yeah. It's a pretty simple DSL where each line starts with a case insensitive keyword, e.g.:
etc. I think generating the individual cases won't be too hard, so that will probably work. Thanks. |
Glad I could help! :-) Be aware that you might run into an edge case if you have identifiers too: https://github.com/tjvr/moo#keywords —moo only handles that if your keywords are specified as strings. |
Maybe it would be a good idea to add something like this: moo.compile({
evenOdd: { caseInsensitive: true, keyword: ['even', 'odd'] }
}) |
I've got a use case where the keywords in my language are case insensitive but other things (e.g. the contents of strings) aren't. Is there any way I can make a lexer that recognizes these? I tried
keyword: [/foo/i, ...]
but it complains that the "/i" flag isn't allowed.The text was updated successfully, but these errors were encountered: