-
Notifications
You must be signed in to change notification settings - Fork 4.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
Add new Hack file extensions. #4354
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.
Thanks for the contribution!
I've not checked the usage for the .hack
and .hhi
extensions yet. Also, I did not found the change to the heuristic; did you push it?
Note: A change to the heuristic rule is only required if other languages share the same extensions.
@pchaigno i have removed the |
This pull request has been automatically marked as stale because it has not had recent activity, and will be closed if no further activity occurs. If this pull request was overlooked, forgotten, or should remain open for any other reason, please reply here to call attention to it and remove the stale status. Thank you for your contributions. |
cc @pchaigno |
Usage for the We'll have an issue with the EDIT: Sorry for the delay in answering. I've had quite a busy January :( |
Problems with
|
We’ve not yet announced support for .hack files - an while the support was committed, it is about to change, and these pull request examples will no longer be considered valid - as of next monday’s release, having any ‘<?’ token in a .hack file is a syntax error. They’re always strict mode. |
@fredemmott i suggested these examples before we discussed the |
Just for context: the existing |
Thank you all for the information! I've checked 2817
We try to follow usage and not specifications in Linguist. If one language says some syntax is illegal but a large number of users still rely on that syntax, we'll try to support it. So I'm not sure we should remove the tags here. The best thing would be to preserve the sample files in their original form. |
There's definitely not a large number of users; Hack uses a of variant PHP-style autoloading, and no release of the autoloader supports the |
Though, |
@fredemmott the |
I think that's fine. It is pretty unlikely that anyone would intentionally configure a language context for these files since they are far closer to binaries than they are human-consumable text. Caveat that I don't speak for the Nand2Tetris project or community in any real way other than having gone through the course as a hobbyist. |
Thanks @jeffomatic! @azjezz - Could you add the Nand2Tetris Hack language to Linguist in this pull request as well, with a heuristic to disambiguate between the two Something along the lines of: - extensions: ['.hack']
rules:
- language: Nand2Tetris Hack
pattern: ^[01]+$
- language: Hack should be enough. |
@pchaigno done 👍 |
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.
Sorry if I was unclear; you'll need to add the Nand2Tetris Hack language as well by following the contribution guidelines.
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.
The Travis CIbuilds are failing. I commented the few things you'll need to change to pass the tests.
There's one failure I can't quite explain yet. I'll have a look when I'll be on my computer.
This pull request has been automatically marked as stale because it has not had recent activity, and will be closed if no further activity occurs. If this pull request was overlooked, forgotten, or should remain open for any other reason, please reply here to call attention to it and remove the stale status. Thank you for your contributions. |
My guess would be that the tests are failing because the tokenizer is unable to extract tokens from the Nand2Tetris hack sample file. If that's the case, we'll probably need to adapt the tokenizer or add an exception mechanism. I haven't found time to debug this yet. |
@pchaigno if the Nand2Tetris files are only ones and zeroes (and unlimited whitespace), then there are no real tokens. This language is not read as source code. Would it be okay if I did something dirty and just specified the token definition as "Each byte is the start of a new token"? Would this somehow cause something unrelated to break? I would like to have syntax highlighting in hack files, so sorry for not prioritising the Nand2Tetris hack format more. |
@pchaigno Are we following the route of not requiring tokenizers. Tokenizing such files is rather pointless, since there are no tokens. Hack code is being used in dothack files in many more places than it was at the release of HHVM4. This leaves entire repositories as black text on GitHub. |
cc @pchaigno, any updates here ? after #4544 , the example : |
Wow! How did I miss this one for so long. Sorry folks. Support for the |
@lildude i myself forgot about this PR :) i have update the PR to only address |
Description
Add support for hack
hhi
extension.Checklist:
.hhi
: https://github.com/search?utf8=%E2%9C%93&type=Code&ref=searchresults&q=extension%3Ahhi+hh