Update `hirad.js`
09eea184447f501a3998a292d88a90b902cb9595
1 parent
1ef831c5
static/js/hirad.js
+6 -7
| 4 | 4 | // |
|
| 5 | 5 | // Copyright (c) 2020-2025 Alexis Sellier |
|
| 6 | 6 | // |
|
| 7 | 7 | const selector = hirad || '.language-radiance'; |
|
| 8 | 8 | const keywords = [ |
|
| 9 | - | 'fn', 'pub', 'if', 'else', 'for', 'while', 'break', 'switch', 'match', |
|
| 10 | - | 'record', 'union', 'const', 'align', 'let', 'use', 'mod', 'case', |
|
| 9 | + | 'fn', 'if', 'else', 'for', 'while', 'break', 'switch', 'match', 'set', |
|
| 10 | + | 'record', 'union', 'constant', 'align', 'let', 'use', 'mod', 'module', 'case', |
|
| 11 | 11 | 'continue', 'return', 'true', 'false', 'loop', 'extern', 'panic', |
|
| 12 | - | 'device', 'register', 'catch', 'throw', 'throws', |
|
| 13 | - | 'at', 'mut', 'nil', 'undefined', 'static', 'in', 'is', 'where', |
|
| 14 | - | 'as', 'and', 'or', 'xor', 'not', 'try', 'atomic', 'select', 'trait', |
|
| 15 | - | 'instance', 'assert' |
|
| 12 | + | 'device', 'register', 'bit', 'catch', 'throw', 'throws', 'test', 'trait', 'instance', |
|
| 13 | + | 'at', 'mut', 'nil', 'undefined', 'static', 'in', 'is', 'where', 'export', |
|
| 14 | + | 'as', 'and', 'or', 'xor', 'not', 'try', 'atomic', 'select', 'of', 'assert' |
|
| 16 | 15 | ]; |
|
| 17 | 16 | const types = ['bool', 'u8', 'u16', 'u32', 'u64', 'i8', 'i16', 'i32', 'i64', 'f32', 'void', 'opaque']; |
|
| 18 | 17 | ||
| 19 | 18 | // Syntax definition. |
|
| 20 | 19 | // |
| 25 | 24 | ['number' , /\b(0x[0-9a-fA-F]+|0b[01]+|[0-9]+(?:\.[0-9]+)?)\b/g], |
|
| 26 | 25 | ['ref' , /(&|&'|\*)\b/g], |
|
| 27 | 26 | ['delim' , /(->|=>|\(|\)|\{|\}|\[|\])/g], |
|
| 28 | 27 | ['builtin', /(@[a-zA-Z]+)/g], |
|
| 29 | 28 | ['access' , /(\.|::)/g], |
|
| 30 | - | ['op' , /(=|!=|\.\.|\+|-|\*|\/|%|\?{1,2}|!{1,2}|>=?|<=?)/g], |
|
| 29 | + | ['op' , /(=|<>|\.\.|\+|-|\*|\/|%|\?{1,2}|!{1,2}|>=?|<=?)/g], |
|
| 31 | 30 | ['keyword', new RegExp('\\b(' + keywords.join('|') + ')\\b', 'g')], |
|
| 32 | 31 | ['type' , new RegExp('\\b(' + types.join('|') + ')\\b', 'g')], |
|
| 33 | 32 | ]; |
|
| 34 | 33 | ||
| 35 | 34 | const table = {}; |