|
|
@ -13,20 +13,24 @@ export const conf: IRichLanguageConfiguration = {
|
|
|
|
lineComment: ';;',
|
|
|
|
lineComment: ';;',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
brackets: [['(', ')'], ['[', ']'], ['{', '}']],
|
|
|
|
brackets: [
|
|
|
|
|
|
|
|
['[', ']'],
|
|
|
|
|
|
|
|
['(', ')'],
|
|
|
|
|
|
|
|
['{', '}']
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
|
|
autoClosingPairs: [
|
|
|
|
autoClosingPairs: [
|
|
|
|
{open: '(', close: ')'},
|
|
|
|
|
|
|
|
{open: '[', close: ']'},
|
|
|
|
{open: '[', close: ']'},
|
|
|
|
{open: '{', close: '}'},
|
|
|
|
|
|
|
|
{open: '"', close: '"'},
|
|
|
|
{open: '"', close: '"'},
|
|
|
|
|
|
|
|
{open: '(', close: ')'},
|
|
|
|
|
|
|
|
{open: '{', close: '}'},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
|
|
surroundingPairs: [
|
|
|
|
surroundingPairs: [
|
|
|
|
{open: '(', close: ')'},
|
|
|
|
|
|
|
|
{open: '[', close: ']'},
|
|
|
|
{open: '[', close: ']'},
|
|
|
|
{open: '{', close: '}'},
|
|
|
|
|
|
|
|
{open: '"', close: '"'},
|
|
|
|
{open: '"', close: '"'},
|
|
|
|
|
|
|
|
{open: '(', close: ')'},
|
|
|
|
|
|
|
|
{open: '{', close: '}'},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -36,11 +40,26 @@ export const language = <ILanguage>{
|
|
|
|
tokenPostfix: '.clj',
|
|
|
|
tokenPostfix: '.clj',
|
|
|
|
|
|
|
|
|
|
|
|
brackets: [
|
|
|
|
brackets: [
|
|
|
|
|
|
|
|
{open: '[', close: ']', token: 'delimiter.square'},
|
|
|
|
{open: '(', close: ')', token: 'delimiter.parenthesis'},
|
|
|
|
{open: '(', close: ')', token: 'delimiter.parenthesis'},
|
|
|
|
{open: '{', close: '}', token: 'delimiter.curly'},
|
|
|
|
{open: '{', close: '}', token: 'delimiter.curly'},
|
|
|
|
{open: '[', close: ']', token: 'delimiter.square'},
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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: /^\\(?:backspace|formfeed|newline|return|space|tab|o[0-7]{3}|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{4}|.)?/,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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: [
|
|
|
|
specialForms: [
|
|
|
|
'.',
|
|
|
|
'.',
|
|
|
|
'catch',
|
|
|
|
'catch',
|
|
|
@ -712,14 +731,6 @@ export const language = <ILanguage>{
|
|
|
|
'zipmap',
|
|
|
|
'zipmap',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
|
|
constants: ['true', 'false', 'nil'],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
symbolCharacter: /[!#'*+\-.\/:<=>?_\w\xa1-\uffff]/,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
numbers: /[+\-]?\d+(?:(?:N|(?:[eE][+\-]?\d+))|(?:\.?\d*(?:M|(?:[eE][+\-]?\d+))?)|\/\d+|[xX][0-9a-fA-F]+|r[0-9a-zA-Z]+)?/,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
characters: /\\(?:backspace|formfeed|newline|return|space|tab|x[0-9A-Fa-f]{4}|u[0-9A-Fa-f]{4}|o[0-7]{3}|@symbolCharacter|[\\"()\[\]{}])/,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tokenizer: {
|
|
|
|
tokenizer: {
|
|
|
|
root: [
|
|
|
|
root: [
|
|
|
|
// whitespaces and comments
|
|
|
|
// whitespaces and comments
|
|
|
@ -743,12 +754,10 @@ export const language = <ILanguage>{
|
|
|
|
// reader macro characters
|
|
|
|
// reader macro characters
|
|
|
|
[/[#'@^`~]/, 'meta'],
|
|
|
|
[/[#'@^`~]/, 'meta'],
|
|
|
|
|
|
|
|
|
|
|
|
// keywords
|
|
|
|
|
|
|
|
[/:@symbolCharacter+/, 'constant'],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// symbols
|
|
|
|
// symbols
|
|
|
|
[/@symbolCharacter+/, {
|
|
|
|
[/@qualifiedSymbols/, {
|
|
|
|
cases: {
|
|
|
|
cases: {
|
|
|
|
|
|
|
|
'^:.+$': 'constant', // Clojure keywords (e.g., `:foo/bar`)
|
|
|
|
'@specialForms': 'keyword',
|
|
|
|
'@specialForms': 'keyword',
|
|
|
|
'@coreSymbols': 'keyword',
|
|
|
|
'@coreSymbols': 'keyword',
|
|
|
|
'@constants': 'constant',
|
|
|
|
'@constants': 'constant',
|
|
|
@ -777,7 +786,7 @@ export const language = <ILanguage>{
|
|
|
|
|
|
|
|
|
|
|
|
multiLineString: [
|
|
|
|
multiLineString: [
|
|
|
|
[/[^\\"]+/, 'string'],
|
|
|
|
[/[^\\"]+/, 'string'],
|
|
|
|
[/@characters/, 'string'],
|
|
|
|
[/@escapes/, 'string'],
|
|
|
|
[/"/, 'string', '@pop']
|
|
|
|
[/"/, 'string', '@pop']
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|