mirror of
https://github.com/MathMan05/Fermi.git
synced 2026-10-23 00:01:22 +00:00
add Kap support
This commit is contained in:
2 files changed
+20
No files matched your search
@@ -93,5 +93,16 @@
|
||||
"hashComments": true,
|
||||
"doubleSlashComments": false,
|
||||
"multilineSlashComments": false
|
||||
},
|
||||
{
|
||||
"names":["kap"],
|
||||
"keywords":["!", "#", "%", "&", "*", "+", ",", "-", "/", "<", "=", ">", "?", "^", "|",
|
||||
"~", "¨", "×", "÷", "↑", "→", "↓", "∊", "∘", "∧", "∨", "∩", "∪", "∼", "≠", "≡",
|
||||
"≢", "≤", "≥", "⊂", "⊃", "⊖", "⊢", "⊣", "⊤", "⊥", "⋆", "⌈", "⌊", "⌶", "⌷", "⌹",
|
||||
"⌻", "⌽", "⌿", "⍀", "⍉", "⍋", "⍎", "⍒", "⍕", "⍞", "⍟", "⍠", "⍣", "⍤",
|
||||
"⍨", "⍪", "⍫", "⍱", "⍲", "⍳", "⍴", "⍵", "⍶", "⍷", "⍸", "⍹", "⍺", "◊",
|
||||
"○", "$", "¥", "χ", "\\", "∵", "⍓", "⫽", "⑊", "⊆", "⊇", "⍥", "∥", "⍛", "˝",
|
||||
"⍢", "√", "∙", "⌸", "≬", "⍮", "⫇", "…", "⍰","and","or","while", "if", "else", "when", "⋄"],
|
||||
"customComment":"⍝"
|
||||
}
|
||||
]
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user