-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add Rez #6524
Add Rez #6524
Conversation
add one for Rez (could use some more, though)
If you're looking for a color: R has blue and grey, so I'd say pick one of the remaining colors from the ResEdit icon, which seem to be green (00CE00), red (E60100), or a light salmon ("flesh") color (FFDAB3). For detecting, the most common resource types are probably 'vers', 'SIZE', 'ICON', 'cicn', 'ICN#', 'icns', 'BNDL', 'DITL', 'DLOG', 'ALRT', 'MENU', 'CURS' and 'PICT'. Might also be worth looking for |
OK, I counted how many pixels of each there were in the icon:
This suggests to me that we should go with the last of the 3.
OK, could I get some help with a regex to catch all of those? I'm not very good with regexes... |
add color, suggested by @uliwitness in github-linguist#6524
Actually, this might be a better heuristic:
That will basically catch the first line of a resource declaration, as long as they don't have extra line breaks. |
For detecting some common types, one would do
|
To detect the includes one would do
I guess detecting any of these three regexes could be seen to indicate that it's a Rez file. So maybe something like:
should probably catch something in most files. Though some of these might give false positives if the files don't have the '.r' suffix. That said, I haven't seen an R source file yet, so we might wanna check that none of these are valid/common in that other language. |
There are some examples of R sources in linguist's samples directory, if you want to take a look |
OK, the
|
Oh, I also think I overlooked how one specifies a resource name in Rez. Update: It's fine, the name is inside the parentheses where the ID is, so we correctly parse that case too: |
ok, so does that need to be quoted, or can it just be pasted as-is? Generally the other regexes in |
Oh yeah since that uses YAML and that single-quotes these regexes, you'll prolly have to escape the backslashes and the single quotes, good catch. So the entire, quoted regex should be something like:
|
Improved Rez detection from @uliwitness
OK thanks, I made this the regex in 2837cbc. Unfortunately bundler is giving me some issues that are preventing me from testing locally, so hopefully a maintainer will let the CI workflows run... |
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.
See comments inline.
Please remove or replace the two large samples that are currently collapsed in the PR view; they're too big with the icons file mostly filled stuff that isn't relevant to the language.
We also need the cached license file the script/add-grammar
should have downloaded when your added the grammar.
remove `.rez` extension due to no examples of it being present; resolves review comment
backslashes don't need to be escaped, apparently, so stop doubling up on them
OK, addressed.
Removed in 769cf15.
Hm, I guess I should just re-run the script then, if I'm not seeing it? |
I tried rerunning `scripts/grammar`, but it did some other weird stuff, so I had to stash its other changes. It left this behind, though, which is hopefully what was requested in the PR
OK, re-ran; is the file added in dadde18 what you were requesting? |
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.
OK, re-ran; is the file added in dadde18 what you were requesting?
Yup. That's the one.
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.
I've rectified the last of the issues and all looks good now. Usage appears high enough for inclusion too 👍
Description
See issue #6107
Checklist:
#FFDAB3