diff --git a/src/webpage/highlighter/clike/langs.json b/src/webpage/highlighter/clike/langs.json index 1624a79..31e550e 100644 --- a/src/webpage/highlighter/clike/langs.json +++ b/src/webpage/highlighter/clike/langs.json @@ -93,5 +93,16 @@ "hashComments": true, "doubleSlashComments": false, "multilineSlashComments": false +}, +{ + "names":["kap"], + "keywords":["!", "#", "%", "&", "*", "+", ",", "-", "/", "<", "=", ">", "?", "^", "|", + "~", "¨", "×", "÷", "↑", "→", "↓", "∊", "∘", "∧", "∨", "∩", "∪", "∼", "≠", "≡", + "≢", "≤", "≥", "⊂", "⊃", "⊖", "⊢", "⊣", "⊤", "⊥", "⋆", "⌈", "⌊", "⌶", "⌷", "⌹", + "⌻", "⌽", "⌿", "⍀", "⍉", "⍋", "⍎", "⍒", "⍕", "⍞", "⍟", "⍠", "⍣", "⍤", + "⍨", "⍪", "⍫", "⍱", "⍲", "⍳", "⍴", "⍵", "⍶", "⍷", "⍸", "⍹", "⍺", "◊", + "○", "$", "¥", "χ", "\\", "∵", "⍓", "⫽", "⑊", "⊆", "⊇", "⍥", "∥", "⍛", "˝", + "⍢", "√", "∙", "⌸", "≬", "⍮", "⫇", "…", "⍰","and","or","while", "if", "else", "when", "⋄"], + "customComment":"⍝" } ] diff --git a/src/webpage/highlighter/clike/lex.ts b/src/webpage/highlighter/clike/lex.ts index 0de49b9..5909231 100644 --- a/src/webpage/highlighter/clike/lex.ts +++ b/src/webpage/highlighter/clike/lex.ts @@ -9,6 +9,7 @@ interface clikeConf { multilineSlashComments?: boolean; JSLikeTemplateStrings?: boolean; multiLine?: string; + customComment?: string; } function regex(config: clikeConf): RegExp { const conds = [] as string[]; @@ -30,6 +31,9 @@ function regex(config: clikeConf): RegExp { if (config.hashComments) { conds.push("#.*"); } + if (config.customComment) { + conds.push(config.customComment + ".*"); + } if (config.doubleSlashComments) { conds.push("\\/\\/.*"); } @@ -143,6 +147,11 @@ function* lex(code: string, config: clikeConf) { type: hcolors.comment, content: lex, }; + } else if (config.customComment && lex.startsWith(config.customComment)) { + yield { + type: hcolors.comment, + content: lex, + }; } else if (lex.startsWith("`") && config.JSLikeTemplateStrings) { yield { type: hcolors.string,