|
| 1 | +// Ren'Py script language support. |
| 2 | +hljs.registerLanguage("renpy", (hljs) => { |
| 3 | + const IDENT = /[A-Za-z_][A-Za-z0-9_]*/; |
| 4 | + const RENPY_KEYWORDS = [ |
| 5 | + "add", "at", "behind", "call", "camera", "centered", "contains", |
| 6 | + "default", "define", "drag", "draggroup", "elif", "else", "event", |
| 7 | + "expression", "hide", "hotspot", "if", "image", "init", "jump", |
| 8 | + "key", "label", "menu", "nvl", "on", "pass", "python", "queue", |
| 9 | + "repeat", "return", "scene", "screen", "show", "side", "sound", |
| 10 | + "stop", "style", "text", "time", "timer", "transform", "use", |
| 11 | + "voice", "while", "with", "window", "zorder" |
| 12 | + ].join(" "); |
| 13 | + const PYTHON_KEYWORDS = [ |
| 14 | + "and", "as", "assert", "async", "await", "break", "class", |
| 15 | + "continue", "def", "del", "except", "False", "finally", "for", |
| 16 | + "from", "global", "import", "in", "is", "lambda", "None", |
| 17 | + "nonlocal", "not", "or", "raise", "True", "try", "yield" |
| 18 | + ].join(" "); |
| 19 | + |
| 20 | + return { |
| 21 | + name: "Ren'Py", |
| 22 | + aliases: ["rpy"], |
| 23 | + keywords: { |
| 24 | + keyword: `${RENPY_KEYWORDS} ${PYTHON_KEYWORDS}`, |
| 25 | + literal: "True False None yes no", |
| 26 | + built_in: "Character DynamicCharacter Solid Null Fade Dissolve MoveTransition Pause SetVariable ToggleVariable Show Hide Jump Call Return Function Play Queue Stop" |
| 27 | + }, |
| 28 | + contains: [ |
| 29 | + hljs.HASH_COMMENT_MODE, |
| 30 | + hljs.QUOTE_STRING_MODE, |
| 31 | + hljs.APOS_STRING_MODE, |
| 32 | + hljs.NUMBER_MODE, |
| 33 | + { |
| 34 | + className: "meta", |
| 35 | + begin: /^\s*\$+/, |
| 36 | + end: /$/, |
| 37 | + contains: [ |
| 38 | + hljs.HASH_COMMENT_MODE, |
| 39 | + hljs.QUOTE_STRING_MODE, |
| 40 | + hljs.APOS_STRING_MODE, |
| 41 | + hljs.NUMBER_MODE |
| 42 | + ] |
| 43 | + }, |
| 44 | + { |
| 45 | + className: "section", |
| 46 | + begin: /^\s*(label|screen|transform|style|image)\s+/, |
| 47 | + end: /:/, |
| 48 | + keywords: "label screen transform style image" |
| 49 | + }, |
| 50 | + { |
| 51 | + className: "title", |
| 52 | + begin: new RegExp(`^\\s*${IDENT.source}(?=\\s+["'])`) |
| 53 | + }, |
| 54 | + { |
| 55 | + className: "variable", |
| 56 | + begin: /\[[^\]\n]+\]/ |
| 57 | + } |
| 58 | + ] |
| 59 | + }; |
| 60 | +}); |
| 61 | + |
1 | 62 | // https://cdn.jsdelivr.net/npm/highlightjs-solidity@2.0.6/dist/yul.min.js |
2 | 63 | hljs.registerLanguage("yul",(()=>{"use strict";function e(){try{return!0 |
3 | 64 | }catch(e){return!1}} |
|
0 commit comments