Define printWidth at 100

This commit is contained in:
Alex Dima 2020-09-19 01:28:33 +02:00
parent 078ee54715
commit bce6fe83af
No known key found for this signature in database
GPG key ID: 6E58D7B045760DA0
81 changed files with 290 additions and 1156 deletions

View file

@ -3,5 +3,6 @@
"singleQuote": true,
"trailingComma": "none",
"semi": true,
"useTabs": true
"useTabs": true,
"printWidth": 100
}

View file

@ -22,10 +22,7 @@ const BUNDLED_FILE_HEADER = [
].join('\n');
bundleOne('monaco.contribution');
glob('out/amd/*/*.contribution.js', { cwd: path.dirname(__dirname) }, function (
err,
files
) {
glob('out/amd/*/*.contribution.js', { cwd: path.dirname(__dirname) }, function (err, files) {
if (err) {
console.log(err);
return;
@ -52,14 +49,8 @@ function bundleOne(moduleId, exclude) {
optimize: 'none'
},
async function (buildResponse) {
const devFilePath = path.join(
REPO_ROOT,
'release/dev/' + moduleId + '.js'
);
const minFilePath = path.join(
REPO_ROOT,
'release/min/' + moduleId + '.js'
);
const devFilePath = path.join(REPO_ROOT, 'release/dev/' + moduleId + '.js');
const minFilePath = path.join(REPO_ROOT, 'release/min/' + moduleId + '.js');
const fileContents = fs.readFileSync(devFilePath).toString();
console.log();
console.log(`Minifying ${devFilePath}...`);

View file

@ -20,9 +20,7 @@ const lazyLanguageLoaders: { [languageId: string]: LazyLanguageLoader } = {};
class LazyLanguageLoader {
public static getOrCreate(languageId: string): LazyLanguageLoader {
if (!lazyLanguageLoaders[languageId]) {
lazyLanguageLoaders[languageId] = new LazyLanguageLoader(
languageId
);
lazyLanguageLoaders[languageId] = new LazyLanguageLoader(languageId);
}
return lazyLanguageLoaders[languageId];
}

View file

@ -499,17 +499,11 @@ export const language = <languages.IMonarchLanguage>{
[/[:,.]/, 'delimiter'],
[/[{}()\[\]]/, '@brackets'],
[
/@symbols/,
{ cases: { '@operators': 'operator', '@default': '' } }
],
[/@symbols/, { cases: { '@operators': 'operator', '@default': '' } }],
[/'/, { token: 'string', bracket: '@open', next: '@stringquote' }],
[/`/, { token: 'string', bracket: '@open', next: '@stringping' }],
[
/\|/,
{ token: 'string', bracket: '@open', next: '@stringtemplate' }
],
[/\|/, { token: 'string', bracket: '@open', next: '@stringtemplate' }],
[/\d+/, 'number']
],

View file

@ -233,8 +233,7 @@ testTokenization('apex', [
// Keywords
[
{
line:
'package test; class Program { static void main(String[] args) {} } }',
line: 'package test; class Program { static void main(String[] args) {} } }',
tokens: [
{ startIndex: 0, type: 'keyword.package.apex' },
{ startIndex: 7, type: '' },
@ -271,8 +270,7 @@ testTokenization('apex', [
// Keywords with case variations
[
{
line:
'Package test; CLASS Program { Static void main(String[] args) {} } }',
line: 'Package test; CLASS Program { Static void main(String[] args) {} } }',
tokens: [
{ startIndex: 0, type: 'keyword.Package.apex' },
{ startIndex: 7, type: '' },

View file

@ -34,12 +34,8 @@ export const conf: languages.LanguageConfiguration = {
],
folding: {
markers: {
start: new RegExp(
'^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))'
),
end: new RegExp(
'^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))'
)
start: new RegExp('^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))'),
end: new RegExp('^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))')
}
}
};
@ -300,10 +296,7 @@ export const language = <languages.IMonarchLanguage>{
// numbers
[/(@digits)[eE]([\-+]?(@digits))?[fFdD]?/, 'number.float'],
[
/(@digits)\.(@digits)([eE][\-+]?(@digits))?[fFdD]?/,
'number.float'
],
[/(@digits)\.(@digits)([eE][\-+]?(@digits))?[fFdD]?/, 'number.float'],
[/(@digits)[fFdD]/, 'number.float'],
[/(@digits)[lL]?/, 'number'],

View file

@ -3,15 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import {
testTokenization as actualTestTokenization,
ITestItem
} from '../test/testRunner';
import { testTokenization as actualTestTokenization, ITestItem } from '../test/testRunner';
function testTokenization(
_language: string | string[],
tests: ITestItem[][]
): void {
function testTokenization(_language: string | string[], tests: ITestItem[][]): void {
tests = tests.map((t) => {
return t.map((t) => {
return {
@ -93,8 +87,7 @@ testTokenization('azcli', [
],
[
{
line:
'az ad sp create-for-rb --name ServicePrincipalName --password PASSWORD',
line: 'az ad sp create-for-rb --name ServicePrincipalName --password PASSWORD',
tokens: [
{ startIndex: 0, type: 'keyword.azcli' },
{ startIndex: 23, type: 'key.identifier.azcli' },

View file

@ -55,10 +55,7 @@ export const language = <languages.IMonarchLanguage>{
root: [
[/^(\s*)(rem(?:\s.*|))$/, ['', 'comment']],
[
/(\@?)(@keywords)(?!\w)/,
[{ token: 'keyword' }, { token: 'keyword.$2' }]
],
[/(\@?)(@keywords)(?!\w)/, [{ token: 'keyword' }, { token: 'keyword.$2' }]],
// whitespace
[/[ \t\r\n]+/, ''],

View file

@ -864,10 +864,7 @@ testTokenization('clojure', [
],
// comments
createTestCases(
['; this is an in-line comment.', ';; this is a line comment.'],
'comment'
),
createTestCases(['; this is an in-line comment.', ';; this is a line comment.'], 'comment'),
// `comment`
[

View file

@ -1694,8 +1694,7 @@ testTokenization('coffeescript', [
tokens: [{ startIndex: 0, type: '' }]
},
{
line:
'# Everything is an Expression (at least, as much as possible)',
line: '# Everything is an Expression (at least, as much as possible)',
tokens: [{ startIndex: 0, type: 'comment.coffee' }]
},
{

View file

@ -281,10 +281,7 @@ export const language = <languages.IMonarchLanguage>{
tokenizer: {
root: [
// C++ 11 Raw String
[
/@encoding?R\"(?:([^ ()\\\t]*))\(/,
{ token: 'string.raw.begin', next: '@raw.$1' }
],
[/@encoding?R\"(?:([^ ()\\\t]*))\(/, { token: 'string.raw.begin', next: '@raw.$1' }],
// identifiers and keywords
[
@ -303,10 +300,7 @@ export const language = <languages.IMonarchLanguage>{
// [[ attributes ]].
[/\[\[.*\]\]/, 'annotation'],
[
/^\s*#include/,
{ token: 'keyword.directive.include', next: '@include' }
],
[/^\s*#include/, { token: 'keyword.directive.include', next: '@include' }],
// Preprocessor directive
[/^\s*#\s*\w+/, 'keyword'],
@ -383,12 +377,7 @@ export const language = <languages.IMonarchLanguage>{
'string.raw.end',
{ token: 'string.raw.end', next: '@pop' }
],
'@default': [
'string.raw',
'string.raw',
'string.raw',
'string.raw'
]
'@default': ['string.raw', 'string.raw', 'string.raw', 'string.raw']
}
}
],

View file

@ -205,8 +205,7 @@ testTokenization('csharp', [
tokens: [{ startIndex: 0, type: '' }]
},
{
line:
' string someString = $"hello{outside+variable}the string again {{ escaped";',
line: ' string someString = $"hello{outside+variable}the string again {{ escaped";',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 3, type: 'keyword.string.cs' },
@ -425,8 +424,7 @@ testTokenization('csharp', [
// Keywords
[
{
line:
'namespace VS { class Program { static void Main(string[] args) {} } }',
line: 'namespace VS { class Program { static void Main(string[] args) {} } }',
tokens: [
{ startIndex: 0, type: 'keyword.namespace.cs' },
{ startIndex: 9, type: '' },

View file

@ -163,16 +163,7 @@ export const language = <languages.IMonarchLanguage>{
namespaceFollows: ['namespace', 'using'],
parenFollows: [
'if',
'for',
'while',
'switch',
'foreach',
'using',
'catch',
'when'
],
parenFollows: ['if', 'for', 'while', 'switch', 'foreach', 'using', 'catch', 'when'],
operators: [
'=',

View file

@ -69,23 +69,14 @@ export const language = <languages.IMonarchLanguage>{
{ token: 'keyword', next: '@keyframedeclaration' }
],
['[@](page|content|font-face|-moz-document)', { token: 'keyword' }],
[
'[@](charset|namespace)',
{ token: 'keyword', next: '@declarationbody' }
],
['[@](charset|namespace)', { token: 'keyword', next: '@declarationbody' }],
[
'(url-prefix)(\\()',
[
'attribute.value',
{ token: 'delimiter.parenthesis', next: '@urldeclaration' }
]
['attribute.value', { token: 'delimiter.parenthesis', next: '@urldeclaration' }]
],
[
'(url)(\\()',
[
'attribute.value',
{ token: 'delimiter.parenthesis', next: '@urldeclaration' }
]
['attribute.value', { token: 'delimiter.parenthesis', next: '@urldeclaration' }]
],
{ include: '@selectorname' },
['[\\*]', 'tag'], // selector symbols
@ -96,11 +87,7 @@ export const language = <languages.IMonarchLanguage>{
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
['[*_]?@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' }]
],
@ -117,17 +104,11 @@ export const language = <languages.IMonarchLanguage>{
{ include: '@comments' },
[
'(url-prefix)(\\()',
[
'attribute.value',
{ token: 'delimiter.parenthesis', next: '@urldeclaration' }
]
['attribute.value', { token: 'delimiter.parenthesis', next: '@urldeclaration' }]
],
[
'(url)(\\()',
[
'attribute.value',
{ token: 'delimiter.parenthesis', next: '@urldeclaration' }
]
['attribute.value', { token: 'delimiter.parenthesis', next: '@urldeclaration' }]
],
{ include: '@functioninvocation' },
{ include: '@numbers' },
@ -145,13 +126,9 @@ export const language = <languages.IMonarchLanguage>{
['(?=})', { token: '', next: '@pop' }] // missing semicolon
],
warndebug: [
['[@](warn|debug)', { token: 'keyword', next: '@declarationbody' }]
],
warndebug: [['[@](warn|debug)', { token: 'keyword', next: '@declarationbody' }]],
import: [
['[@](import)', { token: 'keyword', next: '@declarationbody' }]
],
import: [['[@](import)', { token: 'keyword', next: '@declarationbody' }]],
urldeclaration: [
{ include: '@strings' },
@ -211,10 +188,7 @@ export const language = <languages.IMonarchLanguage>{
],
functioninvocation: [
[
'@identifier\\(',
{ token: 'attribute.value', next: '@functionarguments' }
]
['@identifier\\(', { token: 'attribute.value', next: '@functionarguments' }]
],
functionarguments: [

View file

@ -255,23 +255,13 @@ export const language = <languages.IMonarchLanguage>{
regexp: [
[
/(\{)(\d+(?:,\d*)?)(\})/,
[
'regexp.escape.control',
'regexp.escape.control',
'regexp.escape.control'
]
['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', { token: 'regexp.escape.control', next: '@regexrange' }]
],
[/(\()(\?:|\?=|\?!)/, ['regexp.escape.control', 'regexp.escape.control']],
[/[()]/, 'regexp.escape.control'],
[/@regexpctl/, 'regexp.escape.control'],
[/[^\\\/]/, 'regexp'],
@ -279,10 +269,7 @@ export const language = <languages.IMonarchLanguage>{
[/\\\./, 'regexp.invalid'],
[
/(\/)([gimsuy]*)/,
[
{ token: 'regexp', bracket: '@close', next: '@pop' },
'keyword.other'
]
[{ token: 'regexp', bracket: '@close', next: '@pop' }, 'keyword.other']
]
],

View file

@ -146,8 +146,7 @@ testTokenization('dockerfile', [
]
},
{
line:
' && sh autogen.sh && ./configure && make && make install \\',
line: ' && sh autogen.sh && ./configure && make && make install \\',
tokens: [{ startIndex: 0, type: '' }]
},
{

View file

@ -39,10 +39,7 @@ export const language = <languages.IMonarchLanguage>{
{ include: '@comment' },
[/(ONBUILD)(\s+)/, ['keyword', '']],
[
/(ENV)(\s+)([\w]+)/,
['keyword', '', { token: 'variable', next: '@arguments' }]
],
[/(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' }

View file

@ -30,12 +30,8 @@ export const conf: languages.LanguageConfiguration = {
],
folding: {
markers: {
start: new RegExp(
'^\\s*//\\s*#region\\b|^\\s*\\(\\*\\s*#region(.*)\\*\\)'
),
end: new RegExp(
'^\\s*//\\s*#endregion\\b|^\\s*\\(\\*\\s*#endregion\\s*\\*\\)'
)
start: new RegExp('^\\s*//\\s*#region\\b|^\\s*\\(\\*\\s*#region(.*)\\*\\)'),
end: new RegExp('^\\s*//\\s*#endregion\\b|^\\s*\\(\\*\\s*#endregion\\s*\\*\\)')
}
}
};

View file

@ -21,8 +21,7 @@ testTokenization('graphql', [
// Root schema definition
[
{
line:
'schema { query: Query, mutation: Mutation subscription: Subscription }',
line: 'schema { query: Query, mutation: Mutation subscription: Subscription }',
tokens: [
{ startIndex: 0, type: 'keyword.gql' },
{ startIndex: 6, type: '' },

View file

@ -132,18 +132,12 @@ export const language = <languages.IMonarchLanguage>{
// delimiters and operators
[/[{}()\[\]]/, '@brackets'],
[
/@symbols/,
{ cases: { '@operators': 'operator', '@default': '' } }
],
[/@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' }
],
[/@\s*[a-zA-Z_\$][\w\$]*/, { token: 'annotation', log: 'annotation token: $0' }],
// numbers
[/\d*\.\d+([eE][\-+]?\d+)?/, 'number.float'],
@ -153,10 +147,7 @@ export const language = <languages.IMonarchLanguage>{
// delimiter: after number because of .\d floats
[/[;,.]/, 'delimiter'],
[
/"""/,
{ token: 'string', next: '@mlstring', nextEmbedded: 'markdown' }
],
[/"""/, { token: 'string', next: '@mlstring', nextEmbedded: 'markdown' }],
// strings
[/"([^"\\]|\\.)*$/, 'string.invalid'], // non-teminated string

View file

@ -173,8 +173,7 @@ testTokenization(
// HTML Expressions
[
{
line:
'<script type="text/x-handlebars-template"><h1>{{ title }}</h1></script>',
line: '<script type="text/x-handlebars-template"><h1>{{ title }}</h1></script>',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },

View file

@ -56,9 +56,7 @@ export const conf: languages.LanguageConfiguration = {
onEnterRules: [
{
beforeText: new RegExp(
`<(?!(?:${EMPTY_ELEMENTS.join(
'|'
)}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
`<(?!(?:${EMPTY_ELEMENTS.join('|')}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
'i'
),
afterText: /^<\/(\w[\w\d]*)\s*>$/i,
@ -68,9 +66,7 @@ export const conf: languages.LanguageConfiguration = {
},
{
beforeText: new RegExp(
`<(?!(?:${EMPTY_ELEMENTS.join(
'|'
)}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
`<(?!(?:${EMPTY_ELEMENTS.join('|')}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
'i'
),
action: { indentAction: languages.IndentAction.Indent }
@ -88,29 +84,14 @@ export const language = <languages.IMonarchLanguage>{
root: [
[/\{\{!--/, 'comment.block.start.handlebars', '@commentBlock'],
[/\{\{!/, 'comment.start.handlebars', '@comment'],
[
/\{\{/,
{ token: '@rematch', switchTo: '@handlebarsInSimpleState.root' }
],
[/\{\{/, { 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' }]
],
[/(<)(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
@ -194,11 +175,7 @@ export const language = <languages.IMonarchLanguage>{
[/[ \t\r\n]+/], // whitespace
[
/(<\/)(script\s*)(>)/,
[
'delimiter.html',
'tag.html',
{ token: 'delimiter.html', next: '@pop' }
]
['delimiter.html', 'tag.html', { token: 'delimiter.html', next: '@pop' }]
]
],
@ -265,8 +242,7 @@ export const language = <languages.IMonarchLanguage>{
/\{\{/,
{
token: '@rematch',
switchTo:
'@handlebarsInSimpleState.scriptWithCustomType.$S2'
switchTo: '@handlebarsInSimpleState.scriptWithCustomType.$S2'
}
],
[
@ -294,10 +270,7 @@ export const language = <languages.IMonarchLanguage>{
nextEmbedded: '@pop'
}
],
[
/<\/script/,
{ token: '@rematch', next: '@pop', nextEmbedded: '@pop' }
]
[/<\/script/, { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }]
],
// -- END <script> tags handling
@ -329,11 +302,7 @@ export const language = <languages.IMonarchLanguage>{
[/[ \t\r\n]+/], // whitespace
[
/(<\/)(style\s*)(>)/,
[
'delimiter.html',
'tag.html',
{ token: 'delimiter.html', next: '@pop' }
]
['delimiter.html', 'tag.html', { token: 'delimiter.html', next: '@pop' }]
]
],
@ -428,20 +397,14 @@ export const language = <languages.IMonarchLanguage>{
nextEmbedded: '@pop'
}
],
[
/<\/style/,
{ token: '@rematch', next: '@pop', nextEmbedded: '@pop' }
]
[/<\/style/, { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }]
],
// -- END <style> tags handling
handlebarsInSimpleState: [
[/\{\{\{?/, 'delimiter.handlebars'],
[
/\}\}\}?/,
{ token: 'delimiter.handlebars', switchTo: '@$S2.$S3' }
],
[/\}\}\}?/, { token: 'delimiter.handlebars', switchTo: '@$S2.$S3' }],
{ include: 'handlebarsRoot' }
],

View file

@ -7,23 +7,8 @@ import { registerLanguage } from '../_.contribution';
registerLanguage({
id: 'html',
extensions: [
'.html',
'.htm',
'.shtml',
'.xhtml',
'.mdoc',
'.jsp',
'.asp',
'.aspx',
'.jshtm'
],
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'
],
mimetypes: ['text/html', 'text/x-jshtm', 'text/template', 'text/ng-template'],
loader: () => import('./html')
});

View file

@ -569,8 +569,7 @@ testTokenization(
// Tag with Angular Attribute Name
[
{
line:
'<abc #myinput (click)="bar" [value]="someProperty" *ngIf="someCondition">',
line: '<abc #myinput (click)="bar" [value]="someProperty" *ngIf="someCondition">',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },

View file

@ -58,9 +58,7 @@ export const conf: languages.LanguageConfiguration = {
onEnterRules: [
{
beforeText: new RegExp(
`<(?!(?:${EMPTY_ELEMENTS.join(
'|'
)}))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$`,
`<(?!(?:${EMPTY_ELEMENTS.join('|')}))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$`,
'i'
),
afterText: /^<\/([_:\w][_:\w-.\d]*)\s*>$/i,
@ -70,9 +68,7 @@ export const conf: languages.LanguageConfiguration = {
},
{
beforeText: new RegExp(
`<(?!(?:${EMPTY_ELEMENTS.join(
'|'
)}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
`<(?!(?:${EMPTY_ELEMENTS.join('|')}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
'i'
),
action: { indentAction: languages.IndentAction.Indent }
@ -97,20 +93,11 @@ export const language = <languages.IMonarchLanguage>{
root: [
[/<!DOCTYPE/, 'metatag', '@doctype'],
[/<!--/, 'comment', '@comment'],
[
/(<)((?:[\w\-]+:)?[\w\-]+)(\s*)(\/>)/,
['delimiter', 'tag', '', 'delimiter']
],
[/(<)((?:[\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' }]
],
[/(<)((?:[\w\-]+:)?[\w\-]+)/, ['delimiter', { token: 'tag', next: '@otherTag' }]],
[/(<\/)((?:[\w\-]+:)?[\w\-]+)/, ['delimiter', { token: 'tag', next: '@otherTag' }]],
[/</, 'delimiter'],
[/[^<]+/] // text
],
@ -153,10 +140,7 @@ export const language = <languages.IMonarchLanguage>{
}
],
[/[ \t\r\n]+/], // whitespace
[
/(<\/)(script\s*)(>)/,
['delimiter', 'tag', { token: 'delimiter', next: '@pop' }]
]
[/(<\/)(script\s*)(>)/, ['delimiter', 'tag', { token: 'delimiter', next: '@pop' }]]
],
// After <script ... type
@ -221,10 +205,7 @@ export const language = <languages.IMonarchLanguage>{
],
scriptEmbedded: [
[
/<\/script/,
{ token: '@rematch', next: '@pop', nextEmbedded: '@pop' }
],
[/<\/script/, { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }],
[/[^<]+/, '']
],
@ -248,10 +229,7 @@ export const language = <languages.IMonarchLanguage>{
}
],
[/[ \t\r\n]+/], // whitespace
[
/(<\/)(style\s*)(>)/,
['delimiter', 'tag', { token: 'delimiter', next: '@pop' }]
]
[/(<\/)(style\s*)(>)/, ['delimiter', 'tag', { token: 'delimiter', next: '@pop' }]]
],
// After <style ... type
@ -316,10 +294,7 @@ export const language = <languages.IMonarchLanguage>{
],
styleEmbedded: [
[
/<\/style/,
{ token: '@rematch', next: '@pop', nextEmbedded: '@pop' }
],
[/<\/style/, { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }],
[/[^<]+/, '']
]

View file

@ -233,8 +233,7 @@ testTokenization('java', [
// Keywords
[
{
line:
'package test; class Program { static void main(String[] args) {} } }',
line: 'package test; class Program { static void main(String[] args) {} } }',
tokens: [
{ startIndex: 0, type: 'keyword.package.java' },
{ startIndex: 7, type: '' },

View file

@ -34,12 +34,8 @@ export const conf: languages.LanguageConfiguration = {
],
folding: {
markers: {
start: new RegExp(
'^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))'
),
end: new RegExp(
'^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))'
)
start: new RegExp('^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))'),
end: new RegExp('^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))')
}
}
};
@ -186,10 +182,7 @@ export const language = <languages.IMonarchLanguage>{
// numbers
[/(@digits)[eE]([\-+]?(@digits))?[fFdD]?/, 'number.float'],
[
/(@digits)\.(@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'],

View file

@ -3,10 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import {
conf as tsConf,
language as tsLanguage
} from '../typescript/typescript';
import { conf as tsConf, language as tsLanguage } from '../typescript/typescript';
import type { languages } from '../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = tsConf;

View file

@ -347,10 +347,7 @@ export const language = <languages.IMonarchLanguage>{
tokenizer: {
root: [
[/(::)\s*|\b(isa)\s+/, 'keyword', '@typeanno'],
[
/\b(isa)(\s*\(@ident\s*,\s*)/,
['keyword', { token: '', next: '@typeanno' }]
],
[/\b(isa)(\s*\(@ident\s*,\s*)/, ['keyword', { token: '', next: '@typeanno' }]],
[/\b(type|struct)[ \t]+/, 'keyword', '@typeanno'],
// symbols
@ -438,10 +435,7 @@ export const language = <languages.IMonarchLanguage>{
// 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*)*)(\s*<:\s*)/, ['type', 'keyword']],
[/[a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*/, 'type', '@pop'],
['', '', '@pop']
],

View file

@ -229,8 +229,7 @@ testTokenization('kotlin', [
// Keywords
[
{
line:
'package test class Program { fun main(vararg args: String) {} } }',
line: 'package test class Program { fun main(vararg args: String) {} } }',
tokens: [
{ startIndex: 0, type: 'keyword.package.kt' },
{ startIndex: 7, type: '' },

View file

@ -34,12 +34,8 @@ export const conf: languages.LanguageConfiguration = {
],
folding: {
markers: {
start: new RegExp(
'^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))'
),
end: new RegExp(
'^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))'
)
start: new RegExp('^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))'),
end: new RegExp('^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))')
}
}
};
@ -216,10 +212,7 @@ export const language = <languages.IMonarchLanguage>{
// numbers
[/(@digits)[eE]([\-+]?(@digits))?[fFdD]?/, 'number.float'],
[
/(@digits)\.(@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'],

View file

@ -373,8 +373,7 @@ testTokenization(
[
{
line:
'.something(@some, @other) when (iscolor(@other)) { aname// my commen',
line: '.something(@some, @other) when (iscolor(@other)) { aname// my commen',
tokens: [
{ startIndex: 0, type: 'tag.class.less' },
{ startIndex: 10, type: 'delimiter.parenthesis.less' },
@ -529,8 +528,7 @@ testTokenization(
// Escape Strings
[
{
line:
'.class { filter: ~"ms:alwaysHasItsOwnSyntax.For.Stuff()";',
line: '.class { filter: ~"ms:alwaysHasItsOwnSyntax.For.Stuff()";',
tokens: [
{ startIndex: 0, type: 'tag.class.less' },
{ startIndex: 6, type: '' },
@ -736,8 +734,7 @@ testTokenization(
// Attribute in a .class(...)
[
{
line:
'.box-shadow(inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6));',
line: '.box-shadow(inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6));',
tokens: [
{ startIndex: 0, type: 'tag.class.less' },
{ startIndex: 11, type: 'delimiter.parenthesis.less' },
@ -939,8 +936,7 @@ testTokenization(
// Difficult little bugs... => Numbers in classes
[
{
line:
'.translate3d(@x, @y, @z) { -webkit-transform: translate3d(@x, @y, @z); }',
line: '.translate3d(@x, @y, @z) { -webkit-transform: translate3d(@x, @y, @z); }',
tokens: [
{ startIndex: 0, type: 'tag.class.less' },
{ startIndex: 12, type: 'delimiter.parenthesis.less' },
@ -1418,8 +1414,7 @@ testTokenization(
// @import url('something.css');@import url('something.css');
[
{
line:
'@import url("something.css");@import url("something.css");',
line: '@import url("something.css");@import url("something.css");',
tokens: [
{ startIndex: 0, type: 'keyword.less' },
{ startIndex: 7, type: '' },

View file

@ -64,11 +64,7 @@ export const language = <languages.IMonarchLanguage>{
{ include: '@keyword' },
{ include: '@strings' },
{ include: '@numbers' },
[
'[*_]?[a-zA-Z\\-\\s]+(?=:.*(;|(\\\\$)))',
'attribute.name',
'@attribute'
],
['[*_]?[a-zA-Z\\-\\s]+(?=:.*(;|(\\\\$)))', 'attribute.name', '@attribute'],
['url(\\-prefix)?\\(', { token: 'tag', next: '@urldeclaration' }],
@ -178,14 +174,8 @@ export const language = <languages.IMonarchLanguage>{
],
strings: [
<any[]>[
'~?"',
{ token: 'string.delimiter', next: '@stringsEndDoubleQuote' }
],
<any[]>[
"~?'",
{ token: 'string.delimiter', next: '@stringsEndQuote' }
]
<any[]>['~?"', { token: 'string.delimiter', next: '@stringsEndDoubleQuote' }],
<any[]>["~?'", { token: 'string.delimiter', next: '@stringsEndQuote' }]
],
stringsEndDoubleQuote: [

View file

@ -35,8 +35,7 @@ testTokenization('lexon', [
[
{
line:
'COMMENT: 3.f - an escrow that is controlled by a third party for a fee.',
line: 'COMMENT: 3.f - an escrow that is controlled by a third party for a fee.',
tokens: [{ startIndex: 0, type: 'comment.lexon' }]
}
],

View file

@ -148,10 +148,7 @@ export const language = <languages.IMonarchLanguage>{
quoted_identifier: [
[/[^\\"]+/, 'identifier'],
[
/"/,
{ token: 'identifier.quote', bracket: '@close', next: '@pop' }
]
[/"/, { token: 'identifier.quote', bracket: '@close', next: '@pop' }]
],
space_identifier_until_period: [
@ -174,10 +171,7 @@ export const language = <languages.IMonarchLanguage>{
semver: [
{ include: '@whitespace' },
[':', 'delimiter'],
[
/\d*\.\d*\.\d*/,
{ token: 'number.semver', bracket: '@close', next: '@pop' }
]
[/\d*\.\d*\.\d*/, { token: 'number.semver', bracket: '@close', next: '@pop' }]
],
whitespace: [[/[ \t\r\n]+/, 'white']]

View file

@ -110,14 +110,8 @@ export const language = <languages.IMonarchLanguage>{
{ include: '@whitespace' },
// keys
[
/(,)(\s*)([a-zA-Z_]\w*)(\s*)(:)(?!:)/,
['delimiter', '', 'key', '', 'delimiter']
],
[
/({)(\s*)([a-zA-Z_]\w*)(\s*)(:)(?!:)/,
['@brackets', '', 'key', '', 'delimiter']
],
[/(,)(\s*)([a-zA-Z_]\w*)(\s*)(:)(?!:)/, ['delimiter', '', 'key', '', 'delimiter']],
[/({)(\s*)([a-zA-Z_]\w*)(\s*)(:)(?!:)/, ['@brackets', '', 'key', '', 'delimiter']],
// delimiters and operators
[/[{}()\[\]]/, '@brackets'],

View file

@ -7,16 +7,7 @@ import { registerLanguage } from '../_.contribution';
registerLanguage({
id: 'markdown',
extensions: [
'.md',
'.markdown',
'.mdown',
'.mkdn',
'.mkd',
'.mdwn',
'.mdtxt',
'.mdtext'
],
extensions: ['.md', '.markdown', '.mdown', '.mkdn', '.mkd', '.mdwn', '.mdtxt', '.mdtext'],
aliases: ['Markdown', 'markdown'],
loader: () => import('./markdown')
});

View file

@ -89,10 +89,7 @@ export const language = <languages.IMonarchLanguage>{
[/^(\t|[ ]{4})[^ ].*$/, 'string'],
// code block (3 tilde)
[
/^\s*~~~\s*((?:\w|[\/\-#])+)?\s*$/,
{ token: 'string', next: '@codeblock' }
],
[/^\s*~~~\s*((?:\w|[\/\-#])+)?\s*$/, { token: 'string', next: '@codeblock' }],
// github style code blocks (with backticks and language)
[
@ -138,10 +135,7 @@ export const language = <languages.IMonarchLanguage>{
// github style code blocks
codeblockgh: [
[
/```\s*$/,
{ token: 'variable.source', next: '@pop', nextEmbedded: '@pop' }
],
[/```\s*$/, { token: 'variable.source', next: '@pop', nextEmbedded: '@pop' }],
[/[^`]+/, 'variable.source']
],
@ -159,10 +153,7 @@ export const language = <languages.IMonarchLanguage>{
// links
[/\{+[^}]+\}+/, 'string.target'],
[
/(!?\[)((?:[^\]\\]|@escapes)*)(\]\([^\)]+\))/,
['string.link', '', 'string.link']
],
[/(!?\[)((?:[^\]\\]|@escapes)*)(\]\([^\)]+\))/, ['string.link', '', 'string.link']],
[/(!?\[)((?:[^\]\\]|@escapes)*)(\])/, 'string.link'],
// or html
@ -258,19 +249,13 @@ export const language = <languages.IMonarchLanguage>{
embeddedStyle: [
[/[^<]+/, ''],
[
/<\/style\s*>/,
{ token: '@rematch', next: '@pop', nextEmbedded: '@pop' }
],
[/<\/style\s*>/, { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }],
[/</, '']
],
embeddedScript: [
[/[^<]+/, ''],
[
/<\/script\s*>/,
{ token: '@rematch', next: '@pop', nextEmbedded: '@pop' }
],
[/<\/script\s*>/, { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }],
[/</, '']
]
}

View file

@ -108,8 +108,7 @@ testTokenization('mips', [
[
{
line:
'even_str: .asciiz "The number is even!" # Output string for even integer',
line: 'even_str: .asciiz "The number is even!" # Output string for even integer',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 8, type: 'delimiter.mips' },

5
src/mocha.d.ts vendored
View file

@ -6,10 +6,7 @@
declare function run(): void;
declare function suite(name: string, fn: (err?: any) => void): void;
declare function test(
name: string,
fn: (done: (err?: any) => void) => void
): void;
declare function test(name: string, fn: (done: (err?: any) => void) => void): void;
declare function suiteSetup(fn: (done: (err?: any) => void) => void): void;
declare function suiteTeardown(fn: (done: (err?: any) => void) => void): void;
declare function setup(fn: (done: (err?: any) => void) => void): void;

View file

@ -1167,9 +1167,7 @@ export const language = <languages.IMonarchLanguage>{
[/""/, 'string.double'],
[/"/, { token: 'string.double', next: '@pop' }]
],
complexIdentifiers: [
[/`/, { token: 'identifier.quote', next: '@quotedIdentifier' }]
],
complexIdentifiers: [[/`/, { token: 'identifier.quote', next: '@quotedIdentifier' }]],
quotedIdentifier: [
[/[^`]+/, 'identifier'],
[/``/, 'identifier'],

View file

@ -322,14 +322,7 @@ export const language = <languages.IMonarchLanguage>{
],
// File handlers
builtinFileHandlers: [
'ARGV',
'STDERR',
'STDOUT',
'ARGVOUT',
'STDIN',
'ENV'
],
builtinFileHandlers: ['ARGV', 'STDERR', 'STDOUT', 'ARGVOUT', 'STDIN', 'ENV'],
// Perl variables
builtinVariables: [
@ -515,10 +508,7 @@ export const language = <languages.IMonarchLanguage>{
[/[{}\[\]()]/, '@brackets'],
// RegExp
[
/[\/](?:(?:\[(?:\\]|[^\]])+\])|(?:\\\/|[^\]\/]))*[\/]\w*\s*(?=[).,;]|$)/,
'regexp'
],
[/[\/](?:(?:\[(?:\\]|[^\]])+\])|(?:\\\/|[^\]\/]))*[\/]\w*\s*(?=[).,;]|$)/, 'regexp'],
[/@symbols/, 'operators'],
@ -563,86 +553,35 @@ export const language = <languages.IMonarchLanguage>{
// Percent strings in Ruby are similar to quote-like operators in Perl.
// This is adapted from pstrings in ../ruby/ruby.ts.
quotedConstructs: [
[
/(q|qw|tr|y)\s*\(/,
{ token: 'string.delim', switchTo: '@qstring.(.)' }
],
[
/(q|qw|tr|y)\s*\[/,
{ token: 'string.delim', switchTo: '@qstring.[.]' }
],
[
/(q|qw|tr|y)\s*\{/,
{ token: 'string.delim', switchTo: '@qstring.{.}' }
],
[
/(q|qw|tr|y)\s*</,
{ token: 'string.delim', switchTo: '@qstring.<.>' }
],
[
/(q|qw|tr|y)#/,
{ token: 'string.delim', switchTo: '@qstring.#.#' }
],
[/(q|qw|tr|y)\s*\(/, { token: 'string.delim', switchTo: '@qstring.(.)' }],
[/(q|qw|tr|y)\s*\[/, { token: 'string.delim', switchTo: '@qstring.[.]' }],
[/(q|qw|tr|y)\s*\{/, { token: 'string.delim', switchTo: '@qstring.{.}' }],
[/(q|qw|tr|y)\s*</, { token: 'string.delim', switchTo: '@qstring.<.>' }],
[/(q|qw|tr|y)#/, { token: 'string.delim', switchTo: '@qstring.#.#' }],
[
/(q|qw|tr|y)\s*([^A-Za-z0-9#\s])/,
{ token: 'string.delim', switchTo: '@qstring.$2.$2' }
],
[
/(q|qw|tr|y)\s+(\w)/,
{ token: 'string.delim', switchTo: '@qstring.$2.$2' }
],
[/(q|qw|tr|y)\s+(\w)/, { token: 'string.delim', switchTo: '@qstring.$2.$2' }],
[
/(qr|m|s)\s*\(/,
{ token: 'regexp.delim', switchTo: '@qregexp.(.)' }
],
[
/(qr|m|s)\s*\[/,
{ token: 'regexp.delim', switchTo: '@qregexp.[.]' }
],
[
/(qr|m|s)\s*\{/,
{ token: 'regexp.delim', switchTo: '@qregexp.{.}' }
],
[
/(qr|m|s)\s*</,
{ token: 'regexp.delim', switchTo: '@qregexp.<.>' }
],
[/(qr|m|s)\s*\(/, { token: 'regexp.delim', switchTo: '@qregexp.(.)' }],
[/(qr|m|s)\s*\[/, { token: 'regexp.delim', switchTo: '@qregexp.[.]' }],
[/(qr|m|s)\s*\{/, { token: 'regexp.delim', switchTo: '@qregexp.{.}' }],
[/(qr|m|s)\s*</, { token: 'regexp.delim', switchTo: '@qregexp.<.>' }],
[/(qr|m|s)#/, { token: 'regexp.delim', switchTo: '@qregexp.#.#' }],
[
/(qr|m|s)\s*([^A-Za-z0-9_#\s])/,
{ token: 'regexp.delim', switchTo: '@qregexp.$2.$2' }
],
[
/(qr|m|s)\s+(\w)/,
{ token: 'regexp.delim', switchTo: '@qregexp.$2.$2' }
],
[/(qr|m|s)\s+(\w)/, { token: 'regexp.delim', switchTo: '@qregexp.$2.$2' }],
[
/(qq|qx)\s*\(/,
{ token: 'string.delim', switchTo: '@qqstring.(.)' }
],
[
/(qq|qx)\s*\[/,
{ token: 'string.delim', switchTo: '@qqstring.[.]' }
],
[
/(qq|qx)\s*\{/,
{ token: 'string.delim', switchTo: '@qqstring.{.}' }
],
[
/(qq|qx)\s*</,
{ token: 'string.delim', switchTo: '@qqstring.<.>' }
],
[/(qq|qx)\s*\(/, { token: 'string.delim', switchTo: '@qqstring.(.)' }],
[/(qq|qx)\s*\[/, { token: 'string.delim', switchTo: '@qqstring.[.]' }],
[/(qq|qx)\s*\{/, { token: 'string.delim', switchTo: '@qqstring.{.}' }],
[/(qq|qx)\s*</, { token: 'string.delim', switchTo: '@qqstring.<.>' }],
[/(qq|qx)#/, { token: 'string.delim', switchTo: '@qqstring.#.#' }],
[
/(qq|qx)\s*([^A-Za-z0-9#\s])/,
{ token: 'string.delim', switchTo: '@qqstring.$2.$2' }
],
[
/(qq|qx)\s+(\w)/,
{ token: 'string.delim', switchTo: '@qqstring.$2.$2' }
]
[/(qq|qx)\s*([^A-Za-z0-9#\s])/, { token: 'string.delim', switchTo: '@qqstring.$2.$2' }],
[/(qq|qx)\s+(\w)/, { token: 'string.delim', switchTo: '@qqstring.$2.$2' }]
],
// Non-expanded quoted string
@ -685,12 +624,7 @@ export const language = <languages.IMonarchLanguage>{
]
],
regexpModifiers: [
[
/[msixpodualngcer]+/,
{ token: 'regexp.modifier', next: '@popall' }
]
],
regexpModifiers: [[/[msixpodualngcer]+/, { token: 'regexp.modifier', next: '@popall' }]],
// Expanded quoted string
// qqstring.<open>.<close>

View file

@ -1346,9 +1346,7 @@ export const language = <languages.IMonarchLanguage>{
[/''/, 'string'],
[/'/, { token: 'string', next: '@pop' }]
],
complexIdentifiers: [
[/"/, { token: 'identifier.quote', next: '@quotedIdentifier' }]
],
complexIdentifiers: [[/"/, { token: 'identifier.quote', next: '@quotedIdentifier' }]],
quotedIdentifier: [
[/[^"]+/, 'identifier'],
[/""/, 'identifier'],

View file

@ -2182,8 +2182,7 @@ testTokenization(
// html/js/php/js/
[
{
line:
'<abc><script>var i= 10;</script><?php5+3?><script>var x= 15;</script>',
line: '<abc><script>var i= 10;</script><?php5+3?><script>var x= 15;</script>',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },

View file

@ -43,57 +43,33 @@ export const language = <languages.IMonarchLanguage>{
// The main tokenizer for our languages
tokenizer: {
root: [
[
/<\?((php)|=)?/,
{ token: '@rematch', switchTo: '@phpInSimpleState.root' }
],
[/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.root' }],
[/<!DOCTYPE/, 'metatag.html', '@doctype'],
[/<!--/, 'comment.html', '@comment'],
[/(<)(\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' }]
],
[/(<)(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'],
[/[^<]+/] // text
],
doctype: [
[
/<\?((php)|=)?/,
{ token: '@rematch', switchTo: '@phpInSimpleState.comment' }
],
[/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.comment' }],
[/[^>]+/, 'metatag.content.html'],
[/>/, 'metatag.html', '@pop']
],
comment: [
[
/<\?((php)|=)?/,
{ token: '@rematch', switchTo: '@phpInSimpleState.comment' }
],
[/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.comment' }],
[/-->/, 'comment.html', '@pop'],
[/[^-]+/, 'comment.content.html'],
[/./, 'comment.content.html']
],
otherTag: [
[
/<\?((php)|=)?/,
{ token: '@rematch', switchTo: '@phpInSimpleState.otherTag' }
],
[/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.otherTag' }],
[/\/?>/, 'delimiter.html', '@pop'],
[/"([^"]*)"/, 'attribute.value'],
[/'([^']*)'/, 'attribute.value'],
@ -106,10 +82,7 @@ export const language = <languages.IMonarchLanguage>{
// After <script
script: [
[
/<\?((php)|=)?/,
{ token: '@rematch', switchTo: '@phpInSimpleState.script' }
],
[/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.script' }],
[/type/, 'attribute.name', '@scriptAfterType'],
[/"([^"]*)"/, 'attribute.value'],
[/'([^']*)'/, 'attribute.value'],
@ -126,11 +99,7 @@ export const language = <languages.IMonarchLanguage>{
[/[ \t\r\n]+/], // whitespace
[
/(<\/)(script\s*)(>)/,
[
'delimiter.html',
'tag.html',
{ token: 'delimiter.html', next: '@pop' }
]
['delimiter.html', 'tag.html', { token: 'delimiter.html', next: '@pop' }]
]
],
@ -225,10 +194,7 @@ export const language = <languages.IMonarchLanguage>{
nextEmbedded: '@pop'
}
],
[
/<\/script/,
{ token: '@rematch', next: '@pop', nextEmbedded: '@pop' }
]
[/<\/script/, { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }]
],
// -- END <script> tags handling
@ -237,10 +203,7 @@ export const language = <languages.IMonarchLanguage>{
// After <style
style: [
[
/<\?((php)|=)?/,
{ token: '@rematch', switchTo: '@phpInSimpleState.style' }
],
[/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.style' }],
[/type/, 'attribute.name', '@styleAfterType'],
[/"([^"]*)"/, 'attribute.value'],
[/'([^']*)'/, 'attribute.value'],
@ -257,11 +220,7 @@ export const language = <languages.IMonarchLanguage>{
[/[ \t\r\n]+/], // whitespace
[
/(<\/)(style\s*)(>)/,
[
'delimiter.html',
'tag.html',
{ token: 'delimiter.html', next: '@pop' }
]
['delimiter.html', 'tag.html', { token: 'delimiter.html', next: '@pop' }]
]
],
@ -356,10 +315,7 @@ export const language = <languages.IMonarchLanguage>{
nextEmbedded: '@pop'
}
],
[
/<\/style/,
{ token: '@rematch', next: '@pop', nextEmbedded: '@pop' }
]
[/<\/style/, { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }]
],
// -- END <style> tags handling

View file

@ -706,8 +706,7 @@ testTokenization('postiats', [
tokens: []
},
{
line:
'fun fact {n:nat} .<n>. (x: int n) : [r:int] (FACT(n, r) | int(r)) = (',
line: 'fun fact {n:nat} .<n>. (x: int n) : [r:int] (FACT(n, r) | int(r)) = (',
tokens: [
{ startIndex: 0, type: 'keyword.pats' },
{ startIndex: 3, type: '' },

View file

@ -585,10 +585,7 @@ export const language = <languages.IMonarchLanguage>{
{ regex: /'\(/, action: { token: 'delimiter.parenthesis' } },
{ regex: /'\[/, action: { token: 'delimiter.bracket' } },
{ regex: /'\{/, action: { token: 'delimiter.brace' } },
[
/(')(\\@ESCHAR|\\[xX]@xdigit+|\\@digit+)(')/,
['string', 'string.escape', 'string']
],
[/(')(\\@ESCHAR|\\[xX]@xdigit+|\\@digit+)(')/, ['string', 'string.escape', 'string']],
[/'[^\\']'/, 'string'],
// lexing_DQUOTE

View file

@ -898,10 +898,7 @@ export const language = <languages.IMonarchLanguage>{
{ include: '@strings' },
[/[{}()\[\]]/, '@brackets'],
[
/([=\+<>\-\*&@\?\/!])|([<>]=)|(<>)|(=>)|(\.\.\.)|(\.\.)/,
'operators'
],
[/([=\+<>\-\*&@\?\/!])|([<>]=)|(<>)|(=>)|(\.\.\.)|(\.\.)/, 'operators'],
[/[,;]/, 'delimiter']
],

View file

@ -385,8 +385,7 @@ testTokenization('pug', [
tokens: [{ startIndex: 0, type: 'comment.pug' }]
},
{
line:
' syntax highlighting to kick in properly (especially for comments)',
line: ' syntax highlighting to kick in properly (especially for comments)',
tokens: [{ startIndex: 0, type: 'comment.pug' }]
},
{

View file

@ -190,10 +190,7 @@ export const language = <languages.IMonarchLanguage>{
'$2@tags': {
cases: {
'@eos': ['', 'tag'],
'@default': [
'',
{ token: 'tag', next: '@tag.$1' }
]
'@default': ['', { token: 'tag', next: '@tag.$1' }]
}
},
'$2@keywords': ['', { token: 'keyword.$2' }],
@ -219,10 +216,7 @@ export const language = <languages.IMonarchLanguage>{
{
cases: {
'@eos': ['', 'tag.class'],
'@default': [
'',
{ token: 'tag.class', next: '@tag.$1' }
]
'@default': ['', { token: 'tag.class', next: '@tag.$1' }]
}
}
],
@ -257,10 +251,7 @@ export const language = <languages.IMonarchLanguage>{
],
tag: [
[
/(\.)(\s*$)/,
[{ token: 'delimiter', next: '@blockText.$S2.' }, '']
],
[/(\.)(\s*$)/, [{ token: 'delimiter', next: '@blockText.$S2.' }, '']],
[/\s+/, { token: '', next: '@simpleText' }],
// id
@ -321,11 +312,7 @@ export const language = <languages.IMonarchLanguage>{
[/\s+/, ''],
[
/(\w+)(\s*=\s*)("|')/,
[
'attribute.name',
'delimiter',
{ token: 'attribute.value', next: '@value.$3' }
]
['attribute.name', 'delimiter', { token: 'attribute.value', next: '@value.$3' }]
],
[/\w+/, 'attribute.name'],
@ -347,10 +334,7 @@ export const language = <languages.IMonarchLanguage>{
],
whitespace: [
[
/^(\s*)(\/\/.*)$/,
{ token: 'comment', next: '@blockText.$1.comment' }
],
[/^(\s*)(\/\/.*)$/, { token: 'comment', next: '@blockText.$1.comment' }],
[/[ \t\r\n]+/, ''],
[/<!--/, { token: 'comment', next: '@comment' }]
],
@ -409,11 +393,7 @@ export const language = <languages.IMonarchLanguage>{
// interpolation
[
/(#{)([^}]*)(})/,
[
'interpolation.delimiter',
'interpolation',
'interpolation.delimiter'
]
['interpolation.delimiter', 'interpolation', 'interpolation.delimiter']
],
[/#/, 'string'],
[

View file

@ -125,18 +125,7 @@ export const language = <languages.IMonarchLanguage>{
'source'
],
special: [
'\\n',
'\\r',
'\\t',
'\\b',
'\\a',
'\\f',
'\\v',
"\\'",
'\\"',
'\\\\'
],
special: ['\\n', '\\r', '\\t', '\\b', '\\a', '\\f', '\\v', "\\'", '\\"', '\\\\'],
brackets: [
{ open: '{', close: '}', token: 'delimiter.curly' },

View file

@ -55,9 +55,7 @@ export const conf: languages.LanguageConfiguration = {
onEnterRules: [
{
beforeText: new RegExp(
`<(?!(?:${EMPTY_ELEMENTS.join(
'|'
)}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
`<(?!(?:${EMPTY_ELEMENTS.join('|')}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
'i'
),
afterText: /^<\/(\w[\w\d]*)\s*>$/i,
@ -67,9 +65,7 @@ export const conf: languages.LanguageConfiguration = {
},
{
beforeText: new RegExp(
`<(?!(?:${EMPTY_ELEMENTS.join(
'|'
)}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
`<(?!(?:${EMPTY_ELEMENTS.join('|')}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
'i'
),
action: { indentAction: languages.IndentAction.Indent }
@ -86,58 +82,34 @@ export const language = <languages.IMonarchLanguage>{
tokenizer: {
root: [
[/@@/], // text
[
/@[^@]/,
{ token: '@rematch', switchTo: '@razorInSimpleState.root' }
],
[/@[^@]/, { token: '@rematch', switchTo: '@razorInSimpleState.root' }],
[/<!DOCTYPE/, 'metatag.html', '@doctype'],
[/<!--/, 'comment.html', '@comment'],
[/(<)(\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' }]
],
[/(<)(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'],
[/[ \t\r\n]+/], // whitespace
[/[^<@]+/] // text
],
doctype: [
[
/@[^@]/,
{ token: '@rematch', switchTo: '@razorInSimpleState.comment' }
],
[/@[^@]/, { token: '@rematch', switchTo: '@razorInSimpleState.comment' }],
[/[^>]+/, 'metatag.content.html'],
[/>/, 'metatag.html', '@pop']
],
comment: [
[
/@[^@]/,
{ token: '@rematch', switchTo: '@razorInSimpleState.comment' }
],
[/@[^@]/, { token: '@rematch', switchTo: '@razorInSimpleState.comment' }],
[/-->/, 'comment.html', '@pop'],
[/[^-]+/, 'comment.content.html'],
[/./, 'comment.content.html']
],
otherTag: [
[
/@[^@]/,
{ token: '@rematch', switchTo: '@razorInSimpleState.otherTag' }
],
[/@[^@]/, { token: '@rematch', switchTo: '@razorInSimpleState.otherTag' }],
[/\/?>/, 'delimiter.html', '@pop'],
[/"([^"]*)"/, 'attribute.value'],
[/'([^']*)'/, 'attribute.value'],
@ -150,10 +122,7 @@ export const language = <languages.IMonarchLanguage>{
// After <script
script: [
[
/@[^@]/,
{ token: '@rematch', switchTo: '@razorInSimpleState.script' }
],
[/@[^@]/, { token: '@rematch', switchTo: '@razorInSimpleState.script' }],
[/type/, 'attribute.name', '@scriptAfterType'],
[/"([^"]*)"/, 'attribute.value'],
[/'([^']*)'/, 'attribute.value'],
@ -170,11 +139,7 @@ export const language = <languages.IMonarchLanguage>{
[/[ \t\r\n]+/], // whitespace
[
/(<\/)(script\s*)(>)/,
[
'delimiter.html',
'tag.html',
{ token: 'delimiter.html', next: '@pop' }
]
['delimiter.html', 'tag.html', { token: 'delimiter.html', next: '@pop' }]
]
],
@ -269,10 +234,7 @@ export const language = <languages.IMonarchLanguage>{
nextEmbedded: '@pop'
}
],
[
/<\/script/,
{ token: '@rematch', next: '@pop', nextEmbedded: '@pop' }
]
[/<\/script/, { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }]
],
// -- END <script> tags handling
@ -281,10 +243,7 @@ export const language = <languages.IMonarchLanguage>{
// After <style
style: [
[
/@[^@]/,
{ token: '@rematch', switchTo: '@razorInSimpleState.style' }
],
[/@[^@]/, { token: '@rematch', switchTo: '@razorInSimpleState.style' }],
[/type/, 'attribute.name', '@styleAfterType'],
[/"([^"]*)"/, 'attribute.value'],
[/'([^']*)'/, 'attribute.value'],
@ -301,11 +260,7 @@ export const language = <languages.IMonarchLanguage>{
[/[ \t\r\n]+/], // whitespace
[
/(<\/)(style\s*)(>)/,
[
'delimiter.html',
'tag.html',
{ token: 'delimiter.html', next: '@pop' }
]
['delimiter.html', 'tag.html', { token: 'delimiter.html', next: '@pop' }]
]
],
@ -400,10 +355,7 @@ export const language = <languages.IMonarchLanguage>{
nextEmbedded: '@pop'
}
],
[
/<\/style/,
{ token: '@rematch', next: '@pop', nextEmbedded: '@pop' }
]
[/<\/style/, { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }]
],
// -- END <style> tags handling
@ -411,10 +363,7 @@ export const language = <languages.IMonarchLanguage>{
razorInSimpleState: [
[/@\*/, 'comment.cs', '@razorBlockCommentTopLevel'],
[/@[{(]/, 'metatag.cs', '@razorRootTopLevel'],
[
/(@)(\s*[\w]+)/,
['metatag.cs', { token: 'identifier.cs', switchTo: '@$S2.$S3' }]
],
[/(@)(\s*[\w]+)/, ['metatag.cs', { token: 'identifier.cs', switchTo: '@$S2.$S3' }]],
[/[})]/, { token: 'metatag.cs', switchTo: '@$S2.$S3' }],
[/\*@/, { token: 'comment.cs', switchTo: '@$S2.$S3' }]
],

View file

@ -270,8 +270,7 @@ testTokenization('redis', [
[
{
line:
'GEOADD Sicily 13.361389 38.115556 "Palermo" 15.087269 37.502669 "Catania"',
line: 'GEOADD Sicily 13.361389 38.115556 "Palermo" 15.087269 37.502669 "Catania"',
tokens: [
{ startIndex: 0, type: 'keyword.redis' },
{ startIndex: 6, type: 'white.redis' },

View file

@ -800,9 +800,7 @@ export const language = <languages.IMonarchLanguage>{
[/''/, 'string'],
[/'/, { token: 'string', next: '@pop' }]
],
complexIdentifiers: [
[/"/, { token: 'identifier.quote', next: '@quotedIdentifier' }]
],
complexIdentifiers: [[/"/, { token: 'identifier.quote', next: '@quotedIdentifier' }]],
quotedIdentifier: [
[/[^"]+/, 'identifier'],
[/""/, 'identifier'],

View file

@ -437,13 +437,11 @@ testTokenization('restructuredtext', [
],
[
{
line:
'+------------------------+------------+----------+----------+',
line: '+------------------------+------------+----------+----------+',
tokens: [{ startIndex: 0, type: 'keyword.rst' }]
},
{
line:
'+========================+============+==========+==========+',
line: '+========================+============+==========+==========+',
tokens: [{ startIndex: 0, type: 'keyword.rst' }]
}
]

View file

@ -72,10 +72,7 @@ export const language = <languages.IMonarchLanguage>{
//No rules on it
//bullet-lists
[
/^\s*([\*\-+‣•]|[a-zA-Z0-9]+\.|\([a-zA-Z0-9]+\)|[a-zA-Z0-9]+\))\s/,
'keyword'
],
[/^\s*([\*\-+‣•]|[a-zA-Z0-9]+\.|\([a-zA-Z0-9]+\)|[a-zA-Z0-9]+\))\s/, 'keyword'],
//literal-blocks
[/([ ]::)\s*$/, 'keyword', '@blankLineOfLiteralBlocks'],
@ -101,41 +98,20 @@ export const language = <languages.IMonarchLanguage>{
//hyperlink-targets
[
/^(\.\.)(\s+)(_)(@simpleRefName)(:)(\s+)(.*)/,
[
{ token: '', next: 'hyperlinks' },
'',
'',
'string.link',
'',
'',
'string.link'
]
[{ token: '', next: 'hyperlinks' }, '', '', 'string.link', '', '', 'string.link']
],
//anonymous-hyperlinks
[
/^((?:(?:\.\.)(?:\s+))?)(__)(:)(\s+)(.*)/,
[
{ token: '', next: 'subsequentLines' },
'',
'',
'',
'string.link'
]
[{ token: '', next: 'subsequentLines' }, '', '', '', 'string.link']
],
[/^(__\s+)(.+)/, ['', 'string.link']],
//substitution-definitions
[
/^(\.\.)( \|)([^| ]+[^|]*[^| ]*)(\| )(@simpleRefName)(:: .*)/,
[
{ token: '', next: 'subsequentLines' },
'',
'string.link',
'',
'keyword',
''
],
[{ token: '', next: 'subsequentLines' }, '', 'string.link', '', 'keyword', ''],
'@rawBlocks'
],
[/(\|)([^| ]+[^|]*[^| ]*)(\|_{0,2})/, ['', 'string.link', '']],
@ -151,10 +127,7 @@ export const language = <languages.IMonarchLanguage>{
[/(@simpleRefName)(_{1,2})/, ['string.link', '']],
//embedded-uris-and-aliases
[
/(`)([^<`]+\s+)(<)(.*)(>)(`)(_)/,
['', 'string.link', '', 'string.link', '', '', '']
],
[/(`)([^<`]+\s+)(<)(.*)(>)(`)(_)/, ['', 'string.link', '', 'string.link', '', '', '']],
//emphasis
[/\*\*([^\\*]|\*(?!\*))+\*\*/, 'strong'],
@ -165,14 +138,8 @@ export const language = <languages.IMonarchLanguage>{
[/(__\s+)(.+)/, ['', 'keyword']],
//interpreted-text
[
/(:)((?:@simpleRefNameWithoutBq)?)(:`)([^`]+)(`)/,
['', 'keyword', '', '', '']
],
[
/(`)([^`]+)(`:)((?:@simpleRefNameWithoutBq)?)(:)/,
['', '', '', 'keyword', '']
],
[/(:)((?:@simpleRefNameWithoutBq)?)(:`)([^`]+)(`)/, ['', 'keyword', '', '', '']],
[/(`)([^`]+)(`:)((?:@simpleRefNameWithoutBq)?)(:)/, ['', '', '', 'keyword', '']],
[/(`)([^`]+)(`)/, ''],
//inline-internal-targets
@ -184,9 +151,7 @@ export const language = <languages.IMonarchLanguage>{
[{ token: '', next: '@subsequentLines' }, 'string.link', '', '']
]
],
citationsReference: [
[/(\[)(@citationName)(\]_)/, ['', 'string.link', '']]
],
citationsReference: [[/(\[)(@citationName)(\]_)/, ['', 'string.link', '']]],
footnotes: [
[
/^(\.\.\s+\[)((?:[0-9]+))(\]\s+.*)/,

View file

@ -165,17 +165,7 @@ export const language = <languages.IMonarchLanguage>{
'unless'
],
linedecls: [
'def',
'case',
'do',
'begin',
'for',
'if',
'while',
'until',
'unless'
],
linedecls: ['def', 'case', 'do', 'begin', 'for', 'if', 'while', 'until', 'unless'],
operators: [
'^',
@ -295,18 +285,12 @@ export const language = <languages.IMonarchLanguage>{
[/@@[\w]*/, 'namespace.class.identifier'], // class
// here document
[
/<<[-~](@heredelim).*/,
{ token: 'string.heredoc.delimiter', next: '@heredoc.$1' }
],
[/<<[-~](@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' }],
[
/[ \t\r\n]+<<(@heredelim).*/,
{ token: 'string.heredoc.delimiter', next: '@heredoc.$1' }
],
[
/^<<(@heredelim).*/,
{ token: 'string.heredoc.delimiter', next: '@heredoc.$1' }
],
[/^<<(@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' }],
// whitespace
{ include: '@whitespace' },
@ -325,10 +309,7 @@ export const language = <languages.IMonarchLanguage>{
[/:'/, { token: 'string.s.delim', next: '@sstring.s' }],
// regular expressions. Lookahead for a (not escaped) closing forwardslash on the same line
[
/\/(?=(\\\/|[^\/\n])+\/)/,
{ token: 'regexp.delim', next: '@regexp' }
],
[/\/(?=(\\\/|[^\/\n])+\/)/, { token: 'regexp.delim', next: '@regexp' }],
// delimiters and operators
[/[{}()\[\]]/, '@brackets'],
@ -525,14 +506,8 @@ export const language = <languages.IMonarchLanguage>{
{ token: 'regexp.escape.control', next: '@regexrange' }
]
],
[
/(\()(\?[:=!])/,
['@brackets.regexp.escape.control', 'regexp.escape.control']
],
[
/\(\?#/,
{ token: 'regexp.escape.control', next: '@regexpcomment' }
],
[/(\()(\?[:=!])/, ['@brackets.regexp.escape.control', 'regexp.escape.control']],
[/\(\?#/, { token: 'regexp.escape.control', next: '@regexpcomment' }],
[/[()]/, '@brackets.regexp.escape.control'],
[/@regexpctl/, 'regexp.escape.control'],
[/\\$/, 'regexp.escape'],
@ -558,56 +533,23 @@ export const language = <languages.IMonarchLanguage>{
// % quoted strings
// A bit repetitive since we need to often special case the kind of ending delimiter
pstring: [
[
/%([qws])\(/,
{ token: 'string.$1.delim', switchTo: '@qstring.$1.(.)' }
],
[
/%([qws])\[/,
{ token: 'string.$1.delim', switchTo: '@qstring.$1.[.]' }
],
[
/%([qws])\{/,
{ token: 'string.$1.delim', switchTo: '@qstring.$1.{.}' }
],
[
/%([qws])</,
{ token: 'string.$1.delim', switchTo: '@qstring.$1.<.>' }
],
[
/%([qws])(@delim)/,
{ token: 'string.$1.delim', switchTo: '@qstring.$1.$2.$2' }
],
[/%([qws])\(/, { token: 'string.$1.delim', switchTo: '@qstring.$1.(.)' }],
[/%([qws])\[/, { token: 'string.$1.delim', switchTo: '@qstring.$1.[.]' }],
[/%([qws])\{/, { token: 'string.$1.delim', switchTo: '@qstring.$1.{.}' }],
[/%([qws])</, { token: 'string.$1.delim', switchTo: '@qstring.$1.<.>' }],
[/%([qws])(@delim)/, { token: 'string.$1.delim', switchTo: '@qstring.$1.$2.$2' }],
[/%r\(/, { token: 'regexp.delim', switchTo: '@pregexp.(.)' }],
[/%r\[/, { token: 'regexp.delim', switchTo: '@pregexp.[.]' }],
[/%r\{/, { token: 'regexp.delim', switchTo: '@pregexp.{.}' }],
[/%r</, { token: 'regexp.delim', switchTo: '@pregexp.<.>' }],
[
/%r(@delim)/,
{ token: 'regexp.delim', switchTo: '@pregexp.$1.$1' }
],
[/%r(@delim)/, { token: 'regexp.delim', switchTo: '@pregexp.$1.$1' }],
[
/%(x|W|Q?)\(/,
{ token: 'string.$1.delim', switchTo: '@qqstring.$1.(.)' }
],
[
/%(x|W|Q?)\[/,
{ token: 'string.$1.delim', switchTo: '@qqstring.$1.[.]' }
],
[
/%(x|W|Q?)\{/,
{ token: 'string.$1.delim', switchTo: '@qqstring.$1.{.}' }
],
[
/%(x|W|Q?)</,
{ token: 'string.$1.delim', switchTo: '@qqstring.$1.<.>' }
],
[
/%(x|W|Q?)(@delim)/,
{ token: 'string.$1.delim', switchTo: '@qqstring.$1.$2.$2' }
],
[/%(x|W|Q?)\(/, { token: 'string.$1.delim', switchTo: '@qqstring.$1.(.)' }],
[/%(x|W|Q?)\[/, { token: 'string.$1.delim', switchTo: '@qqstring.$1.[.]' }],
[/%(x|W|Q?)\{/, { token: 'string.$1.delim', switchTo: '@qqstring.$1.{.}' }],
[/%(x|W|Q?)</, { token: 'string.$1.delim', switchTo: '@qqstring.$1.<.>' }],
[/%(x|W|Q?)(@delim)/, { token: 'string.$1.delim', switchTo: '@qqstring.$1.$2.$2' }],
[/%([rqwsxW]|Q?)./, { token: 'invalid', next: '@pop' }], // recover
[/./, { token: 'invalid', next: '@pop' }] // recover
@ -638,10 +580,7 @@ export const language = <languages.IMonarchLanguage>{
// kind = Q|W|x (double quote, array, command)
// open = open delimiter
// close = close delimiter
qqstring: [
[/#/, 'string.$S2.escape', '@interpolated'],
{ include: '@qstring' }
],
qqstring: [[/#/, 'string.$S2.escape', '@interpolated'], { include: '@qstring' }],
// whitespace & comments
whitespace: [

View file

@ -301,10 +301,7 @@ export const language = <languages.IMonarchLanguage>{
],
[/[{}()\[\]<>]/, '@brackets'],
[
/@symbols/,
{ cases: { '@operators': 'operator', '@default': '' } }
]
[/@symbols/, { cases: { '@operators': 'operator', '@default': '' } }]
],
whitespace: [
@ -332,10 +329,7 @@ export const language = <languages.IMonarchLanguage>{
//Binary
[/(0b[0-1_]+)(@intSuffixes)?/, { token: 'number' }],
//Exponent
[
/[\d][\d_]*(\.[\d][\d_]*)?[eE][+-][\d_]+(@floatSuffixes)?/,
{ token: 'number' }
],
[/[\d][\d_]*(\.[\d][\d_]*)?[eE][+-][\d_]+(@floatSuffixes)?/, { token: 'number' }],
//Float
[/\b(\d\.?[\d_]*)(@floatSuffixes)?\b/, { token: 'number' }],
//Hexadecimal

View file

@ -59,20 +59,7 @@ export const language = <languages.IMonarchLanguage>{
tagwords: ['If', 'Sub', 'While', 'For'],
operators: [
'>',
'<',
'<>',
'<=',
'>=',
'And',
'Or',
'+',
'-',
'*',
'/',
'='
],
operators: ['>', '<', '<>', '<=', '>=', 'And', 'Or', '+', '-', '*', '/', '='],
// we include these common regular expressions
identifier: /[a-zA-Z_][\w]*/,

View file

@ -9,11 +9,6 @@ registerLanguage({
id: 'scala',
extensions: ['.scala', '.sc', '.sbt'],
aliases: ['Scala', 'scala', 'SBT', 'Sbt', 'sbt', 'Dotty', 'dotty'],
mimetypes: [
'text/x-scala-source',
'text/x-scala',
'text/x-sbt',
'text/x-dotty'
],
mimetypes: ['text/x-scala-source', 'text/x-scala', 'text/x-sbt', 'text/x-dotty'],
loader: () => import('./scala')
});

View file

@ -257,8 +257,7 @@ testTokenization('scala', [
// Keywords
[
{
line:
'package test; object Program { def main(args: Array[String]): Unit = {} }',
line: 'package test; object Program { def main(args: Array[String]): Unit = {} }',
tokens: [
{ startIndex: 0, type: 'keyword.scala' },
{ startIndex: 7, type: 'white.scala' },

View file

@ -38,12 +38,8 @@ export const conf: languages.LanguageConfiguration = {
],
folding: {
markers: {
start: new RegExp(
'^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))'
),
end: new RegExp(
'^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))'
)
start: new RegExp('^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))'),
end: new RegExp('^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))')
}
}
};
@ -127,50 +123,21 @@ export const language = <languages.IMonarchLanguage>{
tokenizer: {
root: [
// strings
[
/\braw"""/,
{ token: 'string.quote', bracket: '@open', next: '@rawstringt' }
],
[
/\braw"/,
{ token: 'string.quote', bracket: '@open', next: '@rawstring' }
],
[/\braw"""/, { token: 'string.quote', bracket: '@open', next: '@rawstringt' }],
[/\braw"/, { token: 'string.quote', bracket: '@open', next: '@rawstring' }],
[
/\bs"""/,
{ token: 'string.quote', bracket: '@open', next: '@sstringt' }
],
[
/\bs"/,
{ token: 'string.quote', bracket: '@open', next: '@sstring' }
],
[/\bs"""/, { token: 'string.quote', bracket: '@open', next: '@sstringt' }],
[/\bs"/, { token: 'string.quote', bracket: '@open', next: '@sstring' }],
[
/\bf""""/,
{ token: 'string.quote', bracket: '@open', next: '@fstringt' }
],
[
/\bf"/,
{ token: 'string.quote', bracket: '@open', next: '@fstring' }
],
[/\bf""""/, { token: 'string.quote', bracket: '@open', next: '@fstringt' }],
[/\bf"/, { token: 'string.quote', bracket: '@open', next: '@fstring' }],
[
/"""/,
{ token: 'string.quote', bracket: '@open', next: '@stringt' }
],
[/"""/, { token: 'string.quote', bracket: '@open', next: '@stringt' }],
[/"/, { token: 'string.quote', bracket: '@open', next: '@string' }],
// numbers
[
/(@digits)[eE]([\-+]?(@digits))?[fFdD]?/,
'number.float',
'@allowMethod'
],
[
/(@digits)\.(@digits)([eE][\-+]?(@digits))?[fFdD]?/,
'number.float',
'@allowMethod'
],
[/(@digits)[eE]([\-+]?(@digits))?[fFdD]?/, 'number.float', '@allowMethod'],
[/(@digits)\.(@digits)([eE][\-+]?(@digits))?[fFdD]?/, 'number.float', '@allowMethod'],
[/0[xX](@hexdigits)[Ll]?/, 'number.hex', '@allowMethod'],
[/(@digits)[fFdD]/, 'number.float', '@allowMethod'],
[/(@digits)[lL]?/, 'number', '@allowMethod'],
@ -180,10 +147,7 @@ export const language = <languages.IMonarchLanguage>{
// identifiers and keywords
[/\bimport\b/, 'keyword', '@import'],
[
/\b(case)([ \t]+)(class)\b/,
['keyword.modifier', 'white', 'keyword']
],
[/\b(case)([ \t]+)(class)\b/, ['keyword.modifier', 'white', 'keyword']],
[/\bcase\b/, 'keyword', '@case'],
[/\bva[lr]\b/, 'keyword', '@vardef'],
[
@ -191,10 +155,7 @@ export const language = <languages.IMonarchLanguage>{
['keyword', 'white', 'identifier']
],
[/@name(?=[ \t]*:(?!:))/, 'variable'],
[
/(\.)(@name|@symbols)/,
['operator', { token: '@rematch', next: '@allowMethod' }]
],
[/(\.)(@name|@symbols)/, ['operator', { token: '@rematch', next: '@allowMethod' }]],
[/([{(])(\s*)(@name(?=\s*=>))/, ['@brackets', 'white', 'variable']],
[
/@name/,
@ -227,11 +188,7 @@ export const language = <languages.IMonarchLanguage>{
[/[{(]/, '@brackets'],
[/[})]/, '@brackets', '@allowMethod'],
[/\[/, 'operator.square'],
[
/](?!\s*(?:va[rl]|def|type)\b)/,
'operator.square',
'@allowMethod'
],
[/](?!\s*(?:va[rl]|def|type)\b)/, 'operator.square', '@allowMethod'],
[/]/, 'operator.square'],
[/([=-]>|<-|>:|<:|:>|<%)(?=[\s\w()[\]{},\."'`])/, 'keyword'],
[/@symbols/, 'operator'],
@ -246,11 +203,7 @@ export const language = <languages.IMonarchLanguage>{
[/'[^\\']'/, 'string', '@allowMethod'],
[
/(')(@escapes)(')/,
[
'string',
'string.escape',
{ token: 'string', next: '@allowMethod' }
]
['string', 'string.escape', { token: 'string', next: '@allowMethod' }]
],
[/'/, 'string.invalid']
],
@ -361,14 +314,8 @@ export const language = <languages.IMonarchLanguage>{
/(%)([\-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,
['metatag', 'keyword.modifier', 'number', 'metatag']
],
[
/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,
['metatag', 'number', 'metatag']
],
[
/(%)([\-#+ 0,(])(@fstring_conv)/,
['metatag', 'keyword.modifier', 'metatag']
],
[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/, ['metatag', 'number', 'metatag']],
[/(%)([\-#+ 0,(])(@fstring_conv)/, ['metatag', 'keyword.modifier', 'metatag']],
[/(%)(@fstring_conv)/, ['metatag', 'metatag']],
[/./, 'string']
],
@ -392,14 +339,8 @@ export const language = <languages.IMonarchLanguage>{
/(%)([\-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,
['metatag', 'keyword.modifier', 'number', 'metatag']
],
[
/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,
['metatag', 'number', 'metatag']
],
[
/(%)([\-#+ 0,(])(@fstring_conv)/,
['metatag', 'keyword.modifier', 'metatag']
],
[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/, ['metatag', 'number', 'metatag']],
[/(%)([\-#+ 0,(])(@fstring_conv)/, ['metatag', 'keyword.modifier', 'metatag']],
[/(%)(@fstring_conv)/, ['metatag', 'metatag']],
[/./, 'string']
],
@ -437,11 +378,7 @@ export const language = <languages.IMonarchLanguage>{
[/./, 'string']
],
interp: [
[/{/, 'operator', '@push'],
[/}/, 'operator', '@pop'],
{ include: '@root' }
],
interp: [[/{/, 'operator', '@push'], [/}/, 'operator', '@pop'], { include: '@root' }],
rawstring: [
[/[^"]/, 'string'],

View file

@ -3,15 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import {
testTokenization as actualTestTokenization,
ITestItem
} from '../test/testRunner';
import { testTokenization as actualTestTokenization, ITestItem } from '../test/testRunner';
function testTokenization(
_language: string | string[],
tests: ITestItem[][]
): void {
function testTokenization(_language: string | string[], tests: ITestItem[][]): void {
tests = tests.map((t) => {
return t.map((t) => {
return {
@ -360,8 +354,7 @@ testTokenization('scss', [
// Rules without whitespaces
[
{
line:
'legend {foo{a:s}margin-top:0;margin-bottom:#123;margin-top:s(1)}',
line: 'legend {foo{a:s}margin-top:0;margin-bottom:#123;margin-top:s(1)}',
tokens: [
{ startIndex: 0, type: 'tag.scss' } /* 'legend' */,
{ startIndex: 6, type: '' },
@ -1344,10 +1337,7 @@ testTokenization('scss', [
// for statementwhitespaces
[
{
line:
'@for $i from 1 through 3 {\n' +
' .item-#{$i} { width: 2em * $i; }\n' +
'}',
line: '@for $i from 1 through 3 {\n' + ' .item-#{$i} { width: 2em * $i; }\n' + '}',
tokens: [
{ startIndex: 0, type: 'keyword.flow.scss' } /* '@for' */,
{ startIndex: 4, type: '' },
@ -2035,11 +2025,7 @@ testTokenization('scss', [
// CSS @pagewhitespaces
[
{
line:
'@page :left {\n' +
' margin-left: 4cm;\n' +
' margin-right: 3cm;\n' +
'}',
line: '@page :left {\n' + ' margin-left: 4cm;\n' + ' margin-right: 3cm;\n' + '}',
tokens: [
{ startIndex: 0, type: 'keyword.scss' } /* '@page' */,
{ startIndex: 5, type: '' },
@ -2149,8 +2135,7 @@ testTokenization('scss', [
// @font-facewhitespaces
[
{
line:
"@font-face { font-family: Delicious; src: url('Delicious-Roman.otf'); } ",
line: "@font-face { font-family: Delicious; src: url('Delicious-Roman.otf'); } ",
tokens: [
{ startIndex: 0, type: 'keyword.scss' } /* '@font-face' */,
{ startIndex: 10, type: '' },

View file

@ -67,14 +67,8 @@ export const language = <languages.IMonarchLanguage>{
{ token: 'keyword', next: '@keyframedeclaration' }
],
['[@](page|content|font-face|-moz-document)', { token: 'keyword' }], // sass: placeholder for includes
[
'[@](charset|namespace)',
{ token: 'keyword', next: '@declarationbody' }
],
[
'[@](function)',
{ token: 'keyword', next: '@functiondeclaration' }
],
['[@](charset|namespace)', { token: 'keyword', next: '@declarationbody' }],
['[@](function)', { token: 'keyword', next: '@functiondeclaration' }],
['[@](mixin)', { token: 'keyword', next: '@mixindeclaration' }],
['url(\\-prefix)?\\(', { token: 'meta', next: '@urldeclaration' }],
{ include: '@controlstatement' }, // sass control statements
@ -86,11 +80,7 @@ export const language = <languages.IMonarchLanguage>{
],
selectorbody: [
[
'[*_]?@identifier@ws:(?=(\\s|\\d|[^{;}]*[;}]))',
'attribute.name',
'@rulevalue'
], // rule definition: to distinguish from a nested selector check for whitespace, number or a semicolon
['[*_]?@identifier@ws:(?=(\\s|\\d|[^{;}]*[;}]))', 'attribute.name', '@rulevalue'], // rule definition: to distinguish from a nested selector check for whitespace, number or a semicolon
{ include: '@selector' }, // sass: nested selectors
['[@](extend)', { token: 'keyword', next: '@extendbody' }], // sass: extend other selectors
['[@](return)', { token: 'keyword', next: '@declarationbody' }],
@ -119,10 +109,7 @@ export const language = <languages.IMonarchLanguage>{
['([<>=\\+\\-\\*\\/\\^\\|\\~,])', 'operator'],
[',', 'delimiter'],
['!default', 'literal'],
[
'\\(',
{ token: 'delimiter.parenthesis', next: '@parenthizedterm' }
]
['\\(', { token: 'delimiter.parenthesis', next: '@parenthizedterm' }]
],
rulevalue: [
@ -139,13 +126,9 @@ export const language = <languages.IMonarchLanguage>{
['}', { token: 'delimiter.curly', next: '@pop' }]
],
warndebug: [
['[@](warn|debug)', { token: 'keyword', next: '@declarationbody' }]
],
warndebug: [['[@](warn|debug)', { token: 'keyword', next: '@declarationbody' }]],
import: [
['[@](import)', { token: 'keyword', next: '@declarationbody' }]
],
import: [['[@](import)', { token: 'keyword', next: '@declarationbody' }]],
variabledeclaration: [
// sass variables
@ -201,10 +184,7 @@ export const language = <languages.IMonarchLanguage>{
name: [['@identifier', 'attribute.value']],
numbers: [
[
'(\\d*\\.)?\\d+([eE][\\-+]?\\d+)?',
{ token: 'number', next: '@units' }
],
['(\\d*\\.)?\\d+([eE][\\-+]?\\d+)?', { token: 'number', next: '@units' }],
['#[0-9a-fA-F_]+(?!\\w)', 'number.hex']
],
@ -217,19 +197,13 @@ export const language = <languages.IMonarchLanguage>{
],
functiondeclaration: [
[
'@identifier@ws\\(',
{ token: 'meta', next: '@parameterdeclaration' }
],
['@identifier@ws\\(', { token: 'meta', next: '@parameterdeclaration' }],
['{', { token: 'delimiter.curly', switchTo: '@functionbody' }]
],
mixindeclaration: [
// mixin with parameters
[
'@identifier@ws\\(',
{ token: 'meta', next: '@parameterdeclaration' }
],
['@identifier@ws\\(', { token: 'meta', next: '@parameterdeclaration' }],
// mixin without parameters
['@identifier', 'meta'],
['{', { token: 'delimiter.curly', switchTo: '@selectorbody' }]
@ -284,9 +258,7 @@ export const language = <languages.IMonarchLanguage>{
['}', { token: 'delimiter.curly', next: '@pop' }]
],
functioninvocation: [
['@identifier\\(', { token: 'meta', next: '@functionarguments' }]
],
functioninvocation: [['@identifier\\(', { token: 'meta', next: '@functionarguments' }]],
functionarguments: [
['\\$@identifier@ws:', 'attribute.name'],
@ -296,10 +268,7 @@ export const language = <languages.IMonarchLanguage>{
],
strings: [
[
'~?"',
{ token: 'string.delimiter', next: '@stringenddoublequote' }
],
['~?"', { token: 'string.delimiter', next: '@stringenddoublequote' }],
["~?'", { token: 'string.delimiter', next: '@stringendquote' }]
],

View file

@ -640,8 +640,7 @@ testTokenization('sql', [
[
{
line:
'BEGIN TRAN BEGIN TRY SELECT $ COMMIT END TRY BEGIN CATCH ROLLBACK END CATCH',
line: 'BEGIN TRAN BEGIN TRY SELECT $ COMMIT END TRY BEGIN CATCH ROLLBACK END CATCH',
tokens: [
{ startIndex: 0, type: 'keyword.sql' },
{ startIndex: 10, type: 'white.sql' },

View file

@ -395,14 +395,8 @@ export const language = <languages.IMonarchLanguage>{
[/[{}()\[\]]/, '@brackets'],
[/"([^"\\]|\\.)*$/, 'string.invalid'], // non-teminated string
[
/"/,
{ token: 'string.quote', bracket: '@open', next: '@string_dq' }
],
[
/'/,
{ token: 'string.quote', bracket: '@open', next: '@string_sq' }
],
[/"/, { token: 'string.quote', bracket: '@open', next: '@string_dq' }],
[/'/, { token: 'string.quote', bracket: '@open', next: '@string_sq' }],
[/'[^\\']'/, 'string'],
[/(')(@escapes)(')/, ['string', 'string.escape', 'string']],

View file

@ -174,8 +174,7 @@ testTokenization('swift', [
// String with interpolated expression
[
{
line:
' let message = "\\(y) times 2.5 is \\(Double(25) * 2.5)"',
line: ' let message = "\\(y) times 2.5 is \\(Double(25) * 2.5)"',
tokens: [
{ startIndex: 0, type: 'white.swift' },
{ startIndex: 8, type: 'keyword.swift' } /* 'let' */,

View file

@ -141,8 +141,7 @@ testTokenization('systemverilog', [
],
[
{
line:
'assert property (@(clk) go ##1 get[*2] |-> !stop throughout put[->2]);',
line: 'assert property (@(clk) go ##1 get[*2] |-> !stop throughout put[->2]);',
tokens: [
{ startIndex: 0, type: 'keyword.assert.sv' },
{ startIndex: 6, type: '' },
@ -874,8 +873,7 @@ testTokenization('systemverilog', [
// Multiline Comments
[
{
line:
'/* temp_byte = data[0:7]; \\n m_buffer.push_back(temp_byte) */',
line: '/* temp_byte = data[0:7]; \\n m_buffer.push_back(temp_byte) */',
tokens: [{ startIndex: 0, type: 'comment.sv' }]
}
],

View file

@ -460,10 +460,7 @@ export const language = <languages.IMonarchLanguage>{
],
// include statements
[
/^\s*`include/,
{ token: 'keyword.directive.include', next: '@include' }
],
[/^\s*`include/, { token: 'keyword.directive.include', next: '@include' }],
// Preprocessor directives
[/^\s*`\s*\w+/, 'keyword'],
@ -518,22 +515,10 @@ export const language = <languages.IMonarchLanguage>{
numbers: [
[/\d+?[\d_]*(?:\.[\d_]+)?[eE][\-+]?\d+/, 'number.float'],
[/\d+?[\d_]*\.[\d_]+(?:\s*@timeunits)?/, 'number.float'],
[
/(?:\d+?[\d_]*\s*)?'[sS]?[dD]\s*[0-9xXzZ?]+?[0-9xXzZ?_]*/,
'number'
],
[
/(?:\d+?[\d_]*\s*)?'[sS]?[bB]\s*[0-1xXzZ?]+?[0-1xXzZ?_]*/,
'number.binary'
],
[
/(?:\d+?[\d_]*\s*)?'[sS]?[oO]\s*[0-7xXzZ?]+?[0-7xXzZ?_]*/,
'number.octal'
],
[
/(?:\d+?[\d_]*\s*)?'[sS]?[hH]\s*[0-9a-fA-FxXzZ?]+?[0-9a-fA-FxXzZ?_]*/,
'number.hex'
],
[/(?:\d+?[\d_]*\s*)?'[sS]?[dD]\s*[0-9xXzZ?]+?[0-9xXzZ?_]*/, 'number'],
[/(?:\d+?[\d_]*\s*)?'[sS]?[bB]\s*[0-1xXzZ?]+?[0-1xXzZ?_]*/, 'number.binary'],
[/(?:\d+?[\d_]*\s*)?'[sS]?[oO]\s*[0-7xXzZ?]+?[0-7xXzZ?_]*/, 'number.octal'],
[/(?:\d+?[\d_]*\s*)?'[sS]?[hH]\s*[0-9a-fA-FxXzZ?]+?[0-9a-fA-FxXzZ?_]*/, 'number.hex'],
[/1step/, 'number'],
[/[\dxXzZ]+?[\dxXzZ_]*(?:\s*@timeunits)?/, 'number'],
[/'[01xXzZ]+/, 'number']
@ -541,10 +526,7 @@ export const language = <languages.IMonarchLanguage>{
module_instance: [
{ include: '@whitespace' },
[
/(#?)(\()/,
['', { token: '@brackets', next: '@port_connection' }]
],
[/(#?)(\()/, ['', { token: '@brackets', next: '@port_connection' }]],
[/@identifier\s*[;={}\[\],]/, { token: '@rematch', next: '@pop' }],
[/@symbols|[;={}\[\],]/, { token: '@rematch', next: '@pop' }],
[/@identifier/, 'type'],

View file

@ -194,10 +194,7 @@ export const language = <languages.IMonarchLanguage>{
// delimiters and operators
[/[{}()\[\]]/, '@brackets'],
[/@symbols/, 'operator'],
[
/\$+(?:\:\:)?\{/,
{ token: 'identifier', next: '@nestedVariable' }
],
[/\$+(?:\:\:)?\{/, { token: 'identifier', next: '@nestedVariable' }],
[/@variables/, 'type.identifier'],
[/\.(?!\d|\.)[\w\-]*/, 'operator.sql'],
@ -209,19 +206,13 @@ export const language = <languages.IMonarchLanguage>{
[/;/, 'delimiter'],
// strings
[
/"/,
{ token: 'string.quote', bracket: '@open', next: '@dstring' }
],
[/"/, { token: 'string.quote', bracket: '@open', next: '@dstring' }],
[/'/, { token: 'string.quote', bracket: '@open', next: '@sstring' }]
],
dstring: [
[/\[/, { token: '@brackets', next: '@nestedCall' }],
[
/\$+(?:\:\:)?\{/,
{ token: 'identifier', next: '@nestedVariable' }
],
[/\$+(?:\:\:)?\{/, { token: 'identifier', next: '@nestedVariable' }],
[/@variables/, 'type.identifier'],
[/[^\\$\[\]"]+/, 'string'],
[/@escapes/, 'string.escape'],
@ -230,10 +221,7 @@ export const language = <languages.IMonarchLanguage>{
sstring: [
[/\[/, { token: '@brackets', next: '@nestedCall' }],
[
/\$+(?:\:\:)?\{/,
{ token: 'identifier', next: '@nestedVariable' }
],
[/\$+(?:\:\:)?\{/, { token: 'identifier', next: '@nestedVariable' }],
[/@variables/, 'type.identifier'],
[/[^\\$\[\]']+/, 'string'],
[/@escapes/, 'string.escape'],

View file

@ -18,10 +18,7 @@ export interface ITestItem {
tokens: IRelaxedToken[];
}
export function testTokenization(
_language: string | string[],
tests: ITestItem[][]
): void {
export function testTokenization(_language: string | string[], tests: ITestItem[][]): void {
let languages: string[];
if (typeof _language === 'string') {
languages = [_language];
@ -43,11 +40,7 @@ export function testTokenization(
});
}
function runTests(
t: test.Test,
languageId: string,
tests: ITestItem[][]
): void {
function runTests(t: test.Test, languageId: string, tests: ITestItem[][]): void {
tests.forEach((test) => runTest(t, languageId, test));
}

View file

@ -4,12 +4,6 @@
"moduleResolution": "node",
"outDir": "../out/esm",
"target": "es5",
"lib": [
"dom",
"es5",
"es2015.collection",
"es2015.iterable",
"es2015.promise"
]
"lib": ["dom", "es5", "es2015.collection", "es2015.iterable", "es2015.promise"]
}
}

View file

@ -5,12 +5,6 @@
"outDir": "../out/amd",
"target": "es5",
"strict": true,
"lib": [
"dom",
"es5",
"es2015.collection",
"es2015.iterable",
"es2015.promise"
]
"lib": ["dom", "es5", "es2015.collection", "es2015.iterable", "es2015.promise"]
}
}

View file

@ -572,8 +572,7 @@ testTokenization(
// Tag with Angular Attribute Name
[
{
line:
'<abc #myinput (click)="bar" [value]="someProperty" *ngIf="someCondition">',
line: '<abc #myinput (click)="bar" [value]="someProperty" *ngIf="someCondition">',
tokens: [
{ startIndex: 0, type: 'delimiter.html' },
{ startIndex: 1, type: 'tag.html' },

View file

@ -102,14 +102,8 @@ export const language = <languages.IMonarchLanguage>{
/(<)((?:[\w\-]+:)?[\w\-]+)(\s*)(\/>)/,
['delimiter.html', 'tag.html', '', 'delimiter.html']
],
[
/(<)(script)/,
['delimiter.html', { token: 'tag.html', next: '@script' }]
],
[
/(<)(style)/,
['delimiter.html', { token: 'tag.html', next: '@style' }]
],
[/(<)(script)/, ['delimiter.html', { token: 'tag.html', next: '@script' }]],
[/(<)(style)/, ['delimiter.html', { token: 'tag.html', next: '@style' }]],
[
/(<)((?:[\w\-]+:)?[\w\-]+)/,
['delimiter.html', { token: 'tag.html', next: '@otherTag' }]
@ -142,11 +136,7 @@ export const language = <languages.IMonarchLanguage>{
// transition to ensure we mark its contents as strings.
[
/(verbatim)(\s*)([-~]?%})/,
[
'keyword.twig',
'',
{ token: 'delimiter.twig', next: '@rawDataState' }
]
['keyword.twig', '', { token: 'delimiter.twig', next: '@rawDataState' }]
],
{ include: 'expression' }
],
@ -169,10 +159,7 @@ export const language = <languages.IMonarchLanguage>{
/**
* Variable Tag Handling
*/
variableState: [
[/[-~]?}}/, 'delimiter.twig', '@pop'],
{ include: 'expression' }
],
variableState: [[/[-~]?}}/, 'delimiter.twig', '@pop'], { include: 'expression' }],
stringState: [
// closing double quoted string
@ -224,10 +211,7 @@ export const language = <languages.IMonarchLanguage>{
// punctuation
[/\(|\)|\[|\]|{|}|,/, 'delimiter.twig'],
// strings
[
/"([^#"\\]*(?:\\.[^#"\\]*)*)"|\'([^\'\\]*(?:\\.[^\'\\]*)*)\'/,
'string.twig'
],
[/"([^#"\\]*(?:\\.[^#"\\]*)*)"|\'([^\'\\]*(?:\\.[^\'\\]*)*)\'/, 'string.twig'],
// opening double quoted string
[/"/, 'string.twig', '@stringState'],
@ -283,11 +267,7 @@ export const language = <languages.IMonarchLanguage>{
[/[ \t\r\n]+/], // whitespace
[
/(<\/)(script\s*)(>)/,
[
'delimiter.html',
'tag.html',
{ token: 'delimiter.html', next: '@pop' }
]
['delimiter.html', 'tag.html', { token: 'delimiter.html', next: '@pop' }]
]
],
@ -353,10 +333,7 @@ export const language = <languages.IMonarchLanguage>{
],
scriptEmbedded: [
[
/<\/script/,
{ token: '@rematch', next: '@pop', nextEmbedded: '@pop' }
],
[/<\/script/, { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }],
[/[^<]+/, '']
],
@ -382,11 +359,7 @@ export const language = <languages.IMonarchLanguage>{
[/[ \t\r\n]+/], // whitespace
[
/(<\/)(style\s*)(>)/,
[
'delimiter.html',
'tag.html',
{ token: 'delimiter.html', next: '@pop' }
]
['delimiter.html', 'tag.html', { token: 'delimiter.html', next: '@pop' }]
]
],
@ -452,10 +425,7 @@ export const language = <languages.IMonarchLanguage>{
],
styleEmbedded: [
[
/<\/style/,
{ token: '@rematch', next: '@pop', nextEmbedded: '@pop' }
],
[/<\/style/, { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }],
[/[^<]+/, '']
]
}

View file

@ -299,23 +299,13 @@ export const language = {
regexp: [
[
/(\{)(\d+(?:,\d*)?)(\})/,
[
'regexp.escape.control',
'regexp.escape.control',
'regexp.escape.control'
]
['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', { token: 'regexp.escape.control', next: '@regexrange' }]
],
[/(\()(\?:|\?=|\?!)/, ['regexp.escape.control', 'regexp.escape.control']],
[/[()]/, 'regexp.escape.control'],
[/@regexpctl/, 'regexp.escape.control'],
[/[^\\\/]/, 'regexp'],
@ -323,10 +313,7 @@ export const language = {
[/\\\./, 'regexp.invalid'],
[
/(\/)([gimsuy]*)/,
[
{ token: 'regexp', bracket: '@close', next: '@pop' },
'keyword.other'
]
[{ token: 'regexp', bracket: '@close', next: '@pop' }, 'keyword.other']
]
],

View file

@ -24,11 +24,6 @@ registerLanguage({
],
firstLine: '(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)',
aliases: ['XML', 'xml'],
mimetypes: [
'text/xml',
'application/xml',
'application/xaml+xml',
'application/xml-dtd'
],
mimetypes: ['text/xml', 'application/xml', 'application/xaml+xml', 'application/xml-dtd'],
loader: () => import('./xml')
});

View file

@ -415,8 +415,7 @@ testTokenization('xml', [
]
},
{
line:
'<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">',
line: '<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">',
tokens: [
{ startIndex: 0, type: 'delimiter.xml' },
{ startIndex: 1, type: 'tag.xml' },
@ -450,8 +449,7 @@ testTokenization('xml', [
]
},
{
line:
' connectionString="value for the deployed Web.config file" ',
line: ' connectionString="value for the deployed Web.config file" ',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 6, type: 'attribute.name.xml' },
@ -461,8 +459,7 @@ testTokenization('xml', [
]
},
{
line:
' xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>',
line: ' xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 6, type: 'attribute.name.xml' },
@ -521,8 +518,7 @@ testTokenization('xml', [
]
},
{
line:
' <error statusCode="500" redirect="InternalError.htm"/>',
line: ' <error statusCode="500" redirect="InternalError.htm"/>',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 6, type: 'delimiter.xml' },
@ -562,8 +558,7 @@ testTokenization('xml', [
tokens: [{ startIndex: 0, type: '' }]
},
{
line:
' <!-- The stuff below was added for extra tokenizer testing -->',
line: ' <!-- The stuff below was added for extra tokenizer testing -->',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'comment.xml' },

View file

@ -38,33 +38,19 @@ export const language = <languages.IMonarchLanguage>{
{ include: '@whitespace' },
// Standard opening tag
[
/(<)(@qualifiedName)/,
[{ token: 'delimiter' }, { token: 'tag', next: '@tag' }]
],
[/(<)(@qualifiedName)/, [{ token: 'delimiter' }, { token: 'tag', next: '@tag' }]],
// Standard closing tag
[
/(<\/)(@qualifiedName)(\s*)(>)/,
[
{ token: 'delimiter' },
{ token: 'tag' },
'',
{ token: 'delimiter' }
]
[{ token: 'delimiter' }, { token: 'tag' }, '', { token: 'delimiter' }]
],
// Meta tags - instruction
[
/(<\?)(@qualifiedName)/,
[{ token: 'delimiter' }, { token: 'metatag', next: '@tag' }]
],
[/(<\?)(@qualifiedName)/, [{ token: 'delimiter' }, { token: 'metatag', next: '@tag' }]],
// Meta tags - declaration
[
/(<\!)(@qualifiedName)/,
[{ token: 'delimiter' }, { token: 'metatag', next: '@tag' }]
],
[/(<\!)(@qualifiedName)/, [{ token: 'delimiter' }, { token: 'metatag', next: '@tag' }]],
// CDATA
[/<\!\[CDATA\[/, { token: 'delimiter.cdata', next: '@cdata' }],
@ -94,10 +80,7 @@ export const language = <languages.IMonarchLanguage>{
],
[/@qualifiedName/, 'attribute.name'],
[/\?>/, { token: 'delimiter', next: '@pop' }],
[
/(\/)(>)/,
[{ token: 'tag' }, { token: 'delimiter', next: '@pop' }]
],
[/(\/)(>)/, [{ token: 'tag' }, { token: 'delimiter', next: '@pop' }]],
[/>/, { token: 'delimiter', next: '@pop' }]
],

View file

@ -36,18 +36,7 @@ export const language = <languages.IMonarchLanguage>{
{ token: 'delimiter.square', open: '[', close: ']' }
],
keywords: [
'true',
'True',
'TRUE',
'false',
'False',
'FALSE',
'null',
'Null',
'Null',
'~'
],
keywords: ['true', 'True', 'TRUE', 'false', 'False', 'FALSE', 'null', 'Null', 'Null', '~'],
numberInteger: /(?:0|[+-]?[0-9]+)/,
numberFloat: /(?:0|[+-]?[0-9]+)(?:\.[0-9]+)?(?:e[-+][1-9][0-9]*)?/,
@ -89,10 +78,7 @@ export const language = <languages.IMonarchLanguage>{
[/@numberDate(?![ \t]*\S+)/, 'number.date'],
// Key:Value pair
[
/(".*?"|'.*?'|.*?)([ \t]*)(:)( |$)/,
['type', 'white', 'operators', 'white']
],
[/(".*?"|'.*?'|.*?)([ \t]*)(:)( |$)/, ['type', 'white', 'operators', 'white']],
{ include: '@flowScalars' },

View file

@ -8,8 +8,7 @@ requirejs.config({
paths: {
'vs/css': 'test/css.mock',
'vs/nls': 'test/nls.mock',
'out/amd/fillers/monaco-editor-core':
'out/amd/fillers/monaco-editor-core-amd',
'out/amd/fillers/monaco-editor-core': 'out/amd/fillers/monaco-editor-core-amd',
vs: 'node_modules/monaco-editor-core/dev/vs'
},
nodeRequire: require
@ -27,10 +26,7 @@ global.window = { location: {}, navigator: tmp.window.navigator };
requirejs(
['./test/setup'],
function () {
glob('out/amd/*/*.test.js', { cwd: path.dirname(__dirname) }, function (
err,
files
) {
glob('out/amd/*/*.test.js', { cwd: path.dirname(__dirname) }, function (err, files) {
if (err) {
console.log(err);
return;