Version 1.0

This commit is contained in:
Alexander R.
2026-07-21 22:24:25 +00:00
parent f3645fbfbc
commit 9edbfd3f77
4134 changed files with 1448752 additions and 1 deletions
@@ -0,0 +1,120 @@
import '../editor/browser/coreCommands.js';
import '../editor/browser/widget/codeEditor/codeEditorWidget.js';
import '../editor/browser/widget/diffEditor/diffEditor.contribution.js';
import '../editor/contrib/anchorSelect/browser/anchorSelect.js';
import '../editor/contrib/bracketMatching/browser/bracketMatching.js';
import '../editor/contrib/caretOperations/browser/caretOperations.js';
import '../editor/contrib/caretOperations/browser/transpose.js';
import '../editor/contrib/clipboard/browser/clipboard.js';
import '../editor/contrib/codeAction/browser/codeActionContributions.js';
import '../editor/contrib/codelens/browser/codelensController.js';
import '../editor/contrib/colorPicker/browser/colorPickerContribution.js';
import '../editor/contrib/comment/browser/comment.js';
import '../editor/contrib/contextmenu/browser/contextmenu.js';
import '../editor/contrib/cursorUndo/browser/cursorUndo.js';
import '../editor/contrib/dnd/browser/dnd.js';
import '../editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js';
import '../editor/contrib/dropOrPasteInto/browser/dropIntoEditorContribution.js';
import '../editor/contrib/find/browser/findController.js';
import '../editor/contrib/folding/browser/folding.js';
import '../editor/contrib/fontZoom/browser/fontZoom.js';
import '../editor/contrib/format/browser/formatActions.js';
import '../editor/contrib/documentSymbols/browser/documentSymbols.js';
import '../editor/contrib/inlineCompletions/browser/inlineCompletions.contribution.js';
import '../editor/contrib/inlineProgress/browser/inlineProgress.js';
import '../editor/contrib/gotoSymbol/browser/goToCommands.js';
import '../editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js';
import '../editor/contrib/gotoError/browser/gotoError.js';
import '../editor/contrib/gpu/browser/gpuActions.js';
import '../editor/contrib/hover/browser/hoverContribution.js';
import '../editor/contrib/indentation/browser/indentation.js';
import '../editor/contrib/inlayHints/browser/inlayHintsContribution.js';
import '../editor/contrib/inPlaceReplace/browser/inPlaceReplace.js';
import '../editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js';
import '../editor/contrib/lineSelection/browser/lineSelection.js';
import '../editor/contrib/linesOperations/browser/linesOperations.js';
import '../editor/contrib/linkedEditing/browser/linkedEditing.js';
import '../editor/contrib/links/browser/links.js';
import '../editor/contrib/longLinesHelper/browser/longLinesHelper.js';
import '../editor/contrib/middleScroll/browser/middleScroll.contribution.js';
import '../editor/contrib/multicursor/browser/multicursor.js';
import '../editor/contrib/parameterHints/browser/parameterHints.js';
import '../editor/contrib/placeholderText/browser/placeholderText.contribution.js';
import '../editor/contrib/rename/browser/rename.js';
import '../editor/contrib/sectionHeaders/browser/sectionHeaders.js';
import '../editor/contrib/semanticTokens/browser/documentSemanticTokens.js';
import '../editor/contrib/semanticTokens/browser/viewportSemanticTokens.js';
import '../editor/contrib/smartSelect/browser/smartSelect.js';
import '../editor/contrib/snippet/browser/snippetController2.js';
import '../editor/contrib/stickyScroll/browser/stickyScrollContribution.js';
import '../editor/contrib/suggest/browser/suggestController.js';
import '../editor/contrib/suggest/browser/suggestInlineCompletions.js';
import '../editor/contrib/tokenization/browser/tokenization.js';
import '../editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js';
import '../editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js';
import '../editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js';
import '../editor/contrib/wordHighlighter/browser/wordHighlighter.js';
import '../editor/contrib/wordOperations/browser/wordOperations.js';
import '../editor/contrib/wordPartOperations/browser/wordPartOperations.js';
import '../editor/contrib/readOnlyMessage/browser/contribution.js';
import '../editor/contrib/diffEditorBreadcrumbs/browser/contribution.js';
import '../editor/contrib/floatingMenu/browser/floatingMenu.contribution.js';
import '../editor/common/standaloneStrings.js';
import '../base/browser/ui/codicons/codicon/codicon.css';
import '../base/browser/ui/codicons/codicon/codicon-modifiers.css';
import '../editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.js';
import '../editor/standalone/browser/inspectTokens/inspectTokens.js';
import '../editor/standalone/browser/quickAccess/standaloneHelpQuickAccess.js';
import '../editor/standalone/browser/quickAccess/standaloneGotoLineQuickAccess.js';
import '../editor/standalone/browser/quickAccess/standaloneGotoSymbolQuickAccess.js';
import '../editor/standalone/browser/quickAccess/standaloneCommandsQuickAccess.js';
import '../editor/standalone/browser/referenceSearch/standaloneReferenceSearch.js';
import '../editor/standalone/browser/toggleHighContrast/toggleHighContrast.js';
import { languages } from '../editor/editor.api2.js';
const languageDefinitions = {};
const lazyLanguageLoaders = {};
class LazyLanguageLoader {
static getOrCreate(languageId) {
if (!lazyLanguageLoaders[languageId]) {
lazyLanguageLoaders[languageId] = new LazyLanguageLoader(languageId);
}
return lazyLanguageLoaders[languageId];
}
constructor(languageId) {
this._languageId = languageId;
this._loadingTriggered = false;
this._lazyLoadPromise = new Promise((resolve, reject) => {
this._lazyLoadPromiseResolve = resolve;
this._lazyLoadPromiseReject = reject;
});
}
load() {
if (!this._loadingTriggered) {
this._loadingTriggered = true;
languageDefinitions[this._languageId].loader().then(
(mod) => this._lazyLoadPromiseResolve(mod),
(err) => this._lazyLoadPromiseReject(err)
);
}
return this._lazyLoadPromise;
}
}
function registerLanguage(def) {
const languageId = def.id;
languageDefinitions[languageId] = def;
languages.register(def);
const lazyLanguageLoader = LazyLanguageLoader.getOrCreate(languageId);
languages.registerTokensProviderFactory(languageId, {
create: async () => {
const mod = await lazyLanguageLoader.load();
return mod.language;
}
});
languages.onLanguageEncountered(languageId, async () => {
const mod = await lazyLanguageLoader.load();
languages.setLanguageConfiguration(languageId, mod.conf);
});
}
export { registerLanguage };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,8 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "abap",
extensions: [".abap"],
aliases: ["abap", "ABAP"],
loader: () => import('./abap.js')
});
File diff suppressed because it is too large Load Diff
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,9 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "apex",
extensions: [".cls"],
aliases: ["Apex", "apex"],
mimetypes: ["text/x-apex-source", "text/x-apex"],
loader: () => import('./apex.js')
});
+329
View File
@@ -0,0 +1,329 @@
const conf = {
// the default separators except `@$`
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
comments: {
lineComment: "//",
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" },
{ open: "<", close: ">" }
],
folding: {
markers: {
start: new RegExp("^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))"),
end: new RegExp("^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))")
}
}
};
const keywords = [
"abstract",
"activate",
"and",
"any",
"array",
"as",
"asc",
"assert",
"autonomous",
"begin",
"bigdecimal",
"blob",
"boolean",
"break",
"bulk",
"by",
"case",
"cast",
"catch",
"char",
"class",
"collect",
"commit",
"const",
"continue",
"convertcurrency",
"decimal",
"default",
"delete",
"desc",
"do",
"double",
"else",
"end",
"enum",
"exception",
"exit",
"export",
"extends",
"false",
"final",
"finally",
"float",
"for",
"from",
"future",
"get",
"global",
"goto",
"group",
"having",
"hint",
"if",
"implements",
"import",
"in",
"inner",
"insert",
"instanceof",
"int",
"interface",
"into",
"join",
"last_90_days",
"last_month",
"last_n_days",
"last_week",
"like",
"limit",
"list",
"long",
"loop",
"map",
"merge",
"native",
"new",
"next_90_days",
"next_month",
"next_n_days",
"next_week",
"not",
"null",
"nulls",
"number",
"object",
"of",
"on",
"or",
"outer",
"override",
"package",
"parallel",
"pragma",
"private",
"protected",
"public",
"retrieve",
"return",
"returning",
"rollback",
"savepoint",
"search",
"select",
"set",
"short",
"sort",
"stat",
"static",
"strictfp",
"super",
"switch",
"synchronized",
"system",
"testmethod",
"then",
"this",
"this_month",
"this_week",
"throw",
"throws",
"today",
"tolabel",
"tomorrow",
"transaction",
"transient",
"trigger",
"true",
"try",
"type",
"undelete",
"update",
"upsert",
"using",
"virtual",
"void",
"volatile",
"webservice",
"when",
"where",
"while",
"yesterday"
];
const uppercaseFirstLetter = (lowercase) => lowercase.charAt(0).toUpperCase() + lowercase.substr(1);
let keywordsWithCaseVariations = [];
keywords.forEach((lowercase) => {
keywordsWithCaseVariations.push(lowercase);
keywordsWithCaseVariations.push(lowercase.toUpperCase());
keywordsWithCaseVariations.push(uppercaseFirstLetter(lowercase));
});
const language = {
defaultToken: "",
tokenPostfix: ".apex",
keywords: keywordsWithCaseVariations,
operators: [
"=",
">",
"<",
"!",
"~",
"?",
":",
"==",
"<=",
">=",
"!=",
"&&",
"||",
"++",
"--",
"+",
"-",
"*",
"/",
"&",
"|",
"^",
"%",
"<<",
">>",
">>>",
"+=",
"-=",
"*=",
"/=",
"&=",
"|=",
"^=",
"%=",
"<<=",
">>=",
">>>="
],
// we include these common regular expressions
symbols: /[=><!~?:&|+\-*\/\^%]+/,
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
digits: /\d+(_+\d+)*/,
octaldigits: /[0-7]+(_+[0-7]+)*/,
binarydigits: /[0-1]+(_+[0-1]+)*/,
hexdigits: /[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,
// The main tokenizer for our languages
tokenizer: {
root: [
// identifiers and keywords
[
/[a-z_$][\w$]*/,
{
cases: {
"@keywords": { token: "keyword.$0" },
"@default": "identifier"
}
}
],
// assume that identifiers starting with an uppercase letter are types
[
/[A-Z][\w\$]*/,
{
cases: {
"@keywords": { token: "keyword.$0" },
"@default": "type.identifier"
}
}
],
// whitespace
{ include: "@whitespace" },
// delimiters and operators
[/[{}()\[\]]/, "@brackets"],
[/[<>](?!@symbols)/, "@brackets"],
[
/@symbols/,
{
cases: {
"@operators": "delimiter",
"@default": ""
}
}
],
// @ annotations.
[/@\s*[a-zA-Z_\$][\w\$]*/, "annotation"],
// numbers
[/(@digits)[eE]([\-+]?(@digits))?[fFdD]?/, "number.float"],
[/(@digits)\.(@digits)([eE][\-+]?(@digits))?[fFdD]?/, "number.float"],
[/(@digits)[fFdD]/, "number.float"],
[/(@digits)[lL]?/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings
[/"([^"\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/'([^'\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/"/, "string", '@string."'],
[/'/, "string", "@string.'"],
// characters
[/'[^\\']'/, "string"],
[/(')(@escapes)(')/, ["string", "string.escape", "string"]],
[/'/, "string.invalid"]
],
whitespace: [
[/[ \t\r\n]+/, ""],
[/\/\*\*(?!\/)/, "comment.doc", "@apexdoc"],
[/\/\*/, "comment", "@comment"],
[/\/\/.*$/, "comment"]
],
comment: [
[/[^\/*]+/, "comment"],
// [/\/\*/, 'comment', '@push' ], // nested comment not allowed :-(
// [/\/\*/, 'comment.invalid' ], // this breaks block comments in the shape of /* //*/
[/\*\//, "comment", "@pop"],
[/[\/*]/, "comment"]
],
//Identical copy of comment above, except for the addition of .doc
apexdoc: [
[/[^\/*]+/, "comment.doc"],
[/\*\//, "comment.doc", "@pop"],
[/[\/*]/, "comment.doc"]
],
string: [
[/[^\\"']+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[
/["']/,
{
cases: {
"$#==$S2": { token: "string", next: "@pop" },
"@default": "string"
}
}
]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,8 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "azcli",
extensions: [".azcli"],
aliases: ["Azure CLI", "azcli"],
loader: () => import('./azcli.js')
});
@@ -0,0 +1,67 @@
const conf = {
comments: {
lineComment: "#"
}
};
const language = {
defaultToken: "keyword",
ignoreCase: true,
tokenPostfix: ".azcli",
str: /[^#\s]/,
tokenizer: {
root: [
{ include: "@comment" },
[
/\s-+@str*\s*/,
{
cases: {
"@eos": { token: "key.identifier", next: "@popall" },
"@default": { token: "key.identifier", next: "@type" }
}
}
],
[
/^-+@str*\s*/,
{
cases: {
"@eos": { token: "key.identifier", next: "@popall" },
"@default": { token: "key.identifier", next: "@type" }
}
}
]
],
type: [
{ include: "@comment" },
[
/-+@str*\s*/,
{
cases: {
"@eos": { token: "key.identifier", next: "@popall" },
"@default": "key.identifier"
}
}
],
[
/@str+\s*/,
{
cases: {
"@eos": { token: "string", next: "@popall" },
"@default": "string"
}
}
]
],
comment: [
[
/#.*$/,
{
cases: {
"@eos": { token: "comment", next: "@popall" }
}
}
]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,8 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "bat",
extensions: [".bat", ".cmd"],
aliases: ["Batch", "bat"],
loader: () => import('./bat.js')
});
+99
View File
@@ -0,0 +1,99 @@
const conf = {
comments: {
lineComment: "REM"
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' }
],
surroundingPairs: [
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' }
],
folding: {
markers: {
start: new RegExp("^\\s*(::\\s*|REM\\s+)#region"),
end: new RegExp("^\\s*(::\\s*|REM\\s+)#endregion")
}
}
};
const language = {
defaultToken: "",
ignoreCase: true,
tokenPostfix: ".bat",
brackets: [
{ token: "delimiter.bracket", open: "{", close: "}" },
{ token: "delimiter.parenthesis", open: "(", close: ")" },
{ token: "delimiter.square", open: "[", close: "]" }
],
keywords: /call|defined|echo|errorlevel|exist|for|goto|if|pause|set|shift|start|title|not|pushd|popd/,
// we include these common regular expressions
symbols: /[=><!~?&|+\-*\/\^;\.,]+/,
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
// The main tokenizer for our languages
tokenizer: {
root: [
[/^(\s*)(rem(?:\s.*|))$/, ["", "comment"]],
[/(\@?)(@keywords)(?!\w)/, [{ token: "keyword" }, { token: "keyword.$2" }]],
// whitespace
[/[ \t\r\n]+/, ""],
// blocks
[/setlocal(?!\w)/, "keyword.tag-setlocal"],
[/endlocal(?!\w)/, "keyword.tag-setlocal"],
// words
[/[a-zA-Z_]\w*/, ""],
// labels
[/:\w*/, "metatag"],
// variables
[/%[^%]+%/, "variable"],
[/%%[\w]+(?!\w)/, "variable"],
// punctuations
[/[{}()\[\]]/, "@brackets"],
[/@symbols/, "delimiter"],
// numbers
[/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"],
[/0[xX][0-9a-fA-F_]*[0-9a-fA-F]/, "number.hex"],
[/\d+/, "number"],
// punctuation: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings:
[/"/, "string", '@string."'],
[/'/, "string", "@string.'"]
],
string: [
[
/[^\\"'%]+/,
{
cases: {
"@eos": { token: "string", next: "@popall" },
"@default": "string"
}
}
],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/%[\w ]+%/, "variable"],
[/%%[\w]+(?!\w)/, "variable"],
[
/["']/,
{
cases: {
"$#==$S2": { token: "string", next: "@pop" },
"@default": "string"
}
}
],
[/$/, "string", "@popall"]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,8 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "bicep",
extensions: [".bicep"],
aliases: ["Bicep"],
loader: () => import('./bicep.js')
});
@@ -0,0 +1,108 @@
const bounded = (text) => `\\b${text}\\b`;
const identifierStart = "[_a-zA-Z]";
const identifierContinue = "[_a-zA-Z0-9]";
const identifier = bounded(`${identifierStart}${identifierContinue}*`);
const keywords = [
"targetScope",
"resource",
"module",
"param",
"var",
"output",
"for",
"in",
"if",
"existing"
];
const namedLiterals = ["true", "false", "null"];
const nonCommentWs = `[ \\t\\r\\n]`;
const numericLiteral = `[0-9]+`;
const conf = {
comments: {
lineComment: "//",
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "'", close: "'" },
{ open: "'''", close: "'''" }
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "'", close: "'", notIn: ["string", "comment"] },
{ open: "'''", close: "'''", notIn: ["string", "comment"] }
],
autoCloseBefore: ":.,=}])' \n ",
indentationRules: {
increaseIndentPattern: new RegExp("^((?!\\/\\/).)*(\\{[^}\"'`]*|\\([^)\"'`]*|\\[[^\\]\"'`]*)$"),
decreaseIndentPattern: new RegExp("^((?!.*?\\/\\*).*\\*/)?\\s*[\\}\\]].*$")
}
};
const language = {
defaultToken: "",
tokenPostfix: ".bicep",
brackets: [
{ open: "{", close: "}", token: "delimiter.curly" },
{ open: "[", close: "]", token: "delimiter.square" },
{ open: "(", close: ")", token: "delimiter.parenthesis" }
],
symbols: /[=><!~?:&|+\-*/^%]+/,
keywords,
namedLiterals,
escapes: `\\\\(u{[0-9A-Fa-f]+}|n|r|t|\\\\|'|\\\${)`,
tokenizer: {
root: [{ include: "@expression" }, { include: "@whitespace" }],
stringVerbatim: [
{ regex: `(|'|'')[^']`, action: { token: "string" } },
{ regex: `'''`, action: { token: "string.quote", next: "@pop" } }
],
stringLiteral: [
{ regex: `\\\${`, action: { token: "delimiter.bracket", next: "@bracketCounting" } },
{ regex: `[^\\\\'$]+`, action: { token: "string" } },
{ regex: "@escapes", action: { token: "string.escape" } },
{ regex: `\\\\.`, action: { token: "string.escape.invalid" } },
{ regex: `'`, action: { token: "string", next: "@pop" } }
],
bracketCounting: [
{ regex: `{`, action: { token: "delimiter.bracket", next: "@bracketCounting" } },
{ regex: `}`, action: { token: "delimiter.bracket", next: "@pop" } },
{ include: "expression" }
],
comment: [
{ regex: `[^\\*]+`, action: { token: "comment" } },
{ regex: `\\*\\/`, action: { token: "comment", next: "@pop" } },
{ regex: `[\\/*]`, action: { token: "comment" } }
],
whitespace: [
{ regex: nonCommentWs },
{ regex: `\\/\\*`, action: { token: "comment", next: "@comment" } },
{ regex: `\\/\\/.*$`, action: { token: "comment" } }
],
expression: [
{ regex: `'''`, action: { token: "string.quote", next: "@stringVerbatim" } },
{ regex: `'`, action: { token: "string.quote", next: "@stringLiteral" } },
{ regex: numericLiteral, action: { token: "number" } },
{
regex: identifier,
action: {
cases: {
"@keywords": { token: "keyword" },
"@namedLiterals": { token: "keyword" },
"@default": { token: "identifier" }
}
}
}
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,8 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "cameligo",
extensions: [".mligo"],
aliases: ["Cameligo"],
loader: () => import('./cameligo.js')
});
@@ -0,0 +1,173 @@
const conf = {
comments: {
lineComment: "//",
blockComment: ["(*", "*)"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"],
["<", ">"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "<", close: ">" },
{ open: "'", close: "'" },
{ open: '"', close: '"' },
{ open: "(*", close: "*)" }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "<", close: ">" },
{ open: "'", close: "'" },
{ open: '"', close: '"' },
{ open: "(*", close: "*)" }
]
};
const language = {
defaultToken: "",
tokenPostfix: ".cameligo",
ignoreCase: true,
brackets: [
{ open: "{", close: "}", token: "delimiter.curly" },
{ open: "[", close: "]", token: "delimiter.square" },
{ open: "(", close: ")", token: "delimiter.parenthesis" },
{ open: "<", close: ">", token: "delimiter.angle" }
],
keywords: [
"abs",
"assert",
"block",
"Bytes",
"case",
"Crypto",
"Current",
"else",
"failwith",
"false",
"for",
"fun",
"if",
"in",
"let",
"let%entry",
"let%init",
"List",
"list",
"Map",
"map",
"match",
"match%nat",
"mod",
"not",
"operation",
"Operation",
"of",
"record",
"Set",
"set",
"sender",
"skip",
"source",
"String",
"then",
"to",
"true",
"type",
"with"
],
typeKeywords: ["int", "unit", "string", "tz", "nat", "bool"],
operators: [
"=",
">",
"<",
"<=",
">=",
"<>",
":",
":=",
"and",
"mod",
"or",
"+",
"-",
"*",
"/",
"@",
"&",
"^",
"%",
"->",
"<-",
"&&",
"||"
],
// we include these common regular expressions
symbols: /[=><:@\^&|+\-*\/\^%]+/,
// The main tokenizer for our languages
tokenizer: {
root: [
// identifiers and keywords
[
/[a-zA-Z_][\w]*/,
{
cases: {
"@keywords": { token: "keyword.$0" },
"@default": "identifier"
}
}
],
// whitespace
{ include: "@whitespace" },
// delimiters and operators
[/[{}()\[\]]/, "@brackets"],
[/[<>](?!@symbols)/, "@brackets"],
[
/@symbols/,
{
cases: {
"@operators": "delimiter",
"@default": ""
}
}
],
// numbers
[/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"],
[/\$[0-9a-fA-F]{1,16}/, "number.hex"],
[/\d+/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings
[/'([^'\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/'/, "string", "@string"],
// characters
[/'[^\\']'/, "string"],
[/'/, "string.invalid"],
[/\#\d+/, "string"]
],
/* */
comment: [
[/[^\(\*]+/, "comment"],
//[/\(\*/, 'comment', '@push' ], // nested comment not allowed :-(
[/\*\)/, "comment", "@pop"],
[/\(\*/, "comment"]
],
string: [
[/[^\\']+/, "string"],
[/\\./, "string.escape.invalid"],
[/'/, { token: "string.quote", bracket: "@close", next: "@pop" }]
],
whitespace: [
[/[ \t\r\n]+/, "white"],
[/\(\*/, "comment", "@comment"],
[/\/\/.*$/, "comment"]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,8 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "clojure",
extensions: [".clj", ".cljs", ".cljc", ".edn"],
aliases: ["clojure", "Clojure"],
loader: () => import('./clojure.js')
});
@@ -0,0 +1,760 @@
const conf = {
comments: {
lineComment: ";;"
},
brackets: [
["[", "]"],
["(", ")"],
["{", "}"]
],
autoClosingPairs: [
{ open: "[", close: "]" },
{ open: '"', close: '"' },
{ open: "(", close: ")" },
{ open: "{", close: "}" }
],
surroundingPairs: [
{ open: "[", close: "]" },
{ open: '"', close: '"' },
{ open: "(", close: ")" },
{ open: "{", close: "}" }
]
};
const language = {
defaultToken: "",
ignoreCase: true,
tokenPostfix: ".clj",
brackets: [
{ open: "[", close: "]", token: "delimiter.square" },
{ open: "(", close: ")", token: "delimiter.parenthesis" },
{ open: "{", close: "}", token: "delimiter.curly" }
],
constants: ["true", "false", "nil"],
// delimiters: /[\\\[\]\s"#'(),;@^`{}~]|$/,
numbers: /^(?:[+\-]?\d+(?:(?:N|(?:[eE][+\-]?\d+))|(?:\.?\d*(?:M|(?:[eE][+\-]?\d+))?)|\/\d+|[xX][0-9a-fA-F]+|r[0-9a-zA-Z]+)?(?=[\\\[\]\s"#'(),;@^`{}~]|$))/,
characters: /^(?:\\(?:backspace|formfeed|newline|return|space|tab|o[0-7]{3}|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{4}|.)?(?=[\\\[\]\s"(),;@^`{}~]|$))/,
escapes: /^\\(?:["'\\bfnrt]|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
// simple-namespace := /^[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*/
// simple-symbol := /^(?:\/|[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)/
// qualified-symbol := (<simple-namespace>(<.><simple-namespace>)*</>)?<simple-symbol>
qualifiedSymbols: /^(?:(?:[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*(?:\.[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)*\/)?(?:\/|[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)*(?=[\\\[\]\s"(),;@^`{}~]|$))/,
specialForms: [
".",
"catch",
"def",
"do",
"if",
"monitor-enter",
"monitor-exit",
"new",
"quote",
"recur",
"set!",
"throw",
"try",
"var"
],
coreSymbols: [
"*",
"*'",
"*1",
"*2",
"*3",
"*agent*",
"*allow-unresolved-vars*",
"*assert*",
"*clojure-version*",
"*command-line-args*",
"*compile-files*",
"*compile-path*",
"*compiler-options*",
"*data-readers*",
"*default-data-reader-fn*",
"*e",
"*err*",
"*file*",
"*flush-on-newline*",
"*fn-loader*",
"*in*",
"*math-context*",
"*ns*",
"*out*",
"*print-dup*",
"*print-length*",
"*print-level*",
"*print-meta*",
"*print-namespace-maps*",
"*print-readably*",
"*read-eval*",
"*reader-resolver*",
"*source-path*",
"*suppress-read*",
"*unchecked-math*",
"*use-context-classloader*",
"*verbose-defrecords*",
"*warn-on-reflection*",
"+",
"+'",
"-",
"-'",
"->",
"->>",
"->ArrayChunk",
"->Eduction",
"->Vec",
"->VecNode",
"->VecSeq",
"-cache-protocol-fn",
"-reset-methods",
"..",
"/",
"<",
"<=",
"=",
"==",
">",
">=",
"EMPTY-NODE",
"Inst",
"StackTraceElement->vec",
"Throwable->map",
"accessor",
"aclone",
"add-classpath",
"add-watch",
"agent",
"agent-error",
"agent-errors",
"aget",
"alength",
"alias",
"all-ns",
"alter",
"alter-meta!",
"alter-var-root",
"amap",
"ancestors",
"and",
"any?",
"apply",
"areduce",
"array-map",
"as->",
"aset",
"aset-boolean",
"aset-byte",
"aset-char",
"aset-double",
"aset-float",
"aset-int",
"aset-long",
"aset-short",
"assert",
"assoc",
"assoc!",
"assoc-in",
"associative?",
"atom",
"await",
"await-for",
"await1",
"bases",
"bean",
"bigdec",
"bigint",
"biginteger",
"binding",
"bit-and",
"bit-and-not",
"bit-clear",
"bit-flip",
"bit-not",
"bit-or",
"bit-set",
"bit-shift-left",
"bit-shift-right",
"bit-test",
"bit-xor",
"boolean",
"boolean-array",
"boolean?",
"booleans",
"bound-fn",
"bound-fn*",
"bound?",
"bounded-count",
"butlast",
"byte",
"byte-array",
"bytes",
"bytes?",
"case",
"cast",
"cat",
"char",
"char-array",
"char-escape-string",
"char-name-string",
"char?",
"chars",
"chunk",
"chunk-append",
"chunk-buffer",
"chunk-cons",
"chunk-first",
"chunk-next",
"chunk-rest",
"chunked-seq?",
"class",
"class?",
"clear-agent-errors",
"clojure-version",
"coll?",
"comment",
"commute",
"comp",
"comparator",
"compare",
"compare-and-set!",
"compile",
"complement",
"completing",
"concat",
"cond",
"cond->",
"cond->>",
"condp",
"conj",
"conj!",
"cons",
"constantly",
"construct-proxy",
"contains?",
"count",
"counted?",
"create-ns",
"create-struct",
"cycle",
"dec",
"dec'",
"decimal?",
"declare",
"dedupe",
"default-data-readers",
"definline",
"definterface",
"defmacro",
"defmethod",
"defmulti",
"defn",
"defn-",
"defonce",
"defprotocol",
"defrecord",
"defstruct",
"deftype",
"delay",
"delay?",
"deliver",
"denominator",
"deref",
"derive",
"descendants",
"destructure",
"disj",
"disj!",
"dissoc",
"dissoc!",
"distinct",
"distinct?",
"doall",
"dorun",
"doseq",
"dosync",
"dotimes",
"doto",
"double",
"double-array",
"double?",
"doubles",
"drop",
"drop-last",
"drop-while",
"eduction",
"empty",
"empty?",
"ensure",
"ensure-reduced",
"enumeration-seq",
"error-handler",
"error-mode",
"eval",
"even?",
"every-pred",
"every?",
"ex-data",
"ex-info",
"extend",
"extend-protocol",
"extend-type",
"extenders",
"extends?",
"false?",
"ffirst",
"file-seq",
"filter",
"filterv",
"find",
"find-keyword",
"find-ns",
"find-protocol-impl",
"find-protocol-method",
"find-var",
"first",
"flatten",
"float",
"float-array",
"float?",
"floats",
"flush",
"fn",
"fn?",
"fnext",
"fnil",
"for",
"force",
"format",
"frequencies",
"future",
"future-call",
"future-cancel",
"future-cancelled?",
"future-done?",
"future?",
"gen-class",
"gen-interface",
"gensym",
"get",
"get-in",
"get-method",
"get-proxy-class",
"get-thread-bindings",
"get-validator",
"group-by",
"halt-when",
"hash",
"hash-combine",
"hash-map",
"hash-ordered-coll",
"hash-set",
"hash-unordered-coll",
"ident?",
"identical?",
"identity",
"if-let",
"if-not",
"if-some",
"ifn?",
"import",
"in-ns",
"inc",
"inc'",
"indexed?",
"init-proxy",
"inst-ms",
"inst-ms*",
"inst?",
"instance?",
"int",
"int-array",
"int?",
"integer?",
"interleave",
"intern",
"interpose",
"into",
"into-array",
"ints",
"io!",
"isa?",
"iterate",
"iterator-seq",
"juxt",
"keep",
"keep-indexed",
"key",
"keys",
"keyword",
"keyword?",
"last",
"lazy-cat",
"lazy-seq",
"let",
"letfn",
"line-seq",
"list",
"list*",
"list?",
"load",
"load-file",
"load-reader",
"load-string",
"loaded-libs",
"locking",
"long",
"long-array",
"longs",
"loop",
"macroexpand",
"macroexpand-1",
"make-array",
"make-hierarchy",
"map",
"map-entry?",
"map-indexed",
"map?",
"mapcat",
"mapv",
"max",
"max-key",
"memfn",
"memoize",
"merge",
"merge-with",
"meta",
"method-sig",
"methods",
"min",
"min-key",
"mix-collection-hash",
"mod",
"munge",
"name",
"namespace",
"namespace-munge",
"nat-int?",
"neg-int?",
"neg?",
"newline",
"next",
"nfirst",
"nil?",
"nnext",
"not",
"not-any?",
"not-empty",
"not-every?",
"not=",
"ns",
"ns-aliases",
"ns-imports",
"ns-interns",
"ns-map",
"ns-name",
"ns-publics",
"ns-refers",
"ns-resolve",
"ns-unalias",
"ns-unmap",
"nth",
"nthnext",
"nthrest",
"num",
"number?",
"numerator",
"object-array",
"odd?",
"or",
"parents",
"partial",
"partition",
"partition-all",
"partition-by",
"pcalls",
"peek",
"persistent!",
"pmap",
"pop",
"pop!",
"pop-thread-bindings",
"pos-int?",
"pos?",
"pr",
"pr-str",
"prefer-method",
"prefers",
"primitives-classnames",
"print",
"print-ctor",
"print-dup",
"print-method",
"print-simple",
"print-str",
"printf",
"println",
"println-str",
"prn",
"prn-str",
"promise",
"proxy",
"proxy-call-with-super",
"proxy-mappings",
"proxy-name",
"proxy-super",
"push-thread-bindings",
"pvalues",
"qualified-ident?",
"qualified-keyword?",
"qualified-symbol?",
"quot",
"rand",
"rand-int",
"rand-nth",
"random-sample",
"range",
"ratio?",
"rational?",
"rationalize",
"re-find",
"re-groups",
"re-matcher",
"re-matches",
"re-pattern",
"re-seq",
"read",
"read-line",
"read-string",
"reader-conditional",
"reader-conditional?",
"realized?",
"record?",
"reduce",
"reduce-kv",
"reduced",
"reduced?",
"reductions",
"ref",
"ref-history-count",
"ref-max-history",
"ref-min-history",
"ref-set",
"refer",
"refer-clojure",
"reify",
"release-pending-sends",
"rem",
"remove",
"remove-all-methods",
"remove-method",
"remove-ns",
"remove-watch",
"repeat",
"repeatedly",
"replace",
"replicate",
"require",
"reset!",
"reset-meta!",
"reset-vals!",
"resolve",
"rest",
"restart-agent",
"resultset-seq",
"reverse",
"reversible?",
"rseq",
"rsubseq",
"run!",
"satisfies?",
"second",
"select-keys",
"send",
"send-off",
"send-via",
"seq",
"seq?",
"seqable?",
"seque",
"sequence",
"sequential?",
"set",
"set-agent-send-executor!",
"set-agent-send-off-executor!",
"set-error-handler!",
"set-error-mode!",
"set-validator!",
"set?",
"short",
"short-array",
"shorts",
"shuffle",
"shutdown-agents",
"simple-ident?",
"simple-keyword?",
"simple-symbol?",
"slurp",
"some",
"some->",
"some->>",
"some-fn",
"some?",
"sort",
"sort-by",
"sorted-map",
"sorted-map-by",
"sorted-set",
"sorted-set-by",
"sorted?",
"special-symbol?",
"spit",
"split-at",
"split-with",
"str",
"string?",
"struct",
"struct-map",
"subs",
"subseq",
"subvec",
"supers",
"swap!",
"swap-vals!",
"symbol",
"symbol?",
"sync",
"tagged-literal",
"tagged-literal?",
"take",
"take-last",
"take-nth",
"take-while",
"test",
"the-ns",
"thread-bound?",
"time",
"to-array",
"to-array-2d",
"trampoline",
"transduce",
"transient",
"tree-seq",
"true?",
"type",
"unchecked-add",
"unchecked-add-int",
"unchecked-byte",
"unchecked-char",
"unchecked-dec",
"unchecked-dec-int",
"unchecked-divide-int",
"unchecked-double",
"unchecked-float",
"unchecked-inc",
"unchecked-inc-int",
"unchecked-int",
"unchecked-long",
"unchecked-multiply",
"unchecked-multiply-int",
"unchecked-negate",
"unchecked-negate-int",
"unchecked-remainder-int",
"unchecked-short",
"unchecked-subtract",
"unchecked-subtract-int",
"underive",
"unquote",
"unquote-splicing",
"unreduced",
"unsigned-bit-shift-right",
"update",
"update-in",
"update-proxy",
"uri?",
"use",
"uuid?",
"val",
"vals",
"var-get",
"var-set",
"var?",
"vary-meta",
"vec",
"vector",
"vector-of",
"vector?",
"volatile!",
"volatile?",
"vreset!",
"vswap!",
"when",
"when-first",
"when-let",
"when-not",
"when-some",
"while",
"with-bindings",
"with-bindings*",
"with-in-str",
"with-loading-context",
"with-local-vars",
"with-meta",
"with-open",
"with-out-str",
"with-precision",
"with-redefs",
"with-redefs-fn",
"xml-seq",
"zero?",
"zipmap"
],
tokenizer: {
root: [
// whitespaces and comments
{ include: "@whitespace" },
// numbers
[/@numbers/, "number"],
// characters
[/@characters/, "string"],
// strings
{ include: "@string" },
// brackets
[/[()\[\]{}]/, "@brackets"],
// regular expressions
[/\/#"(?:\.|(?:")|[^"\n])*"\/g/, "regexp"],
// reader macro characters
[/[#'@^`~]/, "meta"],
// symbols
[
/@qualifiedSymbols/,
{
cases: {
"^:.+$": "constant",
// Clojure keywords (e.g., `:foo/bar`)
"@specialForms": "keyword",
"@coreSymbols": "keyword",
"@constants": "constant",
"@default": "identifier"
}
}
]
],
whitespace: [
[/[\s,]+/, "white"],
[/;.*$/, "comment"],
[/\(comment\b/, "comment", "@comment"]
],
comment: [
[/\(/, "comment", "@push"],
[/\)/, "comment", "@pop"],
[/[^()]/, "comment"]
],
string: [[/"/, "string", "@multiLineString"]],
multiLineString: [
[/"/, "string", "@popall"],
[/@escapes/, "string.escape"],
[/./, "string"]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,9 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "coffeescript",
extensions: [".coffee"],
aliases: ["CoffeeScript", "coffeescript", "coffee"],
mimetypes: ["text/x-coffeescript", "text/coffeescript"],
loader: () => import('./coffee.js')
});
@@ -0,0 +1,231 @@
const conf = {
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#%\^\&\*\(\)\=\$\-\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
comments: {
blockComment: ["###", "###"],
lineComment: "#"
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
folding: {
markers: {
start: new RegExp("^\\s*#region\\b"),
end: new RegExp("^\\s*#endregion\\b")
}
}
};
const language = {
defaultToken: "",
ignoreCase: true,
tokenPostfix: ".coffee",
brackets: [
{ open: "{", close: "}", token: "delimiter.curly" },
{ open: "[", close: "]", token: "delimiter.square" },
{ open: "(", close: ")", token: "delimiter.parenthesis" }
],
regEx: /\/(?!\/\/)(?:[^\/\\]|\\.)*\/[igm]*/,
keywords: [
"and",
"or",
"is",
"isnt",
"not",
"on",
"yes",
"@",
"no",
"off",
"true",
"false",
"null",
"this",
"new",
"delete",
"typeof",
"in",
"instanceof",
"return",
"throw",
"break",
"continue",
"debugger",
"if",
"else",
"switch",
"for",
"while",
"do",
"try",
"catch",
"finally",
"class",
"extends",
"super",
"undefined",
"then",
"unless",
"until",
"loop",
"of",
"by",
"when"
],
// we include these common regular expressions
symbols: /[=><!~?&%|+\-*\/\^\.,\:]+/,
escapes: /\\(?:[abfnrtv\\"'$]|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
// The main tokenizer for our languages
tokenizer: {
root: [
// identifiers and keywords
[/\@[a-zA-Z_]\w*/, "variable.predefined"],
[
/[a-zA-Z_]\w*/,
{
cases: {
this: "variable.predefined",
"@keywords": { token: "keyword.$0" },
"@default": ""
}
}
],
// whitespace
[/[ \t\r\n]+/, ""],
// Comments
[/###/, "comment", "@comment"],
[/#.*$/, "comment"],
// regular expressions
["///", { token: "regexp", next: "@hereregexp" }],
[/^(\s*)(@regEx)/, ["", "regexp"]],
[/(\()(\s*)(@regEx)/, ["@brackets", "", "regexp"]],
[/(\,)(\s*)(@regEx)/, ["delimiter", "", "regexp"]],
[/(\=)(\s*)(@regEx)/, ["delimiter", "", "regexp"]],
[/(\:)(\s*)(@regEx)/, ["delimiter", "", "regexp"]],
[/(\[)(\s*)(@regEx)/, ["@brackets", "", "regexp"]],
[/(\!)(\s*)(@regEx)/, ["delimiter", "", "regexp"]],
[/(\&)(\s*)(@regEx)/, ["delimiter", "", "regexp"]],
[/(\|)(\s*)(@regEx)/, ["delimiter", "", "regexp"]],
[/(\?)(\s*)(@regEx)/, ["delimiter", "", "regexp"]],
[/(\{)(\s*)(@regEx)/, ["@brackets", "", "regexp"]],
[/(\;)(\s*)(@regEx)/, ["", "", "regexp"]],
// delimiters
[
/}/,
{
cases: {
"$S2==interpolatedstring": {
token: "string",
next: "@pop"
},
"@default": "@brackets"
}
}
],
[/[{}()\[\]]/, "@brackets"],
[/@symbols/, "delimiter"],
// numbers
[/\d+[eE]([\-+]?\d+)?/, "number.float"],
[/\d+\.\d+([eE][\-+]?\d+)?/, "number.float"],
[/0[xX][0-9a-fA-F]+/, "number.hex"],
[/0[0-7]+(?!\d)/, "number.octal"],
[/\d+/, "number"],
// delimiter: after number because of .\d floats
[/[,.]/, "delimiter"],
// strings:
[/"""/, "string", '@herestring."""'],
[/'''/, "string", "@herestring.'''"],
[
/"/,
{
cases: {
"@eos": "string",
"@default": { token: "string", next: '@string."' }
}
}
],
[
/'/,
{
cases: {
"@eos": "string",
"@default": { token: "string", next: "@string.'" }
}
}
]
],
string: [
[/[^"'\#\\]+/, "string"],
[/@escapes/, "string.escape"],
[/\./, "string.escape.invalid"],
[/\./, "string.escape.invalid"],
[
/#{/,
{
cases: {
'$S2=="': {
token: "string",
next: "root.interpolatedstring"
},
"@default": "string"
}
}
],
[
/["']/,
{
cases: {
"$#==$S2": { token: "string", next: "@pop" },
"@default": "string"
}
}
],
[/#/, "string"]
],
herestring: [
[
/("""|''')/,
{
cases: {
"$1==$S2": { token: "string", next: "@pop" },
"@default": "string"
}
}
],
[/[^#\\'"]+/, "string"],
[/['"]+/, "string"],
[/@escapes/, "string.escape"],
[/\./, "string.escape.invalid"],
[/#{/, { token: "string.quote", next: "root.interpolatedstring" }],
[/#/, "string"]
],
comment: [
[/[^#]+/, "comment"],
[/###/, "comment", "@pop"],
[/#/, "comment"]
],
hereregexp: [
[/[^\\\/#]+/, "regexp"],
[/\\./, "regexp"],
[/#.*$/, "comment"],
["///[igm]*", { token: "regexp", next: "@pop" }],
[/\//, "regexp"]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,14 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "c",
extensions: [".c", ".h"],
aliases: ["C", "c"],
loader: () => import('./cpp.js')
});
registerLanguage({
id: "cpp",
extensions: [".cpp", ".cc", ".cxx", ".hpp", ".hh", ".hxx"],
aliases: ["C++", "Cpp", "cpp"],
loader: () => import('./cpp.js')
});
+388
View File
@@ -0,0 +1,388 @@
const conf = {
comments: {
lineComment: "//",
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "[", close: "]" },
{ open: "{", close: "}" },
{ open: "(", close: ")" },
{ open: "'", close: "'", notIn: ["string", "comment"] },
{ open: '"', close: '"', notIn: ["string"] }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
folding: {
markers: {
start: new RegExp("^\\s*#pragma\\s+region\\b"),
end: new RegExp("^\\s*#pragma\\s+endregion\\b")
}
}
};
const language = {
defaultToken: "",
tokenPostfix: ".cpp",
brackets: [
{ token: "delimiter.curly", open: "{", close: "}" },
{ token: "delimiter.parenthesis", open: "(", close: ")" },
{ token: "delimiter.square", open: "[", close: "]" },
{ token: "delimiter.angle", open: "<", close: ">" }
],
keywords: [
"abstract",
"amp",
"array",
"auto",
"bool",
"break",
"case",
"catch",
"char",
"class",
"const",
"constexpr",
"const_cast",
"continue",
"cpu",
"decltype",
"default",
"delegate",
"delete",
"do",
"double",
"dynamic_cast",
"each",
"else",
"enum",
"event",
"explicit",
"export",
"extern",
"false",
"final",
"finally",
"float",
"for",
"friend",
"gcnew",
"generic",
"goto",
"if",
"in",
"initonly",
"inline",
"int",
"interface",
"interior_ptr",
"internal",
"literal",
"long",
"mutable",
"namespace",
"new",
"noexcept",
"nullptr",
"__nullptr",
"operator",
"override",
"partial",
"pascal",
"pin_ptr",
"private",
"property",
"protected",
"public",
"ref",
"register",
"reinterpret_cast",
"restrict",
"return",
"safe_cast",
"sealed",
"short",
"signed",
"sizeof",
"static",
"static_assert",
"static_cast",
"struct",
"switch",
"template",
"this",
"thread_local",
"throw",
"tile_static",
"true",
"try",
"typedef",
"typeid",
"typename",
"union",
"unsigned",
"using",
"virtual",
"void",
"volatile",
"wchar_t",
"where",
"while",
"_asm",
// reserved word with one underscores
"_based",
"_cdecl",
"_declspec",
"_fastcall",
"_if_exists",
"_if_not_exists",
"_inline",
"_multiple_inheritance",
"_pascal",
"_single_inheritance",
"_stdcall",
"_virtual_inheritance",
"_w64",
"__abstract",
// reserved word with two underscores
"__alignof",
"__asm",
"__assume",
"__based",
"__box",
"__builtin_alignof",
"__cdecl",
"__clrcall",
"__declspec",
"__delegate",
"__event",
"__except",
"__fastcall",
"__finally",
"__forceinline",
"__gc",
"__hook",
"__identifier",
"__if_exists",
"__if_not_exists",
"__inline",
"__int128",
"__int16",
"__int32",
"__int64",
"__int8",
"__interface",
"__leave",
"__m128",
"__m128d",
"__m128i",
"__m256",
"__m256d",
"__m256i",
"__m512",
"__m512d",
"__m512i",
"__m64",
"__multiple_inheritance",
"__newslot",
"__nogc",
"__noop",
"__nounwind",
"__novtordisp",
"__pascal",
"__pin",
"__pragma",
"__property",
"__ptr32",
"__ptr64",
"__raise",
"__restrict",
"__resume",
"__sealed",
"__single_inheritance",
"__stdcall",
"__super",
"__thiscall",
"__try",
"__try_cast",
"__typeof",
"__unaligned",
"__unhook",
"__uuidof",
"__value",
"__virtual_inheritance",
"__w64",
"__wchar_t"
],
operators: [
"=",
">",
"<",
"!",
"~",
"?",
":",
"==",
"<=",
">=",
"!=",
"&&",
"||",
"++",
"--",
"+",
"-",
"*",
"/",
"&",
"|",
"^",
"%",
"<<",
">>",
"+=",
"-=",
"*=",
"/=",
"&=",
"|=",
"^=",
"%=",
"<<=",
">>="
],
// we include these common regular expressions
symbols: /[=><!~?:&|+\-*\/\^%]+/,
escapes: /\\(?:[0abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
integersuffix: /([uU](ll|LL|l|L)|(ll|LL|l|L)?[uU]?)/,
floatsuffix: /[fFlL]?/,
encoding: /u|u8|U|L/,
// The main tokenizer for our languages
tokenizer: {
root: [
// C++ 11 Raw String
[/@encoding?R\"(?:([^ ()\\\t]*))\(/, { token: "string.raw.begin", next: "@raw.$1" }],
// identifiers and keywords
[
/[a-zA-Z_]\w*/,
{
cases: {
"@keywords": { token: "keyword.$0" },
"@default": "identifier"
}
}
],
// The preprocessor checks must be before whitespace as they check /^\s*#/ which
// otherwise fails to match later after other whitespace has been removed.
// Inclusion
[/^\s*#\s*include/, { token: "keyword.directive.include", next: "@include" }],
// Preprocessor directive
[/^\s*#\s*\w+/, "keyword.directive"],
// whitespace
{ include: "@whitespace" },
// [[ attributes ]].
[/\[\s*\[/, { token: "annotation", next: "@annotation" }],
// delimiters and operators
[/[{}()<>\[\]]/, "@brackets"],
[
/@symbols/,
{
cases: {
"@operators": "delimiter",
"@default": ""
}
}
],
// numbers
[/\d*\d+[eE]([\-+]?\d+)?(@floatsuffix)/, "number.float"],
[/\d*\.\d+([eE][\-+]?\d+)?(@floatsuffix)/, "number.float"],
[/0[xX][0-9a-fA-F']*[0-9a-fA-F](@integersuffix)/, "number.hex"],
[/0[0-7']*[0-7](@integersuffix)/, "number.octal"],
[/0[bB][0-1']*[0-1](@integersuffix)/, "number.binary"],
[/\d[\d']*\d(@integersuffix)/, "number"],
[/\d(@integersuffix)/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings
[/"([^"\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/"/, "string", "@string"],
// characters
[/'[^\\']'/, "string"],
[/(')(@escapes)(')/, ["string", "string.escape", "string"]],
[/'/, "string.invalid"]
],
whitespace: [
[/[ \t\r\n]+/, ""],
[/\/\*\*(?!\/)/, "comment.doc", "@doccomment"],
[/\/\*/, "comment", "@comment"],
[/\/\/.*\\$/, "comment", "@linecomment"],
[/\/\/.*$/, "comment"]
],
comment: [
[/[^\/*]+/, "comment"],
[/\*\//, "comment", "@pop"],
[/[\/*]/, "comment"]
],
//For use with continuous line comments
linecomment: [
[/.*[^\\]$/, "comment", "@pop"],
[/[^]+/, "comment"]
],
//Identical copy of comment above, except for the addition of .doc
doccomment: [
[/[^\/*]+/, "comment.doc"],
[/\*\//, "comment.doc", "@pop"],
[/[\/*]/, "comment.doc"]
],
string: [
[/[^\\"]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/"/, "string", "@pop"]
],
raw: [
[/[^)]+/, "string.raw"],
[/\)$S2\"/, { token: "string.raw.end", next: "@pop" }],
[/\)/, "string.raw"]
],
annotation: [
{ include: "@whitespace" },
[/using|alignas/, "keyword"],
[/[a-zA-Z0-9_]+/, "annotation"],
[/[,:]/, "delimiter"],
[/[()]/, "@brackets"],
[/\]\s*\]/, { token: "annotation", next: "@pop" }]
],
include: [
[
/(\s*)(<)([^<>]*)(>)/,
[
"",
"keyword.directive.include.begin",
"string.include.identifier",
{ token: "keyword.directive.include.end", next: "@pop" }
]
],
[
/(\s*)(")([^"]*)(")/,
[
"",
"keyword.directive.include.begin",
"string.include.identifier",
{ token: "keyword.directive.include.end", next: "@pop" }
]
]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,8 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "csharp",
extensions: [".cs", ".csx", ".cake"],
aliases: ["C#", "csharp"],
loader: () => import('./csharp.js')
});
@@ -0,0 +1,325 @@
const conf = {
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\#\$\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
comments: {
lineComment: "//",
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "'", close: "'", notIn: ["string", "comment"] },
{ open: '"', close: '"', notIn: ["string", "comment"] }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "<", close: ">" },
{ open: "'", close: "'" },
{ open: '"', close: '"' }
],
folding: {
markers: {
start: new RegExp("^\\s*#region\\b"),
end: new RegExp("^\\s*#endregion\\b")
}
}
};
const language = {
defaultToken: "",
tokenPostfix: ".cs",
brackets: [
{ open: "{", close: "}", token: "delimiter.curly" },
{ open: "[", close: "]", token: "delimiter.square" },
{ open: "(", close: ")", token: "delimiter.parenthesis" },
{ open: "<", close: ">", token: "delimiter.angle" }
],
keywords: [
"extern",
"alias",
"using",
"bool",
"decimal",
"sbyte",
"byte",
"short",
"ushort",
"int",
"uint",
"long",
"ulong",
"char",
"float",
"double",
"object",
"dynamic",
"string",
"assembly",
"is",
"as",
"ref",
"out",
"this",
"base",
"new",
"typeof",
"void",
"checked",
"unchecked",
"default",
"delegate",
"var",
"const",
"if",
"else",
"switch",
"case",
"while",
"do",
"for",
"foreach",
"in",
"break",
"continue",
"goto",
"return",
"throw",
"try",
"catch",
"finally",
"lock",
"yield",
"from",
"let",
"where",
"join",
"on",
"equals",
"into",
"orderby",
"ascending",
"descending",
"select",
"group",
"by",
"namespace",
"partial",
"class",
"field",
"event",
"method",
"param",
"public",
"protected",
"internal",
"private",
"abstract",
"sealed",
"static",
"struct",
"readonly",
"volatile",
"virtual",
"override",
"params",
"get",
"set",
"add",
"remove",
"operator",
"true",
"false",
"implicit",
"explicit",
"interface",
"enum",
"null",
"async",
"await",
"fixed",
"sizeof",
"stackalloc",
"unsafe",
"nameof",
"when"
],
namespaceFollows: ["namespace", "using"],
parenFollows: ["if", "for", "while", "switch", "foreach", "using", "catch", "when"],
operators: [
"=",
"??",
"||",
"&&",
"|",
"^",
"&",
"==",
"!=",
"<=",
">=",
"<<",
"+",
"-",
"*",
"/",
"%",
"!",
"~",
"++",
"--",
"+=",
"-=",
"*=",
"/=",
"%=",
"&=",
"|=",
"^=",
"<<=",
">>=",
">>",
"=>"
],
symbols: /[=><!~?:&|+\-*\/\^%]+/,
// escape sequences
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
// The main tokenizer for our languages
tokenizer: {
root: [
// identifiers and keywords
[
/\@?[a-zA-Z_]\w*/,
{
cases: {
"@namespaceFollows": {
token: "keyword.$0",
next: "@namespace"
},
"@keywords": {
token: "keyword.$0",
next: "@qualified"
},
"@default": { token: "identifier", next: "@qualified" }
}
}
],
// whitespace
{ include: "@whitespace" },
// delimiters and operators
[
/}/,
{
cases: {
"$S2==interpolatedstring": {
token: "string.quote",
next: "@pop"
},
"$S2==litinterpstring": {
token: "string.quote",
next: "@pop"
},
"@default": "@brackets"
}
}
],
[/[{}()\[\]]/, "@brackets"],
[/[<>](?!@symbols)/, "@brackets"],
[
/@symbols/,
{
cases: {
"@operators": "delimiter",
"@default": ""
}
}
],
// numbers
[/[0-9_]*\.[0-9_]+([eE][\-+]?\d+)?[fFdD]?/, "number.float"],
[/0[xX][0-9a-fA-F_]+/, "number.hex"],
[/0[bB][01_]+/, "number.hex"],
// binary: use same theme style as hex
[/[0-9_]+/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings
[/"([^"\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/"/, { token: "string.quote", next: "@string" }],
[/\$\@"/, { token: "string.quote", next: "@litinterpstring" }],
[/\@"/, { token: "string.quote", next: "@litstring" }],
[/\$"/, { token: "string.quote", next: "@interpolatedstring" }],
// characters
[/'[^\\']'/, "string"],
[/(')(@escapes)(')/, ["string", "string.escape", "string"]],
[/'/, "string.invalid"]
],
qualified: [
[
/[a-zA-Z_][\w]*/,
{
cases: {
"@keywords": { token: "keyword.$0" },
"@default": "identifier"
}
}
],
[/\./, "delimiter"],
["", "", "@pop"]
],
namespace: [
{ include: "@whitespace" },
[/[A-Z]\w*/, "namespace"],
[/[\.=]/, "delimiter"],
["", "", "@pop"]
],
comment: [
[/[^\/*]+/, "comment"],
// [/\/\*/, 'comment', '@push' ], // no nested comments :-(
["\\*/", "comment", "@pop"],
[/[\/*]/, "comment"]
],
string: [
[/[^\\"]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/"/, { token: "string.quote", next: "@pop" }]
],
litstring: [
[/[^"]+/, "string"],
[/""/, "string.escape"],
[/"/, { token: "string.quote", next: "@pop" }]
],
litinterpstring: [
[/[^"{]+/, "string"],
[/""/, "string.escape"],
[/{{/, "string.escape"],
[/}}/, "string.escape"],
[/{/, { token: "string.quote", next: "root.litinterpstring" }],
[/"/, { token: "string.quote", next: "@pop" }]
],
interpolatedstring: [
[/[^\\"{]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/{{/, "string.escape"],
[/}}/, "string.escape"],
[/{/, { token: "string.quote", next: "root.interpolatedstring" }],
[/"/, { token: "string.quote", next: "@pop" }]
],
whitespace: [
[/^[ \t\v\f]*#((r)|(load))(?=\s)/, "directive.csx"],
[/^[ \t\v\f]*#\w.*$/, "namespace.cpp"],
[/[ \t\v\f\r\n]+/, ""],
[/\/\*/, "comment", "@comment"],
[/\/\/.*$/, "comment"]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,8 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "csp",
extensions: [".csp"],
aliases: ["CSP", "csp"],
loader: () => import('./csp.js')
});
+52
View File
@@ -0,0 +1,52 @@
const conf = {
brackets: [],
autoClosingPairs: [],
surroundingPairs: []
};
const language = {
// Set defaultToken to invalid to see what you do not tokenize yet
// defaultToken: 'invalid',
keywords: [],
typeKeywords: [],
tokenPostfix: ".csp",
operators: [],
symbols: /[=><!~?:&|+\-*\/\^%]+/,
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
tokenizer: {
root: [
[/child-src/, "string.quote"],
[/connect-src/, "string.quote"],
[/default-src/, "string.quote"],
[/font-src/, "string.quote"],
[/frame-src/, "string.quote"],
[/img-src/, "string.quote"],
[/manifest-src/, "string.quote"],
[/media-src/, "string.quote"],
[/object-src/, "string.quote"],
[/script-src/, "string.quote"],
[/style-src/, "string.quote"],
[/worker-src/, "string.quote"],
[/base-uri/, "string.quote"],
[/plugin-types/, "string.quote"],
[/sandbox/, "string.quote"],
[/disown-opener/, "string.quote"],
[/form-action/, "string.quote"],
[/frame-ancestors/, "string.quote"],
[/report-uri/, "string.quote"],
[/report-to/, "string.quote"],
[/upgrade-insecure-requests/, "string.quote"],
[/block-all-mixed-content/, "string.quote"],
[/require-sri-for/, "string.quote"],
[/reflected-xss/, "string.quote"],
[/referrer/, "string.quote"],
[/policy-uri/, "string.quote"],
[/'self'/, "string.quote"],
[/'unsafe-inline'/, "string.quote"],
[/'unsafe-eval'/, "string.quote"],
[/'strict-dynamic'/, "string.quote"],
[/'unsafe-hashed-attributes'/, "string.quote"]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,9 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "css",
extensions: [".css"],
aliases: ["CSS", "css"],
mimetypes: ["text/css"],
loader: () => import('./css.js')
});
+184
View File
@@ -0,0 +1,184 @@
const conf = {
wordPattern: /(#?-?\d*\.\d\w*%?)|((::|[@#.!:])?[\w-?]+%?)|::|[@#.!:]/g,
comments: {
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}", notIn: ["string", "comment"] },
{ open: "[", close: "]", notIn: ["string", "comment"] },
{ open: "(", close: ")", notIn: ["string", "comment"] },
{ open: '"', close: '"', notIn: ["string", "comment"] },
{ open: "'", close: "'", notIn: ["string", "comment"] }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
folding: {
markers: {
start: new RegExp("^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/"),
end: new RegExp("^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/")
}
}
};
const language = {
defaultToken: "",
tokenPostfix: ".css",
ws: "[ \n\r\f]*",
// whitespaces (referenced in several rules)
identifier: "-?-?([a-zA-Z]|(\\\\(([0-9a-fA-F]{1,6}\\s?)|[^[0-9a-fA-F])))([\\w\\-]|(\\\\(([0-9a-fA-F]{1,6}\\s?)|[^[0-9a-fA-F])))*",
brackets: [
{ open: "{", close: "}", token: "delimiter.bracket" },
{ open: "[", close: "]", token: "delimiter.bracket" },
{ open: "(", close: ")", token: "delimiter.parenthesis" },
{ open: "<", close: ">", token: "delimiter.angle" }
],
tokenizer: {
root: [{ include: "@selector" }],
selector: [
{ include: "@comments" },
{ include: "@import" },
{ include: "@strings" },
[
"[@](keyframes|-webkit-keyframes|-moz-keyframes|-o-keyframes)",
{ token: "keyword", next: "@keyframedeclaration" }
],
["[@](page|content|font-face|-moz-document)", { token: "keyword" }],
["[@](charset|namespace)", { token: "keyword", next: "@declarationbody" }],
[
"(url-prefix)(\\()",
["attribute.value", { token: "delimiter.parenthesis", next: "@urldeclaration" }]
],
[
"(url)(\\()",
["attribute.value", { token: "delimiter.parenthesis", next: "@urldeclaration" }]
],
{ include: "@selectorname" },
["[\\*]", "tag"],
// selector symbols
["[>\\+,]", "delimiter"],
// selector operators
["\\[", { token: "delimiter.bracket", next: "@selectorattribute" }],
["{", { token: "delimiter.bracket", next: "@selectorbody" }]
],
selectorbody: [
{ include: "@comments" },
["[*_]?@identifier@ws:(?=(\\s|\\d|[^{;}]*[;}]))", "attribute.name", "@rulevalue"],
// rule definition: to distinguish from a nested selector check for whitespace, number or a semicolon
["}", { token: "delimiter.bracket", next: "@pop" }]
],
selectorname: [
["(\\.|#(?=[^{])|%|(@identifier)|:)+", "tag"]
// selector (.foo, div, ...)
],
selectorattribute: [{ include: "@term" }, ["]", { token: "delimiter.bracket", next: "@pop" }]],
term: [
{ include: "@comments" },
[
"(url-prefix)(\\()",
["attribute.value", { token: "delimiter.parenthesis", next: "@urldeclaration" }]
],
[
"(url)(\\()",
["attribute.value", { token: "delimiter.parenthesis", next: "@urldeclaration" }]
],
{ include: "@functioninvocation" },
{ include: "@numbers" },
{ include: "@name" },
{ include: "@strings" },
["([<>=\\+\\-\\*\\/\\^\\|\\~,])", "delimiter"],
[",", "delimiter"]
],
rulevalue: [
{ include: "@comments" },
{ include: "@strings" },
{ include: "@term" },
["!important", "keyword"],
[";", "delimiter", "@pop"],
["(?=})", { token: "", next: "@pop" }]
// missing semicolon
],
warndebug: [["[@](warn|debug)", { token: "keyword", next: "@declarationbody" }]],
import: [["[@](import)", { token: "keyword", next: "@declarationbody" }]],
urldeclaration: [
{ include: "@strings" },
["[^)\r\n]+", "string"],
["\\)", { token: "delimiter.parenthesis", next: "@pop" }]
],
parenthizedterm: [
{ include: "@term" },
["\\)", { token: "delimiter.parenthesis", next: "@pop" }]
],
declarationbody: [
{ include: "@term" },
[";", "delimiter", "@pop"],
["(?=})", { token: "", next: "@pop" }]
// missing semicolon
],
comments: [
["\\/\\*", "comment", "@comment"],
["\\/\\/+.*", "comment"]
],
comment: [
["\\*\\/", "comment", "@pop"],
[/[^*/]+/, "comment"],
[/./, "comment"]
],
name: [["@identifier", "attribute.value"]],
numbers: [
["-?(\\d*\\.)?\\d+([eE][\\-+]?\\d+)?", { token: "attribute.value.number", next: "@units" }],
["#[0-9a-fA-F_]+(?!\\w)", "attribute.value.hex"]
],
units: [
[
"(em|ex|ch|rem|fr|vmin|vmax|vw|vh|vm|cm|mm|in|px|pt|pc|deg|grad|rad|turn|s|ms|Hz|kHz|%)?",
"attribute.value.unit",
"@pop"
]
],
keyframedeclaration: [
["@identifier", "attribute.value"],
["{", { token: "delimiter.bracket", switchTo: "@keyframebody" }]
],
keyframebody: [
{ include: "@term" },
["{", { token: "delimiter.bracket", next: "@selectorbody" }],
["}", { token: "delimiter.bracket", next: "@pop" }]
],
functioninvocation: [
["@identifier\\(", { token: "attribute.value", next: "@functionarguments" }]
],
functionarguments: [
["\\$@identifier@ws:", "attribute.name"],
["[,]", "delimiter"],
{ include: "@term" },
["\\)", { token: "attribute.value", next: "@pop" }]
],
strings: [
['~?"', { token: "string", next: "@stringenddoublequote" }],
["~?'", { token: "string", next: "@stringendquote" }]
],
stringenddoublequote: [
["\\\\.", "string"],
['"', { token: "string", next: "@pop" }],
[/[^\\"]+/, "string"],
[".", "string"]
],
stringendquote: [
["\\\\.", "string"],
["'", { token: "string", next: "@pop" }],
[/[^\\']+/, "string"],
[".", "string"]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,8 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "cypher",
extensions: [".cypher", ".cyp"],
aliases: ["Cypher", "OpenCypher"],
loader: () => import('./cypher.js')
});
@@ -0,0 +1,262 @@
const conf = {
comments: {
lineComment: "//",
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" },
{ open: "`", close: "`" }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" },
{ open: "`", close: "`" }
]
};
const language = {
defaultToken: "",
tokenPostfix: `.cypher`,
ignoreCase: true,
brackets: [
{ open: "{", close: "}", token: "delimiter.curly" },
{ open: "[", close: "]", token: "delimiter.bracket" },
{ open: "(", close: ")", token: "delimiter.parenthesis" }
],
keywords: [
"ALL",
"AND",
"AS",
"ASC",
"ASCENDING",
"BY",
"CALL",
"CASE",
"CONTAINS",
"CREATE",
"DELETE",
"DESC",
"DESCENDING",
"DETACH",
"DISTINCT",
"ELSE",
"END",
"ENDS",
"EXISTS",
"IN",
"IS",
"LIMIT",
"MANDATORY",
"MATCH",
"MERGE",
"NOT",
"ON",
"ON",
"OPTIONAL",
"OR",
"ORDER",
"REMOVE",
"RETURN",
"SET",
"SKIP",
"STARTS",
"THEN",
"UNION",
"UNWIND",
"WHEN",
"WHERE",
"WITH",
"XOR",
"YIELD"
],
builtinLiterals: ["true", "TRUE", "false", "FALSE", "null", "NULL"],
builtinFunctions: [
"abs",
"acos",
"asin",
"atan",
"atan2",
"avg",
"ceil",
"coalesce",
"collect",
"cos",
"cot",
"count",
"degrees",
"e",
"endNode",
"exists",
"exp",
"floor",
"head",
"id",
"keys",
"labels",
"last",
"left",
"length",
"log",
"log10",
"lTrim",
"max",
"min",
"nodes",
"percentileCont",
"percentileDisc",
"pi",
"properties",
"radians",
"rand",
"range",
"relationships",
"replace",
"reverse",
"right",
"round",
"rTrim",
"sign",
"sin",
"size",
"split",
"sqrt",
"startNode",
"stDev",
"stDevP",
"substring",
"sum",
"tail",
"tan",
"timestamp",
"toBoolean",
"toFloat",
"toInteger",
"toLower",
"toString",
"toUpper",
"trim",
"type"
],
operators: [
// Math operators
"+",
"-",
"*",
"/",
"%",
"^",
// Comparison operators
"=",
"<>",
"<",
">",
"<=",
">=",
// Pattern operators
"->",
"<-",
"-->",
"<--"
],
escapes: /\\(?:[tbnrf\\"'`]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
digits: /\d+/,
octaldigits: /[0-7]+/,
hexdigits: /[0-9a-fA-F]+/,
tokenizer: {
root: [[/[{}[\]()]/, "@brackets"], { include: "common" }],
common: [
{ include: "@whitespace" },
{ include: "@numbers" },
{ include: "@strings" },
// Cypher labels on nodes/relationships, e.g. (n:NodeLabel)-[e:RelationshipLabel]
[/:[a-zA-Z_][\w]*/, "type.identifier"],
[
/[a-zA-Z_][\w]*(?=\()/,
{
cases: {
"@builtinFunctions": "predefined.function"
}
}
],
[
/[a-zA-Z_$][\w$]*/,
{
cases: {
"@keywords": "keyword",
"@builtinLiterals": "predefined.literal",
"@default": "identifier"
}
}
],
[/`/, "identifier.escape", "@identifierBacktick"],
// delimiter and operator after number because of `.\d` floats and `:` in labels
[/[;,.:|]/, "delimiter"],
[
/[<>=%+\-*/^]+/,
{
cases: {
"@operators": "delimiter",
"@default": ""
}
}
]
],
numbers: [
[/-?(@digits)[eE](-?(@digits))?/, "number.float"],
[/-?(@digits)?\.(@digits)([eE]-?(@digits))?/, "number.float"],
[/-?0x(@hexdigits)/, "number.hex"],
[/-?0(@octaldigits)/, "number.octal"],
[/-?(@digits)/, "number"]
],
strings: [
[/"([^"\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/'([^'\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/"/, "string", "@stringDouble"],
[/'/, "string", "@stringSingle"]
],
whitespace: [
[/[ \t\r\n]+/, "white"],
[/\/\*/, "comment", "@comment"],
[/\/\/.*$/, "comment"]
],
comment: [
[/\/\/.*/, "comment"],
[/[^/*]+/, "comment"],
[/\*\//, "comment", "@pop"],
[/[/*]/, "comment"]
],
stringDouble: [
[/[^\\"]+/, "string"],
[/@escapes/, "string"],
[/\\./, "string.invalid"],
[/"/, "string", "@pop"]
],
stringSingle: [
[/[^\\']+/, "string"],
[/@escapes/, "string"],
[/\\./, "string.invalid"],
[/'/, "string", "@pop"]
],
identifierBacktick: [
[/[^\\`]+/, "identifier.escape"],
[/@escapes/, "identifier.escape"],
[/\\./, "identifier.escape.invalid"],
[/`/, "identifier.escape", "@pop"]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,9 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "dart",
extensions: [".dart"],
aliases: ["Dart", "dart"],
mimetypes: ["text/x-dart-source", "text/x-dart"],
loader: () => import('./dart.js')
});
+280
View File
@@ -0,0 +1,280 @@
const conf = {
comments: {
lineComment: "//",
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "'", close: "'", notIn: ["string", "comment"] },
{ open: '"', close: '"', notIn: ["string"] },
{ open: "`", close: "`", notIn: ["string", "comment"] },
{ open: "/**", close: " */", notIn: ["string"] }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "<", close: ">" },
{ open: "'", close: "'" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "`", close: "`" }
],
folding: {
markers: {
start: /^\s*\s*#?region\b/,
end: /^\s*\s*#?endregion\b/
}
}
};
const language = {
defaultToken: "invalid",
tokenPostfix: ".dart",
keywords: [
"abstract",
"dynamic",
"implements",
"show",
"as",
"else",
"import",
"static",
"assert",
"enum",
"in",
"super",
"async",
"export",
"interface",
"switch",
"await",
"extends",
"is",
"sync",
"break",
"external",
"library",
"this",
"case",
"factory",
"mixin",
"throw",
"catch",
"false",
"new",
"true",
"class",
"final",
"null",
"try",
"const",
"finally",
"on",
"typedef",
"continue",
"for",
"operator",
"var",
"covariant",
"Function",
"part",
"void",
"default",
"get",
"rethrow",
"while",
"deferred",
"hide",
"return",
"with",
"do",
"if",
"set",
"yield"
],
typeKeywords: ["int", "double", "String", "bool"],
operators: [
"+",
"-",
"*",
"/",
"~/",
"%",
"++",
"--",
"==",
"!=",
">",
"<",
">=",
"<=",
"=",
"-=",
"/=",
"%=",
">>=",
"^=",
"+=",
"*=",
"~/=",
"<<=",
"&=",
"!=",
"||",
"&&",
"&",
"|",
"^",
"~",
"<<",
">>",
"!",
">>>",
"??",
"?",
":",
"|="
],
// we include these common regular expressions
symbols: /[=><!~?:&|+\-*\/\^%]+/,
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
digits: /\d+(_+\d+)*/,
octaldigits: /[0-7]+(_+[0-7]+)*/,
binarydigits: /[0-1]+(_+[0-1]+)*/,
hexdigits: /[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,
regexpctl: /[(){}\[\]\$\^|\-*+?\.]/,
regexpesc: /\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,
// The main tokenizer for our languages
tokenizer: {
root: [[/[{}]/, "delimiter.bracket"], { include: "common" }],
common: [
// identifiers and keywords
[
/[a-z_$][\w$]*/,
{
cases: {
"@typeKeywords": "type.identifier",
"@keywords": "keyword",
"@default": "identifier"
}
}
],
[/[A-Z_$][\w\$]*/, "type.identifier"],
// show class names
// [/[A-Z][\w\$]*/, 'identifier'],
// whitespace
{ include: "@whitespace" },
// regular expression: ensure it is terminated before beginning (otherwise it is an opeator)
[
/\/(?=([^\\\/]|\\.)+\/([gimsuy]*)(\s*)(\.|;|,|\)|\]|\}|$))/,
{ token: "regexp", bracket: "@open", next: "@regexp" }
],
// @ annotations.
[/@[a-zA-Z]+/, "annotation"],
// variable
// delimiters and operators
[/[()\[\]]/, "@brackets"],
[/[<>](?!@symbols)/, "@brackets"],
[/!(?=([^=]|$))/, "delimiter"],
[
/@symbols/,
{
cases: {
"@operators": "delimiter",
"@default": ""
}
}
],
// numbers
[/(@digits)[eE]([\-+]?(@digits))?/, "number.float"],
[/(@digits)\.(@digits)([eE][\-+]?(@digits))?/, "number.float"],
[/0[xX](@hexdigits)n?/, "number.hex"],
[/0[oO]?(@octaldigits)n?/, "number.octal"],
[/0[bB](@binarydigits)n?/, "number.binary"],
[/(@digits)n?/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings
[/"([^"\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/'([^'\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/"/, "string", "@string_double"],
[/'/, "string", "@string_single"]
// [/[a-zA-Z]+/, "variable"]
],
whitespace: [
[/[ \t\r\n]+/, ""],
[/\/\*\*(?!\/)/, "comment.doc", "@jsdoc"],
[/\/\*/, "comment", "@comment"],
[/\/\/\/.*$/, "comment.doc"],
[/\/\/.*$/, "comment"]
],
comment: [
[/[^\/*]+/, "comment"],
[/\*\//, "comment", "@pop"],
[/[\/*]/, "comment"]
],
jsdoc: [
[/[^\/*]+/, "comment.doc"],
[/\*\//, "comment.doc", "@pop"],
[/[\/*]/, "comment.doc"]
],
// We match regular expression quite precisely
regexp: [
[
/(\{)(\d+(?:,\d*)?)(\})/,
["regexp.escape.control", "regexp.escape.control", "regexp.escape.control"]
],
[
/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,
["regexp.escape.control", { token: "regexp.escape.control", next: "@regexrange" }]
],
[/(\()(\?:|\?=|\?!)/, ["regexp.escape.control", "regexp.escape.control"]],
[/[()]/, "regexp.escape.control"],
[/@regexpctl/, "regexp.escape.control"],
[/[^\\\/]/, "regexp"],
[/@regexpesc/, "regexp.escape"],
[/\\\./, "regexp.invalid"],
[/(\/)([gimsuy]*)/, [{ token: "regexp", bracket: "@close", next: "@pop" }, "keyword.other"]]
],
regexrange: [
[/-/, "regexp.escape.control"],
[/\^/, "regexp.invalid"],
[/@regexpesc/, "regexp.escape"],
[/[^\]]/, "regexp"],
[
/\]/,
{
token: "regexp.escape.control",
next: "@pop",
bracket: "@close"
}
]
],
string_double: [
[/[^\\"\$]+/, "string"],
[/[^\\"]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/"/, "string", "@pop"],
[/\$\w+/, "identifier"]
],
string_single: [
[/[^\\'\$]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/'/, "string", "@pop"],
[/\$\w+/, "identifier"]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,9 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "dockerfile",
extensions: [".dockerfile"],
filenames: ["Dockerfile"],
aliases: ["Dockerfile"],
loader: () => import('./dockerfile.js')
});
@@ -0,0 +1,129 @@
const conf = {
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
]
};
const language = {
defaultToken: "",
tokenPostfix: ".dockerfile",
variable: /\${?[\w]+}?/,
tokenizer: {
root: [
{ include: "@whitespace" },
{ include: "@comment" },
[/(ONBUILD)(\s+)/, ["keyword", ""]],
[/(ENV)(\s+)([\w]+)/, ["keyword", "", { token: "variable", next: "@arguments" }]],
[
/(FROM|MAINTAINER|RUN|EXPOSE|ENV|ADD|ARG|VOLUME|LABEL|USER|WORKDIR|COPY|CMD|STOPSIGNAL|SHELL|HEALTHCHECK|ENTRYPOINT)/,
{ token: "keyword", next: "@arguments" }
]
],
arguments: [
{ include: "@whitespace" },
{ include: "@strings" },
[
/(@variable)/,
{
cases: {
"@eos": { token: "variable", next: "@popall" },
"@default": "variable"
}
}
],
[
/\\/,
{
cases: {
"@eos": "",
"@default": ""
}
}
],
[
/./,
{
cases: {
"@eos": { token: "", next: "@popall" },
"@default": ""
}
}
]
],
// Deal with white space, including comments
whitespace: [
[
/\s+/,
{
cases: {
"@eos": { token: "", next: "@popall" },
"@default": ""
}
}
]
],
comment: [[/(^#.*$)/, "comment", "@popall"]],
// Recognize strings, including those broken across lines with \ (but not without)
strings: [
[/\\'$/, "", "@popall"],
// \' leaves @arguments at eol
[/\\'/, ""],
// \' is not a string
[/'$/, "string", "@popall"],
[/'/, "string", "@stringBody"],
[/"$/, "string", "@popall"],
[/"/, "string", "@dblStringBody"]
],
stringBody: [
[
/[^\\\$']/,
{
cases: {
"@eos": { token: "string", next: "@popall" },
"@default": "string"
}
}
],
[/\\./, "string.escape"],
[/'$/, "string", "@popall"],
[/'/, "string", "@pop"],
[/(@variable)/, "variable"],
[/\\$/, "string"],
[/$/, "string", "@popall"]
],
dblStringBody: [
[
/[^\\\$"]/,
{
cases: {
"@eos": { token: "string", next: "@popall" },
"@default": "string"
}
}
],
[/\\./, "string.escape"],
[/"$/, "string", "@popall"],
[/"/, "string", "@pop"],
[/(@variable)/, "variable"],
[/\\$/, "string"],
[/$/, "string", "@popall"]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,8 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "ecl",
extensions: [".ecl"],
aliases: ["ECL", "Ecl", "ecl"],
loader: () => import('./ecl.js')
});
+455
View File
@@ -0,0 +1,455 @@
const conf = {
comments: {
lineComment: "//",
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "'", close: "'", notIn: ["string", "comment"] },
{ open: '"', close: '"', notIn: ["string", "comment"] }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "<", close: ">" },
{ open: "'", close: "'" },
{ open: '"', close: '"' }
]
};
const language = {
defaultToken: "",
tokenPostfix: ".ecl",
ignoreCase: true,
brackets: [
{ open: "{", close: "}", token: "delimiter.curly" },
{ open: "[", close: "]", token: "delimiter.square" },
{ open: "(", close: ")", token: "delimiter.parenthesis" },
{ open: "<", close: ">", token: "delimiter.angle" }
],
pounds: [
"append",
"break",
"declare",
"demangle",
"end",
"for",
"getdatatype",
"if",
"inmodule",
"loop",
"mangle",
"onwarning",
"option",
"set",
"stored",
"uniquename"
].join("|"),
keywords: [
"__compressed__",
"after",
"all",
"and",
"any",
"as",
"atmost",
"before",
"beginc",
"best",
"between",
"case",
"cluster",
"compressed",
"compression",
"const",
"counter",
"csv",
"default",
"descend",
"embed",
"encoding",
"encrypt",
"end",
"endc",
"endembed",
"endmacro",
"enum",
"escape",
"except",
"exclusive",
"expire",
"export",
"extend",
"fail",
"few",
"fileposition",
"first",
"flat",
"forward",
"from",
"full",
"function",
"functionmacro",
"group",
"grouped",
"heading",
"hole",
"ifblock",
"import",
"in",
"inner",
"interface",
"internal",
"joined",
"keep",
"keyed",
"last",
"left",
"limit",
"linkcounted",
"literal",
"little_endian",
"load",
"local",
"locale",
"lookup",
"lzw",
"macro",
"many",
"maxcount",
"maxlength",
"min skew",
"module",
"mofn",
"multiple",
"named",
"namespace",
"nocase",
"noroot",
"noscan",
"nosort",
"not",
"noxpath",
"of",
"onfail",
"only",
"opt",
"or",
"outer",
"overwrite",
"packed",
"partition",
"penalty",
"physicallength",
"pipe",
"prefetch",
"quote",
"record",
"repeat",
"retry",
"return",
"right",
"right1",
"right2",
"rows",
"rowset",
"scan",
"scope",
"self",
"separator",
"service",
"shared",
"skew",
"skip",
"smart",
"soapaction",
"sql",
"stable",
"store",
"terminator",
"thor",
"threshold",
"timelimit",
"timeout",
"token",
"transform",
"trim",
"type",
"unicodeorder",
"unordered",
"unsorted",
"unstable",
"update",
"use",
"validate",
"virtual",
"whole",
"width",
"wild",
"within",
"wnotrim",
"xml",
"xpath"
],
functions: [
"abs",
"acos",
"aggregate",
"allnodes",
"apply",
"ascii",
"asin",
"assert",
"asstring",
"atan",
"atan2",
"ave",
"build",
"buildindex",
"case",
"catch",
"choose",
"choosen",
"choosesets",
"clustersize",
"combine",
"correlation",
"cos",
"cosh",
"count",
"covariance",
"cron",
"dataset",
"dedup",
"define",
"denormalize",
"dictionary",
"distribute",
"distributed",
"distribution",
"ebcdic",
"enth",
"error",
"evaluate",
"event",
"eventextra",
"eventname",
"exists",
"exp",
"fail",
"failcode",
"failmessage",
"fetch",
"fromunicode",
"fromxml",
"getenv",
"getisvalid",
"global",
"graph",
"group",
"hash",
"hash32",
"hash64",
"hashcrc",
"hashmd5",
"having",
"httpcall",
"httpheader",
"if",
"iff",
"index",
"intformat",
"isvalid",
"iterate",
"join",
"keydiff",
"keypatch",
"keyunicode",
"length",
"library",
"limit",
"ln",
"loadxml",
"local",
"log",
"loop",
"map",
"matched",
"matchlength",
"matchposition",
"matchtext",
"matchunicode",
"max",
"merge",
"mergejoin",
"min",
"nofold",
"nolocal",
"nonempty",
"normalize",
"nothor",
"notify",
"output",
"parallel",
"parse",
"pipe",
"power",
"preload",
"process",
"project",
"pull",
"random",
"range",
"rank",
"ranked",
"realformat",
"recordof",
"regexfind",
"regexreplace",
"regroup",
"rejected",
"rollup",
"round",
"roundup",
"row",
"rowdiff",
"sample",
"sequential",
"set",
"sin",
"sinh",
"sizeof",
"soapcall",
"sort",
"sorted",
"sqrt",
"stepped",
"stored",
"sum",
"table",
"tan",
"tanh",
"thisnode",
"topn",
"tounicode",
"toxml",
"transfer",
"transform",
"trim",
"truncate",
"typeof",
"ungroup",
"unicodeorder",
"variance",
"wait",
"which",
"workunit",
"xmldecode",
"xmlencode",
"xmltext",
"xmlunicode"
],
typesint: ["integer", "unsigned"].join("|"),
typesnum: ["data", "qstring", "string", "unicode", "utf8", "varstring", "varunicode"],
typesone: [
"ascii",
"big_endian",
"boolean",
"data",
"decimal",
"ebcdic",
"grouped",
"integer",
"linkcounted",
"pattern",
"qstring",
"real",
"record",
"rule",
"set of",
"streamed",
"string",
"token",
"udecimal",
"unicode",
"unsigned",
"utf8",
"varstring",
"varunicode"
].join("|"),
operators: ["+", "-", "/", ":=", "<", "<>", "=", ">", "\\", "and", "in", "not", "or"],
symbols: /[=><!~?:&|+\-*\/\^%]+/,
// escape sequences
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
// The main tokenizer for our languages
tokenizer: {
root: [
[/@typesint[4|8]/, "type"],
[/#(@pounds)/, "type"],
[/@typesone/, "type"],
[
/[a-zA-Z_$][\w-$]*/,
{
cases: {
"@functions": "keyword.function",
"@keywords": "keyword",
"@operators": "operator"
}
}
],
// whitespace
{ include: "@whitespace" },
[/[{}()\[\]]/, "@brackets"],
[/[<>](?!@symbols)/, "@brackets"],
[
/@symbols/,
{
cases: {
"@operators": "delimiter",
"@default": ""
}
}
],
// numbers
[/[0-9_]*\.[0-9_]+([eE][\-+]?\d+)?/, "number.float"],
[/0[xX][0-9a-fA-F_]+/, "number.hex"],
[/0[bB][01]+/, "number.hex"],
// binary: use same theme style as hex
[/[0-9_]+/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings
[/"([^"\\]|\\.)*$/, "string.invalid"],
[/"/, "string", "@string"],
// characters
[/'[^\\']'/, "string"],
[/(')(@escapes)(')/, ["string", "string.escape", "string"]],
[/'/, "string.invalid"]
],
whitespace: [
[/[ \t\v\f\r\n]+/, ""],
[/\/\*/, "comment", "@comment"],
[/\/\/.*$/, "comment"]
],
comment: [
[/[^\/*]+/, "comment"],
[/\*\//, "comment", "@pop"],
[/[\/*]/, "comment"]
],
string: [
[/[^\\']+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/'/, "string", "@pop"]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,8 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "elixir",
extensions: [".ex", ".exs"],
aliases: ["Elixir", "elixir", "ex"],
loader: () => import('./elixir.js')
});
@@ -0,0 +1,568 @@
const conf = {
comments: {
lineComment: "#"
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "'", close: "'" },
{ open: '"', close: '"' }
],
autoClosingPairs: [
{ open: "'", close: "'", notIn: ["string", "comment"] },
{ open: '"', close: '"', notIn: ["comment"] },
{ open: '"""', close: '"""' },
{ open: "`", close: "`", notIn: ["string", "comment"] },
{ open: "(", close: ")" },
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "<<", close: ">>" }
],
indentationRules: {
increaseIndentPattern: /^\s*(after|else|catch|rescue|fn|[^#]*(do|<\-|\->|\{|\[|\=))\s*$/,
decreaseIndentPattern: /^\s*((\}|\])\s*$|(after|else|catch|rescue|end)\b)/
}
};
const language = {
defaultToken: "source",
tokenPostfix: ".elixir",
brackets: [
{ open: "[", close: "]", token: "delimiter.square" },
{ open: "(", close: ")", token: "delimiter.parenthesis" },
{ open: "{", close: "}", token: "delimiter.curly" },
{ open: "<<", close: ">>", token: "delimiter.angle.special" }
],
// Below are lists/regexps to which we reference later.
declarationKeywords: [
"def",
"defp",
"defn",
"defnp",
"defguard",
"defguardp",
"defmacro",
"defmacrop",
"defdelegate",
"defcallback",
"defmacrocallback",
"defmodule",
"defprotocol",
"defexception",
"defimpl",
"defstruct"
],
operatorKeywords: ["and", "in", "not", "or", "when"],
namespaceKeywords: ["alias", "import", "require", "use"],
otherKeywords: [
"after",
"case",
"catch",
"cond",
"do",
"else",
"end",
"fn",
"for",
"if",
"quote",
"raise",
"receive",
"rescue",
"super",
"throw",
"try",
"unless",
"unquote_splicing",
"unquote",
"with"
],
constants: ["true", "false", "nil"],
nameBuiltin: ["__MODULE__", "__DIR__", "__ENV__", "__CALLER__", "__STACKTRACE__"],
// Matches any of the operator names:
// <<< >>> ||| &&& ^^^ ~~~ === !== ~>> <~> |~> <|> == != <= >= && || \\ <> ++ -- |> =~ -> <- ~> <~ :: .. = < > + - * / | . ^ & !
operator: /-[->]?|!={0,2}|\*{1,2}|\/|\\\\|&{1,3}|\.\.?|\^(?:\^\^)?|\+\+?|<(?:-|<<|=|>|\|>|~>?)?|=~|={1,3}|>(?:=|>>)?|\|~>|\|>|\|{1,3}|~>>?|~~~|::/,
// See https://hexdocs.pm/elixir/syntax-reference.html#variables
variableName: /[a-z_][a-zA-Z0-9_]*[?!]?/,
// See https://hexdocs.pm/elixir/syntax-reference.html#atoms
atomName: /[a-zA-Z_][a-zA-Z0-9_@]*[?!]?|@specialAtomName|@operator/,
specialAtomName: /\.\.\.|<<>>|%\{\}|%|\{\}/,
aliasPart: /[A-Z][a-zA-Z0-9_]*/,
moduleName: /@aliasPart(?:\.@aliasPart)*/,
// Sigil pairs are: """ """, ''' ''', " ", ' ', / /, | |, < >, { }, [ ], ( )
sigilSymmetricDelimiter: /"""|'''|"|'|\/|\|/,
sigilStartDelimiter: /@sigilSymmetricDelimiter|<|\{|\[|\(/,
sigilEndDelimiter: /@sigilSymmetricDelimiter|>|\}|\]|\)/,
sigilModifiers: /[a-zA-Z0-9]*/,
decimal: /\d(?:_?\d)*/,
hex: /[0-9a-fA-F](_?[0-9a-fA-F])*/,
octal: /[0-7](_?[0-7])*/,
binary: /[01](_?[01])*/,
// See https://hexdocs.pm/elixir/master/String.html#module-escape-characters
escape: /\\u[0-9a-fA-F]{4}|\\x[0-9a-fA-F]{2}|\\./,
// The keys below correspond to tokenizer states.
// We start from the root state and match against its rules
// until we explicitly transition into another state.
// The `include` simply brings in all operations from the given state
// and is useful for improving readability.
tokenizer: {
root: [
{ include: "@whitespace" },
{ include: "@comments" },
// Keywords start as either an identifier or a string,
// but end with a : so it's important to match this first.
{ include: "@keywordsShorthand" },
{ include: "@numbers" },
{ include: "@identifiers" },
{ include: "@strings" },
{ include: "@atoms" },
{ include: "@sigils" },
{ include: "@attributes" },
{ include: "@symbols" }
],
// Whitespace
whitespace: [[/\s+/, "white"]],
// Comments
comments: [[/(#)(.*)/, ["comment.punctuation", "comment"]]],
// Keyword list shorthand
keywordsShorthand: [
[/(@atomName)(:)(\s+)/, ["constant", "constant.punctuation", "white"]],
// Use positive look-ahead to ensure the string is followed by :
// and should be considered a keyword.
[
/"(?=([^"]|#\{.*?\}|\\")*":)/,
{ token: "constant.delimiter", next: "@doubleQuotedStringKeyword" }
],
[
/'(?=([^']|#\{.*?\}|\\')*':)/,
{ token: "constant.delimiter", next: "@singleQuotedStringKeyword" }
]
],
doubleQuotedStringKeyword: [
[/":/, { token: "constant.delimiter", next: "@pop" }],
{ include: "@stringConstantContentInterpol" }
],
singleQuotedStringKeyword: [
[/':/, { token: "constant.delimiter", next: "@pop" }],
{ include: "@stringConstantContentInterpol" }
],
// Numbers
numbers: [
[/0b@binary/, "number.binary"],
[/0o@octal/, "number.octal"],
[/0x@hex/, "number.hex"],
[/@decimal\.@decimal([eE]-?@decimal)?/, "number.float"],
[/@decimal/, "number"]
],
// Identifiers
identifiers: [
// Tokenize identifier name in function-like definitions.
// Note: given `def a + b, do: nil`, `a` is not a function name,
// so we use negative look-ahead to ensure there's no operator.
[
/\b(defp?|defnp?|defmacrop?|defguardp?|defdelegate)(\s+)(@variableName)(?!\s+@operator)/,
[
"keyword.declaration",
"white",
{
cases: {
unquote: "keyword",
"@default": "function"
}
}
]
],
// Tokenize function calls
[
// In-scope call - an identifier followed by ( or .(
/(@variableName)(?=\s*\.?\s*\()/,
{
cases: {
// Tokenize as keyword in cases like `if(..., do: ..., else: ...)`
"@declarationKeywords": "keyword.declaration",
"@namespaceKeywords": "keyword",
"@otherKeywords": "keyword",
"@default": "function.call"
}
}
],
[
// Referencing function in a module
/(@moduleName)(\s*)(\.)(\s*)(@variableName)/,
["type.identifier", "white", "operator", "white", "function.call"]
],
[
// Referencing function in an Erlang module
/(:)(@atomName)(\s*)(\.)(\s*)(@variableName)/,
["constant.punctuation", "constant", "white", "operator", "white", "function.call"]
],
[
// Piping into a function (tokenized separately as it may not have parentheses)
/(\|>)(\s*)(@variableName)/,
[
"operator",
"white",
{
cases: {
"@otherKeywords": "keyword",
"@default": "function.call"
}
}
]
],
[
// Function reference passed to another function
/(&)(\s*)(@variableName)/,
["operator", "white", "function.call"]
],
// Language keywords, builtins, constants and variables
[
/@variableName/,
{
cases: {
"@declarationKeywords": "keyword.declaration",
"@operatorKeywords": "keyword.operator",
"@namespaceKeywords": "keyword",
"@otherKeywords": "keyword",
"@constants": "constant.language",
"@nameBuiltin": "variable.language",
"_.*": "comment.unused",
"@default": "identifier"
}
}
],
// Module names
[/@moduleName/, "type.identifier"]
],
// Strings
strings: [
[/"""/, { token: "string.delimiter", next: "@doubleQuotedHeredoc" }],
[/'''/, { token: "string.delimiter", next: "@singleQuotedHeredoc" }],
[/"/, { token: "string.delimiter", next: "@doubleQuotedString" }],
[/'/, { token: "string.delimiter", next: "@singleQuotedString" }]
],
doubleQuotedHeredoc: [
[/"""/, { token: "string.delimiter", next: "@pop" }],
{ include: "@stringContentInterpol" }
],
singleQuotedHeredoc: [
[/'''/, { token: "string.delimiter", next: "@pop" }],
{ include: "@stringContentInterpol" }
],
doubleQuotedString: [
[/"/, { token: "string.delimiter", next: "@pop" }],
{ include: "@stringContentInterpol" }
],
singleQuotedString: [
[/'/, { token: "string.delimiter", next: "@pop" }],
{ include: "@stringContentInterpol" }
],
// Atoms
atoms: [
[/(:)(@atomName)/, ["constant.punctuation", "constant"]],
[/:"/, { token: "constant.delimiter", next: "@doubleQuotedStringAtom" }],
[/:'/, { token: "constant.delimiter", next: "@singleQuotedStringAtom" }]
],
doubleQuotedStringAtom: [
[/"/, { token: "constant.delimiter", next: "@pop" }],
{ include: "@stringConstantContentInterpol" }
],
singleQuotedStringAtom: [
[/'/, { token: "constant.delimiter", next: "@pop" }],
{ include: "@stringConstantContentInterpol" }
],
// Sigils
// See https://elixir-lang.org/getting-started/sigils.html
// Sigils allow for typing values using their textual representation.
// All sigils start with ~ followed by a letter or
// multi-letter uppercase starting at Elixir v1.15.0, indicating sigil type
// and then a delimiter pair enclosing the textual representation.
// Optional modifiers are allowed after the closing delimiter.
// For instance a regular expressions can be written as:
// ~r/foo|bar/ ~r{foo|bar} ~r/foo|bar/g
//
// In general lowercase sigils allow for interpolation
// and escaped characters, whereas uppercase sigils don't
//
// During tokenization we want to distinguish some
// specific sigil types, namely string and regexp,
// so that they cen be themed separately.
//
// To reasonably handle all those combinations we leverage
// dot-separated states, so if we transition to @sigilStart.interpol.s.{.}
// then "sigilStart.interpol.s" state will match and also all
// the individual dot-separated parameters can be accessed.
sigils: [
[/~[a-z]@sigilStartDelimiter/, { token: "@rematch", next: "@sigil.interpol" }],
[/~([A-Z]+)@sigilStartDelimiter/, { token: "@rematch", next: "@sigil.noInterpol" }]
],
sigil: [
[/~([a-z]|[A-Z]+)\{/, { token: "@rematch", switchTo: "@sigilStart.$S2.$1.{.}" }],
[/~([a-z]|[A-Z]+)\[/, { token: "@rematch", switchTo: "@sigilStart.$S2.$1.[.]" }],
[/~([a-z]|[A-Z]+)\(/, { token: "@rematch", switchTo: "@sigilStart.$S2.$1.(.)" }],
[/~([a-z]|[A-Z]+)\</, { token: "@rematch", switchTo: "@sigilStart.$S2.$1.<.>" }],
[
/~([a-z]|[A-Z]+)(@sigilSymmetricDelimiter)/,
{ token: "@rematch", switchTo: "@sigilStart.$S2.$1.$2.$2" }
]
],
// The definitions below expect states to be of the form:
//
// sigilStart.<interpol-or-noInterpol>.<sigil-letter>.<start-delimiter>.<end-delimiter>
// sigilContinue.<interpol-or-noInterpol>.<sigil-letter>.<start-delimiter>.<end-delimiter>
//
// The sigilStart state is used only to properly classify the token (as string/regex/sigil)
// and immediately switches to the sigilContinue sate, which handles the actual content
// and waits for the corresponding end delimiter.
"sigilStart.interpol.s": [
[
/~s@sigilStartDelimiter/,
{
token: "string.delimiter",
switchTo: "@sigilContinue.$S2.$S3.$S4.$S5"
}
]
],
"sigilContinue.interpol.s": [
[
/(@sigilEndDelimiter)@sigilModifiers/,
{
cases: {
"$1==$S5": { token: "string.delimiter", next: "@pop" },
"@default": "string"
}
}
],
{ include: "@stringContentInterpol" }
],
"sigilStart.noInterpol.S": [
[
/~S@sigilStartDelimiter/,
{
token: "string.delimiter",
switchTo: "@sigilContinue.$S2.$S3.$S4.$S5"
}
]
],
"sigilContinue.noInterpol.S": [
// Ignore escaped sigil end
[/(^|[^\\])\\@sigilEndDelimiter/, "string"],
[
/(@sigilEndDelimiter)@sigilModifiers/,
{
cases: {
"$1==$S5": { token: "string.delimiter", next: "@pop" },
"@default": "string"
}
}
],
{ include: "@stringContent" }
],
"sigilStart.interpol.r": [
[
/~r@sigilStartDelimiter/,
{
token: "regexp.delimiter",
switchTo: "@sigilContinue.$S2.$S3.$S4.$S5"
}
]
],
"sigilContinue.interpol.r": [
[
/(@sigilEndDelimiter)@sigilModifiers/,
{
cases: {
"$1==$S5": { token: "regexp.delimiter", next: "@pop" },
"@default": "regexp"
}
}
],
{ include: "@regexpContentInterpol" }
],
"sigilStart.noInterpol.R": [
[
/~R@sigilStartDelimiter/,
{
token: "regexp.delimiter",
switchTo: "@sigilContinue.$S2.$S3.$S4.$S5"
}
]
],
"sigilContinue.noInterpol.R": [
// Ignore escaped sigil end
[/(^|[^\\])\\@sigilEndDelimiter/, "regexp"],
[
/(@sigilEndDelimiter)@sigilModifiers/,
{
cases: {
"$1==$S5": { token: "regexp.delimiter", next: "@pop" },
"@default": "regexp"
}
}
],
{ include: "@regexpContent" }
],
// Fallback to the generic sigil by default
"sigilStart.interpol": [
[
/~([a-z]|[A-Z]+)@sigilStartDelimiter/,
{
token: "sigil.delimiter",
switchTo: "@sigilContinue.$S2.$S3.$S4.$S5"
}
]
],
"sigilContinue.interpol": [
[
/(@sigilEndDelimiter)@sigilModifiers/,
{
cases: {
"$1==$S5": { token: "sigil.delimiter", next: "@pop" },
"@default": "sigil"
}
}
],
{ include: "@sigilContentInterpol" }
],
"sigilStart.noInterpol": [
[
/~([a-z]|[A-Z]+)@sigilStartDelimiter/,
{
token: "sigil.delimiter",
switchTo: "@sigilContinue.$S2.$S3.$S4.$S5"
}
]
],
"sigilContinue.noInterpol": [
// Ignore escaped sigil end
[/(^|[^\\])\\@sigilEndDelimiter/, "sigil"],
[
/(@sigilEndDelimiter)@sigilModifiers/,
{
cases: {
"$1==$S5": { token: "sigil.delimiter", next: "@pop" },
"@default": "sigil"
}
}
],
{ include: "@sigilContent" }
],
// Attributes
attributes: [
// Module @doc* attributes - tokenized as comments
[
/\@(module|type)?doc (~[sS])?"""/,
{
token: "comment.block.documentation",
next: "@doubleQuotedHeredocDocstring"
}
],
[
/\@(module|type)?doc (~[sS])?'''/,
{
token: "comment.block.documentation",
next: "@singleQuotedHeredocDocstring"
}
],
[
/\@(module|type)?doc (~[sS])?"/,
{
token: "comment.block.documentation",
next: "@doubleQuotedStringDocstring"
}
],
[
/\@(module|type)?doc (~[sS])?'/,
{
token: "comment.block.documentation",
next: "@singleQuotedStringDocstring"
}
],
[/\@(module|type)?doc false/, "comment.block.documentation"],
// Module attributes
[/\@(@variableName)/, "variable"]
],
doubleQuotedHeredocDocstring: [
[/"""/, { token: "comment.block.documentation", next: "@pop" }],
{ include: "@docstringContent" }
],
singleQuotedHeredocDocstring: [
[/'''/, { token: "comment.block.documentation", next: "@pop" }],
{ include: "@docstringContent" }
],
doubleQuotedStringDocstring: [
[/"/, { token: "comment.block.documentation", next: "@pop" }],
{ include: "@docstringContent" }
],
singleQuotedStringDocstring: [
[/'/, { token: "comment.block.documentation", next: "@pop" }],
{ include: "@docstringContent" }
],
// Operators, punctuation, brackets
symbols: [
// Code point operator (either with regular character ?a or an escaped one ?\n)
[/\?(\\.|[^\\\s])/, "number.constant"],
// Anonymous function arguments
[/&\d+/, "operator"],
// Bitshift operators (must go before delimiters, so that << >> don't match first)
[/<<<|>>>/, "operator"],
// Delimiter pairs
[/[()\[\]\{\}]|<<|>>/, "@brackets"],
// Triple dot is a valid name (must go before operators, so that .. doesn't match instead)
[/\.\.\./, "identifier"],
// Punctuation => (must go before operators, so it's not tokenized as = then >)
[/=>/, "punctuation"],
// Operators
[/@operator/, "operator"],
// Punctuation
[/[:;,.%]/, "punctuation"]
],
// Generic helpers
stringContentInterpol: [
{ include: "@interpolation" },
{ include: "@escapeChar" },
{ include: "@stringContent" }
],
stringContent: [[/./, "string"]],
stringConstantContentInterpol: [
{ include: "@interpolation" },
{ include: "@escapeChar" },
{ include: "@stringConstantContent" }
],
stringConstantContent: [[/./, "constant"]],
regexpContentInterpol: [
{ include: "@interpolation" },
{ include: "@escapeChar" },
{ include: "@regexpContent" }
],
regexpContent: [
// # may be a regular regexp char, so we use a heuristic
// assuming a # surrounded by whitespace is actually a comment.
[/(\s)(#)(\s.*)$/, ["white", "comment.punctuation", "comment"]],
[/./, "regexp"]
],
sigilContentInterpol: [
{ include: "@interpolation" },
{ include: "@escapeChar" },
{ include: "@sigilContent" }
],
sigilContent: [[/./, "sigil"]],
docstringContent: [[/./, "comment.block.documentation"]],
escapeChar: [[/@escape/, "constant.character.escape"]],
interpolation: [[/#{/, { token: "delimiter.bracket.embed", next: "@interpolationContinue" }]],
interpolationContinue: [
[/}/, { token: "delimiter.bracket.embed", next: "@pop" }],
// Interpolation brackets may contain arbitrary code,
// so we simply match against all the root rules,
// until we reach interpolation end (the above matches).
{ include: "@root" }
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,8 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "flow9",
extensions: [".flow"],
aliases: ["Flow9", "Flow", "flow9", "flow"],
loader: () => import('./flow9.js')
});
@@ -0,0 +1,141 @@
const conf = {
comments: {
blockComment: ["/*", "*/"],
lineComment: "//"
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}", notIn: ["string"] },
{ open: "[", close: "]", notIn: ["string"] },
{ open: "(", close: ")", notIn: ["string"] },
{ open: '"', close: '"', notIn: ["string"] },
{ open: "'", close: "'", notIn: ["string"] }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" },
{ open: "<", close: ">" }
]
};
const language = {
defaultToken: "",
tokenPostfix: ".flow",
keywords: [
"import",
"require",
"export",
"forbid",
"native",
"if",
"else",
"cast",
"unsafe",
"switch",
"default"
],
types: [
"io",
"mutable",
"bool",
"int",
"double",
"string",
"flow",
"void",
"ref",
"true",
"false",
"with"
],
operators: [
"=",
">",
"<",
"<=",
">=",
"==",
"!",
"!=",
":=",
"::=",
"&&",
"||",
"+",
"-",
"*",
"/",
"@",
"&",
"%",
":",
"->",
"\\",
"$",
"??",
"^"
],
symbols: /[@$=><!~?:&|+\-*\\\/\^%]+/,
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
// The main tokenizer for our languages
tokenizer: {
root: [
// identifiers and keywords
[
/[a-zA-Z_]\w*/,
{
cases: {
"@keywords": "keyword",
"@types": "type",
"@default": "identifier"
}
}
],
// whitespace
{ include: "@whitespace" },
// delimiters and operators
[/[{}()\[\]]/, "delimiter"],
[/[<>](?!@symbols)/, "delimiter"],
[
/@symbols/,
{
cases: {
"@operators": "delimiter",
"@default": ""
}
}
],
// numbers
[/((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings
[/"([^"\\]|\\.)*$/, "string.invalid"],
[/"/, "string", "@string"]
],
whitespace: [
[/[ \t\r\n]+/, ""],
[/\/\*/, "comment", "@comment"],
[/\/\/.*$/, "comment"]
],
comment: [
[/[^\/*]+/, "comment"],
[/\*\//, "comment", "@pop"],
[/[\/*]/, "comment"]
],
string: [
[/[^\\"]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/"/, "string", "@pop"]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,52 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "freemarker2",
extensions: [".ftl", ".ftlh", ".ftlx"],
aliases: ["FreeMarker2", "Apache FreeMarker2"],
loader: () => {
return import('./freemarker2.js').then((m) => m.TagAutoInterpolationDollar);
}
});
registerLanguage({
id: "freemarker2.tag-angle.interpolation-dollar",
aliases: ["FreeMarker2 (Angle/Dollar)", "Apache FreeMarker2 (Angle/Dollar)"],
loader: () => {
return import('./freemarker2.js').then((m) => m.TagAngleInterpolationDollar);
}
});
registerLanguage({
id: "freemarker2.tag-bracket.interpolation-dollar",
aliases: ["FreeMarker2 (Bracket/Dollar)", "Apache FreeMarker2 (Bracket/Dollar)"],
loader: () => {
return import('./freemarker2.js').then((m) => m.TagBracketInterpolationDollar);
}
});
registerLanguage({
id: "freemarker2.tag-angle.interpolation-bracket",
aliases: ["FreeMarker2 (Angle/Bracket)", "Apache FreeMarker2 (Angle/Bracket)"],
loader: () => {
return import('./freemarker2.js').then((m) => m.TagAngleInterpolationBracket);
}
});
registerLanguage({
id: "freemarker2.tag-bracket.interpolation-bracket",
aliases: ["FreeMarker2 (Bracket/Bracket)", "Apache FreeMarker2 (Bracket/Bracket)"],
loader: () => {
return import('./freemarker2.js').then((m) => m.TagBracketInterpolationBracket);
}
});
registerLanguage({
id: "freemarker2.tag-auto.interpolation-dollar",
aliases: ["FreeMarker2 (Auto/Dollar)", "Apache FreeMarker2 (Auto/Dollar)"],
loader: () => {
return import('./freemarker2.js').then((m) => m.TagAutoInterpolationDollar);
}
});
registerLanguage({
id: "freemarker2.tag-auto.interpolation-bracket",
aliases: ["FreeMarker2 (Auto/Bracket)", "Apache FreeMarker2 (Auto/Bracket)"],
loader: () => {
return import('./freemarker2.js').then((m) => m.TagAutoInterpolationBracket);
}
});
File diff suppressed because it is too large Load Diff
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,8 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "fsharp",
extensions: [".fs", ".fsi", ".ml", ".mli", ".fsx", ".fsscript"],
aliases: ["F#", "FSharp", "fsharp"],
loader: () => import('./fsharp.js')
});
@@ -0,0 +1,216 @@
const conf = {
comments: {
lineComment: "//",
blockComment: ["(*", "*)"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
folding: {
markers: {
start: new RegExp("^\\s*//\\s*#region\\b|^\\s*\\(\\*\\s*#region(.*)\\*\\)"),
end: new RegExp("^\\s*//\\s*#endregion\\b|^\\s*\\(\\*\\s*#endregion\\s*\\*\\)")
}
}
};
const language = {
defaultToken: "",
tokenPostfix: ".fs",
keywords: [
"abstract",
"and",
"atomic",
"as",
"assert",
"asr",
"base",
"begin",
"break",
"checked",
"component",
"const",
"constraint",
"constructor",
"continue",
"class",
"default",
"delegate",
"do",
"done",
"downcast",
"downto",
"elif",
"else",
"end",
"exception",
"eager",
"event",
"external",
"extern",
"false",
"finally",
"for",
"fun",
"function",
"fixed",
"functor",
"global",
"if",
"in",
"include",
"inherit",
"inline",
"interface",
"internal",
"land",
"lor",
"lsl",
"lsr",
"lxor",
"lazy",
"let",
"match",
"member",
"mod",
"module",
"mutable",
"namespace",
"method",
"mixin",
"new",
"not",
"null",
"of",
"open",
"or",
"object",
"override",
"private",
"parallel",
"process",
"protected",
"pure",
"public",
"rec",
"return",
"static",
"sealed",
"struct",
"sig",
"then",
"to",
"true",
"tailcall",
"trait",
"try",
"type",
"upcast",
"use",
"val",
"void",
"virtual",
"volatile",
"when",
"while",
"with",
"yield"
],
// we include these common regular expressions
symbols: /[=><!~?:&|+\-*\^%;\.,\/]+/,
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
integersuffix: /[uU]?[yslnLI]?/,
floatsuffix: /[fFmM]?/,
// The main tokenizer for our languages
tokenizer: {
root: [
// identifiers and keywords
[
/[a-zA-Z_]\w*/,
{
cases: {
"@keywords": { token: "keyword.$0" },
"@default": "identifier"
}
}
],
// whitespace
{ include: "@whitespace" },
// [< attributes >].
[/\[<.*>\]/, "annotation"],
// Preprocessor directive
[/^#(if|else|endif)/, "keyword"],
// delimiters and operators
[/[{}()\[\]]/, "@brackets"],
[/[<>](?!@symbols)/, "@brackets"],
[/@symbols/, "delimiter"],
// numbers
[/\d*\d+[eE]([\-+]?\d+)?(@floatsuffix)/, "number.float"],
[/\d*\.\d+([eE][\-+]?\d+)?(@floatsuffix)/, "number.float"],
[/0x[0-9a-fA-F]+LF/, "number.float"],
[/0x[0-9a-fA-F]+(@integersuffix)/, "number.hex"],
[/0b[0-1]+(@integersuffix)/, "number.bin"],
[/\d+(@integersuffix)/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings
[/"([^"\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/"""/, "string", '@string."""'],
[/"/, "string", '@string."'],
// literal string
[/\@"/, { token: "string.quote", next: "@litstring" }],
// characters
[/'[^\\']'B?/, "string"],
[/(')(@escapes)(')/, ["string", "string.escape", "string"]],
[/'/, "string.invalid"]
],
whitespace: [
[/[ \t\r\n]+/, ""],
[/\(\*(?!\))/, "comment", "@comment"],
[/\/\/.*$/, "comment"]
],
comment: [
[/[^*(]+/, "comment"],
[/\*\)/, "comment", "@pop"],
[/\*/, "comment"],
[/\(\*\)/, "comment"],
[/\(/, "comment"]
],
string: [
[/[^\\"]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[
/("""|"B?)/,
{
cases: {
"$#==$S2": { token: "string", next: "@pop" },
"@default": "string"
}
}
]
],
litstring: [
[/[^"]+/, "string"],
[/""/, "string.escape"],
[/"/, { token: "string.quote", next: "@pop" }]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,8 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "go",
extensions: [".go"],
aliases: ["Go"],
loader: () => import('./go.js')
});
+217
View File
@@ -0,0 +1,217 @@
const conf = {
comments: {
lineComment: "//",
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "`", close: "`", notIn: ["string"] },
{ open: '"', close: '"', notIn: ["string"] },
{ open: "'", close: "'", notIn: ["string", "comment"] }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "`", close: "`" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
]
};
const language = {
defaultToken: "",
tokenPostfix: ".go",
keywords: [
"break",
"case",
"chan",
"const",
"continue",
"default",
"defer",
"else",
"fallthrough",
"for",
"func",
"go",
"goto",
"if",
"import",
"interface",
"map",
"package",
"range",
"return",
"select",
"struct",
"switch",
"type",
"var",
"bool",
"true",
"false",
"uint8",
"uint16",
"uint32",
"uint64",
"int8",
"int16",
"int32",
"int64",
"float32",
"float64",
"complex64",
"complex128",
"byte",
"rune",
"uint",
"int",
"uintptr",
"string",
"nil"
],
operators: [
"+",
"-",
"*",
"/",
"%",
"&",
"|",
"^",
"<<",
">>",
"&^",
"+=",
"-=",
"*=",
"/=",
"%=",
"&=",
"|=",
"^=",
"<<=",
">>=",
"&^=",
"&&",
"||",
"<-",
"++",
"--",
"==",
"<",
">",
"=",
"!",
"!=",
"<=",
">=",
":=",
"...",
"(",
")",
"",
"]",
"{",
"}",
",",
";",
".",
":"
],
// we include these common regular expressions
symbols: /[=><!~?:&|+\-*\/\^%]+/,
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
// The main tokenizer for our languages
tokenizer: {
root: [
// identifiers and keywords
[
/[a-zA-Z_]\w*/,
{
cases: {
"@keywords": { token: "keyword.$0" },
"@default": "identifier"
}
}
],
// whitespace
{ include: "@whitespace" },
// [[ attributes ]].
[/\[\[.*\]\]/, "annotation"],
// Preprocessor directive
[/^\s*#\w+/, "keyword"],
// delimiters and operators
[/[{}()\[\]]/, "@brackets"],
[/[<>](?!@symbols)/, "@brackets"],
[
/@symbols/,
{
cases: {
"@operators": "delimiter",
"@default": ""
}
}
],
// numbers
[/\d*\d+[eE]([\-+]?\d+)?/, "number.float"],
[/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"],
[/0[xX][0-9a-fA-F']*[0-9a-fA-F]/, "number.hex"],
[/0[0-7']*[0-7]/, "number.octal"],
[/0[bB][0-1']*[0-1]/, "number.binary"],
[/\d[\d']*/, "number"],
[/\d/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings
[/"([^"\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/"/, "string", "@string"],
[/`/, "string", "@rawstring"],
// characters
[/'[^\\']'/, "string"],
[/(')(@escapes)(')/, ["string", "string.escape", "string"]],
[/'/, "string.invalid"]
],
whitespace: [
[/[ \t\r\n]+/, ""],
[/\/\*\*(?!\/)/, "comment.doc", "@doccomment"],
[/\/\*/, "comment", "@comment"],
[/\/\/.*$/, "comment"]
],
comment: [
[/[^\/*]+/, "comment"],
// [/\/\*/, 'comment', '@push' ], // nested comment not allowed :-(
// [/\/\*/, 'comment.invalid' ], // this breaks block comments in the shape of /* //*/
[/\*\//, "comment", "@pop"],
[/[\/*]/, "comment"]
],
//Identical copy of comment above, except for the addition of .doc
doccomment: [
[/[^\/*]+/, "comment.doc"],
// [/\/\*/, 'comment.doc', '@push' ], // nested comment not allowed :-(
[/\/\*/, "comment.doc.invalid"],
[/\*\//, "comment.doc", "@pop"],
[/[\/*]/, "comment.doc"]
],
string: [
[/[^\\"]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/"/, "string", "@pop"]
],
rawstring: [
[/[^\`]/, "string"],
[/`/, "string", "@pop"]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,9 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "graphql",
extensions: [".graphql", ".gql"],
aliases: ["GraphQL", "graphql", "gql"],
mimetypes: ["application/graphql"],
loader: () => import('./graphql.js')
});
@@ -0,0 +1,150 @@
const conf = {
comments: {
lineComment: "#"
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"""', close: '"""', notIn: ["string", "comment"] },
{ open: '"', close: '"', notIn: ["string", "comment"] }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"""', close: '"""' },
{ open: '"', close: '"' }
],
folding: {
offSide: true
}
};
const language = {
// Set defaultToken to invalid to see what you do not tokenize yet
defaultToken: "invalid",
tokenPostfix: ".gql",
keywords: [
"null",
"true",
"false",
"query",
"mutation",
"subscription",
"extend",
"schema",
"directive",
"scalar",
"type",
"interface",
"union",
"enum",
"input",
"implements",
"fragment",
"on"
],
typeKeywords: ["Int", "Float", "String", "Boolean", "ID"],
directiveLocations: [
"SCHEMA",
"SCALAR",
"OBJECT",
"FIELD_DEFINITION",
"ARGUMENT_DEFINITION",
"INTERFACE",
"UNION",
"ENUM",
"ENUM_VALUE",
"INPUT_OBJECT",
"INPUT_FIELD_DEFINITION",
"QUERY",
"MUTATION",
"SUBSCRIPTION",
"FIELD",
"FRAGMENT_DEFINITION",
"FRAGMENT_SPREAD",
"INLINE_FRAGMENT",
"VARIABLE_DEFINITION"
],
operators: ["=", "!", "?", ":", "&", "|"],
// we include these common regular expressions
symbols: /[=!?:&|]+/,
// https://facebook.github.io/graphql/draft/#sec-String-Value
escapes: /\\(?:["\\\/bfnrt]|u[0-9A-Fa-f]{4})/,
// The main tokenizer for our languages
tokenizer: {
root: [
// fields and argument names
[
/[a-z_][\w$]*/,
{
cases: {
"@keywords": "keyword",
"@default": "key.identifier"
}
}
],
// identify typed input variables
[
/[$][\w$]*/,
{
cases: {
"@keywords": "keyword",
"@default": "argument.identifier"
}
}
],
// to show class names nicely
[
/[A-Z][\w\$]*/,
{
cases: {
"@typeKeywords": "keyword",
"@default": "type.identifier"
}
}
],
// whitespace
{ include: "@whitespace" },
// delimiters and operators
[/[{}()\[\]]/, "@brackets"],
[/@symbols/, { cases: { "@operators": "operator", "@default": "" } }],
// @ annotations.
// As an example, we emit a debugging log message on these tokens.
// Note: message are supressed during the first load -- change some lines to see them.
[/@\s*[a-zA-Z_\$][\w\$]*/, { token: "annotation", log: "annotation token: $0" }],
// numbers
[/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"],
[/0[xX][0-9a-fA-F]+/, "number.hex"],
[/\d+/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
[/"""/, { token: "string", next: "@mlstring", nextEmbedded: "markdown" }],
// strings
[/"([^"\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/"/, { token: "string.quote", bracket: "@open", next: "@string" }]
],
mlstring: [
[/[^"]+/, "string"],
['"""', { token: "string", next: "@pop", nextEmbedded: "@pop" }]
],
string: [
[/[^\\"]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/"/, { token: "string.quote", bracket: "@close", next: "@pop" }]
],
whitespace: [
[/[ \t\r\n]+/, ""],
[/#.*$/, "comment"]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,9 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "handlebars",
extensions: [".handlebars", ".hbs"],
aliases: ["Handlebars", "handlebars", "hbs"],
mimetypes: ["text/x-handlebars-template"],
loader: () => import('./handlebars.js')
});
@@ -0,0 +1,485 @@
import '../../editor/browser/coreCommands.js';
import '../../editor/browser/widget/codeEditor/codeEditorWidget.js';
import '../../editor/browser/widget/diffEditor/diffEditor.contribution.js';
import '../../editor/contrib/anchorSelect/browser/anchorSelect.js';
import '../../editor/contrib/bracketMatching/browser/bracketMatching.js';
import '../../editor/contrib/caretOperations/browser/caretOperations.js';
import '../../editor/contrib/caretOperations/browser/transpose.js';
import '../../editor/contrib/clipboard/browser/clipboard.js';
import '../../editor/contrib/codeAction/browser/codeActionContributions.js';
import '../../editor/contrib/codelens/browser/codelensController.js';
import '../../editor/contrib/colorPicker/browser/colorPickerContribution.js';
import '../../editor/contrib/comment/browser/comment.js';
import '../../editor/contrib/contextmenu/browser/contextmenu.js';
import '../../editor/contrib/cursorUndo/browser/cursorUndo.js';
import '../../editor/contrib/dnd/browser/dnd.js';
import '../../editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js';
import '../../editor/contrib/dropOrPasteInto/browser/dropIntoEditorContribution.js';
import '../../editor/contrib/find/browser/findController.js';
import '../../editor/contrib/folding/browser/folding.js';
import '../../editor/contrib/fontZoom/browser/fontZoom.js';
import '../../editor/contrib/format/browser/formatActions.js';
import '../../editor/contrib/documentSymbols/browser/documentSymbols.js';
import '../../editor/contrib/inlineCompletions/browser/inlineCompletions.contribution.js';
import '../../editor/contrib/inlineProgress/browser/inlineProgress.js';
import '../../editor/contrib/gotoSymbol/browser/goToCommands.js';
import '../../editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js';
import '../../editor/contrib/gotoError/browser/gotoError.js';
import '../../editor/contrib/gpu/browser/gpuActions.js';
import '../../editor/contrib/hover/browser/hoverContribution.js';
import '../../editor/contrib/indentation/browser/indentation.js';
import '../../editor/contrib/inlayHints/browser/inlayHintsContribution.js';
import '../../editor/contrib/inPlaceReplace/browser/inPlaceReplace.js';
import '../../editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js';
import '../../editor/contrib/lineSelection/browser/lineSelection.js';
import '../../editor/contrib/linesOperations/browser/linesOperations.js';
import '../../editor/contrib/linkedEditing/browser/linkedEditing.js';
import '../../editor/contrib/links/browser/links.js';
import '../../editor/contrib/longLinesHelper/browser/longLinesHelper.js';
import '../../editor/contrib/middleScroll/browser/middleScroll.contribution.js';
import '../../editor/contrib/multicursor/browser/multicursor.js';
import '../../editor/contrib/parameterHints/browser/parameterHints.js';
import '../../editor/contrib/placeholderText/browser/placeholderText.contribution.js';
import '../../editor/contrib/rename/browser/rename.js';
import '../../editor/contrib/sectionHeaders/browser/sectionHeaders.js';
import '../../editor/contrib/semanticTokens/browser/documentSemanticTokens.js';
import '../../editor/contrib/semanticTokens/browser/viewportSemanticTokens.js';
import '../../editor/contrib/smartSelect/browser/smartSelect.js';
import '../../editor/contrib/snippet/browser/snippetController2.js';
import '../../editor/contrib/stickyScroll/browser/stickyScrollContribution.js';
import '../../editor/contrib/suggest/browser/suggestController.js';
import '../../editor/contrib/suggest/browser/suggestInlineCompletions.js';
import '../../editor/contrib/tokenization/browser/tokenization.js';
import '../../editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js';
import '../../editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js';
import '../../editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js';
import '../../editor/contrib/wordHighlighter/browser/wordHighlighter.js';
import '../../editor/contrib/wordOperations/browser/wordOperations.js';
import '../../editor/contrib/wordPartOperations/browser/wordPartOperations.js';
import '../../editor/contrib/readOnlyMessage/browser/contribution.js';
import '../../editor/contrib/diffEditorBreadcrumbs/browser/contribution.js';
import '../../editor/contrib/floatingMenu/browser/floatingMenu.contribution.js';
import '../../editor/common/standaloneStrings.js';
import '../../base/browser/ui/codicons/codicon/codicon.css';
import '../../base/browser/ui/codicons/codicon/codicon-modifiers.css';
import '../../editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.js';
import '../../editor/standalone/browser/inspectTokens/inspectTokens.js';
import '../../editor/standalone/browser/quickAccess/standaloneHelpQuickAccess.js';
import '../../editor/standalone/browser/quickAccess/standaloneGotoLineQuickAccess.js';
import '../../editor/standalone/browser/quickAccess/standaloneGotoSymbolQuickAccess.js';
import '../../editor/standalone/browser/quickAccess/standaloneCommandsQuickAccess.js';
import '../../editor/standalone/browser/referenceSearch/standaloneReferenceSearch.js';
import '../../editor/standalone/browser/toggleHighContrast/toggleHighContrast.js';
import { languages } from '../../editor/editor.api2.js';
const EMPTY_ELEMENTS = [
"area",
"base",
"br",
"col",
"embed",
"hr",
"img",
"input",
"keygen",
"link",
"menuitem",
"meta",
"param",
"source",
"track",
"wbr"
];
const conf = {
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
comments: {
blockComment: ["{{!--", "--}}"]
},
brackets: [
["<!--", "-->"],
["<", ">"],
["{{", "}}"],
["{", "}"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
surroundingPairs: [
{ open: "<", close: ">" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
onEnterRules: [
{
beforeText: new RegExp(
`<(?!(?:${EMPTY_ELEMENTS.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
"i"
),
afterText: /^<\/(\w[\w\d]*)\s*>$/i,
action: {
indentAction: languages.IndentAction.IndentOutdent
}
},
{
beforeText: new RegExp(
`<(?!(?:${EMPTY_ELEMENTS.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
"i"
),
action: { indentAction: languages.IndentAction.Indent }
}
]
};
const language = {
defaultToken: "",
tokenPostfix: "",
// ignoreCase: true,
// The main tokenizer for our languages
tokenizer: {
root: [
[/\{\{!--/, "comment.block.start.handlebars", "@commentBlock"],
[/\{\{!/, "comment.start.handlebars", "@comment"],
[/\{\{/, { token: "@rematch", switchTo: "@handlebarsInSimpleState.root" }],
[/<!DOCTYPE/, "metatag.html", "@doctype"],
[/<!--/, "comment.html", "@commentHtml"],
[/(<)(\w+)(\/>)/, ["delimiter.html", "tag.html", "delimiter.html"]],
[/(<)(script)/, ["delimiter.html", { token: "tag.html", next: "@script" }]],
[/(<)(style)/, ["delimiter.html", { token: "tag.html", next: "@style" }]],
[/(<)([:\w]+)/, ["delimiter.html", { token: "tag.html", next: "@otherTag" }]],
[/(<\/)(\w+)/, ["delimiter.html", { token: "tag.html", next: "@otherTag" }]],
[/</, "delimiter.html"],
[/\{/, "delimiter.html"],
[/[^<{]+/]
// text
],
doctype: [
[
/\{\{/,
{
token: "@rematch",
switchTo: "@handlebarsInSimpleState.comment"
}
],
[/[^>]+/, "metatag.content.html"],
[/>/, "metatag.html", "@pop"]
],
comment: [
[/\}\}/, "comment.end.handlebars", "@pop"],
[/./, "comment.content.handlebars"]
],
commentBlock: [
[/--\}\}/, "comment.block.end.handlebars", "@pop"],
[/./, "comment.content.handlebars"]
],
commentHtml: [
[
/\{\{/,
{
token: "@rematch",
switchTo: "@handlebarsInSimpleState.comment"
}
],
[/-->/, "comment.html", "@pop"],
[/[^-]+/, "comment.content.html"],
[/./, "comment.content.html"]
],
otherTag: [
[
/\{\{/,
{
token: "@rematch",
switchTo: "@handlebarsInSimpleState.otherTag"
}
],
[/\/?>/, "delimiter.html", "@pop"],
[/"([^"]*)"/, "attribute.value"],
[/'([^']*)'/, "attribute.value"],
[/[\w\-]+/, "attribute.name"],
[/=/, "delimiter"],
[/[ \t\r\n]+/]
// whitespace
],
// -- BEGIN <script> tags handling
// After <script
script: [
[
/\{\{/,
{
token: "@rematch",
switchTo: "@handlebarsInSimpleState.script"
}
],
[/type/, "attribute.name", "@scriptAfterType"],
[/"([^"]*)"/, "attribute.value"],
[/'([^']*)'/, "attribute.value"],
[/[\w\-]+/, "attribute.name"],
[/=/, "delimiter"],
[
/>/,
{
token: "delimiter.html",
next: "@scriptEmbedded.text/javascript",
nextEmbedded: "text/javascript"
}
],
[/[ \t\r\n]+/],
// whitespace
[
/(<\/)(script\s*)(>)/,
["delimiter.html", "tag.html", { token: "delimiter.html", next: "@pop" }]
]
],
// After <script ... type
scriptAfterType: [
[
/\{\{/,
{
token: "@rematch",
switchTo: "@handlebarsInSimpleState.scriptAfterType"
}
],
[/=/, "delimiter", "@scriptAfterTypeEquals"],
[
/>/,
{
token: "delimiter.html",
next: "@scriptEmbedded.text/javascript",
nextEmbedded: "text/javascript"
}
],
// cover invalid e.g. <script type>
[/[ \t\r\n]+/],
// whitespace
[/<\/script\s*>/, { token: "@rematch", next: "@pop" }]
],
// After <script ... type =
scriptAfterTypeEquals: [
[
/\{\{/,
{
token: "@rematch",
switchTo: "@handlebarsInSimpleState.scriptAfterTypeEquals"
}
],
[
/"([^"]*)"/,
{
token: "attribute.value",
switchTo: "@scriptWithCustomType.$1"
}
],
[
/'([^']*)'/,
{
token: "attribute.value",
switchTo: "@scriptWithCustomType.$1"
}
],
[
/>/,
{
token: "delimiter.html",
next: "@scriptEmbedded.text/javascript",
nextEmbedded: "text/javascript"
}
],
// cover invalid e.g. <script type=>
[/[ \t\r\n]+/],
// whitespace
[/<\/script\s*>/, { token: "@rematch", next: "@pop" }]
],
// After <script ... type = $S2
scriptWithCustomType: [
[
/\{\{/,
{
token: "@rematch",
switchTo: "@handlebarsInSimpleState.scriptWithCustomType.$S2"
}
],
[
/>/,
{
token: "delimiter.html",
next: "@scriptEmbedded.$S2",
nextEmbedded: "$S2"
}
],
[/"([^"]*)"/, "attribute.value"],
[/'([^']*)'/, "attribute.value"],
[/[\w\-]+/, "attribute.name"],
[/=/, "delimiter"],
[/[ \t\r\n]+/],
// whitespace
[/<\/script\s*>/, { token: "@rematch", next: "@pop" }]
],
scriptEmbedded: [
[
/\{\{/,
{
token: "@rematch",
switchTo: "@handlebarsInEmbeddedState.scriptEmbedded.$S2",
nextEmbedded: "@pop"
}
],
[/<\/script/, { token: "@rematch", next: "@pop", nextEmbedded: "@pop" }]
],
// -- END <script> tags handling
// -- BEGIN <style> tags handling
// After <style
style: [
[
/\{\{/,
{
token: "@rematch",
switchTo: "@handlebarsInSimpleState.style"
}
],
[/type/, "attribute.name", "@styleAfterType"],
[/"([^"]*)"/, "attribute.value"],
[/'([^']*)'/, "attribute.value"],
[/[\w\-]+/, "attribute.name"],
[/=/, "delimiter"],
[
/>/,
{
token: "delimiter.html",
next: "@styleEmbedded.text/css",
nextEmbedded: "text/css"
}
],
[/[ \t\r\n]+/],
// whitespace
[
/(<\/)(style\s*)(>)/,
["delimiter.html", "tag.html", { token: "delimiter.html", next: "@pop" }]
]
],
// After <style ... type
styleAfterType: [
[
/\{\{/,
{
token: "@rematch",
switchTo: "@handlebarsInSimpleState.styleAfterType"
}
],
[/=/, "delimiter", "@styleAfterTypeEquals"],
[
/>/,
{
token: "delimiter.html",
next: "@styleEmbedded.text/css",
nextEmbedded: "text/css"
}
],
// cover invalid e.g. <style type>
[/[ \t\r\n]+/],
// whitespace
[/<\/style\s*>/, { token: "@rematch", next: "@pop" }]
],
// After <style ... type =
styleAfterTypeEquals: [
[
/\{\{/,
{
token: "@rematch",
switchTo: "@handlebarsInSimpleState.styleAfterTypeEquals"
}
],
[
/"([^"]*)"/,
{
token: "attribute.value",
switchTo: "@styleWithCustomType.$1"
}
],
[
/'([^']*)'/,
{
token: "attribute.value",
switchTo: "@styleWithCustomType.$1"
}
],
[
/>/,
{
token: "delimiter.html",
next: "@styleEmbedded.text/css",
nextEmbedded: "text/css"
}
],
// cover invalid e.g. <style type=>
[/[ \t\r\n]+/],
// whitespace
[/<\/style\s*>/, { token: "@rematch", next: "@pop" }]
],
// After <style ... type = $S2
styleWithCustomType: [
[
/\{\{/,
{
token: "@rematch",
switchTo: "@handlebarsInSimpleState.styleWithCustomType.$S2"
}
],
[
/>/,
{
token: "delimiter.html",
next: "@styleEmbedded.$S2",
nextEmbedded: "$S2"
}
],
[/"([^"]*)"/, "attribute.value"],
[/'([^']*)'/, "attribute.value"],
[/[\w\-]+/, "attribute.name"],
[/=/, "delimiter"],
[/[ \t\r\n]+/],
// whitespace
[/<\/style\s*>/, { token: "@rematch", next: "@pop" }]
],
styleEmbedded: [
[
/\{\{/,
{
token: "@rematch",
switchTo: "@handlebarsInEmbeddedState.styleEmbedded.$S2",
nextEmbedded: "@pop"
}
],
[/<\/style/, { token: "@rematch", next: "@pop", nextEmbedded: "@pop" }]
],
// -- END <style> tags handling
handlebarsInSimpleState: [
[/\{\{\{?/, "delimiter.handlebars"],
[/\}\}\}?/, { token: "delimiter.handlebars", switchTo: "@$S2.$S3" }],
{ include: "handlebarsRoot" }
],
handlebarsInEmbeddedState: [
[/\{\{\{?/, "delimiter.handlebars"],
[
/\}\}\}?/,
{
token: "delimiter.handlebars",
switchTo: "@$S2.$S3",
nextEmbedded: "$S3"
}
],
{ include: "handlebarsRoot" }
],
handlebarsRoot: [
[/"[^"]*"/, "string.handlebars"],
[/[#/][^\s}]+/, "keyword.helper.handlebars"],
[/else\b/, "keyword.helper.handlebars"],
[/[\s]+/],
[/[^}]/, "variable.parameter.handlebars"]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,8 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "hcl",
extensions: [".tf", ".tfvars", ".hcl"],
aliases: ["Terraform", "tf", "HCL", "hcl"],
loader: () => import('./hcl.js')
});
+182
View File
@@ -0,0 +1,182 @@
const conf = {
comments: {
lineComment: "#",
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"', notIn: ["string"] }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' }
]
};
const language = {
defaultToken: "",
tokenPostfix: ".hcl",
keywords: [
"var",
"local",
"path",
"for_each",
"any",
"string",
"number",
"bool",
"true",
"false",
"null",
"if ",
"else ",
"endif ",
"for ",
"in",
"endfor"
],
operators: [
"=",
">=",
"<=",
"==",
"!=",
"+",
"-",
"*",
"/",
"%",
"&&",
"||",
"!",
"<",
">",
"?",
"...",
":"
],
symbols: /[=><!~?:&|+\-*\/\^%]+/,
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
terraformFunctions: /(abs|ceil|floor|log|max|min|pow|signum|chomp|format|formatlist|indent|join|lower|regex|regexall|replace|split|strrev|substr|title|trimspace|upper|chunklist|coalesce|coalescelist|compact|concat|contains|distinct|element|flatten|index|keys|length|list|lookup|map|matchkeys|merge|range|reverse|setintersection|setproduct|setunion|slice|sort|transpose|values|zipmap|base64decode|base64encode|base64gzip|csvdecode|jsondecode|jsonencode|urlencode|yamldecode|yamlencode|abspath|dirname|pathexpand|basename|file|fileexists|fileset|filebase64|templatefile|formatdate|timeadd|timestamp|base64sha256|base64sha512|bcrypt|filebase64sha256|filebase64sha512|filemd5|filemd1|filesha256|filesha512|md5|rsadecrypt|sha1|sha256|sha512|uuid|uuidv5|cidrhost|cidrnetmask|cidrsubnet|tobool|tolist|tomap|tonumber|toset|tostring)/,
terraformMainBlocks: /(module|data|terraform|resource|provider|variable|output|locals)/,
tokenizer: {
root: [
// highlight main blocks
[
/^@terraformMainBlocks([ \t]*)([\w-]+|"[\w-]+"|)([ \t]*)([\w-]+|"[\w-]+"|)([ \t]*)(\{)/,
["type", "", "string", "", "string", "", "@brackets"]
],
// highlight all the remaining blocks
[
/(\w+[ \t]+)([ \t]*)([\w-]+|"[\w-]+"|)([ \t]*)([\w-]+|"[\w-]+"|)([ \t]*)(\{)/,
["identifier", "", "string", "", "string", "", "@brackets"]
],
// highlight block
[
/(\w+[ \t]+)([ \t]*)([\w-]+|"[\w-]+"|)([ \t]*)([\w-]+|"[\w-]+"|)(=)(\{)/,
["identifier", "", "string", "", "operator", "", "@brackets"]
],
// terraform general highlight - shared with expressions
{ include: "@terraform" }
],
terraform: [
// highlight terraform functions
[/@terraformFunctions(\()/, ["type", "@brackets"]],
// all other words are variables or keywords
[
/[a-zA-Z_]\w*-*/,
// must work with variables such as foo-bar and also with negative numbers
{
cases: {
"@keywords": { token: "keyword.$0" },
"@default": "variable"
}
}
],
{ include: "@whitespace" },
{ include: "@heredoc" },
// delimiters and operators
[/[{}()\[\]]/, "@brackets"],
[/[<>](?!@symbols)/, "@brackets"],
[
/@symbols/,
{
cases: {
"@operators": "operator",
"@default": ""
}
}
],
// numbers
[/\d*\d+[eE]([\-+]?\d+)?/, "number.float"],
[/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"],
[/\d[\d']*/, "number"],
[/\d/, "number"],
[/[;,.]/, "delimiter"],
// delimiter: after number because of .\d floats
// strings
[/"/, "string", "@string"],
// this will include expressions
[/'/, "invalid"]
],
heredoc: [
[/<<[-]*\s*["]?([\w\-]+)["]?/, { token: "string.heredoc.delimiter", next: "@heredocBody.$1" }]
],
heredocBody: [
[
/([\w\-]+)$/,
{
cases: {
"$1==$S2": [
{
token: "string.heredoc.delimiter",
next: "@popall"
}
],
"@default": "string.heredoc"
}
}
],
[/./, "string.heredoc"]
],
whitespace: [
[/[ \t\r\n]+/, ""],
[/\/\*/, "comment", "@comment"],
[/\/\/.*$/, "comment"],
[/#.*$/, "comment"]
],
comment: [
[/[^\/*]+/, "comment"],
[/\*\//, "comment", "@pop"],
[/[\/*]/, "comment"]
],
string: [
[/\$\{/, { token: "delimiter", next: "@stringExpression" }],
[/[^\\"\$]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/"/, "string", "@popall"]
],
stringInsideExpression: [
[/[^\\"]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/"/, "string", "@pop"]
],
stringExpression: [
[/\}/, { token: "delimiter", next: "@pop" }],
[/"/, "string", "@stringInsideExpression"],
{ include: "@terraform" }
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,9 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "html",
extensions: [".html", ".htm", ".shtml", ".xhtml", ".mdoc", ".jsp", ".asp", ".aspx", ".jshtm"],
aliases: ["HTML", "htm", "html", "xhtml"],
mimetypes: ["text/html", "text/x-jshtm", "text/template", "text/ng-template"],
loader: () => import('./html.js')
});
+374
View File
@@ -0,0 +1,374 @@
import '../../editor/browser/coreCommands.js';
import '../../editor/browser/widget/codeEditor/codeEditorWidget.js';
import '../../editor/browser/widget/diffEditor/diffEditor.contribution.js';
import '../../editor/contrib/anchorSelect/browser/anchorSelect.js';
import '../../editor/contrib/bracketMatching/browser/bracketMatching.js';
import '../../editor/contrib/caretOperations/browser/caretOperations.js';
import '../../editor/contrib/caretOperations/browser/transpose.js';
import '../../editor/contrib/clipboard/browser/clipboard.js';
import '../../editor/contrib/codeAction/browser/codeActionContributions.js';
import '../../editor/contrib/codelens/browser/codelensController.js';
import '../../editor/contrib/colorPicker/browser/colorPickerContribution.js';
import '../../editor/contrib/comment/browser/comment.js';
import '../../editor/contrib/contextmenu/browser/contextmenu.js';
import '../../editor/contrib/cursorUndo/browser/cursorUndo.js';
import '../../editor/contrib/dnd/browser/dnd.js';
import '../../editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js';
import '../../editor/contrib/dropOrPasteInto/browser/dropIntoEditorContribution.js';
import '../../editor/contrib/find/browser/findController.js';
import '../../editor/contrib/folding/browser/folding.js';
import '../../editor/contrib/fontZoom/browser/fontZoom.js';
import '../../editor/contrib/format/browser/formatActions.js';
import '../../editor/contrib/documentSymbols/browser/documentSymbols.js';
import '../../editor/contrib/inlineCompletions/browser/inlineCompletions.contribution.js';
import '../../editor/contrib/inlineProgress/browser/inlineProgress.js';
import '../../editor/contrib/gotoSymbol/browser/goToCommands.js';
import '../../editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js';
import '../../editor/contrib/gotoError/browser/gotoError.js';
import '../../editor/contrib/gpu/browser/gpuActions.js';
import '../../editor/contrib/hover/browser/hoverContribution.js';
import '../../editor/contrib/indentation/browser/indentation.js';
import '../../editor/contrib/inlayHints/browser/inlayHintsContribution.js';
import '../../editor/contrib/inPlaceReplace/browser/inPlaceReplace.js';
import '../../editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js';
import '../../editor/contrib/lineSelection/browser/lineSelection.js';
import '../../editor/contrib/linesOperations/browser/linesOperations.js';
import '../../editor/contrib/linkedEditing/browser/linkedEditing.js';
import '../../editor/contrib/links/browser/links.js';
import '../../editor/contrib/longLinesHelper/browser/longLinesHelper.js';
import '../../editor/contrib/middleScroll/browser/middleScroll.contribution.js';
import '../../editor/contrib/multicursor/browser/multicursor.js';
import '../../editor/contrib/parameterHints/browser/parameterHints.js';
import '../../editor/contrib/placeholderText/browser/placeholderText.contribution.js';
import '../../editor/contrib/rename/browser/rename.js';
import '../../editor/contrib/sectionHeaders/browser/sectionHeaders.js';
import '../../editor/contrib/semanticTokens/browser/documentSemanticTokens.js';
import '../../editor/contrib/semanticTokens/browser/viewportSemanticTokens.js';
import '../../editor/contrib/smartSelect/browser/smartSelect.js';
import '../../editor/contrib/snippet/browser/snippetController2.js';
import '../../editor/contrib/stickyScroll/browser/stickyScrollContribution.js';
import '../../editor/contrib/suggest/browser/suggestController.js';
import '../../editor/contrib/suggest/browser/suggestInlineCompletions.js';
import '../../editor/contrib/tokenization/browser/tokenization.js';
import '../../editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js';
import '../../editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js';
import '../../editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js';
import '../../editor/contrib/wordHighlighter/browser/wordHighlighter.js';
import '../../editor/contrib/wordOperations/browser/wordOperations.js';
import '../../editor/contrib/wordPartOperations/browser/wordPartOperations.js';
import '../../editor/contrib/readOnlyMessage/browser/contribution.js';
import '../../editor/contrib/diffEditorBreadcrumbs/browser/contribution.js';
import '../../editor/contrib/floatingMenu/browser/floatingMenu.contribution.js';
import '../../editor/common/standaloneStrings.js';
import '../../base/browser/ui/codicons/codicon/codicon.css';
import '../../base/browser/ui/codicons/codicon/codicon-modifiers.css';
import '../../editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.js';
import '../../editor/standalone/browser/inspectTokens/inspectTokens.js';
import '../../editor/standalone/browser/quickAccess/standaloneHelpQuickAccess.js';
import '../../editor/standalone/browser/quickAccess/standaloneGotoLineQuickAccess.js';
import '../../editor/standalone/browser/quickAccess/standaloneGotoSymbolQuickAccess.js';
import '../../editor/standalone/browser/quickAccess/standaloneCommandsQuickAccess.js';
import '../../editor/standalone/browser/referenceSearch/standaloneReferenceSearch.js';
import '../../editor/standalone/browser/toggleHighContrast/toggleHighContrast.js';
import { languages } from '../../editor/editor.api2.js';
const EMPTY_ELEMENTS = [
"area",
"base",
"br",
"col",
"embed",
"hr",
"img",
"input",
"keygen",
"link",
"menuitem",
"meta",
"param",
"source",
"track",
"wbr"
];
const conf = {
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
comments: {
blockComment: ["<!--", "-->"]
},
brackets: [
["<!--", "-->"],
["<", ">"],
["{", "}"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
surroundingPairs: [
{ open: '"', close: '"' },
{ open: "'", close: "'" },
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "<", close: ">" }
],
onEnterRules: [
{
beforeText: new RegExp(
`<(?!(?:${EMPTY_ELEMENTS.join("|")}))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$`,
"i"
),
afterText: /^<\/([_:\w][_:\w-.\d]*)\s*>$/i,
action: {
indentAction: languages.IndentAction.IndentOutdent
}
},
{
beforeText: new RegExp(
`<(?!(?:${EMPTY_ELEMENTS.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
"i"
),
action: { indentAction: languages.IndentAction.Indent }
}
],
folding: {
markers: {
start: new RegExp("^\\s*<!--\\s*#region\\b.*-->"),
end: new RegExp("^\\s*<!--\\s*#endregion\\b.*-->")
}
}
};
const language = {
defaultToken: "",
tokenPostfix: ".html",
ignoreCase: true,
// The main tokenizer for our languages
tokenizer: {
root: [
[/<!DOCTYPE/, "metatag", "@doctype"],
[/<!--/, "comment", "@comment"],
[/(<)((?:[\w\-]+:)?[\w\-]+)(\s*)(\/>)/, ["delimiter", "tag", "", "delimiter"]],
[/(<)(script)/, ["delimiter", { token: "tag", next: "@script" }]],
[/(<)(style)/, ["delimiter", { token: "tag", next: "@style" }]],
[/(<)((?:[\w\-]+:)?[\w\-]+)/, ["delimiter", { token: "tag", next: "@otherTag" }]],
[/(<\/)((?:[\w\-]+:)?[\w\-]+)/, ["delimiter", { token: "tag", next: "@otherTag" }]],
[/</, "delimiter"],
[/[^<]+/]
// text
],
doctype: [
[/[^>]+/, "metatag.content"],
[/>/, "metatag", "@pop"]
],
comment: [
[/-->/, "comment", "@pop"],
[/[^-]+/, "comment.content"],
[/./, "comment.content"]
],
otherTag: [
[/\/?>/, "delimiter", "@pop"],
[/"([^"]*)"/, "attribute.value"],
[/'([^']*)'/, "attribute.value"],
[/[\w\-]+/, "attribute.name"],
[/=/, "delimiter"],
[/[ \t\r\n]+/]
// whitespace
],
// -- BEGIN <script> tags handling
// After <script
script: [
[/type/, "attribute.name", "@scriptAfterType"],
[/"([^"]*)"/, "attribute.value"],
[/'([^']*)'/, "attribute.value"],
[/[\w\-]+/, "attribute.name"],
[/=/, "delimiter"],
[
/>/,
{
token: "delimiter",
next: "@scriptEmbedded",
nextEmbedded: "text/javascript"
}
],
[/[ \t\r\n]+/],
// whitespace
[/(<\/)(script\s*)(>)/, ["delimiter", "tag", { token: "delimiter", next: "@pop" }]]
],
// After <script ... type
scriptAfterType: [
[/=/, "delimiter", "@scriptAfterTypeEquals"],
[
/>/,
{
token: "delimiter",
next: "@scriptEmbedded",
nextEmbedded: "text/javascript"
}
],
// cover invalid e.g. <script type>
[/[ \t\r\n]+/],
// whitespace
[/<\/script\s*>/, { token: "@rematch", next: "@pop" }]
],
// After <script ... type =
scriptAfterTypeEquals: [
[
/"module"/,
{
token: "attribute.value",
switchTo: "@scriptWithCustomType.text/javascript"
}
],
[
/'module'/,
{
token: "attribute.value",
switchTo: "@scriptWithCustomType.text/javascript"
}
],
[
/"([^"]*)"/,
{
token: "attribute.value",
switchTo: "@scriptWithCustomType.$1"
}
],
[
/'([^']*)'/,
{
token: "attribute.value",
switchTo: "@scriptWithCustomType.$1"
}
],
[
/>/,
{
token: "delimiter",
next: "@scriptEmbedded",
nextEmbedded: "text/javascript"
}
],
// cover invalid e.g. <script type=>
[/[ \t\r\n]+/],
// whitespace
[/<\/script\s*>/, { token: "@rematch", next: "@pop" }]
],
// After <script ... type = $S2
scriptWithCustomType: [
[
/>/,
{
token: "delimiter",
next: "@scriptEmbedded.$S2",
nextEmbedded: "$S2"
}
],
[/"([^"]*)"/, "attribute.value"],
[/'([^']*)'/, "attribute.value"],
[/[\w\-]+/, "attribute.name"],
[/=/, "delimiter"],
[/[ \t\r\n]+/],
// whitespace
[/<\/script\s*>/, { token: "@rematch", next: "@pop" }]
],
scriptEmbedded: [
[/<\/script/, { token: "@rematch", next: "@pop", nextEmbedded: "@pop" }],
[/[^<]+/, ""]
],
// -- END <script> tags handling
// -- BEGIN <style> tags handling
// After <style
style: [
[/type/, "attribute.name", "@styleAfterType"],
[/"([^"]*)"/, "attribute.value"],
[/'([^']*)'/, "attribute.value"],
[/[\w\-]+/, "attribute.name"],
[/=/, "delimiter"],
[
/>/,
{
token: "delimiter",
next: "@styleEmbedded",
nextEmbedded: "text/css"
}
],
[/[ \t\r\n]+/],
// whitespace
[/(<\/)(style\s*)(>)/, ["delimiter", "tag", { token: "delimiter", next: "@pop" }]]
],
// After <style ... type
styleAfterType: [
[/=/, "delimiter", "@styleAfterTypeEquals"],
[
/>/,
{
token: "delimiter",
next: "@styleEmbedded",
nextEmbedded: "text/css"
}
],
// cover invalid e.g. <style type>
[/[ \t\r\n]+/],
// whitespace
[/<\/style\s*>/, { token: "@rematch", next: "@pop" }]
],
// After <style ... type =
styleAfterTypeEquals: [
[
/"([^"]*)"/,
{
token: "attribute.value",
switchTo: "@styleWithCustomType.$1"
}
],
[
/'([^']*)'/,
{
token: "attribute.value",
switchTo: "@styleWithCustomType.$1"
}
],
[
/>/,
{
token: "delimiter",
next: "@styleEmbedded",
nextEmbedded: "text/css"
}
],
// cover invalid e.g. <style type=>
[/[ \t\r\n]+/],
// whitespace
[/<\/style\s*>/, { token: "@rematch", next: "@pop" }]
],
// After <style ... type = $S2
styleWithCustomType: [
[
/>/,
{
token: "delimiter",
next: "@styleEmbedded.$S2",
nextEmbedded: "$S2"
}
],
[/"([^"]*)"/, "attribute.value"],
[/'([^']*)'/, "attribute.value"],
[/[\w\-]+/, "attribute.name"],
[/=/, "delimiter"],
[/[ \t\r\n]+/],
// whitespace
[/<\/style\s*>/, { token: "@rematch", next: "@pop" }]
],
styleEmbedded: [
[/<\/style/, { token: "@rematch", next: "@pop", nextEmbedded: "@pop" }],
[/[^<]+/, ""]
]
// -- END <style> tags handling
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,9 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "ini",
extensions: [".ini", ".properties", ".gitconfig"],
filenames: ["config", ".gitattributes", ".gitconfig", ".editorconfig"],
aliases: ["Ini", "ini"],
loader: () => import('./ini.js')
});
+70
View File
@@ -0,0 +1,70 @@
const conf = {
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: "'" }
]
};
const language = {
defaultToken: "",
tokenPostfix: ".ini",
// we include these common regular expressions
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
// The main tokenizer for our languages
tokenizer: {
root: [
// sections
[/^\[[^\]]*\]/, "metatag"],
// keys
[/(^\w+)(\s*)(\=)/, ["key", "", "delimiter"]],
// whitespace
{ include: "@whitespace" },
// numbers
[/\d+/, "number"],
// strings: recover on non-terminated strings
[/"([^"\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/'([^'\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/"/, "string", '@string."'],
[/'/, "string", "@string.'"]
],
whitespace: [
[/[ \t\r\n]+/, ""],
[/^\s*[#;].*$/, "comment"]
],
string: [
[/[^\\"']+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[
/["']/,
{
cases: {
"$#==$S2": { token: "string", next: "@pop" },
"@default": "string"
}
}
]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,9 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "java",
extensions: [".java", ".jav"],
aliases: ["Java", "java"],
mimetypes: ["text/x-java-source", "text/x-java"],
loader: () => import('./java.js')
});
+231
View File
@@ -0,0 +1,231 @@
const conf = {
// the default separators except `@$`
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
comments: {
lineComment: "//",
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" },
{ open: "<", close: ">" }
],
folding: {
markers: {
start: new RegExp("^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))"),
end: new RegExp("^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))")
}
}
};
const language = {
defaultToken: "",
tokenPostfix: ".java",
keywords: [
"abstract",
"continue",
"for",
"new",
"switch",
"assert",
"default",
"goto",
"package",
"synchronized",
"boolean",
"do",
"if",
"private",
"this",
"break",
"double",
"implements",
"protected",
"throw",
"byte",
"else",
"import",
"public",
"throws",
"case",
"enum",
"instanceof",
"return",
"transient",
"catch",
"extends",
"int",
"short",
"try",
"char",
"final",
"interface",
"static",
"void",
"class",
"finally",
"long",
"strictfp",
"volatile",
"const",
"float",
"native",
"super",
"while",
"true",
"false",
"yield",
"record",
"sealed",
"non-sealed",
"permits"
],
operators: [
"=",
">",
"<",
"!",
"~",
"?",
":",
"==",
"<=",
">=",
"!=",
"&&",
"||",
"++",
"--",
"+",
"-",
"*",
"/",
"&",
"|",
"^",
"%",
"<<",
">>",
">>>",
"+=",
"-=",
"*=",
"/=",
"&=",
"|=",
"^=",
"%=",
"<<=",
">>=",
">>>="
],
// we include these common regular expressions
symbols: /[=><!~?:&|+\-*\/\^%]+/,
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
digits: /\d+(_+\d+)*/,
octaldigits: /[0-7]+(_+[0-7]+)*/,
binarydigits: /[0-1]+(_+[0-1]+)*/,
hexdigits: /[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,
// The main tokenizer for our languages
tokenizer: {
root: [
// Special keyword with a dash
["non-sealed", "keyword.non-sealed"],
// identifiers and keywords
[
/[a-zA-Z_$][\w$]*/,
{
cases: {
"@keywords": { token: "keyword.$0" },
"@default": "identifier"
}
}
],
// whitespace
{ include: "@whitespace" },
// delimiters and operators
[/[{}()\[\]]/, "@brackets"],
[/[<>](?!@symbols)/, "@brackets"],
[
/@symbols/,
{
cases: {
"@operators": "delimiter",
"@default": ""
}
}
],
// @ annotations.
[/@\s*[a-zA-Z_\$][\w\$]*/, "annotation"],
// numbers
[/(@digits)[eE]([\-+]?(@digits))?[fFdD]?/, "number.float"],
[/(@digits)\.(@digits)([eE][\-+]?(@digits))?[fFdD]?/, "number.float"],
[/0[xX](@hexdigits)[Ll]?/, "number.hex"],
[/0(@octaldigits)[Ll]?/, "number.octal"],
[/0[bB](@binarydigits)[Ll]?/, "number.binary"],
[/(@digits)[fFdD]/, "number.float"],
[/(@digits)[lL]?/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings
[/"([^"\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/"""/, "string", "@multistring"],
[/"/, "string", "@string"],
// characters
[/'[^\\']'/, "string"],
[/(')(@escapes)(')/, ["string", "string.escape", "string"]],
[/'/, "string.invalid"]
],
whitespace: [
[/[ \t\r\n]+/, ""],
[/\/\*\*(?!\/)/, "comment.doc", "@javadoc"],
[/\/\*/, "comment", "@comment"],
[/\/\/.*$/, "comment"]
],
comment: [
[/[^\/*]+/, "comment"],
// [/\/\*/, 'comment', '@push' ], // nested comment not allowed :-(
// [/\/\*/, 'comment.invalid' ], // this breaks block comments in the shape of /* //*/
[/\*\//, "comment", "@pop"],
[/[\/*]/, "comment"]
],
//Identical copy of comment above, except for the addition of .doc
javadoc: [
[/[^\/*]+/, "comment.doc"],
// [/\/\*/, 'comment.doc', '@push' ], // nested comment not allowed :-(
[/\/\*/, "comment.doc.invalid"],
[/\*\//, "comment.doc", "@pop"],
[/[\/*]/, "comment.doc"]
],
string: [
[/[^\\"]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/"/, "string", "@pop"]
],
multistring: [
[/[^\\"]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/"""/, "string", "@pop"],
[/./, "string"]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,11 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "javascript",
extensions: [".js", ".es6", ".jsx", ".mjs", ".cjs"],
firstLine: "^#!.*\\bnode",
filenames: ["jakefile"],
aliases: ["JavaScript", "javascript", "js"],
mimetypes: ["text/javascript"],
loader: () => import('./javascript.js')
});
@@ -0,0 +1,70 @@
import { conf as conf$1, language as language$1 } from '../typescript/typescript.js';
const conf = conf$1;
const language = {
// Set defaultToken to invalid to see what you do not tokenize yet
defaultToken: "invalid",
tokenPostfix: ".js",
keywords: [
"break",
"case",
"catch",
"class",
"continue",
"const",
"constructor",
"debugger",
"default",
"delete",
"do",
"else",
"export",
"extends",
"false",
"finally",
"for",
"from",
"function",
"get",
"if",
"import",
"in",
"instanceof",
"let",
"new",
"null",
"return",
"set",
"static",
"super",
"switch",
"symbol",
"this",
"throw",
"true",
"try",
"typeof",
"undefined",
"var",
"void",
"while",
"with",
"yield",
"async",
"await",
"of"
],
typeKeywords: [],
operators: language$1.operators,
symbols: language$1.symbols,
escapes: language$1.escapes,
digits: language$1.digits,
octaldigits: language$1.octaldigits,
binarydigits: language$1.binarydigits,
hexdigits: language$1.hexdigits,
regexpctl: language$1.regexpctl,
regexpesc: language$1.regexpesc,
tokenizer: language$1.tokenizer
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,8 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "julia",
extensions: [".jl"],
aliases: ["julia", "Julia"],
loader: () => import('./julia.js')
});
@@ -0,0 +1,510 @@
const conf = {
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
]
};
const language = {
tokenPostfix: ".julia",
keywords: [
"begin",
"while",
"if",
"for",
"try",
"return",
"break",
"continue",
"function",
"macro",
"quote",
"let",
"local",
"global",
"const",
"do",
"struct",
"module",
"baremodule",
"using",
"import",
"export",
"end",
"else",
"elseif",
"catch",
"finally",
"mutable",
"primitive",
"abstract",
"type",
"in",
"isa",
"where",
"new"
],
types: [
"LinRange",
"LineNumberNode",
"LinearIndices",
"LoadError",
"MIME",
"Matrix",
"Method",
"MethodError",
"Missing",
"MissingException",
"Module",
"NTuple",
"NamedTuple",
"Nothing",
"Number",
"OrdinalRange",
"OutOfMemoryError",
"OverflowError",
"Pair",
"PartialQuickSort",
"PermutedDimsArray",
"Pipe",
"Ptr",
"QuoteNode",
"Rational",
"RawFD",
"ReadOnlyMemoryError",
"Real",
"ReentrantLock",
"Ref",
"Regex",
"RegexMatch",
"RoundingMode",
"SegmentationFault",
"Set",
"Signed",
"Some",
"StackOverflowError",
"StepRange",
"StepRangeLen",
"StridedArray",
"StridedMatrix",
"StridedVecOrMat",
"StridedVector",
"String",
"StringIndexError",
"SubArray",
"SubString",
"SubstitutionString",
"Symbol",
"SystemError",
"Task",
"Text",
"TextDisplay",
"Timer",
"Tuple",
"Type",
"TypeError",
"TypeVar",
"UInt",
"UInt128",
"UInt16",
"UInt32",
"UInt64",
"UInt8",
"UndefInitializer",
"AbstractArray",
"UndefKeywordError",
"AbstractChannel",
"UndefRefError",
"AbstractChar",
"UndefVarError",
"AbstractDict",
"Union",
"AbstractDisplay",
"UnionAll",
"AbstractFloat",
"UnitRange",
"AbstractIrrational",
"Unsigned",
"AbstractMatrix",
"AbstractRange",
"Val",
"AbstractSet",
"Vararg",
"AbstractString",
"VecElement",
"AbstractUnitRange",
"VecOrMat",
"AbstractVecOrMat",
"Vector",
"AbstractVector",
"VersionNumber",
"Any",
"WeakKeyDict",
"ArgumentError",
"WeakRef",
"Array",
"AssertionError",
"BigFloat",
"BigInt",
"BitArray",
"BitMatrix",
"BitSet",
"BitVector",
"Bool",
"BoundsError",
"CapturedException",
"CartesianIndex",
"CartesianIndices",
"Cchar",
"Cdouble",
"Cfloat",
"Channel",
"Char",
"Cint",
"Cintmax_t",
"Clong",
"Clonglong",
"Cmd",
"Colon",
"Complex",
"ComplexF16",
"ComplexF32",
"ComplexF64",
"CompositeException",
"Condition",
"Cptrdiff_t",
"Cshort",
"Csize_t",
"Cssize_t",
"Cstring",
"Cuchar",
"Cuint",
"Cuintmax_t",
"Culong",
"Culonglong",
"Cushort",
"Cvoid",
"Cwchar_t",
"Cwstring",
"DataType",
"DenseArray",
"DenseMatrix",
"DenseVecOrMat",
"DenseVector",
"Dict",
"DimensionMismatch",
"Dims",
"DivideError",
"DomainError",
"EOFError",
"Enum",
"ErrorException",
"Exception",
"ExponentialBackOff",
"Expr",
"Float16",
"Float32",
"Float64",
"Function",
"GlobalRef",
"HTML",
"IO",
"IOBuffer",
"IOContext",
"IOStream",
"IdDict",
"IndexCartesian",
"IndexLinear",
"IndexStyle",
"InexactError",
"InitError",
"Int",
"Int128",
"Int16",
"Int32",
"Int64",
"Int8",
"Integer",
"InterruptException",
"InvalidStateException",
"Irrational",
"KeyError"
],
keywordops: ["<:", ">:", ":", "=>", "...", ".", "->", "?"],
allops: /[^\w\d\s()\[\]{}"'#]+/,
constants: [
"true",
"false",
"nothing",
"missing",
"undef",
"Inf",
"pi",
"NaN",
"\u03C0",
"\u212F",
"ans",
"PROGRAM_FILE",
"ARGS",
"C_NULL",
"VERSION",
"DEPOT_PATH",
"LOAD_PATH"
],
operators: [
"!",
"!=",
"!==",
"%",
"&",
"*",
"+",
"-",
"/",
"//",
"<",
"<<",
"<=",
"==",
"===",
"=>",
">",
">=",
">>",
">>>",
"\\",
"^",
"|",
"|>",
"~",
"\xF7",
"\u2208",
"\u2209",
"\u220B",
"\u220C",
"\u2218",
"\u221A",
"\u221B",
"\u2229",
"\u222A",
"\u2248",
"\u2249",
"\u2260",
"\u2261",
"\u2262",
"\u2264",
"\u2265",
"\u2286",
"\u2287",
"\u2288",
"\u2289",
"\u228A",
"\u228B",
"\u22BB"
],
brackets: [
{ open: "(", close: ")", token: "delimiter.parenthesis" },
{ open: "{", close: "}", token: "delimiter.curly" },
{ open: "[", close: "]", token: "delimiter.square" }
],
ident: /π||\b(?!\d)\w+\b/,
// escape sequences
escape: /(?:[abefnrstv\\"'\n\r]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4})/,
escapes: /\\(?:C\-(@escape|.)|c(@escape|.)|@escape)/,
// The main tokenizer for our languages
tokenizer: {
root: [
[/(::)\s*|\b(isa)\s+/, "keyword", "@typeanno"],
[/\b(isa)(\s*\(@ident\s*,\s*)/, ["keyword", { token: "", next: "@typeanno" }]],
[/\b(type|struct)[ \t]+/, "keyword", "@typeanno"],
// symbols
[/^\s*:@ident[!?]?/, "metatag"],
[/(return)(\s*:@ident[!?]?)/, ["keyword", "metatag"]],
[/(\(|\[|\{|@allops)(\s*:@ident[!?]?)/, ["", "metatag"]],
[/:\(/, "metatag", "@quote"],
// regular expressions
[/r"""/, "regexp.delim", "@tregexp"],
[/r"/, "regexp.delim", "@sregexp"],
// strings
[/raw"""/, "string.delim", "@rtstring"],
[/[bv]?"""/, "string.delim", "@dtstring"],
[/raw"/, "string.delim", "@rsstring"],
[/[bv]?"/, "string.delim", "@dsstring"],
[
/(@ident)\{/,
{
cases: {
"$1@types": { token: "type", next: "@gen" },
"@default": { token: "type", next: "@gen" }
}
}
],
[
/@ident[!?'']?(?=\.?\()/,
{
cases: {
"@types": "type",
"@keywords": "keyword",
"@constants": "variable",
"@default": "keyword.flow"
}
}
],
[
/@ident[!?']?/,
{
cases: {
"@types": "type",
"@keywords": "keyword",
"@constants": "variable",
"@default": "identifier"
}
}
],
[/\$\w+/, "key"],
[/\$\(/, "key", "@paste"],
[/@@@ident/, "annotation"],
// whitespace
{ include: "@whitespace" },
// characters
[/'(?:@escapes|.)'/, "string.character"],
// delimiters and operators
[/[()\[\]{}]/, "@brackets"],
[
/@allops/,
{
cases: {
"@keywordops": "keyword",
"@operators": "operator"
}
}
],
[/[;,]/, "delimiter"],
// numbers
[/0[xX][0-9a-fA-F](_?[0-9a-fA-F])*/, "number.hex"],
[/0[_oO][0-7](_?[0-7])*/, "number.octal"],
[/0[bB][01](_?[01])*/, "number.binary"],
[/[+\-]?\d+(\.\d+)?(im?|[eE][+\-]?\d+(\.\d+)?)?/, "number"]
],
// type
typeanno: [
[/[a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*\{/, "type", "@gen"],
[/([a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)(\s*<:\s*)/, ["type", "keyword"]],
[/[a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*/, "type", "@pop"],
["", "", "@pop"]
],
// generic type
gen: [
[/[a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*\{/, "type", "@push"],
[/[a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*/, "type"],
[/<:/, "keyword"],
[/(\})(\s*<:\s*)/, ["type", { token: "keyword", next: "@pop" }]],
[/\}/, "type", "@pop"],
{ include: "@root" }
],
// $(...)
quote: [
[/\$\(/, "key", "@paste"],
[/\(/, "@brackets", "@paren"],
[/\)/, "metatag", "@pop"],
{ include: "@root" }
],
// :(...)
paste: [
[/:\(/, "metatag", "@quote"],
[/\(/, "@brackets", "@paren"],
[/\)/, "key", "@pop"],
{ include: "@root" }
],
// (...)
paren: [
[/\$\(/, "key", "@paste"],
[/:\(/, "metatag", "@quote"],
[/\(/, "@brackets", "@push"],
[/\)/, "@brackets", "@pop"],
{ include: "@root" }
],
// r"egex string"
sregexp: [
[/^.*/, "invalid"],
[/[^\\"()\[\]{}]/, "regexp"],
[/[()\[\]{}]/, "@brackets"],
[/\\./, "operator.scss"],
[/"[imsx]*/, "regexp.delim", "@pop"]
],
tregexp: [
[/[^\\"()\[\]{}]/, "regexp"],
[/[()\[\]{}]/, "@brackets"],
[/\\./, "operator.scss"],
[/"(?!"")/, "string"],
[/"""[imsx]*/, "regexp.delim", "@pop"]
],
// raw"string"
rsstring: [
[/^.*/, "invalid"],
[/[^\\"]/, "string"],
[/\\./, "string.escape"],
[/"/, "string.delim", "@pop"]
],
rtstring: [
[/[^\\"]/, "string"],
[/\\./, "string.escape"],
[/"(?!"")/, "string"],
[/"""/, "string.delim", "@pop"]
],
// "string".
dsstring: [
[/^.*/, "invalid"],
[/[^\\"\$]/, "string"],
[/\$/, "", "@interpolated"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/"/, "string.delim", "@pop"]
],
dtstring: [
[/[^\\"\$]/, "string"],
[/\$/, "", "@interpolated"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/"(?!"")/, "string"],
[/"""/, "string.delim", "@pop"]
],
// interpolated sequence
interpolated: [
[/\(/, { token: "", switchTo: "@interpolated_compound" }],
[/[a-zA-Z_]\w*/, "identifier"],
["", "", "@pop"]
// just a $ is interpreted as a $
],
// any code
interpolated_compound: [[/\)/, "", "@pop"], { include: "@root" }],
// whitespace & comments
whitespace: [
[/[ \t\r\n]+/, ""],
[/#=/, "comment", "@multi_comment"],
[/#.*$/, "comment"]
],
multi_comment: [
[/#=/, "comment", "@push"],
[/=#/, "comment", "@pop"],
[/=(?!#)|#(?!=)/, "comment"],
[/[^#=]+/, "comment"]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,9 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "kotlin",
extensions: [".kt", ".kts"],
aliases: ["Kotlin", "kotlin"],
mimetypes: ["text/x-kotlin-source", "text/x-kotlin"],
loader: () => import('./kotlin.js')
});
@@ -0,0 +1,251 @@
const conf = {
// the default separators except `@$`
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
comments: {
lineComment: "//",
blockComment: ["/*", "*/"]
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" },
{ open: "<", close: ">" }
],
folding: {
markers: {
start: new RegExp("^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))"),
end: new RegExp("^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))")
}
}
};
const language = {
defaultToken: "",
tokenPostfix: ".kt",
keywords: [
"as",
"as?",
"break",
"class",
"continue",
"do",
"else",
"false",
"for",
"fun",
"if",
"in",
"!in",
"interface",
"is",
"!is",
"null",
"object",
"package",
"return",
"super",
"this",
"throw",
"true",
"try",
"typealias",
"val",
"var",
"when",
"while",
"by",
"catch",
"constructor",
"delegate",
"dynamic",
"field",
"file",
"finally",
"get",
"import",
"init",
"param",
"property",
"receiver",
"set",
"setparam",
"where",
"actual",
"abstract",
"annotation",
"companion",
"const",
"crossinline",
"data",
"enum",
"expect",
"external",
"final",
"infix",
"inline",
"inner",
"internal",
"lateinit",
"noinline",
"open",
"operator",
"out",
"override",
"private",
"protected",
"public",
"reified",
"sealed",
"suspend",
"tailrec",
"vararg",
"field",
"it"
],
operators: [
"+",
"-",
"*",
"/",
"%",
"=",
"+=",
"-=",
"*=",
"/=",
"%=",
"++",
"--",
"&&",
"||",
"!",
"==",
"!=",
"===",
"!==",
">",
"<",
"<=",
">=",
"[",
"]",
"!!",
"?.",
"?:",
"::",
"..",
":",
"?",
"->",
"@",
";",
"$",
"_"
],
// we include these common regular expressions
symbols: /[=><!~?:&|+\-*\/\^%]+/,
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
digits: /\d+(_+\d+)*/,
octaldigits: /[0-7]+(_+[0-7]+)*/,
binarydigits: /[0-1]+(_+[0-1]+)*/,
hexdigits: /[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,
// The main tokenizer for our languages
tokenizer: {
root: [
// class name highlighting
[/[A-Z][\w\$]*/, "type.identifier"],
// identifiers and keywords
[
/[a-zA-Z_$][\w$]*/,
{
cases: {
"@keywords": { token: "keyword.$0" },
"@default": "identifier"
}
}
],
// whitespace
{ include: "@whitespace" },
// delimiters and operators
[/[{}()\[\]]/, "@brackets"],
[/[<>](?!@symbols)/, "@brackets"],
[
/@symbols/,
{
cases: {
"@operators": "delimiter",
"@default": ""
}
}
],
// @ annotations.
[/@\s*[a-zA-Z_\$][\w\$]*/, "annotation"],
// numbers
[/(@digits)[eE]([\-+]?(@digits))?[fF]?/, "number.float"],
[/(@digits)?\.(@digits)([eE][\-+]?(@digits))?[fF]?/, "number.float"],
[/0[xX](@hexdigits)[uU]?L?/, "number.hex"],
[/0[bB](@binarydigits)[uU]?L?/, "number.binary"],
[/(@digits)[fF]/, "number.float"],
[/(@digits)[uU]?L?/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"],
// strings
[/"([^"\\]|\\.)*$/, "string.invalid"],
// non-teminated string
[/"""/, "string", "@multistring"],
[/"/, "string", "@string"],
// characters
[/'[^\\']'/, "string"],
[/(')(@escapes)(')/, ["string", "string.escape", "string"]],
[/'/, "string.invalid"]
],
whitespace: [
[/[ \t\r\n]+/, ""],
[/\/\*\*(?!\/)/, "comment.doc", "@javadoc"],
[/\/\*/, "comment", "@comment"],
[/\/\/.*$/, "comment"]
],
comment: [
[/[^\/*]+/, "comment"],
[/\/\*/, "comment", "@comment"],
[/\*\//, "comment", "@pop"],
[/[\/*]/, "comment"]
],
//Identical copy of comment above, except for the addition of .doc
javadoc: [
[/[^\/*]+/, "comment.doc"],
[/\/\*/, "comment.doc", "@push"],
[/\/\*/, "comment.doc.invalid"],
[/\*\//, "comment.doc", "@pop"],
[/[\/*]/, "comment.doc"]
],
string: [
[/[^\\"]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/"/, "string", "@pop"]
],
multistring: [
[/[^\\"]+/, "string"],
[/@escapes/, "string.escape"],
[/\\./, "string.escape.invalid"],
[/"""/, "string", "@pop"],
[/./, "string"]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,9 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "less",
extensions: [".less"],
aliases: ["Less", "less"],
mimetypes: ["text/x-less", "text/less"],
loader: () => import('./less.js')
});
+160
View File
@@ -0,0 +1,160 @@
const conf = {
wordPattern: /(#?-?\d*\.\d\w*%?)|([@#!.:]?[\w-?]+%?)|[@#!.]/g,
comments: {
blockComment: ["/*", "*/"],
lineComment: "//"
},
brackets: [
["{", "}"],
["[", "]"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}", notIn: ["string", "comment"] },
{ open: "[", close: "]", notIn: ["string", "comment"] },
{ open: "(", close: ")", notIn: ["string", "comment"] },
{ open: '"', close: '"', notIn: ["string", "comment"] },
{ open: "'", close: "'", notIn: ["string", "comment"] }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
folding: {
markers: {
start: new RegExp("^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/"),
end: new RegExp("^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/")
}
}
};
const language = {
defaultToken: "",
tokenPostfix: ".less",
identifier: "-?-?([a-zA-Z]|(\\\\(([0-9a-fA-F]{1,6}\\s?)|[^[0-9a-fA-F])))([\\w\\-]|(\\\\(([0-9a-fA-F]{1,6}\\s?)|[^[0-9a-fA-F])))*",
identifierPlus: "-?-?([a-zA-Z:.]|(\\\\(([0-9a-fA-F]{1,6}\\s?)|[^[0-9a-fA-F])))([\\w\\-:.]|(\\\\(([0-9a-fA-F]{1,6}\\s?)|[^[0-9a-fA-F])))*",
brackets: [
{ open: "{", close: "}", token: "delimiter.curly" },
{ open: "[", close: "]", token: "delimiter.bracket" },
{ open: "(", close: ")", token: "delimiter.parenthesis" },
{ open: "<", close: ">", token: "delimiter.angle" }
],
tokenizer: {
root: [
{ include: "@nestedJSBegin" },
["[ \\t\\r\\n]+", ""],
{ include: "@comments" },
{ include: "@keyword" },
{ include: "@strings" },
{ include: "@numbers" },
["[*_]?[a-zA-Z\\-\\s]+(?=:.*(;|(\\\\$)))", "attribute.name", "@attribute"],
["url(\\-prefix)?\\(", { token: "tag", next: "@urldeclaration" }],
["[{}()\\[\\]]", "@brackets"],
["[,:;]", "delimiter"],
["#@identifierPlus", "tag.id"],
["&", "tag"],
["\\.@identifierPlus(?=\\()", "tag.class", "@attribute"],
["\\.@identifierPlus", "tag.class"],
["@identifierPlus", "tag"],
{ include: "@operators" },
["@(@identifier(?=[:,\\)]))", "variable", "@attribute"],
["@(@identifier)", "variable"],
["@", "key", "@atRules"]
],
nestedJSBegin: [
["``", "delimiter.backtick"],
[
"`",
{
token: "delimiter.backtick",
next: "@nestedJSEnd",
nextEmbedded: "text/javascript"
}
]
],
nestedJSEnd: [
[
"`",
{
token: "delimiter.backtick",
next: "@pop",
nextEmbedded: "@pop"
}
]
],
operators: [["[<>=\\+\\-\\*\\/\\^\\|\\~]", "operator"]],
keyword: [
[
"(@[\\s]*import|![\\s]*important|true|false|when|iscolor|isnumber|isstring|iskeyword|isurl|ispixel|ispercentage|isem|hue|saturation|lightness|alpha|lighten|darken|saturate|desaturate|fadein|fadeout|fade|spin|mix|round|ceil|floor|percentage)\\b",
"keyword"
]
],
urldeclaration: [
{ include: "@strings" },
["[^)\r\n]+", "string"],
["\\)", { token: "tag", next: "@pop" }]
],
attribute: [
{ include: "@nestedJSBegin" },
{ include: "@comments" },
{ include: "@strings" },
{ include: "@numbers" },
{ include: "@keyword" },
["[a-zA-Z\\-]+(?=\\()", "attribute.value", "@attribute"],
[">", "operator", "@pop"],
["@identifier", "attribute.value"],
{ include: "@operators" },
["@(@identifier)", "variable"],
["[)\\}]", "@brackets", "@pop"],
["[{}()\\[\\]>]", "@brackets"],
["[;]", "delimiter", "@pop"],
["[,=:]", "delimiter"],
["\\s", ""],
[".", "attribute.value"]
],
comments: [
["\\/\\*", "comment", "@comment"],
["\\/\\/+.*", "comment"]
],
comment: [
["\\*\\/", "comment", "@pop"],
[".", "comment"]
],
numbers: [
["(\\d*\\.)?\\d+([eE][\\-+]?\\d+)?", { token: "attribute.value.number", next: "@units" }],
["#[0-9a-fA-F_]+(?!\\w)", "attribute.value.hex"]
],
units: [
[
"(em|ex|ch|rem|fr|vmin|vmax|vw|vh|vm|cm|mm|in|px|pt|pc|deg|grad|rad|turn|s|ms|Hz|kHz|%)?",
"attribute.value.unit",
"@pop"
]
],
strings: [
['~?"', { token: "string.delimiter", next: "@stringsEndDoubleQuote" }],
["~?'", { token: "string.delimiter", next: "@stringsEndQuote" }]
],
stringsEndDoubleQuote: [
['\\\\"', "string"],
['"', { token: "string.delimiter", next: "@popall" }],
[".", "string"]
],
stringsEndQuote: [
["\\\\'", "string"],
["'", { token: "string.delimiter", next: "@popall" }],
[".", "string"]
],
atRules: [
{ include: "@comments" },
{ include: "@strings" },
["[()]", "delimiter"],
["[\\{;]", "delimiter", "@pop"],
[".", "key"]
]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,8 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "lexon",
extensions: [".lex"],
aliases: ["Lexon"],
loader: () => import('./lexon.js')
});
@@ -0,0 +1,156 @@
const conf = {
comments: {
lineComment: "COMMENT"
// blockComment: ['COMMENT', '.'],
},
brackets: [["(", ")"]],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: ":", close: "." }
],
surroundingPairs: [
{ open: "{", close: "}" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: "`", close: "`" },
{ open: '"', close: '"' },
{ open: "'", close: "'" },
{ open: ":", close: "." }
],
folding: {
markers: {
start: new RegExp("^\\s*(::\\s*|COMMENT\\s+)#region"),
end: new RegExp("^\\s*(::\\s*|COMMENT\\s+)#endregion")
}
}
};
const language = {
// Set defaultToken to invalid to see what you do not tokenize yet
// defaultToken: 'invalid',
tokenPostfix: ".lexon",
ignoreCase: true,
keywords: [
"lexon",
"lex",
"clause",
"terms",
"contracts",
"may",
"pay",
"pays",
"appoints",
"into",
"to"
],
typeKeywords: ["amount", "person", "key", "time", "date", "asset", "text"],
operators: [
"less",
"greater",
"equal",
"le",
"gt",
"or",
"and",
"add",
"added",
"subtract",
"subtracted",
"multiply",
"multiplied",
"times",
"divide",
"divided",
"is",
"be",
"certified"
],
// we include these common regular expressions
symbols: /[=><!~?:&|+\-*\/\^%]+/,
// The main tokenizer for our languages
tokenizer: {
root: [
// comment
[/^(\s*)(comment:?(?:\s.*|))$/, ["", "comment"]],
// special identifier cases
[
/"/,
{
token: "identifier.quote",
bracket: "@open",
next: "@quoted_identifier"
}
],
[
"LEX$",
{
token: "keyword",
bracket: "@open",
next: "@identifier_until_period"
}
],
["LEXON", { token: "keyword", bracket: "@open", next: "@semver" }],
[
":",
{
token: "delimiter",
bracket: "@open",
next: "@identifier_until_period"
}
],
// identifiers and keywords
[
/[a-z_$][\w$]*/,
{
cases: {
"@operators": "operator",
"@typeKeywords": "keyword.type",
"@keywords": "keyword",
"@default": "identifier"
}
}
],
// whitespace
{ include: "@whitespace" },
// delimiters and operators
[/[{}()\[\]]/, "@brackets"],
[/[<>](?!@symbols)/, "@brackets"],
[/@symbols/, "delimiter"],
// numbers
[/\d*\.\d*\.\d*/, "number.semver"],
[/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"],
[/0[xX][0-9a-fA-F]+/, "number.hex"],
[/\d+/, "number"],
// delimiter: after number because of .\d floats
[/[;,.]/, "delimiter"]
],
quoted_identifier: [
[/[^\\"]+/, "identifier"],
[/"/, { token: "identifier.quote", bracket: "@close", next: "@pop" }]
],
space_identifier_until_period: [
[":", "delimiter"],
[" ", { token: "white", next: "@identifier_rest" }]
],
identifier_until_period: [
{ include: "@whitespace" },
[":", { token: "delimiter", next: "@identifier_rest" }],
[/[^\\.]+/, "identifier"],
[/\./, { token: "delimiter", bracket: "@close", next: "@pop" }]
],
identifier_rest: [
[/[^\\.]+/, "identifier"],
[/\./, { token: "delimiter", bracket: "@close", next: "@pop" }]
],
semver: [
{ include: "@whitespace" },
[":", "delimiter"],
[/\d*\.\d*\.\d*/, { token: "number.semver", bracket: "@close", next: "@pop" }]
],
whitespace: [[/[ \t\r\n]+/, "white"]]
}
};
export { conf, language };
@@ -0,0 +1 @@
export {}
@@ -0,0 +1,9 @@
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
id: "liquid",
extensions: [".liquid", ".html.liquid"],
aliases: ["Liquid", "liquid"],
mimetypes: ["application/liquid"],
loader: () => import('./liquid.js')
});
@@ -0,0 +1,306 @@
import '../../editor/browser/coreCommands.js';
import '../../editor/browser/widget/codeEditor/codeEditorWidget.js';
import '../../editor/browser/widget/diffEditor/diffEditor.contribution.js';
import '../../editor/contrib/anchorSelect/browser/anchorSelect.js';
import '../../editor/contrib/bracketMatching/browser/bracketMatching.js';
import '../../editor/contrib/caretOperations/browser/caretOperations.js';
import '../../editor/contrib/caretOperations/browser/transpose.js';
import '../../editor/contrib/clipboard/browser/clipboard.js';
import '../../editor/contrib/codeAction/browser/codeActionContributions.js';
import '../../editor/contrib/codelens/browser/codelensController.js';
import '../../editor/contrib/colorPicker/browser/colorPickerContribution.js';
import '../../editor/contrib/comment/browser/comment.js';
import '../../editor/contrib/contextmenu/browser/contextmenu.js';
import '../../editor/contrib/cursorUndo/browser/cursorUndo.js';
import '../../editor/contrib/dnd/browser/dnd.js';
import '../../editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js';
import '../../editor/contrib/dropOrPasteInto/browser/dropIntoEditorContribution.js';
import '../../editor/contrib/find/browser/findController.js';
import '../../editor/contrib/folding/browser/folding.js';
import '../../editor/contrib/fontZoom/browser/fontZoom.js';
import '../../editor/contrib/format/browser/formatActions.js';
import '../../editor/contrib/documentSymbols/browser/documentSymbols.js';
import '../../editor/contrib/inlineCompletions/browser/inlineCompletions.contribution.js';
import '../../editor/contrib/inlineProgress/browser/inlineProgress.js';
import '../../editor/contrib/gotoSymbol/browser/goToCommands.js';
import '../../editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js';
import '../../editor/contrib/gotoError/browser/gotoError.js';
import '../../editor/contrib/gpu/browser/gpuActions.js';
import '../../editor/contrib/hover/browser/hoverContribution.js';
import '../../editor/contrib/indentation/browser/indentation.js';
import '../../editor/contrib/inlayHints/browser/inlayHintsContribution.js';
import '../../editor/contrib/inPlaceReplace/browser/inPlaceReplace.js';
import '../../editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js';
import '../../editor/contrib/lineSelection/browser/lineSelection.js';
import '../../editor/contrib/linesOperations/browser/linesOperations.js';
import '../../editor/contrib/linkedEditing/browser/linkedEditing.js';
import '../../editor/contrib/links/browser/links.js';
import '../../editor/contrib/longLinesHelper/browser/longLinesHelper.js';
import '../../editor/contrib/middleScroll/browser/middleScroll.contribution.js';
import '../../editor/contrib/multicursor/browser/multicursor.js';
import '../../editor/contrib/parameterHints/browser/parameterHints.js';
import '../../editor/contrib/placeholderText/browser/placeholderText.contribution.js';
import '../../editor/contrib/rename/browser/rename.js';
import '../../editor/contrib/sectionHeaders/browser/sectionHeaders.js';
import '../../editor/contrib/semanticTokens/browser/documentSemanticTokens.js';
import '../../editor/contrib/semanticTokens/browser/viewportSemanticTokens.js';
import '../../editor/contrib/smartSelect/browser/smartSelect.js';
import '../../editor/contrib/snippet/browser/snippetController2.js';
import '../../editor/contrib/stickyScroll/browser/stickyScrollContribution.js';
import '../../editor/contrib/suggest/browser/suggestController.js';
import '../../editor/contrib/suggest/browser/suggestInlineCompletions.js';
import '../../editor/contrib/tokenization/browser/tokenization.js';
import '../../editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js';
import '../../editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js';
import '../../editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js';
import '../../editor/contrib/wordHighlighter/browser/wordHighlighter.js';
import '../../editor/contrib/wordOperations/browser/wordOperations.js';
import '../../editor/contrib/wordPartOperations/browser/wordPartOperations.js';
import '../../editor/contrib/readOnlyMessage/browser/contribution.js';
import '../../editor/contrib/diffEditorBreadcrumbs/browser/contribution.js';
import '../../editor/contrib/floatingMenu/browser/floatingMenu.contribution.js';
import '../../editor/common/standaloneStrings.js';
import '../../base/browser/ui/codicons/codicon/codicon.css';
import '../../base/browser/ui/codicons/codicon/codicon-modifiers.css';
import '../../editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.js';
import '../../editor/standalone/browser/inspectTokens/inspectTokens.js';
import '../../editor/standalone/browser/quickAccess/standaloneHelpQuickAccess.js';
import '../../editor/standalone/browser/quickAccess/standaloneGotoLineQuickAccess.js';
import '../../editor/standalone/browser/quickAccess/standaloneGotoSymbolQuickAccess.js';
import '../../editor/standalone/browser/quickAccess/standaloneCommandsQuickAccess.js';
import '../../editor/standalone/browser/referenceSearch/standaloneReferenceSearch.js';
import '../../editor/standalone/browser/toggleHighContrast/toggleHighContrast.js';
import { languages } from '../../editor/editor.api2.js';
const EMPTY_ELEMENTS = [
"area",
"base",
"br",
"col",
"embed",
"hr",
"img",
"input",
"keygen",
"link",
"menuitem",
"meta",
"param",
"source",
"track",
"wbr"
];
const conf = {
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
brackets: [
["<!--", "-->"],
["<", ">"],
["{{", "}}"],
["{%", "%}"],
["{", "}"],
["(", ")"]
],
autoClosingPairs: [
{ open: "{", close: "}" },
{ open: "%", close: "%" },
{ open: "[", close: "]" },
{ open: "(", close: ")" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
surroundingPairs: [
{ open: "<", close: ">" },
{ open: '"', close: '"' },
{ open: "'", close: "'" }
],
onEnterRules: [
{
beforeText: new RegExp(
`<(?!(?:${EMPTY_ELEMENTS.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
"i"
),
afterText: /^<\/(\w[\w\d]*)\s*>$/i,
action: {
indentAction: languages.IndentAction.IndentOutdent
}
},
{
beforeText: new RegExp(
`<(?!(?:${EMPTY_ELEMENTS.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
"i"
),
action: { indentAction: languages.IndentAction.Indent }
}
]
};
const language = {
defaultToken: "",
tokenPostfix: "",
builtinTags: [
"if",
"else",
"elseif",
"endif",
"render",
"assign",
"capture",
"endcapture",
"case",
"endcase",
"comment",
"endcomment",
"cycle",
"decrement",
"for",
"endfor",
"include",
"increment",
"layout",
"raw",
"endraw",
"render",
"tablerow",
"endtablerow",
"unless",
"endunless"
],
builtinFilters: [
"abs",
"append",
"at_least",
"at_most",
"capitalize",
"ceil",
"compact",
"date",
"default",
"divided_by",
"downcase",
"escape",
"escape_once",
"first",
"floor",
"join",
"json",
"last",
"lstrip",
"map",
"minus",
"modulo",
"newline_to_br",
"plus",
"prepend",
"remove",
"remove_first",
"replace",
"replace_first",
"reverse",
"round",
"rstrip",
"size",
"slice",
"sort",
"sort_natural",
"split",
"strip",
"strip_html",
"strip_newlines",
"times",
"truncate",
"truncatewords",
"uniq",
"upcase",
"url_decode",
"url_encode",
"where"
],
constants: ["true", "false"],
operators: ["==", "!=", ">", "<", ">=", "<="],
symbol: /[=><!]+/,
identifier: /[a-zA-Z_][\w]*/,
tokenizer: {
root: [
[/\{\%\s*comment\s*\%\}/, "comment.start.liquid", "@comment"],
[/\{\{/, { token: "@rematch", switchTo: "@liquidState.root" }],
[/\{\%/, { token: "@rematch", switchTo: "@liquidState.root" }],
[/(<)([\w\-]+)(\/>)/, ["delimiter.html", "tag.html", "delimiter.html"]],
[/(<)([:\w]+)/, ["delimiter.html", { token: "tag.html", next: "@otherTag" }]],
[/(<\/)([\w\-]+)/, ["delimiter.html", { token: "tag.html", next: "@otherTag" }]],
[/</, "delimiter.html"],
[/\{/, "delimiter.html"],
[/[^<{]+/]
// text
],
comment: [
[/\{\%\s*endcomment\s*\%\}/, "comment.end.liquid", "@pop"],
[/./, "comment.content.liquid"]
],
otherTag: [
[
/\{\{/,
{
token: "@rematch",
switchTo: "@liquidState.otherTag"
}
],
[
/\{\%/,
{
token: "@rematch",
switchTo: "@liquidState.otherTag"
}
],
[/\/?>/, "delimiter.html", "@pop"],
[/"([^"]*)"/, "attribute.value"],
[/'([^']*)'/, "attribute.value"],
[/[\w\-]+/, "attribute.name"],
[/=/, "delimiter"],
[/[ \t\r\n]+/]
// whitespace
],
liquidState: [
[/\{\{/, "delimiter.output.liquid"],
[/\}\}/, { token: "delimiter.output.liquid", switchTo: "@$S2.$S3" }],
[/\{\%/, "delimiter.tag.liquid"],
[/raw\s*\%\}/, "delimiter.tag.liquid", "@liquidRaw"],
[/\%\}/, { token: "delimiter.tag.liquid", switchTo: "@$S2.$S3" }],
{ include: "liquidRoot" }
],
liquidRaw: [
[/^(?!\{\%\s*endraw\s*\%\}).+/],
[/\{\%/, "delimiter.tag.liquid"],
[/@identifier/],
[/\%\}/, { token: "delimiter.tag.liquid", next: "@root" }]
],
liquidRoot: [
[/\d+(\.\d+)?/, "number.liquid"],
[/"[^"]*"/, "string.liquid"],
[/'[^']*'/, "string.liquid"],
[/\s+/],
[
/@symbol/,
{
cases: {
"@operators": "operator.liquid",
"@default": ""
}
}
],
[/\./],
[
/@identifier/,
{
cases: {
"@constants": "keyword.liquid",
"@builtinFilters": "predefined.liquid",
"@builtinTags": "predefined.liquid",
"@default": "variable.liquid"
}
}
],
[/[^}|%]/, "variable.liquid"]
]
}
};
export { conf, language };

Some files were not shown because too many files have changed in this diff Show More