Merge pull request #4744 from kairoski03/master
add toml syntax highlighting for monacopull/4775/head
commit
b04745e973
@ -0,0 +1,62 @@ |
||||
/* eslint-disable no-useless-escape */ |
||||
export const tomlLanguageConfig = { |
||||
comments: { |
||||
lineComment: "#", |
||||
}, |
||||
brackets: [ |
||||
["{", "}"], |
||||
["[", "]"], |
||||
["(", ")"], |
||||
], |
||||
autoClosingPairs: [ |
||||
{ open: "{", close: "}" }, |
||||
{ open: "[", close: "]" }, |
||||
{ open: "(", close: ")" }, |
||||
{ open: '"', close: '"' }, |
||||
{ open: "'", close: "'" }, |
||||
], |
||||
surroundingPairs: [ |
||||
{ open: "{", close: "}" }, |
||||
{ open: "[", close: "]" }, |
||||
{ open: "(", close: ")" }, |
||||
{ open: '"', close: '"' }, |
||||
{ open: "'", close: "'" }, |
||||
], |
||||
} |
||||
|
||||
export const tomlTokenProvider = { |
||||
defaultToken: "", |
||||
tokenPostfix: ".toml", |
||||
|
||||
escapes: |
||||
/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/, |
||||
|
||||
tokenizer: { |
||||
root: [ |
||||
[/([a-zA-Z0-9_-]+)(\s*)(=)/, ["variable.name", "operators", ""]], |
||||
[/\[[a-zA-Z0-9_.-]+\]/, "type.identifier"], |
||||
[/\s*((#).*)$/, "comment"], |
||||
|
||||
[/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"], |
||||
[/0[xX][0-9a-fA-F]+/, "number.hex"], |
||||
[/\d+/, "number"], |
||||
|
||||
[/"([^"\\]|\\.)*$/, "string.invalid"], |
||||
[/'([^'\\]|\\.)*$/, "string.invalid"], |
||||
[/"/, "string", "@string_double"], |
||||
[/'/, "string", "@string_single"], |
||||
], |
||||
string_double: [ |
||||
[/[^\\"]+/, "string"], |
||||
[/@escapes/, "string.escape"], |
||||
[/\\./, "string.escape.invalid"], |
||||
[/"/, "string", "@pop"], |
||||
], |
||||
string_single: [ |
||||
[/[^\\']+/, "string"], |
||||
[/@escapes/, "string.escape"], |
||||
[/\\./, "string.escape.invalid"], |
||||
[/'/, "string", "@pop"], |
||||
], |
||||
}, |
||||
} |
Loading…
Reference in new issue