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, "singleQuote": true,
"trailingComma": "none", "trailingComma": "none",
"semi": true, "semi": true,
"useTabs": true "useTabs": true,
"printWidth": 100
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -255,23 +255,13 @@ export const language = <languages.IMonarchLanguage>{
regexp: [ regexp: [
[ [
/(\{)(\d+(?:,\d*)?)(\})/, /(\{)(\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',
{ token: 'regexp.escape.control', next: '@regexrange' }
]
],
[
/(\()(\?:|\?=|\?!)/,
['regexp.escape.control', 'regexp.escape.control']
], ],
[/(\()(\?:|\?=|\?!)/, ['regexp.escape.control', 'regexp.escape.control']],
[/[()]/, 'regexp.escape.control'], [/[()]/, 'regexp.escape.control'],
[/@regexpctl/, 'regexp.escape.control'], [/@regexpctl/, 'regexp.escape.control'],
[/[^\\\/]/, 'regexp'], [/[^\\\/]/, 'regexp'],
@ -279,10 +269,7 @@ export const language = <languages.IMonarchLanguage>{
[/\\\./, 'regexp.invalid'], [/\\\./, 'regexp.invalid'],
[ [
/(\/)([gimsuy]*)/, /(\/)([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: line: ' && sh autogen.sh && ./configure && make && make install \\',
' && sh autogen.sh && ./configure && make && make install \\',
tokens: [{ startIndex: 0, type: '' }] tokens: [{ startIndex: 0, type: '' }]
}, },
{ {

View file

@ -39,10 +39,7 @@ export const language = <languages.IMonarchLanguage>{
{ include: '@comment' }, { include: '@comment' },
[/(ONBUILD)(\s+)/, ['keyword', '']], [/(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)/, /(FROM|MAINTAINER|RUN|EXPOSE|ENV|ADD|ARG|VOLUME|LABEL|USER|WORKDIR|COPY|CMD|STOPSIGNAL|SHELL|HEALTHCHECK|ENTRYPOINT)/,
{ token: 'keyword', next: '@arguments' } { token: 'keyword', next: '@arguments' }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -34,12 +34,8 @@ export const conf: languages.LanguageConfiguration = {
], ],
folding: { folding: {
markers: { markers: {
start: new RegExp( start: new RegExp('^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))'),
'^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))' end: new RegExp('^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))')
),
end: new RegExp(
'^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))'
)
} }
} }
}; };
@ -186,10 +182,7 @@ export const language = <languages.IMonarchLanguage>{
// numbers // numbers
[/(@digits)[eE]([\-+]?(@digits))?[fFdD]?/, 'number.float'], [/(@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[xX](@hexdigits)[Ll]?/, 'number.hex'],
[/0(@octaldigits)[Ll]?/, 'number.octal'], [/0(@octaldigits)[Ll]?/, 'number.octal'],
[/0[bB](@binarydigits)[Ll]?/, 'number.binary'], [/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. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import { import { conf as tsConf, language as tsLanguage } from '../typescript/typescript';
conf as tsConf,
language as tsLanguage
} from '../typescript/typescript';
import type { languages } from '../fillers/monaco-editor-core'; import type { languages } from '../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = tsConf; export const conf: languages.LanguageConfiguration = tsConf;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -89,10 +89,7 @@ export const language = <languages.IMonarchLanguage>{
[/^(\t|[ ]{4})[^ ].*$/, 'string'], [/^(\t|[ ]{4})[^ ].*$/, 'string'],
// code block (3 tilde) // 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) // github style code blocks (with backticks and language)
[ [
@ -138,10 +135,7 @@ export const language = <languages.IMonarchLanguage>{
// github style code blocks // github style code blocks
codeblockgh: [ codeblockgh: [
[ [/```\s*$/, { token: 'variable.source', next: '@pop', nextEmbedded: '@pop' }],
/```\s*$/,
{ token: 'variable.source', next: '@pop', nextEmbedded: '@pop' }
],
[/[^`]+/, 'variable.source'] [/[^`]+/, 'variable.source']
], ],
@ -159,10 +153,7 @@ export const language = <languages.IMonarchLanguage>{
// links // links
[/\{+[^}]+\}+/, 'string.target'], [/\{+[^}]+\}+/, 'string.target'],
[ [/(!?\[)((?:[^\]\\]|@escapes)*)(\]\([^\)]+\))/, ['string.link', '', 'string.link']],
/(!?\[)((?:[^\]\\]|@escapes)*)(\]\([^\)]+\))/,
['string.link', '', 'string.link']
],
[/(!?\[)((?:[^\]\\]|@escapes)*)(\])/, 'string.link'], [/(!?\[)((?:[^\]\\]|@escapes)*)(\])/, 'string.link'],
// or html // or html
@ -258,19 +249,13 @@ export const language = <languages.IMonarchLanguage>{
embeddedStyle: [ embeddedStyle: [
[/[^<]+/, ''], [/[^<]+/, ''],
[ [/<\/style\s*>/, { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }],
/<\/style\s*>/,
{ token: '@rematch', next: '@pop', nextEmbedded: '@pop' }
],
[/</, ''] [/</, '']
], ],
embeddedScript: [ 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: line: 'even_str: .asciiz "The number is even!" # Output string for even integer',
'even_str: .asciiz "The number is even!" # Output string for even integer',
tokens: [ tokens: [
{ startIndex: 0, type: '' }, { startIndex: 0, type: '' },
{ startIndex: 8, type: 'delimiter.mips' }, { startIndex: 8, type: 'delimiter.mips' },

5
src/mocha.d.ts vendored
View file

@ -6,10 +6,7 @@
declare function run(): void; declare function run(): void;
declare function suite(name: string, fn: (err?: any) => void): void; declare function suite(name: string, fn: (err?: any) => void): void;
declare function test( declare function test(name: string, fn: (done: (err?: any) => void) => void): void;
name: string,
fn: (done: (err?: any) => void) => void
): void;
declare function suiteSetup(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 suiteTeardown(fn: (done: (err?: any) => void) => void): void;
declare function setup(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'], [/""/, 'string.double'],
[/"/, { token: 'string.double', next: '@pop' }] [/"/, { token: 'string.double', next: '@pop' }]
], ],
complexIdentifiers: [ complexIdentifiers: [[/`/, { token: 'identifier.quote', next: '@quotedIdentifier' }]],
[/`/, { token: 'identifier.quote', next: '@quotedIdentifier' }]
],
quotedIdentifier: [ quotedIdentifier: [
[/[^`]+/, 'identifier'], [/[^`]+/, 'identifier'],
[/``/, 'identifier'], [/``/, 'identifier'],

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -395,14 +395,8 @@ export const language = <languages.IMonarchLanguage>{
[/[{}()\[\]]/, '@brackets'], [/[{}()\[\]]/, '@brackets'],
[/"([^"\\]|\\.)*$/, 'string.invalid'], // non-teminated string [/"([^"\\]|\\.)*$/, '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'], [/'[^\\']'/, 'string'],
[/(')(@escapes)(')/, ['string', 'string.escape', 'string']], [/(')(@escapes)(')/, ['string', 'string.escape', 'string']],

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -102,14 +102,8 @@ export const language = <languages.IMonarchLanguage>{
/(<)((?:[\w\-]+:)?[\w\-]+)(\s*)(\/>)/, /(<)((?:[\w\-]+:)?[\w\-]+)(\s*)(\/>)/,
['delimiter.html', 'tag.html', '', 'delimiter.html'] ['delimiter.html', 'tag.html', '', 'delimiter.html']
], ],
[ [/(<)(script)/, ['delimiter.html', { token: 'tag.html', next: '@script' }]],
/(<)(script)/, [/(<)(style)/, ['delimiter.html', { token: 'tag.html', next: '@style' }]],
['delimiter.html', { token: 'tag.html', next: '@script' }]
],
[
/(<)(style)/,
['delimiter.html', { token: 'tag.html', next: '@style' }]
],
[ [
/(<)((?:[\w\-]+:)?[\w\-]+)/, /(<)((?:[\w\-]+:)?[\w\-]+)/,
['delimiter.html', { token: 'tag.html', next: '@otherTag' }] ['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. // transition to ensure we mark its contents as strings.
[ [
/(verbatim)(\s*)([-~]?%})/, /(verbatim)(\s*)([-~]?%})/,
[ ['keyword.twig', '', { token: 'delimiter.twig', next: '@rawDataState' }]
'keyword.twig',
'',
{ token: 'delimiter.twig', next: '@rawDataState' }
]
], ],
{ include: 'expression' } { include: 'expression' }
], ],
@ -169,10 +159,7 @@ export const language = <languages.IMonarchLanguage>{
/** /**
* Variable Tag Handling * Variable Tag Handling
*/ */
variableState: [ variableState: [[/[-~]?}}/, 'delimiter.twig', '@pop'], { include: 'expression' }],
[/[-~]?}}/, 'delimiter.twig', '@pop'],
{ include: 'expression' }
],
stringState: [ stringState: [
// closing double quoted string // closing double quoted string
@ -224,10 +211,7 @@ export const language = <languages.IMonarchLanguage>{
// punctuation // punctuation
[/\(|\)|\[|\]|{|}|,/, 'delimiter.twig'], [/\(|\)|\[|\]|{|}|,/, 'delimiter.twig'],
// strings // strings
[ [/"([^#"\\]*(?:\\.[^#"\\]*)*)"|\'([^\'\\]*(?:\\.[^\'\\]*)*)\'/, 'string.twig'],
/"([^#"\\]*(?:\\.[^#"\\]*)*)"|\'([^\'\\]*(?:\\.[^\'\\]*)*)\'/,
'string.twig'
],
// opening double quoted string // opening double quoted string
[/"/, 'string.twig', '@stringState'], [/"/, 'string.twig', '@stringState'],
@ -283,11 +267,7 @@ export const language = <languages.IMonarchLanguage>{
[/[ \t\r\n]+/], // whitespace [/[ \t\r\n]+/], // whitespace
[ [
/(<\/)(script\s*)(>)/, /(<\/)(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: [ 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 [/[ \t\r\n]+/], // whitespace
[ [
/(<\/)(style\s*)(>)/, /(<\/)(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: [ 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: [ regexp: [
[ [
/(\{)(\d+(?:,\d*)?)(\})/, /(\{)(\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',
{ token: 'regexp.escape.control', next: '@regexrange' }
]
],
[
/(\()(\?:|\?=|\?!)/,
['regexp.escape.control', 'regexp.escape.control']
], ],
[/(\()(\?:|\?=|\?!)/, ['regexp.escape.control', 'regexp.escape.control']],
[/[()]/, 'regexp.escape.control'], [/[()]/, 'regexp.escape.control'],
[/@regexpctl/, 'regexp.escape.control'], [/@regexpctl/, 'regexp.escape.control'],
[/[^\\\/]/, 'regexp'], [/[^\\\/]/, 'regexp'],
@ -323,10 +313,7 @@ export const language = {
[/\\\./, 'regexp.invalid'], [/\\\./, 'regexp.invalid'],
[ [
/(\/)([gimsuy]*)/, /(\/)([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)', firstLine: '(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)',
aliases: ['XML', 'xml'], aliases: ['XML', 'xml'],
mimetypes: [ mimetypes: ['text/xml', 'application/xml', 'application/xaml+xml', 'application/xml-dtd'],
'text/xml',
'application/xml',
'application/xaml+xml',
'application/xml-dtd'
],
loader: () => import('./xml') loader: () => import('./xml')
}); });

View file

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

View file

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

View file

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

View file

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