Skip to content
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

hoon: fix mixed-case aura tokenisation #3002

Merged
merged 2 commits into from Jul 19, 2021
Merged

Conversation

@matildepark
Copy link
Contributor

@matildepark matildepark commented Jul 19, 2021

In Hoon, we have "auras", which are categories of atoms, which are themselves just positive integers. These look like @da but are sometimes, mixed-case, lowercase then uppercase, like @tD in the Caesar cipher example. These were incorrectly parsed, and are fixed in this PR. Compare the test diffs for an example.

@github-actions
Copy link

@github-actions github-actions bot commented Jul 19, 2021

JS File Size Changes (gzipped)

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

file master pull size diff % diff
components/prism-hoon.min.js 330 B 331 B +1 B +0.3%

Generated by 🚫 dangerJS against 9744050

Loading

@@ -8,6 +8,7 @@ Prism.languages.hoon = {
'class-name': [
{
pattern: /@(?:[A-Za-z0-9-]*[A-Za-z0-9])?/,
greedy: true
Copy link
Member

@RunDevelopment RunDevelopment Jul 19, 2021

Choose a reason for hiding this comment

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

greedy: true is one way to fix it. However, greedy: true is more expensive performance-wise and there is an even simpler fix: Just swap the order of function and class-name.

Swapping them should have the same result without the performance hit.

Loading

@matildepark
Copy link
Contributor Author

@matildepark matildepark commented Jul 19, 2021

Fair enough! Patched.

Loading

@RunDevelopment RunDevelopment merged commit 9c8911b into PrismJS:master Jul 19, 2021
11 checks passed
Loading
@RunDevelopment
Copy link
Member

@RunDevelopment RunDevelopment commented Jul 19, 2021

Thank you very much @matildepark!

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants