Skip to content

components: add hoon programming language - #2978

Merged
RunDevelopment merged 15 commits into
PrismJS:masterfrom
matildepark:master
Jul 3, 2021
Merged

RunDevelopment merged 15 commits into
PrismJS:masterfrom
matildepark:master

Conversation

@matildepark

Copy link
Copy Markdown
Contributor

We're using this downstream on https://urbit.org (in a site using next.js and remark-prism), so passing this language definition upstream. Derived from our tmLanguage definition and the documentation.

@github-actions

github-actions Bot commented Jul 2, 2021 •

Copy link
Copy Markdown

JS File Size Changes (gzipped)

A total of 1 files have changed, with a combined diff of +330 B (+100.0%).

Details
file master pull size diff % diff
components/prism-hoon.min.js 0 Bytes 330 B +330 B +100.0%

Generated by 🚫 dangerJS against 112b95d

@RunDevelopment RunDevelopment left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR @matildepark!

Please fix the linting error and make the tests pass.

One reason that the tests don't pass is that you used capturing groups extensively. Except in the case of lookbehinds, you can replace all capturing groups with non-capturing groups. This should fix most of the problems our tests find.

Also, please add language tests for Hoon. We regularly improve our matching algorithm and tooling. Language tests are essential to make sure that nothing breaks. Please add tests that cover every regex in Hoon.
Step 6 in this guide explains how to add tests. For a more detailed explanation, see the test suite documentation.

If you run into problems or have any questions, feel free to ask anytime. I'm here to help.

Comment thread components.json Resolved
Comment thread components/prism-hoon.js Resolved
@matildepark

Copy link
Copy Markdown
Contributor Author

Should resolve, I think — @RunDevelopment

@RunDevelopment RunDevelopment left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few minor suggestions and I think I found a bug.

Comment thread components/prism-hoon.js Resolved
Comment thread components/prism-hoon.js Resolved
Comment thread components/prism-hoon.js Resolved
Comment thread components/prism-hoon.js Resolved
Comment thread components/prism-hoon.js Resolved
Comment thread components/prism-hoon.js Resolved
@matildepark

Copy link
Copy Markdown
Contributor Author

I believe everything addressed again; it's failing a test on identifiers, which I'm a little confused about; you can't name something foo_123 in hoon; it's generally kabob case, and _ is used in runic constructions (or our 'keywords'). Should Hoon be excluded from that? Also added the same example of the cipher, as I think it includes most of the features you'd highlight in one example.

@matildepark

Copy link
Copy Markdown
Contributor Author

Oh, right, I also reverted the change in 3982e75 because it was a broken definition.

@RunDevelopment

Copy link
Copy Markdown
Member

Oh, right, I also reverted the change in 3982e75 because it was a broken definition.

Indeed. I'll make a new suggestion.

Comment thread components/prism-hoon.js Resolved
@RunDevelopment

Copy link
Copy Markdown
Member

it's failing a test on identifiers, which I'm a little confused about; you can't name something foo_123 in hoon; it's generally kabob case, and _ is used in runic constructions (or our 'keywords'). Should Hoon be excluded from that?

Yeah, just exclude it here. I think you only need to disable word and template.

Comment thread components/prism-hoon.js Resolved
@matildepark

Copy link
Copy Markdown
Contributor Author

Oh, lol, it's because I changed it to function-name. OK, one sec ...

@RunDevelopment

Copy link
Copy Markdown
Member

You can let the test runner update all tests with npm run test:languages -- --update.

@RunDevelopment

Copy link
Copy Markdown
Member

Nice, tests pass. Just an npm run build and this is ready.

@matildepark

Copy link
Copy Markdown
Contributor Author

Built!

@RunDevelopment

Copy link
Copy Markdown
Member

Thank you @matildepark!

It's ready as is but we are currently fixing 2 bugs that came up after the last release. I'll merge this PR right after the patch for these 2 bugs is released, maybe in 1 or 2 days.

@matildepark

Copy link
Copy Markdown
Contributor Author

No worries, thanks for the patience.

Comment thread components/prism-hoon.js Resolved
@RunDevelopment
RunDevelopment merged commit ea77675 into PrismJS:master Jul 3, 2021
@RunDevelopment

Copy link
Copy Markdown
Member

Thank you for contributing @matildepark!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants