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
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions components/prism-hoon.js
Expand Up @@ -8,6 +8,7 @@ Prism.languages.hoon = {
'class-name': [
{
pattern: /@(?:[A-Za-z0-9-]*[A-Za-z0-9])?/,
greedy: true
Copy link
Member

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.

},
/\*/
],
Expand Down
2 changes: 1 addition & 1 deletion components/prism-hoon.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions tests/languages/hoon/comments_and_leaves.test
Expand Up @@ -31,8 +31,7 @@
" [",
["function", "now"],
"=",
["class-name", "@"],
["function", "da"],
["class-name", "@da"],
["function", "ovo"],
"=",
["class-name", "*"],
Expand Down
4 changes: 1 addition & 3 deletions tests/languages/hoon/nested_strings.test
Expand Up @@ -48,9 +48,7 @@ c
["keyword", "|="],
["function", "c"],
"=",
["class-name", "@"],
["function", "t"],
"D\r\n",
["class-name", "@tD"],

["keyword", "?:"],
" &((",
Expand Down