-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Adding initial support for CMake language #1820
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @mjrogozinski for providing this language definition! I left you a few comments so please take a look at them.
Apart from the comments a few other things:
- Please a an example page for CMake. You can add an example page as an HTML file under
examples/
. - Regarding the test: Please add all keywords/properties/etc. to your tests.
(Tipp: You can usenpx run test:languages -- --pretty
to get a pretty files token stream. More details at the bottom of this section.)
This is a more general question: You assigned the outputs of these commands the following token names, right?
The command list contains stuff like |
@mjrogozinski With that this PR is almost ready to merge. Only 2 more things:
|
I think we can do a bit more optimizations. I will post them soon. e.g. keyword containing There is one more thing. CMake's compilation features like Edit: yup: all of them are |
I appreciate it but you really don't have to. The patterns from above have the optimizations which saved the most. You can further optimize but the gain won't be as high, so I don't think it's worth putting that much effort into it.
This might cause a lot of false positives, so I don't think we should lose correctness of small file sizes.
Nice! Regarding new features: Want to add variable interpolation for strings as well? Change 'string': {
pattern: /"(?:[^\\"]|\\.)*"/,
greedy: true,
inside: {
'interpolation': {
pattern: /\${(?:[^{}$]|\${[^{}$]*})*}/,
inside: {
'punctuation': /\${|}/,
'variable': /\w+/
}
}
}
}, |
This is awesome. It took me some time to figure out where to put commas in unit tests but I managed :) |
What would you say about: |
Acutally |
Make it the following and I'll take it. 'inserted': {
pattern: /\b\w+::\w+\b/,
inside: {
'punctuation': /::/
}
} Btw. What is this feature even? I've seen it in CMake examples before but I didn't get its purpose. PS: Are you sure that neither of the words left and right of |
Hmmm, in that case, it might be nice to give it some color. The Result: 'inserted': {
pattern: /\b\w+::\w+\b/,
alias: 'class-name'
} |
Pushed |
Thank you very much for contributing @mjrogozinski! |
Thank you very much for helping me :) It was a great pleasure to work on this with you Michael. |
I know it's not perfect but it is good enough for me. Sorry for not being an expert on the subject, it's my first time doing it.