mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 20:52:56 +01:00
Reorganize project
This commit is contained in:
parent
49f2283894
commit
93c48edccc
121 changed files with 875 additions and 426 deletions
104
src/xml.ts
104
src/xml.ts
|
|
@ -1,104 +0,0 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||
|
||||
export const conf: IRichLanguageConfiguration = {
|
||||
comments: {
|
||||
blockComment: ['<!--', '-->'],
|
||||
},
|
||||
brackets: [
|
||||
['<', '>']
|
||||
],
|
||||
autoClosingPairs: [
|
||||
{ open: '<', close: '>' },
|
||||
{ open: '\'', close: '\'' },
|
||||
{ open: '"', close: '"' },
|
||||
],
|
||||
surroundingPairs: [
|
||||
{ open: '<', close: '>' },
|
||||
{ open: '\'', close: '\'' },
|
||||
{ open: '"', close: '"' },
|
||||
]
|
||||
};
|
||||
|
||||
export const language = <ILanguage>{
|
||||
defaultToken: '',
|
||||
tokenPostfix: '.xml',
|
||||
|
||||
ignoreCase: true,
|
||||
|
||||
// Useful regular expressions
|
||||
qualifiedName: /(?:[\w\.\-]+:)?[\w\.\-]+/,
|
||||
|
||||
tokenizer: {
|
||||
root: [
|
||||
[/[^<&]+/, ''],
|
||||
|
||||
{ include: '@whitespace' },
|
||||
|
||||
// Standard opening tag
|
||||
[/(<)(@qualifiedName)/, [
|
||||
{ token: 'delimiter' },
|
||||
{ token: 'tag', next: '@tag' }]],
|
||||
|
||||
// Standard closing tag
|
||||
[/(<\/)(@qualifiedName)(\s*)(>)/, [
|
||||
{ token: 'delimiter' },
|
||||
{ token: 'tag' },
|
||||
'',
|
||||
{ token: 'delimiter' }]],
|
||||
|
||||
// Meta tags - instruction
|
||||
[/(<\?)(@qualifiedName)/, [
|
||||
{ token: 'delimiter' },
|
||||
{ token: 'metatag', next: '@tag' }]],
|
||||
|
||||
// Meta tags - declaration
|
||||
[/(<\!)(@qualifiedName)/, [
|
||||
{ token: 'delimiter' },
|
||||
{ token: 'metatag', next: '@tag' }]],
|
||||
|
||||
// CDATA
|
||||
[/<\!\[CDATA\[/, { token: 'delimiter.cdata', next: '@cdata' }],
|
||||
|
||||
[/&\w+;/, 'string.escape'],
|
||||
],
|
||||
|
||||
cdata: [
|
||||
[/[^\]]+/, ''],
|
||||
[/\]\]>/, { token: 'delimiter.cdata', next: '@pop' }],
|
||||
[/\]/, '']
|
||||
],
|
||||
|
||||
tag: [
|
||||
[/[ \t\r\n]+/, ''],
|
||||
[/(@qualifiedName)(\s*=\s*)("[^"]*"|'[^']*')/, ['attribute.name', '', 'attribute.value']],
|
||||
[/(@qualifiedName)(\s*=\s*)("[^">?\/]*|'[^'>?\/]*)(?=[\?\/]\>)/, ['attribute.name', '', 'attribute.value']],
|
||||
[/(@qualifiedName)(\s*=\s*)("[^">]*|'[^'>]*)/, ['attribute.name', '', 'attribute.value']],
|
||||
[/@qualifiedName/, 'attribute.name'],
|
||||
[/\?>/, { token: 'delimiter', next: '@pop' }],
|
||||
[/(\/)(>)/, [
|
||||
{ token: 'tag' },
|
||||
{ token: 'delimiter', next: '@pop' }]],
|
||||
[/>/, { token: 'delimiter', next: '@pop' }],
|
||||
],
|
||||
|
||||
whitespace: [
|
||||
[/[ \t\r\n]+/, ''],
|
||||
[/<!--/, { token: 'comment', next: '@comment' }]
|
||||
],
|
||||
|
||||
comment: [
|
||||
[/[^<\-]+/, 'comment.content'],
|
||||
[/-->/, { token: 'comment', next: '@pop' }],
|
||||
[/<!--/, 'comment.content.invalid'],
|
||||
[/[<\-]/, 'comment.content']
|
||||
],
|
||||
},
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue