- Notifications
You must be signed in to change notification settings - Fork1.3k
hoon: fix mixed-case aura tokenisation#3002
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
github-actionsbot commentedJul 19, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
components/prism-hoon.js Outdated
@@ -8,6 +8,7 @@ Prism.languages.hoon = { | |||
'class-name': [ | |||
{ | |||
pattern: /@(?:[A-Za-z0-9-]*[A-Za-z0-9])?/, | |||
greedy: true |
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.
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 offunction
andclass-name
.
Swapping them should have the same result without the performance hit.
Fair enough! Patched. |
Thank you very much@matildepark! |
In Hoon, we have "auras", which arecategories 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.