-
Notifications
You must be signed in to change notification settings - Fork 5
/
onyx-syntax.js
55 lines (47 loc) · 1.53 KB
/
onyx-syntax.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
Language: Onyx
Category: common, application
Website: https://onyxlang.io
*/
function onyx(hljs) {
return {
name: "Onyx",
aliases: [ "onyx "],
keywords: {
keyword: [
"package", "struct", "enum", "use", "global", "macro",
"if", "elseif", "else", "where", "interface", "union",
"for", "while", "do", "in", "as",
"switch", "case",
"break", "continue", "return", "defer", "fallthrough",
"cast", "sizeof", "alignof", "typeof"
].join(" "),
literal: "true false null null_proc null_str",
type: "i8 u8 i16 u16 i32 u32 i64 u64 f32 f64 rawptr str cstr dyn_str void i8x16 i16x8 i32x4 i64x2 f32x4 f64x2 v128 type_expr any",
built_in: "math map set array random iter list conv type_info",
},
contains: [].concat(
[
hljs.COMMENT('//', '$', {}),
hljs.C_BLOCK_COMMENT_MODE
],
[
hljs.C_NUMBER_MODE,
hljs.QUOTE_STRING_MODE,
],
[
{
className: "keyword",
scope: "keyword",
begin: /#[a-zA-Z0-9_]+/,
end: ' ',
}
]
)
};
}
window.addEventListener("load", () => {
hljs.registerLanguage("onyx", onyx);
Array.from(document.querySelectorAll("code"))
.forEach(block => hljs.highlightBlock(block));
});