mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 16:15:41 +01:00
Eliminate htmlTokenTypes
This commit is contained in:
parent
f661c5f826
commit
3c5417b252
37 changed files with 622 additions and 716 deletions
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
comments: {
|
comments: {
|
||||||
lineComment: 'REM'
|
lineComment: 'REM'
|
||||||
},
|
},
|
||||||
|
|
@ -30,7 +30,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
ignoreCase: true,
|
ignoreCase: true,
|
||||||
tokenPostfix: '.bat',
|
tokenPostfix: '.bat',
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#%\^\&\*\(\)\=\$\-\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#%\^\&\*\(\)\=\$\-\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
||||||
comments: {
|
comments: {
|
||||||
blockComment: ['###', '###'],
|
blockComment: ['###', '###'],
|
||||||
|
|
@ -35,7 +35,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
ignoreCase: true,
|
ignoreCase: true,
|
||||||
tokenPostfix: '.coffee',
|
tokenPostfix: '.coffee',
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
comments: {
|
comments: {
|
||||||
lineComment: '//',
|
lineComment: '//',
|
||||||
blockComment: ['/*', '*/'],
|
blockComment: ['/*', '*/'],
|
||||||
|
|
@ -34,7 +34,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.cpp',
|
tokenPostfix: '.cpp',
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\#\$\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\#\$\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
||||||
comments: {
|
comments: {
|
||||||
lineComment: '//',
|
lineComment: '//',
|
||||||
|
|
@ -36,7 +36,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.cs',
|
tokenPostfix: '.cs',
|
||||||
|
|
||||||
|
|
|
||||||
30
src/css.ts
30
src/css.ts
|
|
@ -8,7 +8,7 @@
|
||||||
import LanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import LanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import IMonarchLanguage = monaco.languages.IMonarchLanguage;
|
import IMonarchLanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: LanguageConfiguration = {
|
export const conf: LanguageConfiguration = {
|
||||||
wordPattern: /(#?-?\d*\.\d\w*%?)|((::|[@#.!:])?[\w-?]+%?)|::|[@#.!:]/g,
|
wordPattern: /(#?-?\d*\.\d\w*%?)|((::|[@#.!:])?[\w-?]+%?)|::|[@#.!:]/g,
|
||||||
|
|
||||||
comments: {
|
comments: {
|
||||||
|
|
@ -38,13 +38,7 @@ export var conf: LanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
const TOKEN_SELECTOR = 'tag';
|
export const language = <IMonarchLanguage>{
|
||||||
const TOKEN_SELECTOR_TAG = 'tag';
|
|
||||||
const TOKEN_PROPERTY = 'attribute.name';
|
|
||||||
const TOKEN_VALUE = 'attribute.value';
|
|
||||||
const TOKEN_AT_KEYWORD = 'keyword';
|
|
||||||
|
|
||||||
export var language = <IMonarchLanguage>{
|
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.css',
|
tokenPostfix: '.css',
|
||||||
|
|
||||||
|
|
@ -67,13 +61,13 @@ export var language = <IMonarchLanguage>{
|
||||||
{ include: '@comments' },
|
{ include: '@comments' },
|
||||||
{ include: '@import' },
|
{ include: '@import' },
|
||||||
{ include: '@strings' },
|
{ include: '@strings' },
|
||||||
['[@](keyframes|-webkit-keyframes|-moz-keyframes|-o-keyframes)', { token: TOKEN_AT_KEYWORD, next: '@keyframedeclaration' }],
|
['[@](keyframes|-webkit-keyframes|-moz-keyframes|-o-keyframes)', { token: 'keyword', next: '@keyframedeclaration' }],
|
||||||
['[@](page|content|font-face|-moz-document)', { token: TOKEN_AT_KEYWORD }],
|
['[@](page|content|font-face|-moz-document)', { token: 'keyword' }],
|
||||||
['[@](charset|namespace)', { token: TOKEN_AT_KEYWORD, next: '@declarationbody' }],
|
['[@](charset|namespace)', { token: 'keyword', next: '@declarationbody' }],
|
||||||
['(url-prefix)(\\()', ['attribute.value', { token: 'delimiter.parenthesis', next: '@urldeclaration' }]],
|
['(url-prefix)(\\()', ['attribute.value', { token: 'delimiter.parenthesis', next: '@urldeclaration' }]],
|
||||||
['(url)(\\()', ['attribute.value', { token: 'delimiter.parenthesis', next: '@urldeclaration' }]],
|
['(url)(\\()', ['attribute.value', { token: 'delimiter.parenthesis', next: '@urldeclaration' }]],
|
||||||
{ include: '@selectorname' },
|
{ include: '@selectorname' },
|
||||||
['[\\*]', TOKEN_SELECTOR_TAG], // selector symbols
|
['[\\*]', 'tag'], // selector symbols
|
||||||
['[>\\+,]', 'delimiter'], // selector operators
|
['[>\\+,]', 'delimiter'], // selector operators
|
||||||
['\\[', { token: 'delimiter.bracket', next: '@selectorattribute' }],
|
['\\[', { token: 'delimiter.bracket', next: '@selectorattribute' }],
|
||||||
['{', { token: 'delimiter.bracket', next: '@selectorbody' }]
|
['{', { token: 'delimiter.bracket', next: '@selectorbody' }]
|
||||||
|
|
@ -81,12 +75,12 @@ export var language = <IMonarchLanguage>{
|
||||||
|
|
||||||
selectorbody: [
|
selectorbody: [
|
||||||
{ include: '@comments' },
|
{ include: '@comments' },
|
||||||
['[*_]?@identifier@ws:(?=(\\s|\\d|[^{;}]*[;}]))', TOKEN_PROPERTY, '@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' }]
|
||||||
],
|
],
|
||||||
|
|
||||||
selectorname: [
|
selectorname: [
|
||||||
['(\\.|#(?=[^{])|%|(@identifier)|:)+', TOKEN_SELECTOR], // selector (.foo, div, ...)
|
['(\\.|#(?=[^{])|%|(@identifier)|:)+', 'tag'], // selector (.foo, div, ...)
|
||||||
],
|
],
|
||||||
|
|
||||||
selectorattribute: [
|
selectorattribute: [
|
||||||
|
|
@ -115,11 +109,11 @@ export var language = <IMonarchLanguage>{
|
||||||
],
|
],
|
||||||
|
|
||||||
warndebug: [
|
warndebug: [
|
||||||
['[@](warn|debug)', { token: TOKEN_AT_KEYWORD, next: '@declarationbody' }]
|
['[@](warn|debug)', { token: 'keyword', next: '@declarationbody' }]
|
||||||
],
|
],
|
||||||
|
|
||||||
import: [
|
import: [
|
||||||
['[@](import)', { token: TOKEN_AT_KEYWORD, next: '@declarationbody' }]
|
['[@](import)', { token: 'keyword', next: '@declarationbody' }]
|
||||||
],
|
],
|
||||||
|
|
||||||
urldeclaration: [
|
urldeclaration: [
|
||||||
|
|
@ -151,7 +145,7 @@ export var language = <IMonarchLanguage>{
|
||||||
],
|
],
|
||||||
|
|
||||||
name: [
|
name: [
|
||||||
['@identifier', TOKEN_VALUE]
|
['@identifier', 'attribute.value']
|
||||||
],
|
],
|
||||||
|
|
||||||
numbers: [
|
numbers: [
|
||||||
|
|
@ -179,7 +173,7 @@ export var language = <IMonarchLanguage>{
|
||||||
],
|
],
|
||||||
|
|
||||||
functionarguments: [
|
functionarguments: [
|
||||||
['\\$@identifier@ws:', TOKEN_PROPERTY],
|
['\\$@identifier@ws:', 'attribute.name'],
|
||||||
['[,]', 'delimiter'],
|
['[,]', 'delimiter'],
|
||||||
{ include: '@term' },
|
{ include: '@term' },
|
||||||
['\\)', { token: 'attribute.value', next: '@pop' }],
|
['\\)', { token: 'attribute.value', next: '@pop' }],
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
brackets: [
|
brackets: [
|
||||||
['{', '}'],
|
['{', '}'],
|
||||||
['[', ']'],
|
['[', ']'],
|
||||||
|
|
@ -30,7 +30,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.dockerfile',
|
tokenPostfix: '.dockerfile',
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
comments: {
|
comments: {
|
||||||
lineComment: '//',
|
lineComment: '//',
|
||||||
blockComment: ['(*', '*)'],
|
blockComment: ['(*', '*)'],
|
||||||
|
|
@ -33,7 +33,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.fs',
|
tokenPostfix: '.fs',
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
comments: {
|
comments: {
|
||||||
lineComment: '//',
|
lineComment: '//',
|
||||||
blockComment: ['/*', '*/'],
|
blockComment: ['/*', '*/'],
|
||||||
|
|
@ -36,7 +36,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
|
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.go',
|
tokenPostfix: '.go',
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@ import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
// Allow for running under nodejs/requirejs in tests
|
// Allow for running under nodejs/requirejs in tests
|
||||||
var _monaco: typeof monaco = (typeof monaco === 'undefined' ? (<any>self).monaco : monaco);
|
const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (<any>self).monaco : monaco);
|
||||||
|
|
||||||
const EMPTY_ELEMENTS: string[] = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'];
|
const EMPTY_ELEMENTS: string[] = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'];
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
|
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
|
||||||
|
|
||||||
comments: {
|
comments: {
|
||||||
|
|
@ -55,17 +55,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
export const htmlTokenTypes = {
|
export const language = <ILanguage>{
|
||||||
DELIM_START: 'delimiter.html',
|
|
||||||
DELIM_END: 'delimiter.html',
|
|
||||||
DELIM_COMMENT: 'comment.html',
|
|
||||||
COMMENT: 'comment.content.html',
|
|
||||||
getTag: (name: string) => {
|
|
||||||
return 'tag.html';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '',
|
tokenPostfix: '',
|
||||||
// ignoreCase: true,
|
// ignoreCase: true,
|
||||||
|
|
@ -76,13 +66,13 @@ export var language = <ILanguage>{
|
||||||
[/\{\{/, { token: '@rematch', switchTo: '@handlebarsInSimpleState.root' }],
|
[/\{\{/, { token: '@rematch', switchTo: '@handlebarsInSimpleState.root' }],
|
||||||
[/<!DOCTYPE/, 'metatag.html', '@doctype'],
|
[/<!DOCTYPE/, 'metatag.html', '@doctype'],
|
||||||
[/<!--/, 'comment.html', '@comment'],
|
[/<!--/, 'comment.html', '@comment'],
|
||||||
[/(<)(\w+)(\/>)/, [htmlTokenTypes.DELIM_START, 'tag.html', htmlTokenTypes.DELIM_END]],
|
[/(<)(\w+)(\/>)/, ['delimiter.html', 'tag.html', 'delimiter.html']],
|
||||||
[/(<)(script)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@script' }]],
|
[/(<)(script)/, ['delimiter.html', { token: 'tag.html', next: '@script' }]],
|
||||||
[/(<)(style)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@style' }]],
|
[/(<)(style)/, ['delimiter.html', { token: 'tag.html', next: '@style' }]],
|
||||||
[/(<)([:\w]+)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@otherTag' }]],
|
[/(<)([:\w]+)/, ['delimiter.html', { token: 'tag.html', next: '@otherTag' }]],
|
||||||
[/(<\/)(\w+)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@otherTag' }]],
|
[/(<\/)(\w+)/, ['delimiter.html', { token: 'tag.html', next: '@otherTag' }]],
|
||||||
[/</, htmlTokenTypes.DELIM_START],
|
[/</, 'delimiter.html'],
|
||||||
[/\{/, htmlTokenTypes.DELIM_START],
|
[/\{/, 'delimiter.html'],
|
||||||
[/[^<{]+/] // text
|
[/[^<{]+/] // text
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
@ -101,7 +91,7 @@ export var language = <ILanguage>{
|
||||||
|
|
||||||
otherTag: [
|
otherTag: [
|
||||||
[/\{\{/, { token: '@rematch', switchTo: '@handlebarsInSimpleState.otherTag' }],
|
[/\{\{/, { token: '@rematch', switchTo: '@handlebarsInSimpleState.otherTag' }],
|
||||||
[/\/?>/, htmlTokenTypes.DELIM_END, '@pop'],
|
[/\/?>/, 'delimiter.html', '@pop'],
|
||||||
[/"([^"]*)"/, 'attribute.value'],
|
[/"([^"]*)"/, 'attribute.value'],
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
|
|
@ -119,9 +109,9 @@ export var language = <ILanguage>{
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
[/=/, 'delimiter'],
|
[/=/, 'delimiter'],
|
||||||
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.text/javascript', nextEmbedded: 'text/javascript' }],
|
[/>/, { token: 'delimiter.html', next: '@scriptEmbedded.text/javascript', nextEmbedded: 'text/javascript' }],
|
||||||
[/[ \t\r\n]+/], // whitespace
|
[/[ \t\r\n]+/], // whitespace
|
||||||
[/(<\/)(script\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag.html', { token: htmlTokenTypes.DELIM_END, next: '@pop' }]]
|
[/(<\/)(script\s*)(>)/, ['delimiter.html', 'tag.html', { token: 'delimiter.html', next: '@pop' }]]
|
||||||
],
|
],
|
||||||
|
|
||||||
// After <script ... type
|
// After <script ... type
|
||||||
|
|
@ -144,7 +134,7 @@ export var language = <ILanguage>{
|
||||||
// After <script ... type = $S2
|
// After <script ... type = $S2
|
||||||
scriptWithCustomType: [
|
scriptWithCustomType: [
|
||||||
[/\{\{/, { token: '@rematch', switchTo: '@handlebarsInSimpleState.scriptWithCustomType.$S2' }],
|
[/\{\{/, { token: '@rematch', switchTo: '@handlebarsInSimpleState.scriptWithCustomType.$S2' }],
|
||||||
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.$S2', nextEmbedded: '$S2' }],
|
[/>/, { token: 'delimiter.html', next: '@scriptEmbedded.$S2', nextEmbedded: '$S2' }],
|
||||||
[/"([^"]*)"/, 'attribute.value'],
|
[/"([^"]*)"/, 'attribute.value'],
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
|
|
@ -171,9 +161,9 @@ export var language = <ILanguage>{
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
[/=/, 'delimiter'],
|
[/=/, 'delimiter'],
|
||||||
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.text/css', nextEmbedded: 'text/css' }],
|
[/>/, { token: 'delimiter.html', next: '@styleEmbedded.text/css', nextEmbedded: 'text/css' }],
|
||||||
[/[ \t\r\n]+/], // whitespace
|
[/[ \t\r\n]+/], // whitespace
|
||||||
[/(<\/)(style\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag.html', { token: htmlTokenTypes.DELIM_END, next: '@pop' }]]
|
[/(<\/)(style\s*)(>)/, ['delimiter.html', 'tag.html', { token: 'delimiter.html', next: '@pop' }]]
|
||||||
],
|
],
|
||||||
|
|
||||||
// After <style ... type
|
// After <style ... type
|
||||||
|
|
@ -196,7 +186,7 @@ export var language = <ILanguage>{
|
||||||
// After <style ... type = $S2
|
// After <style ... type = $S2
|
||||||
styleWithCustomType: [
|
styleWithCustomType: [
|
||||||
[/\{\{/, { token: '@rematch', switchTo: '@handlebarsInSimpleState.styleWithCustomType.$S2' }],
|
[/\{\{/, { token: '@rematch', switchTo: '@handlebarsInSimpleState.styleWithCustomType.$S2' }],
|
||||||
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.$S2', nextEmbedded: '$S2' }],
|
[/>/, { token: 'delimiter.html', next: '@styleEmbedded.$S2', nextEmbedded: '$S2' }],
|
||||||
[/"([^"]*)"/, 'attribute.value'],
|
[/"([^"]*)"/, 'attribute.value'],
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
|
|
|
||||||
41
src/html.ts
41
src/html.ts
|
|
@ -9,11 +9,11 @@ import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
// Allow for running under nodejs/requirejs in tests
|
// Allow for running under nodejs/requirejs in tests
|
||||||
var _monaco: typeof monaco = (typeof monaco === 'undefined' ? (<any>self).monaco : monaco);
|
const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (<any>self).monaco : monaco);
|
||||||
|
|
||||||
const EMPTY_ELEMENTS: string[] = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'];
|
const EMPTY_ELEMENTS: string[] = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'];
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
|
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
|
||||||
|
|
||||||
comments: {
|
comments: {
|
||||||
|
|
@ -57,16 +57,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const htmlTokenTypes = {
|
export const language = <ILanguage>{
|
||||||
DELIM_START: 'delimiter',
|
|
||||||
DELIM_END: 'delimiter',
|
|
||||||
DELIM_COMMENT: 'comment',
|
|
||||||
getTag: (name: string) => {
|
|
||||||
return 'tag';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.html',
|
tokenPostfix: '.html',
|
||||||
ignoreCase: true,
|
ignoreCase: true,
|
||||||
|
|
@ -76,12 +67,12 @@ export var language = <ILanguage>{
|
||||||
root: [
|
root: [
|
||||||
[/<!DOCTYPE/, 'metatag', '@doctype'],
|
[/<!DOCTYPE/, 'metatag', '@doctype'],
|
||||||
[/<!--/, 'comment', '@comment'],
|
[/<!--/, 'comment', '@comment'],
|
||||||
[/(<)((?:[\w\-]+:)?[\w\-]+)(\s*)(\/>)/, [htmlTokenTypes.DELIM_START, 'tag', '', htmlTokenTypes.DELIM_END]],
|
[/(<)((?:[\w\-]+:)?[\w\-]+)(\s*)(\/>)/, ['delimiter', 'tag', '', 'delimiter']],
|
||||||
[/(<)(script)/, [htmlTokenTypes.DELIM_START, { token: 'tag', next: '@script' }]],
|
[/(<)(script)/, ['delimiter', { token: 'tag', next: '@script' }]],
|
||||||
[/(<)(style)/, [htmlTokenTypes.DELIM_START, { token: 'tag', next: '@style' }]],
|
[/(<)(style)/, ['delimiter', { token: 'tag', next: '@style' }]],
|
||||||
[/(<)((?:[\w\-]+:)?[\w\-]+)/, [htmlTokenTypes.DELIM_START, { token: 'tag', next: '@otherTag' }]],
|
[/(<)((?:[\w\-]+:)?[\w\-]+)/, ['delimiter', { token: 'tag', next: '@otherTag' }]],
|
||||||
[/(<\/)((?:[\w\-]+:)?[\w\-]+)/, [htmlTokenTypes.DELIM_START, { token: 'tag', next: '@otherTag' }]],
|
[/(<\/)((?:[\w\-]+:)?[\w\-]+)/, ['delimiter', { token: 'tag', next: '@otherTag' }]],
|
||||||
[/</, htmlTokenTypes.DELIM_START],
|
[/</, 'delimiter'],
|
||||||
[/[^<]+/], // text
|
[/[^<]+/], // text
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
@ -97,7 +88,7 @@ export var language = <ILanguage>{
|
||||||
],
|
],
|
||||||
|
|
||||||
otherTag: [
|
otherTag: [
|
||||||
[/\/?>/, htmlTokenTypes.DELIM_END, '@pop'],
|
[/\/?>/, 'delimiter', '@pop'],
|
||||||
[/"([^"]*)"/, 'attribute.value'],
|
[/"([^"]*)"/, 'attribute.value'],
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
|
|
@ -114,9 +105,9 @@ export var language = <ILanguage>{
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
[/=/, 'delimiter'],
|
[/=/, 'delimiter'],
|
||||||
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded', nextEmbedded: 'text/javascript' }],
|
[/>/, { token: 'delimiter', next: '@scriptEmbedded', nextEmbedded: 'text/javascript' }],
|
||||||
[/[ \t\r\n]+/], // whitespace
|
[/[ \t\r\n]+/], // whitespace
|
||||||
[/(<\/)(script\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag', { token: htmlTokenTypes.DELIM_END, next: '@pop' }]]
|
[/(<\/)(script\s*)(>)/, ['delimiter', 'tag', { token: 'delimiter', next: '@pop' }]]
|
||||||
],
|
],
|
||||||
|
|
||||||
// After <script ... type
|
// After <script ... type
|
||||||
|
|
@ -136,7 +127,7 @@ export var language = <ILanguage>{
|
||||||
|
|
||||||
// After <script ... type = $S2
|
// After <script ... type = $S2
|
||||||
scriptWithCustomType: [
|
scriptWithCustomType: [
|
||||||
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.$S2', nextEmbedded: '$S2' }],
|
[/>/, { token: 'delimiter', next: '@scriptEmbedded.$S2', nextEmbedded: '$S2' }],
|
||||||
[/"([^"]*)"/, 'attribute.value'],
|
[/"([^"]*)"/, 'attribute.value'],
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
|
|
@ -162,9 +153,9 @@ export var language = <ILanguage>{
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
[/=/, 'delimiter'],
|
[/=/, 'delimiter'],
|
||||||
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded', nextEmbedded: 'text/css' }],
|
[/>/, { token: 'delimiter', next: '@styleEmbedded', nextEmbedded: 'text/css' }],
|
||||||
[/[ \t\r\n]+/], // whitespace
|
[/[ \t\r\n]+/], // whitespace
|
||||||
[/(<\/)(style\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag', { token: htmlTokenTypes.DELIM_END, next: '@pop' }]]
|
[/(<\/)(style\s*)(>)/, ['delimiter', 'tag', { token: 'delimiter', next: '@pop' }]]
|
||||||
],
|
],
|
||||||
|
|
||||||
// After <style ... type
|
// After <style ... type
|
||||||
|
|
@ -184,7 +175,7 @@ export var language = <ILanguage>{
|
||||||
|
|
||||||
// After <style ... type = $S2
|
// After <style ... type = $S2
|
||||||
styleWithCustomType: [
|
styleWithCustomType: [
|
||||||
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.$S2', nextEmbedded: '$S2' }],
|
[/>/, { token: 'delimiter', next: '@styleEmbedded.$S2', nextEmbedded: '$S2' }],
|
||||||
[/"([^"]*)"/, 'attribute.value'],
|
[/"([^"]*)"/, 'attribute.value'],
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
comments: {
|
comments: {
|
||||||
lineComment: '#'
|
lineComment: '#'
|
||||||
},
|
},
|
||||||
|
|
@ -33,7 +33,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.ini',
|
tokenPostfix: '.ini',
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
comments: {
|
comments: {
|
||||||
lineComment: '//'
|
lineComment: '//'
|
||||||
},
|
},
|
||||||
|
|
@ -22,7 +22,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.jade',
|
tokenPostfix: '.jade',
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
// the default separators except `@$`
|
// the default separators except `@$`
|
||||||
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
||||||
comments: {
|
comments: {
|
||||||
|
|
@ -37,7 +37,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.java',
|
tokenPostfix: '.java',
|
||||||
|
|
||||||
|
|
|
||||||
34
src/less.ts
34
src/less.ts
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
wordPattern: /(#?-?\d*\.\d\w*%?)|([@#!.:]?[\w-?]+%?)|[@#!.]/g,
|
wordPattern: /(#?-?\d*\.\d\w*%?)|([@#!.:]?[\w-?]+%?)|[@#!.]/g,
|
||||||
comments: {
|
comments: {
|
||||||
blockComment: ['/*', '*/'],
|
blockComment: ['/*', '*/'],
|
||||||
|
|
@ -35,13 +35,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
const TOKEN_SELECTOR = 'tag';
|
export const language = <ILanguage>{
|
||||||
const TOKEN_SELECTOR_TAG = 'tag';
|
|
||||||
const TOKEN_PROPERTY = 'attribute.name';
|
|
||||||
const TOKEN_VALUE = 'attribute.value';
|
|
||||||
const TOKEN_AT_KEYWORD = 'keyword.control.at-rule';
|
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.less',
|
tokenPostfix: '.less',
|
||||||
|
|
||||||
|
|
@ -65,20 +59,20 @@ export var language = <ILanguage>{
|
||||||
{ include: '@keyword' },
|
{ include: '@keyword' },
|
||||||
{ include: '@strings' },
|
{ include: '@strings' },
|
||||||
{ include: '@numbers' },
|
{ include: '@numbers' },
|
||||||
['[*_]?[a-zA-Z\\-\\s]+(?=:.*(;|(\\\\$)))', TOKEN_PROPERTY, '@attribute'],
|
['[*_]?[a-zA-Z\\-\\s]+(?=:.*(;|(\\\\$)))', 'attribute.name', '@attribute'],
|
||||||
|
|
||||||
['url(\\-prefix)?\\(', { token: 'tag', next: '@urldeclaration' }],
|
['url(\\-prefix)?\\(', { token: 'tag', next: '@urldeclaration' }],
|
||||||
|
|
||||||
['[{}()\\[\\]]', '@brackets'],
|
['[{}()\\[\\]]', '@brackets'],
|
||||||
['[,:;]', 'delimiter'],
|
['[,:;]', 'delimiter'],
|
||||||
|
|
||||||
['#@identifierPlus', TOKEN_SELECTOR + '.id'],
|
['#@identifierPlus', 'tag.id'],
|
||||||
['&', TOKEN_SELECTOR_TAG],
|
['&', 'tag'],
|
||||||
|
|
||||||
['\\.@identifierPlus(?=\\()', TOKEN_SELECTOR + '.class', '@attribute'],
|
['\\.@identifierPlus(?=\\()', 'tag.class', '@attribute'],
|
||||||
['\\.@identifierPlus', TOKEN_SELECTOR + '.class'],
|
['\\.@identifierPlus', 'tag.class'],
|
||||||
|
|
||||||
['@identifierPlus', TOKEN_SELECTOR_TAG],
|
['@identifierPlus', 'tag'],
|
||||||
{ include: '@operators' },
|
{ include: '@operators' },
|
||||||
|
|
||||||
['@(@identifier(?=[:,\\)]))', 'variable', '@attribute'],
|
['@(@identifier(?=[:,\\)]))', 'variable', '@attribute'],
|
||||||
|
|
@ -117,9 +111,9 @@ export var language = <ILanguage>{
|
||||||
|
|
||||||
{ include: '@keyword' },
|
{ include: '@keyword' },
|
||||||
|
|
||||||
['[a-zA-Z\\-]+(?=\\()', TOKEN_VALUE, '@attribute'],
|
['[a-zA-Z\\-]+(?=\\()', 'attribute.value', '@attribute'],
|
||||||
['>', 'operator', '@pop'],
|
['>', 'operator', '@pop'],
|
||||||
['@identifier', TOKEN_VALUE],
|
['@identifier', 'attribute.value'],
|
||||||
{ include: '@operators' },
|
{ include: '@operators' },
|
||||||
['@(@identifier)', 'variable'],
|
['@(@identifier)', 'variable'],
|
||||||
|
|
||||||
|
|
@ -130,7 +124,7 @@ export var language = <ILanguage>{
|
||||||
['[,=:]', 'delimiter'],
|
['[,=:]', 'delimiter'],
|
||||||
|
|
||||||
['\\s', ''],
|
['\\s', ''],
|
||||||
['.', TOKEN_VALUE]
|
['.', 'attribute.value']
|
||||||
],
|
],
|
||||||
|
|
||||||
comments: [
|
comments: [
|
||||||
|
|
@ -144,12 +138,12 @@ export var language = <ILanguage>{
|
||||||
],
|
],
|
||||||
|
|
||||||
numbers: [
|
numbers: [
|
||||||
['(\\d*\\.)?\\d+([eE][\\-+]?\\d+)?', { token: TOKEN_VALUE + '.number', next: '@units' }],
|
['(\\d*\\.)?\\d+([eE][\\-+]?\\d+)?', { token: 'attribute.value.number', next: '@units' }],
|
||||||
['#[0-9a-fA-F_]+(?!\\w)', TOKEN_VALUE + '.hex']
|
['#[0-9a-fA-F_]+(?!\\w)', 'attribute.value.hex']
|
||||||
],
|
],
|
||||||
|
|
||||||
units: [
|
units: [
|
||||||
['(em|ex|ch|rem|vmin|vmax|vw|vh|vm|cm|mm|in|px|pt|pc|deg|grad|rad|turn|s|ms|Hz|kHz|%)?', TOKEN_VALUE + '.unit', '@pop']
|
['(em|ex|ch|rem|vmin|vmax|vw|vh|vm|cm|mm|in|px|pt|pc|deg|grad|rad|turn|s|ms|Hz|kHz|%)?', 'attribute.value.unit', '@pop']
|
||||||
],
|
],
|
||||||
|
|
||||||
strings: [
|
strings: [
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
comments: {
|
comments: {
|
||||||
lineComment: '--',
|
lineComment: '--',
|
||||||
blockComment: ['--[[', ']]'],
|
blockComment: ['--[[', ']]'],
|
||||||
|
|
@ -34,7 +34,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.lua',
|
tokenPostfix: '.lua',
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ function getTag(name: string) {
|
||||||
return 'tag';
|
return 'tag';
|
||||||
}
|
}
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
comments: {
|
comments: {
|
||||||
blockComment: ['<!--', '-->',]
|
blockComment: ['<!--', '-->',]
|
||||||
},
|
},
|
||||||
|
|
@ -47,7 +47,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.md',
|
tokenPostfix: '.md',
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
declare var require: <T>(moduleId: [string], callback: (module: T) => void, error: (err: any) => void) => void;
|
declare var require: <T>(moduleId: [string], callback: (module: T) => void, error: (err: any) => void) => void;
|
||||||
|
|
||||||
// Allow for running under nodejs/requirejs in tests
|
// Allow for running under nodejs/requirejs in tests
|
||||||
var _monaco: typeof monaco = (typeof monaco === 'undefined' ? (<any>self).monaco : monaco);
|
const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (<any>self).monaco : monaco);
|
||||||
|
|
||||||
interface ILang extends monaco.languages.ILanguageExtensionPoint {
|
interface ILang extends monaco.languages.ILanguageExtensionPoint {
|
||||||
module: string;
|
module: string;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
comments: {
|
comments: {
|
||||||
lineComment: '//',
|
lineComment: '//',
|
||||||
blockComment: ['/*', '*/'],
|
blockComment: ['/*', '*/'],
|
||||||
|
|
@ -23,7 +23,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.msdax',
|
tokenPostfix: '.msdax',
|
||||||
ignoreCase: true,
|
ignoreCase: true,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
comments: {
|
comments: {
|
||||||
lineComment: '//',
|
lineComment: '//',
|
||||||
blockComment: ['/*', '*/'],
|
blockComment: ['/*', '*/'],
|
||||||
|
|
@ -34,7 +34,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.objective-c',
|
tokenPostfix: '.objective-c',
|
||||||
|
|
||||||
|
|
|
||||||
40
src/php.ts
40
src/php.ts
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
||||||
|
|
||||||
comments: {
|
comments: {
|
||||||
|
|
@ -31,17 +31,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const htmlTokenTypes = {
|
export const language = <ILanguage>{
|
||||||
DELIM_START: 'delimiter.html',
|
|
||||||
DELIM_END: 'delimiter.html',
|
|
||||||
DELIM_COMMENT: 'comment.html',
|
|
||||||
COMMENT: 'comment.content.html',
|
|
||||||
getTag: (name: string) => {
|
|
||||||
return 'tag.html';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '',
|
tokenPostfix: '',
|
||||||
// ignoreCase: true,
|
// ignoreCase: true,
|
||||||
|
|
@ -52,12 +42,12 @@ export var language = <ILanguage>{
|
||||||
[/<\?((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+)(\/>)/, [htmlTokenTypes.DELIM_START, 'tag.html', htmlTokenTypes.DELIM_END]],
|
[/(<)(\w+)(\/>)/, ['delimiter.html', 'tag.html', 'delimiter.html']],
|
||||||
[/(<)(script)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@script' }]],
|
[/(<)(script)/, ['delimiter.html', { token: 'tag.html', next: '@script' }]],
|
||||||
[/(<)(style)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@style' }]],
|
[/(<)(style)/, ['delimiter.html', { token: 'tag.html', next: '@style' }]],
|
||||||
[/(<)([:\w]+)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@otherTag' }]],
|
[/(<)([:\w]+)/, ['delimiter.html', { token: 'tag.html', next: '@otherTag' }]],
|
||||||
[/(<\/)(\w+)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@otherTag' }]],
|
[/(<\/)(\w+)/, ['delimiter.html', { token: 'tag.html', next: '@otherTag' }]],
|
||||||
[/</, htmlTokenTypes.DELIM_START],
|
[/</, 'delimiter.html'],
|
||||||
[/[^<]+/] // text
|
[/[^<]+/] // text
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
@ -76,7 +66,7 @@ export var language = <ILanguage>{
|
||||||
|
|
||||||
otherTag: [
|
otherTag: [
|
||||||
[/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.otherTag' }],
|
[/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.otherTag' }],
|
||||||
[/\/?>/, htmlTokenTypes.DELIM_END, '@pop'],
|
[/\/?>/, 'delimiter.html', '@pop'],
|
||||||
[/"([^"]*)"/, 'attribute.value'],
|
[/"([^"]*)"/, 'attribute.value'],
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
|
|
@ -94,9 +84,9 @@ export var language = <ILanguage>{
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
[/=/, 'delimiter'],
|
[/=/, 'delimiter'],
|
||||||
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.text/javascript', nextEmbedded: 'text/javascript' }],
|
[/>/, { token: 'delimiter.html', next: '@scriptEmbedded.text/javascript', nextEmbedded: 'text/javascript' }],
|
||||||
[/[ \t\r\n]+/], // whitespace
|
[/[ \t\r\n]+/], // whitespace
|
||||||
[/(<\/)(script\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag.html', { token: htmlTokenTypes.DELIM_END, next: '@pop' }]]
|
[/(<\/)(script\s*)(>)/, ['delimiter.html', 'tag.html', { token: 'delimiter.html', next: '@pop' }]]
|
||||||
],
|
],
|
||||||
|
|
||||||
// After <script ... type
|
// After <script ... type
|
||||||
|
|
@ -119,7 +109,7 @@ export var language = <ILanguage>{
|
||||||
// After <script ... type = $S2
|
// After <script ... type = $S2
|
||||||
scriptWithCustomType: [
|
scriptWithCustomType: [
|
||||||
[/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.scriptWithCustomType.$S2' }],
|
[/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.scriptWithCustomType.$S2' }],
|
||||||
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.$S2', nextEmbedded: '$S2' }],
|
[/>/, { token: 'delimiter.html', next: '@scriptEmbedded.$S2', nextEmbedded: '$S2' }],
|
||||||
[/"([^"]*)"/, 'attribute.value'],
|
[/"([^"]*)"/, 'attribute.value'],
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
|
|
@ -146,9 +136,9 @@ export var language = <ILanguage>{
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
[/=/, 'delimiter'],
|
[/=/, 'delimiter'],
|
||||||
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.text/css', nextEmbedded: 'text/css' }],
|
[/>/, { token: 'delimiter.html', next: '@styleEmbedded.text/css', nextEmbedded: 'text/css' }],
|
||||||
[/[ \t\r\n]+/], // whitespace
|
[/[ \t\r\n]+/], // whitespace
|
||||||
[/(<\/)(style\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag.html', { token: htmlTokenTypes.DELIM_END, next: '@pop' }]]
|
[/(<\/)(style\s*)(>)/, ['delimiter.html', 'tag.html', { token: 'delimiter.html', next: '@pop' }]]
|
||||||
],
|
],
|
||||||
|
|
||||||
// After <style ... type
|
// After <style ... type
|
||||||
|
|
@ -171,7 +161,7 @@ export var language = <ILanguage>{
|
||||||
// After <style ... type = $S2
|
// After <style ... type = $S2
|
||||||
styleWithCustomType: [
|
styleWithCustomType: [
|
||||||
[/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.styleWithCustomType.$S2' }],
|
[/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.styleWithCustomType.$S2' }],
|
||||||
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.$S2', nextEmbedded: '$S2' }],
|
[/>/, { token: 'delimiter.html', next: '@styleEmbedded.$S2', nextEmbedded: '$S2' }],
|
||||||
[/"([^"]*)"/, 'attribute.value'],
|
[/"([^"]*)"/, 'attribute.value'],
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
comments: {
|
comments: {
|
||||||
lineComment: '//',
|
lineComment: '//',
|
||||||
blockComment: ['(*', '*)'],
|
blockComment: ['(*', '*)'],
|
||||||
|
|
@ -24,7 +24,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
tokenPostfix: '.pats',
|
tokenPostfix: '.pats',
|
||||||
|
|
||||||
// TODO: staload and dynload are followed by a special kind of string literals
|
// TODO: staload and dynload are followed by a special kind of string literals
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
// the default separators except `$-`
|
// the default separators except `$-`
|
||||||
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#%\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#%\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
||||||
comments: {
|
comments: {
|
||||||
|
|
@ -36,7 +36,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
ignoreCase: true,
|
ignoreCase: true,
|
||||||
tokenPostfix: '.ps1',
|
tokenPostfix: '.ps1',
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
comments: {
|
comments: {
|
||||||
lineComment: '#',
|
lineComment: '#',
|
||||||
blockComment: ['\'\'\'', '\'\'\''],
|
blockComment: ['\'\'\'', '\'\'\''],
|
||||||
|
|
@ -34,7 +34,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.python',
|
tokenPostfix: '.python',
|
||||||
|
|
||||||
|
|
|
||||||
4
src/r.ts
4
src/r.ts
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
comments: {
|
comments: {
|
||||||
lineComment: '#'
|
lineComment: '#'
|
||||||
},
|
},
|
||||||
|
|
@ -31,7 +31,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.r',
|
tokenPostfix: '.r',
|
||||||
|
|
||||||
|
|
|
||||||
48
src/razor.ts
48
src/razor.ts
|
|
@ -9,11 +9,11 @@ import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
// Allow for running under nodejs/requirejs in tests
|
// Allow for running under nodejs/requirejs in tests
|
||||||
var _monaco: typeof monaco = (typeof monaco === 'undefined' ? (<any>self).monaco : monaco);
|
const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (<any>self).monaco : monaco);
|
||||||
|
|
||||||
const EMPTY_ELEMENTS: string[] = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'];
|
const EMPTY_ELEMENTS: string[] = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'];
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
|
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
|
||||||
|
|
||||||
comments: {
|
comments: {
|
||||||
|
|
@ -54,17 +54,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const htmlTokenTypes = {
|
export const language = <ILanguage>{
|
||||||
DELIM_START: 'delimiter.html',
|
|
||||||
DELIM_END: 'delimiter.html',
|
|
||||||
DELIM_COMMENT: 'comment.html',
|
|
||||||
COMMENT: 'comment.content.html',
|
|
||||||
getTag: (name: string) => {
|
|
||||||
return 'tag.html';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '',
|
tokenPostfix: '',
|
||||||
// ignoreCase: true,
|
// ignoreCase: true,
|
||||||
|
|
@ -76,12 +66,12 @@ export var language = <ILanguage>{
|
||||||
[/@[^@]/, { 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+)(\/>)/, [htmlTokenTypes.DELIM_START, 'tag.html', htmlTokenTypes.DELIM_END]],
|
[/(<)(\w+)(\/>)/, ['delimiter.html', 'tag.html', 'delimiter.html']],
|
||||||
[/(<)(script)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@script' }]],
|
[/(<)(script)/, ['delimiter.html', { token: 'tag.html', next: '@script' }]],
|
||||||
[/(<)(style)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@style' }]],
|
[/(<)(style)/, ['delimiter.html', { token: 'tag.html', next: '@style' }]],
|
||||||
[/(<)([:\w]+)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@otherTag' }]],
|
[/(<)([:\w]+)/, ['delimiter.html', { token: 'tag.html', next: '@otherTag' }]],
|
||||||
[/(<\/)(\w+)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@otherTag' }]],
|
[/(<\/)(\w+)/, ['delimiter.html', { token: 'tag.html', next: '@otherTag' }]],
|
||||||
[/</, htmlTokenTypes.DELIM_START],
|
[/</, 'delimiter.html'],
|
||||||
[/[ \t\r\n]+/], // whitespace
|
[/[ \t\r\n]+/], // whitespace
|
||||||
[/[^<@]+/], // text
|
[/[^<@]+/], // text
|
||||||
],
|
],
|
||||||
|
|
@ -101,7 +91,7 @@ export var language = <ILanguage>{
|
||||||
|
|
||||||
otherTag: [
|
otherTag: [
|
||||||
[/@[^@]/, { token: '@rematch', switchTo: '@razorInSimpleState.otherTag' }],
|
[/@[^@]/, { token: '@rematch', switchTo: '@razorInSimpleState.otherTag' }],
|
||||||
[/\/?>/, htmlTokenTypes.DELIM_END, '@pop'],
|
[/\/?>/, 'delimiter.html', '@pop'],
|
||||||
[/"([^"]*)"/, 'attribute.value'],
|
[/"([^"]*)"/, 'attribute.value'],
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
|
|
@ -119,9 +109,9 @@ export var language = <ILanguage>{
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
[/=/, 'delimiter'],
|
[/=/, 'delimiter'],
|
||||||
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.text/javascript', nextEmbedded: 'text/javascript' }],
|
[/>/, { token: 'delimiter.html', next: '@scriptEmbedded.text/javascript', nextEmbedded: 'text/javascript' }],
|
||||||
[/[ \t\r\n]+/], // whitespace
|
[/[ \t\r\n]+/], // whitespace
|
||||||
[/(<\/)(script\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag.html', { token: htmlTokenTypes.DELIM_END, next: '@pop' }]]
|
[/(<\/)(script\s*)(>)/, ['delimiter.html', 'tag.html', { token: 'delimiter.html', next: '@pop' }]]
|
||||||
],
|
],
|
||||||
|
|
||||||
// After <script ... type
|
// After <script ... type
|
||||||
|
|
@ -144,7 +134,7 @@ export var language = <ILanguage>{
|
||||||
// After <script ... type = $S2
|
// After <script ... type = $S2
|
||||||
scriptWithCustomType: [
|
scriptWithCustomType: [
|
||||||
[/@[^@]/, { token: '@rematch', switchTo: '@razorInSimpleState.scriptWithCustomType.$S2' }],
|
[/@[^@]/, { token: '@rematch', switchTo: '@razorInSimpleState.scriptWithCustomType.$S2' }],
|
||||||
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.$S2', nextEmbedded: '$S2' }],
|
[/>/, { token: 'delimiter.html', next: '@scriptEmbedded.$S2', nextEmbedded: '$S2' }],
|
||||||
[/"([^"]*)"/, 'attribute.value'],
|
[/"([^"]*)"/, 'attribute.value'],
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
|
|
@ -171,9 +161,9 @@ export var language = <ILanguage>{
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
[/=/, 'delimiter'],
|
[/=/, 'delimiter'],
|
||||||
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.text/css', nextEmbedded: 'text/css' }],
|
[/>/, { token: 'delimiter.html', next: '@styleEmbedded.text/css', nextEmbedded: 'text/css' }],
|
||||||
[/[ \t\r\n]+/], // whitespace
|
[/[ \t\r\n]+/], // whitespace
|
||||||
[/(<\/)(style\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag.html', { token: htmlTokenTypes.DELIM_END, next: '@pop' }]]
|
[/(<\/)(style\s*)(>)/, ['delimiter.html', 'tag.html', { token: 'delimiter.html', next: '@pop' }]]
|
||||||
],
|
],
|
||||||
|
|
||||||
// After <style ... type
|
// After <style ... type
|
||||||
|
|
@ -196,7 +186,7 @@ export var language = <ILanguage>{
|
||||||
// After <style ... type = $S2
|
// After <style ... type = $S2
|
||||||
styleWithCustomType: [
|
styleWithCustomType: [
|
||||||
[/@[^@]/, { token: '@rematch', switchTo: '@razorInSimpleState.styleWithCustomType.$S2' }],
|
[/@[^@]/, { token: '@rematch', switchTo: '@razorInSimpleState.styleWithCustomType.$S2' }],
|
||||||
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.$S2', nextEmbedded: '$S2' }],
|
[/>/, { token: 'delimiter.html', next: '@styleEmbedded.$S2', nextEmbedded: '$S2' }],
|
||||||
[/"([^"]*)"/, 'attribute.value'],
|
[/"([^"]*)"/, 'attribute.value'],
|
||||||
[/'([^']*)'/, 'attribute.value'],
|
[/'([^']*)'/, 'attribute.value'],
|
||||||
[/[\w\-]+/, 'attribute.name'],
|
[/[\w\-]+/, 'attribute.name'],
|
||||||
|
|
@ -279,9 +269,9 @@ export var language = <ILanguage>{
|
||||||
[/'([^']*)'/, 'string.cs'],
|
[/'([^']*)'/, 'string.cs'],
|
||||||
|
|
||||||
// simple html
|
// simple html
|
||||||
[/(<)(\w+)(\/>)/, [htmlTokenTypes.DELIM_START, 'tag.html', htmlTokenTypes.DELIM_END]],
|
[/(<)(\w+)(\/>)/, ['delimiter.html', 'tag.html', 'delimiter.html']],
|
||||||
[/(<)(\w+)(>)/, [htmlTokenTypes.DELIM_START, 'tag.html', htmlTokenTypes.DELIM_END]],
|
[/(<)(\w+)(>)/, ['delimiter.html', 'tag.html', 'delimiter.html']],
|
||||||
[/(<\/)(\w+)(>)/, [htmlTokenTypes.DELIM_START, 'tag.html', htmlTokenTypes.DELIM_END]],
|
[/(<\/)(\w+)(>)/, ['delimiter.html', 'tag.html', 'delimiter.html']],
|
||||||
|
|
||||||
// delimiters
|
// delimiters
|
||||||
[/[\+\-\*\%\&\|\^\~\!\=\<\>\/\?\;\:\.\,]/, 'delimiter.cs'],
|
[/[\+\-\*\%\&\|\^\~\!\=\<\>\/\?\;\:\.\,]/, 'delimiter.cs'],
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
comments: {
|
comments: {
|
||||||
lineComment: '#',
|
lineComment: '#',
|
||||||
blockComment: ['=begin', '=end'],
|
blockComment: ['=begin', '=end'],
|
||||||
|
|
@ -83,7 +83,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
* regular expression can also contain comments.
|
* regular expression can also contain comments.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
tokenPostfix: '.ruby',
|
tokenPostfix: '.ruby',
|
||||||
|
|
||||||
keywords: [
|
keywords: [
|
||||||
|
|
|
||||||
44
src/scss.ts
44
src/scss.ts
|
|
@ -8,7 +8,7 @@
|
||||||
import LanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import LanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import IMonarchLanguage = monaco.languages.IMonarchLanguage;
|
import IMonarchLanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: LanguageConfiguration = {
|
export const conf: LanguageConfiguration = {
|
||||||
wordPattern: /(#?-?\d*\.\d\w*%?)|([@$#!.:]?[\w-?]+%?)|[@#!.]/g,
|
wordPattern: /(#?-?\d*\.\d\w*%?)|([@$#!.:]?[\w-?]+%?)|[@#!.]/g,
|
||||||
comments: {
|
comments: {
|
||||||
blockComment: ['/*', '*/'],
|
blockComment: ['/*', '*/'],
|
||||||
|
|
@ -35,13 +35,7 @@ export var conf: LanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
const TOKEN_SELECTOR = 'tag';
|
export const language = <IMonarchLanguage>{
|
||||||
const TOKEN_SELECTOR_TAG = 'tag';
|
|
||||||
const TOKEN_PROPERTY = 'attribute.name';
|
|
||||||
const TOKEN_VALUE = 'attribute.value';
|
|
||||||
const TOKEN_AT_KEYWORD = 'keyword';
|
|
||||||
|
|
||||||
export var language = <IMonarchLanguage>{
|
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.scss',
|
tokenPostfix: '.scss',
|
||||||
|
|
||||||
|
|
@ -65,32 +59,32 @@ export var language = <IMonarchLanguage>{
|
||||||
{ include: '@import' },
|
{ include: '@import' },
|
||||||
{ include: '@variabledeclaration' },
|
{ include: '@variabledeclaration' },
|
||||||
{ include: '@warndebug' }, // sass: log statements
|
{ include: '@warndebug' }, // sass: log statements
|
||||||
['[@](include)', { token: TOKEN_AT_KEYWORD, next: '@includedeclaration' }], // sass: include statement
|
['[@](include)', { token: 'keyword', next: '@includedeclaration' }], // sass: include statement
|
||||||
['[@](keyframes|-webkit-keyframes|-moz-keyframes|-o-keyframes)', { token: TOKEN_AT_KEYWORD, next: '@keyframedeclaration' }],
|
['[@](keyframes|-webkit-keyframes|-moz-keyframes|-o-keyframes)', { token: 'keyword', next: '@keyframedeclaration' }],
|
||||||
['[@](page|content|font-face|-moz-document)', { token: TOKEN_AT_KEYWORD }], // sass: placeholder for includes
|
['[@](page|content|font-face|-moz-document)', { token: 'keyword' }], // sass: placeholder for includes
|
||||||
['[@](charset|namespace)', { token: TOKEN_AT_KEYWORD, next: '@declarationbody' }],
|
['[@](charset|namespace)', { token: 'keyword', next: '@declarationbody' }],
|
||||||
['[@](function)', { token: TOKEN_AT_KEYWORD, next: '@functiondeclaration' }],
|
['[@](function)', { token: 'keyword', next: '@functiondeclaration' }],
|
||||||
['[@](mixin)', { token: TOKEN_AT_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
|
||||||
{ include: '@selectorname' },
|
{ include: '@selectorname' },
|
||||||
['[&\\*]', TOKEN_SELECTOR_TAG], // selector symbols
|
['[&\\*]', 'tag'], // selector symbols
|
||||||
['[>\\+,]', 'delimiter'], // selector operators
|
['[>\\+,]', 'delimiter'], // selector operators
|
||||||
['\\[', { token: 'delimiter.bracket', next: '@selectorattribute' }],
|
['\\[', { token: 'delimiter.bracket', next: '@selectorattribute' }],
|
||||||
['{', { token: 'delimiter.curly', next: '@selectorbody' }],
|
['{', { token: 'delimiter.curly', next: '@selectorbody' }],
|
||||||
],
|
],
|
||||||
|
|
||||||
selectorbody: [
|
selectorbody: [
|
||||||
['[*_]?@identifier@ws:(?=(\\s|\\d|[^{;}]*[;}]))', TOKEN_PROPERTY, '@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: TOKEN_AT_KEYWORD, next: '@extendbody' }], // sass: extend other selectors
|
['[@](extend)', { token: 'keyword', next: '@extendbody' }], // sass: extend other selectors
|
||||||
['[@](return)', { token: TOKEN_AT_KEYWORD, next: '@declarationbody' }],
|
['[@](return)', { token: 'keyword', next: '@declarationbody' }],
|
||||||
['}', { token: 'delimiter.curly', next: '@pop' }],
|
['}', { token: 'delimiter.curly', next: '@pop' }],
|
||||||
],
|
],
|
||||||
|
|
||||||
selectorname: [
|
selectorname: [
|
||||||
['#{', { token: 'meta', next: '@variableinterpolation' }], // sass: interpolation
|
['#{', { token: 'meta', next: '@variableinterpolation' }], // sass: interpolation
|
||||||
['(\\.|#(?=[^{])|%|(@identifier)|:)+', TOKEN_SELECTOR], // selector (.foo, div, ...)
|
['(\\.|#(?=[^{])|%|(@identifier)|:)+', 'tag'], // selector (.foo, div, ...)
|
||||||
],
|
],
|
||||||
|
|
||||||
selectorattribute: [
|
selectorattribute: [
|
||||||
|
|
@ -122,17 +116,17 @@ export var language = <IMonarchLanguage>{
|
||||||
],
|
],
|
||||||
|
|
||||||
nestedproperty: [
|
nestedproperty: [
|
||||||
['[*_]?@identifier@ws:', TOKEN_PROPERTY, '@rulevalue'],
|
['[*_]?@identifier@ws:', 'attribute.name', '@rulevalue'],
|
||||||
{ include: '@comments' },
|
{ include: '@comments' },
|
||||||
['}', { token: 'delimiter.curly', next: '@pop' }],
|
['}', { token: 'delimiter.curly', next: '@pop' }],
|
||||||
],
|
],
|
||||||
|
|
||||||
warndebug: [
|
warndebug: [
|
||||||
['[@](warn|debug)', { token: TOKEN_AT_KEYWORD, next: '@declarationbody' }],
|
['[@](warn|debug)', { token: 'keyword', next: '@declarationbody' }],
|
||||||
],
|
],
|
||||||
|
|
||||||
import: [
|
import: [
|
||||||
['[@](import)', { token: TOKEN_AT_KEYWORD, next: '@declarationbody' }],
|
['[@](import)', { token: 'keyword', next: '@declarationbody' }],
|
||||||
],
|
],
|
||||||
|
|
||||||
variabledeclaration: [ // sass variables
|
variabledeclaration: [ // sass variables
|
||||||
|
|
@ -185,7 +179,7 @@ export var language = <IMonarchLanguage>{
|
||||||
],
|
],
|
||||||
|
|
||||||
name: [
|
name: [
|
||||||
['@identifier', TOKEN_VALUE],
|
['@identifier', 'attribute.value'],
|
||||||
],
|
],
|
||||||
|
|
||||||
numbers: [
|
numbers: [
|
||||||
|
|
@ -248,7 +242,7 @@ export var language = <IMonarchLanguage>{
|
||||||
],
|
],
|
||||||
|
|
||||||
functionbody: [
|
functionbody: [
|
||||||
['[@](return)', { token: TOKEN_AT_KEYWORD }],
|
['[@](return)', { token: 'keyword' }],
|
||||||
{ include: '@variabledeclaration' },
|
{ include: '@variabledeclaration' },
|
||||||
{ include: '@term' },
|
{ include: '@term' },
|
||||||
{ include: '@controlstatement' },
|
{ include: '@controlstatement' },
|
||||||
|
|
@ -261,7 +255,7 @@ export var language = <IMonarchLanguage>{
|
||||||
],
|
],
|
||||||
|
|
||||||
functionarguments: [
|
functionarguments: [
|
||||||
['\\$@identifier@ws:', TOKEN_PROPERTY],
|
['\\$@identifier@ws:', 'attribute.name'],
|
||||||
['[,]', 'delimiter'],
|
['[,]', 'delimiter'],
|
||||||
{ include: '@term' },
|
{ include: '@term' },
|
||||||
['\\)', { token: 'meta', next: '@pop' }],
|
['\\)', { token: 'meta', next: '@pop' }],
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
comments: {
|
comments: {
|
||||||
lineComment: '//',
|
lineComment: '//',
|
||||||
blockComment: ['/*', '*/'],
|
blockComment: ['/*', '*/'],
|
||||||
|
|
@ -17,7 +17,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.sol',
|
tokenPostfix: '.sol',
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
comments: {
|
comments: {
|
||||||
lineComment: '--',
|
lineComment: '--',
|
||||||
blockComment: ['/*', '*/'],
|
blockComment: ['/*', '*/'],
|
||||||
|
|
@ -34,7 +34,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.sql',
|
tokenPostfix: '.sql',
|
||||||
ignoreCase: true,
|
ignoreCase: true,
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
comments: {
|
comments: {
|
||||||
lineComment: '//',
|
lineComment: '//',
|
||||||
blockComment: ['/*', '*/'],
|
blockComment: ['/*', '*/'],
|
||||||
|
|
@ -35,7 +35,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.swift',
|
tokenPostfix: '.swift',
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
comments: {
|
comments: {
|
||||||
lineComment: '\'',
|
lineComment: '\'',
|
||||||
blockComment: ['/*', '*/'],
|
blockComment: ['/*', '*/'],
|
||||||
|
|
@ -50,7 +50,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.vb',
|
tokenPostfix: '.vb',
|
||||||
ignoreCase: true,
|
ignoreCase: true,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||||
|
|
||||||
export var conf: IRichLanguageConfiguration = {
|
export const conf: IRichLanguageConfiguration = {
|
||||||
comments: {
|
comments: {
|
||||||
blockComment: ['<!--', '-->'],
|
blockComment: ['<!--', '-->'],
|
||||||
},
|
},
|
||||||
|
|
@ -27,7 +27,7 @@ export var conf: IRichLanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
export var language = <ILanguage>{
|
export const language = <ILanguage>{
|
||||||
defaultToken: '',
|
defaultToken: '',
|
||||||
tokenPostfix: '.xml',
|
tokenPostfix: '.xml',
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,23 +6,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { testTokenization } from './testRunner';
|
import { testTokenization } from './testRunner';
|
||||||
import { htmlTokenTypes } from '../src/handlebars';
|
|
||||||
|
|
||||||
const HTML_DELIM_START = htmlTokenTypes.DELIM_START;
|
|
||||||
const HTML_DELIM_END = htmlTokenTypes.DELIM_END;
|
|
||||||
const DELIM_ASSIGN = 'delimiter';
|
|
||||||
const HTML_ATTRIB_NAME = 'attribute.name';
|
|
||||||
const HTML_ATTRIB_VALUE = 'attribute.value';
|
|
||||||
function getTag(name: string) {
|
|
||||||
return htmlTokenTypes.getTag(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
const handlebarsTokenTypes = {
|
|
||||||
EMBED: 'delimiter.handlebars',
|
|
||||||
EMBED_UNESCAPED: 'delimiter.handlebars',
|
|
||||||
KEYWORD: 'keyword.helper.handlebars',
|
|
||||||
VARIABLE: 'variable.parameter.handlebars',
|
|
||||||
}
|
|
||||||
|
|
||||||
testTokenization(['handlebars', 'css'], [
|
testTokenization(['handlebars', 'css'], [
|
||||||
|
|
||||||
|
|
@ -30,13 +13,13 @@ testTokenization(['handlebars', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<h1>handlebars!</h1>',
|
line: '<h1>handlebars!</h1>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: HTML_DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('h1') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 3, type: HTML_DELIM_END },
|
{ startIndex: 3, type: 'delimiter.html' },
|
||||||
{ startIndex: 4, type: '' },
|
{ startIndex: 4, type: '' },
|
||||||
{ startIndex: 15, type: HTML_DELIM_START },
|
{ startIndex: 15, type: 'delimiter.html' },
|
||||||
{ startIndex: 17, type: getTag('h1') },
|
{ startIndex: 17, type: 'tag.html' },
|
||||||
{ startIndex: 19, type: HTML_DELIM_END }
|
{ startIndex: 19, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -44,17 +27,17 @@ testTokenization(['handlebars', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<h1>{{ title }}</h1>',
|
line: '<h1>{{ title }}</h1>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: HTML_DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('h1') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 3, type: HTML_DELIM_END },
|
{ startIndex: 3, type: 'delimiter.html' },
|
||||||
{ startIndex: 4, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 4, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 6, type: '' },
|
{ startIndex: 6, type: '' },
|
||||||
{ startIndex: 7, type: handlebarsTokenTypes.VARIABLE },
|
{ startIndex: 7, type: 'variable.parameter.handlebars' },
|
||||||
{ startIndex: 12, type: '' },
|
{ startIndex: 12, type: '' },
|
||||||
{ startIndex: 13, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 13, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 15, type: HTML_DELIM_START },
|
{ startIndex: 15, type: 'delimiter.html' },
|
||||||
{ startIndex: 17, type: getTag('h1') },
|
{ startIndex: 17, type: 'tag.html' },
|
||||||
{ startIndex: 19, type: HTML_DELIM_END }
|
{ startIndex: 19, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -62,15 +45,15 @@ testTokenization(['handlebars', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<h1>{{title}}</h1>',
|
line: '<h1>{{title}}</h1>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: HTML_DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('h1') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 3, type: HTML_DELIM_END },
|
{ startIndex: 3, type: 'delimiter.html' },
|
||||||
{ startIndex: 4, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 4, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 6, type: handlebarsTokenTypes.VARIABLE },
|
{ startIndex: 6, type: 'variable.parameter.handlebars' },
|
||||||
{ startIndex: 11, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 11, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 13, type: HTML_DELIM_START },
|
{ startIndex: 13, type: 'delimiter.html' },
|
||||||
{ startIndex: 15, type: getTag('h1') },
|
{ startIndex: 15, type: 'tag.html' },
|
||||||
{ startIndex: 17, type: HTML_DELIM_END }
|
{ startIndex: 17, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -78,17 +61,17 @@ testTokenization(['handlebars', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<h1>{{{ title }}}</h1>',
|
line: '<h1>{{{ title }}}</h1>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: HTML_DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('h1') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 3, type: HTML_DELIM_END },
|
{ startIndex: 3, type: 'delimiter.html' },
|
||||||
{ startIndex: 4, type: handlebarsTokenTypes.EMBED_UNESCAPED },
|
{ startIndex: 4, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 7, type: '' },
|
{ startIndex: 7, type: '' },
|
||||||
{ startIndex: 8, type: handlebarsTokenTypes.VARIABLE },
|
{ startIndex: 8, type: 'variable.parameter.handlebars' },
|
||||||
{ startIndex: 13, type: '' },
|
{ startIndex: 13, type: '' },
|
||||||
{ startIndex: 14, type: handlebarsTokenTypes.EMBED_UNESCAPED },
|
{ startIndex: 14, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 17, type: HTML_DELIM_START },
|
{ startIndex: 17, type: 'delimiter.html' },
|
||||||
{ startIndex: 19, type: getTag('h1') },
|
{ startIndex: 19, type: 'tag.html' },
|
||||||
{ startIndex: 21, type: HTML_DELIM_END }
|
{ startIndex: 21, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -96,29 +79,29 @@ testTokenization(['handlebars', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<ul>{{#each items}}<li>{{item}}</li>{{/each}}</ul>',
|
line: '<ul>{{#each items}}<li>{{item}}</li>{{/each}}</ul>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: HTML_DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('ul') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 3, type: HTML_DELIM_END },
|
{ startIndex: 3, type: 'delimiter.html' },
|
||||||
{ startIndex: 4, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 4, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 6, type: handlebarsTokenTypes.KEYWORD },
|
{ startIndex: 6, type: 'keyword.helper.handlebars' },
|
||||||
{ startIndex: 11, type: '' },
|
{ startIndex: 11, type: '' },
|
||||||
{ startIndex: 12, type: handlebarsTokenTypes.VARIABLE },
|
{ startIndex: 12, type: 'variable.parameter.handlebars' },
|
||||||
{ startIndex: 17, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 17, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 19, type: HTML_DELIM_START },
|
{ startIndex: 19, type: 'delimiter.html' },
|
||||||
{ startIndex: 20, type: getTag('li') },
|
{ startIndex: 20, type: 'tag.html' },
|
||||||
{ startIndex: 22, type: HTML_DELIM_END },
|
{ startIndex: 22, type: 'delimiter.html' },
|
||||||
{ startIndex: 23, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 23, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 25, type: handlebarsTokenTypes.VARIABLE },
|
{ startIndex: 25, type: 'variable.parameter.handlebars' },
|
||||||
{ startIndex: 29, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 29, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 31, type: HTML_DELIM_START },
|
{ startIndex: 31, type: 'delimiter.html' },
|
||||||
{ startIndex: 33, type: getTag('li') },
|
{ startIndex: 33, type: 'tag.html' },
|
||||||
{ startIndex: 35, type: HTML_DELIM_END },
|
{ startIndex: 35, type: 'delimiter.html' },
|
||||||
{ startIndex: 36, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 36, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 38, type: handlebarsTokenTypes.KEYWORD },
|
{ startIndex: 38, type: 'keyword.helper.handlebars' },
|
||||||
{ startIndex: 43, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 43, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 45, type: HTML_DELIM_START },
|
{ startIndex: 45, type: 'delimiter.html' },
|
||||||
{ startIndex: 47, type: getTag('ul') },
|
{ startIndex: 47, type: 'tag.html' },
|
||||||
{ startIndex: 49, type: HTML_DELIM_END }
|
{ startIndex: 49, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -126,38 +109,38 @@ testTokenization(['handlebars', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<div>',
|
line: '<div>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: HTML_DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('div') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 4, type: HTML_DELIM_END }
|
{ startIndex: 4, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
line: '{{#if foo}}',
|
line: '{{#if foo}}',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 0, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 2, type: handlebarsTokenTypes.KEYWORD },
|
{ startIndex: 2, type: 'keyword.helper.handlebars' },
|
||||||
{ startIndex: 5, type: '' },
|
{ startIndex: 5, type: '' },
|
||||||
{ startIndex: 6, type: handlebarsTokenTypes.VARIABLE },
|
{ startIndex: 6, type: 'variable.parameter.handlebars' },
|
||||||
{ startIndex: 9, type: handlebarsTokenTypes.EMBED }
|
{ startIndex: 9, type: 'delimiter.handlebars' }
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
line: '<span>{{bar}}</span>',
|
line: '<span>{{bar}}</span>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: HTML_DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('span') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 5, type: HTML_DELIM_END },
|
{ startIndex: 5, type: 'delimiter.html' },
|
||||||
{ startIndex: 6, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 6, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 8, type: handlebarsTokenTypes.VARIABLE },
|
{ startIndex: 8, type: 'variable.parameter.handlebars' },
|
||||||
{ startIndex: 11, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 11, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 13, type: HTML_DELIM_START },
|
{ startIndex: 13, type: 'delimiter.html' },
|
||||||
{ startIndex: 15, type: getTag('span') },
|
{ startIndex: 15, type: 'tag.html' },
|
||||||
{ startIndex: 19, type: HTML_DELIM_END }
|
{ startIndex: 19, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
line: '{{/if}}',
|
line: '{{/if}}',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 0, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 2, type: handlebarsTokenTypes.KEYWORD },
|
{ startIndex: 2, type: 'keyword.helper.handlebars' },
|
||||||
{ startIndex: 5, type: handlebarsTokenTypes.EMBED }
|
{ startIndex: 5, type: 'delimiter.handlebars' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -165,9 +148,9 @@ testTokenization(['handlebars', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '</div>',
|
line: '</div>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: HTML_DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 2, type: getTag('div') },
|
{ startIndex: 2, type: 'tag.html' },
|
||||||
{ startIndex: 5, type: HTML_DELIM_END }
|
{ startIndex: 5, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -175,27 +158,27 @@ testTokenization(['handlebars', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<script type="text/x-handlebars-template"><h1>{{ title }}</h1></script>',
|
line: '<script type="text/x-handlebars-template"><h1>{{ title }}</h1></script>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: HTML_DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('script') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 7, type: '' },
|
{ startIndex: 7, type: '' },
|
||||||
{ startIndex: 8, type: HTML_ATTRIB_NAME },
|
{ startIndex: 8, type: 'attribute.name' },
|
||||||
{ startIndex: 12, type: DELIM_ASSIGN },
|
{ startIndex: 12, type: 'delimiter' },
|
||||||
{ startIndex: 13, type: HTML_ATTRIB_VALUE },
|
{ startIndex: 13, type: 'attribute.value' },
|
||||||
{ startIndex: 41, type: HTML_DELIM_END },
|
{ startIndex: 41, type: 'delimiter.html' },
|
||||||
{ startIndex: 42, type: HTML_DELIM_START },
|
{ startIndex: 42, type: 'delimiter.html' },
|
||||||
{ startIndex: 43, type: getTag('h1') },
|
{ startIndex: 43, type: 'tag.html' },
|
||||||
{ startIndex: 45, type: HTML_DELIM_END },
|
{ startIndex: 45, type: 'delimiter.html' },
|
||||||
{ startIndex: 46, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 46, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 48, type: '' },
|
{ startIndex: 48, type: '' },
|
||||||
{ startIndex: 49, type: handlebarsTokenTypes.VARIABLE },
|
{ startIndex: 49, type: 'variable.parameter.handlebars' },
|
||||||
{ startIndex: 54, type: '' },
|
{ startIndex: 54, type: '' },
|
||||||
{ startIndex: 55, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 55, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 57, type: HTML_DELIM_START },
|
{ startIndex: 57, type: 'delimiter.html' },
|
||||||
{ startIndex: 59, type: getTag('h1') },
|
{ startIndex: 59, type: 'tag.html' },
|
||||||
{ startIndex: 61, type: HTML_DELIM_END },
|
{ startIndex: 61, type: 'delimiter.html' },
|
||||||
{ startIndex: 62, type: HTML_DELIM_START },
|
{ startIndex: 62, type: 'delimiter.html' },
|
||||||
{ startIndex: 64, type: getTag('script') },
|
{ startIndex: 64, type: 'tag.html' },
|
||||||
{ startIndex: 70, type: HTML_DELIM_END }
|
{ startIndex: 70, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -203,35 +186,35 @@ testTokenization(['handlebars', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<script type="text/x-handlebars-template">',
|
line: '<script type="text/x-handlebars-template">',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: HTML_DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('script') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 7, type: '' },
|
{ startIndex: 7, type: '' },
|
||||||
{ startIndex: 8, type: HTML_ATTRIB_NAME },
|
{ startIndex: 8, type: 'attribute.name' },
|
||||||
{ startIndex: 12, type: DELIM_ASSIGN },
|
{ startIndex: 12, type: 'delimiter' },
|
||||||
{ startIndex: 13, type: HTML_ATTRIB_VALUE },
|
{ startIndex: 13, type: 'attribute.value' },
|
||||||
{ startIndex: 41, type: HTML_DELIM_END }
|
{ startIndex: 41, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
line: '<h1>{{ title }}</h1>',
|
line: '<h1>{{ title }}</h1>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: HTML_DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('h1') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 3, type: HTML_DELIM_END },
|
{ startIndex: 3, type: 'delimiter.html' },
|
||||||
{ startIndex: 4, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 4, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 6, type: '' },
|
{ startIndex: 6, type: '' },
|
||||||
{ startIndex: 7, type: handlebarsTokenTypes.VARIABLE },
|
{ startIndex: 7, type: 'variable.parameter.handlebars' },
|
||||||
{ startIndex: 12, type: '' },
|
{ startIndex: 12, type: '' },
|
||||||
{ startIndex: 13, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 13, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 15, type: HTML_DELIM_START },
|
{ startIndex: 15, type: 'delimiter.html' },
|
||||||
{ startIndex: 17, type: getTag('h1') },
|
{ startIndex: 17, type: 'tag.html' },
|
||||||
{ startIndex: 19, type: HTML_DELIM_END }
|
{ startIndex: 19, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
line: '</script>',
|
line: '</script>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: HTML_DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 2, type: getTag('script') },
|
{ startIndex: 2, type: 'tag.html' },
|
||||||
{ startIndex: 8, type: HTML_DELIM_END }
|
{ startIndex: 8, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -239,18 +222,18 @@ testTokenization(['handlebars', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '{{foo}}<script></script>{{bar}}',
|
line: '{{foo}}<script></script>{{bar}}',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 0, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 2, type: handlebarsTokenTypes.VARIABLE },
|
{ startIndex: 2, type: 'variable.parameter.handlebars' },
|
||||||
{ startIndex: 5, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 5, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 7, type: HTML_DELIM_START },
|
{ startIndex: 7, type: 'delimiter.html' },
|
||||||
{ startIndex: 8, type: getTag('script') },
|
{ startIndex: 8, type: 'tag.html' },
|
||||||
{ startIndex: 14, type: HTML_DELIM_END },
|
{ startIndex: 14, type: 'delimiter.html' },
|
||||||
// { startIndex:15, type: HTML_DELIM_START },
|
// { startIndex:15, type: 'delimiter.html' },
|
||||||
{ startIndex: 17, type: getTag('script') },
|
{ startIndex: 17, type: 'tag.html' },
|
||||||
{ startIndex: 23, type: HTML_DELIM_END },
|
{ startIndex: 23, type: 'delimiter.html' },
|
||||||
{ startIndex: 24, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 24, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 26, type: handlebarsTokenTypes.VARIABLE },
|
{ startIndex: 26, type: 'variable.parameter.handlebars' },
|
||||||
{ startIndex: 29, type: handlebarsTokenTypes.EMBED }
|
{ startIndex: 29, type: 'delimiter.handlebars' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -258,9 +241,9 @@ testTokenization(['handlebars', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '{{else}}',
|
line: '{{else}}',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 0, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 2, type: handlebarsTokenTypes.KEYWORD },
|
{ startIndex: 2, type: 'keyword.helper.handlebars' },
|
||||||
{ startIndex: 6, type: handlebarsTokenTypes.EMBED }
|
{ startIndex: 6, type: 'delimiter.handlebars' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -268,9 +251,9 @@ testTokenization(['handlebars', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '{{elseFoo}}',
|
line: '{{elseFoo}}',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: handlebarsTokenTypes.EMBED },
|
{ startIndex: 0, type: 'delimiter.handlebars' },
|
||||||
{ startIndex: 2, type: handlebarsTokenTypes.VARIABLE },
|
{ startIndex: 2, type: 'variable.parameter.handlebars' },
|
||||||
{ startIndex: 9, type: handlebarsTokenTypes.EMBED }
|
{ startIndex: 9, type: 'delimiter.handlebars' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -278,13 +261,13 @@ testTokenization(['handlebars', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<a href="/posts/{{permalink}}">',
|
line: '<a href="/posts/{{permalink}}">',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: HTML_DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('a') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 2, type: '' },
|
{ startIndex: 2, type: '' },
|
||||||
{ startIndex: 3, type: HTML_ATTRIB_NAME },
|
{ startIndex: 3, type: 'attribute.name' },
|
||||||
{ startIndex: 7, type: DELIM_ASSIGN },
|
{ startIndex: 7, type: 'delimiter' },
|
||||||
{ startIndex: 8, type: HTML_ATTRIB_VALUE },
|
{ startIndex: 8, type: 'attribute.value' },
|
||||||
{ startIndex: 30, type: HTML_DELIM_END }
|
{ startIndex: 30, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}]
|
}]
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -6,22 +6,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { testTokenization } from './testRunner';
|
import { testTokenization } from './testRunner';
|
||||||
import { htmlTokenTypes } from '../src/html';
|
|
||||||
|
|
||||||
const DELIM_START = htmlTokenTypes.DELIM_START + '.html';
|
|
||||||
const DELIM_END = htmlTokenTypes.DELIM_END + '.html';
|
|
||||||
const ATTRIB_NAME = 'attribute.name.html';
|
|
||||||
const DELIM_ASSIGN = 'delimiter.html';
|
|
||||||
const ATTRIB_VALUE = 'attribute.value.html';
|
|
||||||
|
|
||||||
function getTag(name: string): string {
|
|
||||||
return htmlTokenTypes.getTag(name) + '.html';
|
|
||||||
}
|
|
||||||
|
|
||||||
const DELIM_COMMENT = 'comment.html';
|
|
||||||
const COMMENT = 'comment.content.html';
|
|
||||||
const DELIM_DOCTYPE = 'metatag.html';
|
|
||||||
const DOCTYPE = 'metatag.content.html';
|
|
||||||
|
|
||||||
testTokenization(['html', 'css'], [
|
testTokenization(['html', 'css'], [
|
||||||
|
|
||||||
|
|
@ -29,8 +13,8 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<abc',
|
line: '<abc',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('abc') }
|
{ startIndex: 1, type: 'tag.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -38,8 +22,8 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<input',
|
line: '<input',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('input') }
|
{ startIndex: 1, type: 'tag.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -47,7 +31,7 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '< abc',
|
line: '< abc',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: '' }
|
{ startIndex: 1, type: '' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
@ -56,7 +40,7 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '< abc>',
|
line: '< abc>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: '' }
|
{ startIndex: 1, type: '' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
@ -66,8 +50,8 @@ testTokenization(['html', 'css'], [
|
||||||
line: 'i <len;',
|
line: 'i <len;',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: '' },
|
{ startIndex: 0, type: '' },
|
||||||
{ startIndex: 2, type: DELIM_START },
|
{ startIndex: 2, type: 'delimiter.html' },
|
||||||
{ startIndex: 3, type: getTag('len') },
|
{ startIndex: 3, type: 'tag.html' },
|
||||||
{ startIndex: 6, type: '' }
|
{ startIndex: 6, type: '' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
@ -76,7 +60,7 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<',
|
line: '<',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START }
|
{ startIndex: 0, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -84,8 +68,8 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '</a',
|
line: '</a',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 2, type: getTag('a') }
|
{ startIndex: 2, type: 'tag.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -93,9 +77,9 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<abc>',
|
line: '<abc>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('abc') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 4, type: DELIM_END }
|
{ startIndex: 4, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -103,10 +87,10 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<abc >',
|
line: '<abc >',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('abc') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 4, type: '' },
|
{ startIndex: 4, type: '' },
|
||||||
{ startIndex: 5, type: DELIM_END }
|
{ startIndex: 5, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -114,9 +98,9 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<foo:bar>',
|
line: '<foo:bar>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('foo-bar') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 8, type: DELIM_END }
|
{ startIndex: 8, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -124,9 +108,9 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '</abc>',
|
line: '</abc>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 2, type: getTag('abc') },
|
{ startIndex: 2, type: 'tag.html' },
|
||||||
{ startIndex: 5, type: DELIM_END }
|
{ startIndex: 5, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -134,10 +118,10 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '</abc >',
|
line: '</abc >',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 2, type: getTag('abc') },
|
{ startIndex: 2, type: 'tag.html' },
|
||||||
{ startIndex: 5, type: '' },
|
{ startIndex: 5, type: '' },
|
||||||
{ startIndex: 7, type: DELIM_END }
|
{ startIndex: 7, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -145,10 +129,10 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<abc />',
|
line: '<abc />',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('abc') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 4, type: '' },
|
{ startIndex: 4, type: '' },
|
||||||
{ startIndex: 5, type: DELIM_END }
|
{ startIndex: 5, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -156,17 +140,17 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<script type="text/javascript">var i= 10;</script>',
|
line: '<script type="text/javascript">var i= 10;</script>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('script') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 7, type: '' },
|
{ startIndex: 7, type: '' },
|
||||||
{ startIndex: 8, type: ATTRIB_NAME },
|
{ startIndex: 8, type: 'attribute.name.html' },
|
||||||
{ startIndex: 12, type: DELIM_ASSIGN },
|
{ startIndex: 12, type: 'delimiter.html' },
|
||||||
{ startIndex: 13, type: ATTRIB_VALUE },
|
{ startIndex: 13, type: 'attribute.value.html' },
|
||||||
{ startIndex: 30, type: DELIM_END },
|
{ startIndex: 30, type: 'delimiter.html' },
|
||||||
{ startIndex: 31, type: '' },
|
{ startIndex: 31, type: '' },
|
||||||
{ startIndex: 41, type: DELIM_START },
|
{ startIndex: 41, type: 'delimiter.html' },
|
||||||
{ startIndex: 43, type: getTag('script') },
|
{ startIndex: 43, type: 'tag.html' },
|
||||||
{ startIndex: 49, type: DELIM_END }
|
{ startIndex: 49, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -174,13 +158,13 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<script type="text/javascript">',
|
line: '<script type="text/javascript">',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('script') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 7, type: '' },
|
{ startIndex: 7, type: '' },
|
||||||
{ startIndex: 8, type: ATTRIB_NAME },
|
{ startIndex: 8, type: 'attribute.name.html' },
|
||||||
{ startIndex: 12, type: DELIM_ASSIGN },
|
{ startIndex: 12, type: 'delimiter.html' },
|
||||||
{ startIndex: 13, type: ATTRIB_VALUE },
|
{ startIndex: 13, type: 'attribute.value.html' },
|
||||||
{ startIndex: 30, type: DELIM_END }
|
{ startIndex: 30, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
line: 'var i= 10;',
|
line: 'var i= 10;',
|
||||||
|
|
@ -190,9 +174,9 @@ testTokenization(['html', 'css'], [
|
||||||
}, {
|
}, {
|
||||||
line: '</script>',
|
line: '</script>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 2, type: getTag('script') },
|
{ startIndex: 2, type: 'tag.html' },
|
||||||
{ startIndex: 8, type: DELIM_END }
|
{ startIndex: 8, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -200,21 +184,21 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<script type="text/javascript">var i= 10;',
|
line: '<script type="text/javascript">var i= 10;',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('script') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 7, type: '' },
|
{ startIndex: 7, type: '' },
|
||||||
{ startIndex: 8, type: ATTRIB_NAME },
|
{ startIndex: 8, type: 'attribute.name.html' },
|
||||||
{ startIndex: 12, type: DELIM_ASSIGN },
|
{ startIndex: 12, type: 'delimiter.html' },
|
||||||
{ startIndex: 13, type: ATTRIB_VALUE },
|
{ startIndex: 13, type: 'attribute.value.html' },
|
||||||
{ startIndex: 30, type: DELIM_END },
|
{ startIndex: 30, type: 'delimiter.html' },
|
||||||
{ startIndex: 31, type: '' },
|
{ startIndex: 31, type: '' },
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
line: '</script>',
|
line: '</script>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 2, type: getTag('script') },
|
{ startIndex: 2, type: 'tag.html' },
|
||||||
{ startIndex: 8, type: DELIM_END }
|
{ startIndex: 8, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -222,21 +206,21 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<script type="text/javascript">',
|
line: '<script type="text/javascript">',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('script') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 7, type: '' },
|
{ startIndex: 7, type: '' },
|
||||||
{ startIndex: 8, type: ATTRIB_NAME },
|
{ startIndex: 8, type: 'attribute.name.html' },
|
||||||
{ startIndex: 12, type: DELIM_ASSIGN },
|
{ startIndex: 12, type: 'delimiter.html' },
|
||||||
{ startIndex: 13, type: ATTRIB_VALUE },
|
{ startIndex: 13, type: 'attribute.value.html' },
|
||||||
{ startIndex: 30, type: DELIM_END }
|
{ startIndex: 30, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
line: 'var i= 10;</script>',
|
line: 'var i= 10;</script>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: '' },
|
{ startIndex: 0, type: '' },
|
||||||
{ startIndex: 10, type: DELIM_START },
|
{ startIndex: 10, type: 'delimiter.html' },
|
||||||
{ startIndex: 12, type: getTag('script') },
|
{ startIndex: 12, type: 'tag.html' },
|
||||||
{ startIndex: 18, type: DELIM_END }
|
{ startIndex: 18, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -244,22 +228,22 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<script type="text/plain">a',
|
line: '<script type="text/plain">a',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('script') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 7, type: '' },
|
{ startIndex: 7, type: '' },
|
||||||
{ startIndex: 8, type: ATTRIB_NAME },
|
{ startIndex: 8, type: 'attribute.name.html' },
|
||||||
{ startIndex: 12, type: DELIM_ASSIGN },
|
{ startIndex: 12, type: 'delimiter.html' },
|
||||||
{ startIndex: 13, type: ATTRIB_VALUE },
|
{ startIndex: 13, type: 'attribute.value.html' },
|
||||||
{ startIndex: 25, type: DELIM_END },
|
{ startIndex: 25, type: 'delimiter.html' },
|
||||||
{ startIndex: 26, type: '' },
|
{ startIndex: 26, type: '' },
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
line: '<a</script>',
|
line: '<a</script>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: '' },
|
{ startIndex: 0, type: '' },
|
||||||
{ startIndex: 2, type: DELIM_START },
|
{ startIndex: 2, type: 'delimiter.html' },
|
||||||
{ startIndex: 4, type: getTag('script') },
|
{ startIndex: 4, type: 'tag.html' },
|
||||||
{ startIndex: 10, type: DELIM_END }
|
{ startIndex: 10, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -267,20 +251,20 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<script>a</script><script>b</script>',
|
line: '<script>a</script><script>b</script>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('script') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 7, type: DELIM_END },
|
{ startIndex: 7, type: 'delimiter.html' },
|
||||||
{ startIndex: 8, type: '' },
|
{ startIndex: 8, type: '' },
|
||||||
{ startIndex: 9, type: DELIM_START },
|
{ startIndex: 9, type: 'delimiter.html' },
|
||||||
{ startIndex: 11, type: getTag('script') },
|
{ startIndex: 11, type: 'tag.html' },
|
||||||
{ startIndex: 17, type: DELIM_END },
|
{ startIndex: 17, type: 'delimiter.html' },
|
||||||
// { startIndex:18, type: DELIM_START },
|
// { startIndex:18, type: 'delimiter.html' },
|
||||||
{ startIndex: 19, type: getTag('script') },
|
{ startIndex: 19, type: 'tag.html' },
|
||||||
{ startIndex: 25, type: DELIM_END },
|
{ startIndex: 25, type: 'delimiter.html' },
|
||||||
{ startIndex: 26, type: '' },
|
{ startIndex: 26, type: '' },
|
||||||
{ startIndex: 27, type: DELIM_START },
|
{ startIndex: 27, type: 'delimiter.html' },
|
||||||
{ startIndex: 29, type: getTag('script') },
|
{ startIndex: 29, type: 'tag.html' },
|
||||||
{ startIndex: 35, type: DELIM_END }
|
{ startIndex: 35, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -288,16 +272,16 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<script type="text/javascript"></script>',
|
line: '<script type="text/javascript"></script>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('script') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 7, type: '' },
|
{ startIndex: 7, type: '' },
|
||||||
{ startIndex: 8, type: ATTRIB_NAME },
|
{ startIndex: 8, type: 'attribute.name.html' },
|
||||||
{ startIndex: 12, type: DELIM_ASSIGN },
|
{ startIndex: 12, type: 'delimiter.html' },
|
||||||
{ startIndex: 13, type: ATTRIB_VALUE },
|
{ startIndex: 13, type: 'attribute.value.html' },
|
||||||
{ startIndex: 30, type: DELIM_END },
|
{ startIndex: 30, type: 'delimiter.html' },
|
||||||
// { startIndex:31, type: DELIM_START },
|
// { startIndex:31, type: 'delimiter.html' },
|
||||||
{ startIndex: 33, type: getTag('script') },
|
{ startIndex: 33, type: 'tag.html' },
|
||||||
{ startIndex: 39, type: DELIM_END }
|
{ startIndex: 39, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -305,13 +289,13 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<script>var i= 10;</script>',
|
line: '<script>var i= 10;</script>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('script') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 7, type: DELIM_END },
|
{ startIndex: 7, type: 'delimiter.html' },
|
||||||
{ startIndex: 8, type: '' },
|
{ startIndex: 8, type: '' },
|
||||||
{ startIndex: 18, type: DELIM_START },
|
{ startIndex: 18, type: 'delimiter.html' },
|
||||||
{ startIndex: 20, type: getTag('script') },
|
{ startIndex: 20, type: 'tag.html' },
|
||||||
{ startIndex: 26, type: DELIM_END }
|
{ startIndex: 26, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -319,20 +303,20 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<script type="text/javascript" src="main.js"></script>',
|
line: '<script type="text/javascript" src="main.js"></script>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('script') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 7, type: '' },
|
{ startIndex: 7, type: '' },
|
||||||
{ startIndex: 8, type: ATTRIB_NAME },
|
{ startIndex: 8, type: 'attribute.name.html' },
|
||||||
{ startIndex: 12, type: DELIM_ASSIGN },
|
{ startIndex: 12, type: 'delimiter.html' },
|
||||||
{ startIndex: 13, type: ATTRIB_VALUE },
|
{ startIndex: 13, type: 'attribute.value.html' },
|
||||||
{ startIndex: 30, type: '' },
|
{ startIndex: 30, type: '' },
|
||||||
{ startIndex: 31, type: ATTRIB_NAME },
|
{ startIndex: 31, type: 'attribute.name.html' },
|
||||||
{ startIndex: 34, type: DELIM_ASSIGN },
|
{ startIndex: 34, type: 'delimiter.html' },
|
||||||
{ startIndex: 35, type: ATTRIB_VALUE },
|
{ startIndex: 35, type: 'attribute.value.html' },
|
||||||
{ startIndex: 44, type: DELIM_END },
|
{ startIndex: 44, type: 'delimiter.html' },
|
||||||
// { startIndex:45, type: DELIM_START },
|
// { startIndex:45, type: 'delimiter.html' },
|
||||||
{ startIndex: 47, type: getTag('script') },
|
{ startIndex: 47, type: 'tag.html' },
|
||||||
{ startIndex: 53, type: DELIM_END }
|
{ startIndex: 53, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -340,13 +324,13 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<abc foo="bar">',
|
line: '<abc foo="bar">',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('abc') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 4, type: '' },
|
{ startIndex: 4, type: '' },
|
||||||
{ startIndex: 5, type: ATTRIB_NAME },
|
{ startIndex: 5, type: 'attribute.name.html' },
|
||||||
{ startIndex: 8, type: DELIM_ASSIGN },
|
{ startIndex: 8, type: 'delimiter.html' },
|
||||||
{ startIndex: 9, type: ATTRIB_VALUE },
|
{ startIndex: 9, type: 'attribute.value.html' },
|
||||||
{ startIndex: 14, type: DELIM_END }
|
{ startIndex: 14, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -354,13 +338,13 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<abc foo=\'bar\'>',
|
line: '<abc foo=\'bar\'>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('abc') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 4, type: '' },
|
{ startIndex: 4, type: '' },
|
||||||
{ startIndex: 5, type: ATTRIB_NAME },
|
{ startIndex: 5, type: 'attribute.name.html' },
|
||||||
{ startIndex: 8, type: DELIM_ASSIGN },
|
{ startIndex: 8, type: 'delimiter.html' },
|
||||||
{ startIndex: 9, type: ATTRIB_VALUE },
|
{ startIndex: 9, type: 'attribute.value.html' },
|
||||||
{ startIndex: 14, type: DELIM_END }
|
{ startIndex: 14, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -368,13 +352,13 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<abc foo="">',
|
line: '<abc foo="">',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('abc') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 4, type: '' },
|
{ startIndex: 4, type: '' },
|
||||||
{ startIndex: 5, type: ATTRIB_NAME },
|
{ startIndex: 5, type: 'attribute.name.html' },
|
||||||
{ startIndex: 8, type: DELIM_ASSIGN },
|
{ startIndex: 8, type: 'delimiter.html' },
|
||||||
{ startIndex: 9, type: ATTRIB_VALUE },
|
{ startIndex: 9, type: 'attribute.value.html' },
|
||||||
{ startIndex: 11, type: DELIM_END }
|
{ startIndex: 11, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -382,17 +366,17 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<abc foo="bar" bar=\'foo\'>',
|
line: '<abc foo="bar" bar=\'foo\'>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('abc') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 4, type: '' },
|
{ startIndex: 4, type: '' },
|
||||||
{ startIndex: 5, type: ATTRIB_NAME },
|
{ startIndex: 5, type: 'attribute.name.html' },
|
||||||
{ startIndex: 8, type: DELIM_ASSIGN },
|
{ startIndex: 8, type: 'delimiter.html' },
|
||||||
{ startIndex: 9, type: ATTRIB_VALUE },
|
{ startIndex: 9, type: 'attribute.value.html' },
|
||||||
{ startIndex: 14, type: '' },
|
{ startIndex: 14, type: '' },
|
||||||
{ startIndex: 15, type: ATTRIB_NAME },
|
{ startIndex: 15, type: 'attribute.name.html' },
|
||||||
{ startIndex: 18, type: DELIM_ASSIGN },
|
{ startIndex: 18, type: 'delimiter.html' },
|
||||||
{ startIndex: 19, type: ATTRIB_VALUE },
|
{ startIndex: 19, type: 'attribute.value.html' },
|
||||||
{ startIndex: 24, type: DELIM_END }
|
{ startIndex: 24, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -400,17 +384,17 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<abc foo=bar bar=help-me>',
|
line: '<abc foo=bar bar=help-me>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('abc') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 4, type: '' },
|
{ startIndex: 4, type: '' },
|
||||||
{ startIndex: 5, type: ATTRIB_NAME },
|
{ startIndex: 5, type: 'attribute.name.html' },
|
||||||
{ startIndex: 8, type: DELIM_ASSIGN },
|
{ startIndex: 8, type: 'delimiter.html' },
|
||||||
{ startIndex: 9, type: ATTRIB_NAME }, // slightly incorrect
|
{ startIndex: 9, type: 'attribute.name.html' }, // slightly incorrect
|
||||||
{ startIndex: 12, type: '' },
|
{ startIndex: 12, type: '' },
|
||||||
{ startIndex: 13, type: ATTRIB_NAME },
|
{ startIndex: 13, type: 'attribute.name.html' },
|
||||||
{ startIndex: 16, type: DELIM_ASSIGN },
|
{ startIndex: 16, type: 'delimiter.html' },
|
||||||
{ startIndex: 17, type: ATTRIB_NAME }, // slightly incorrect
|
{ startIndex: 17, type: 'attribute.name.html' }, // slightly incorrect
|
||||||
{ startIndex: 24, type: DELIM_END }
|
{ startIndex: 24, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -418,14 +402,14 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<abc foo= "bar">',
|
line: '<abc foo= "bar">',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('abc') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 4, type: '' },
|
{ startIndex: 4, type: '' },
|
||||||
{ startIndex: 5, type: ATTRIB_NAME },
|
{ startIndex: 5, type: 'attribute.name.html' },
|
||||||
{ startIndex: 8, type: DELIM_ASSIGN },
|
{ startIndex: 8, type: 'delimiter.html' },
|
||||||
{ startIndex: 9, type: '' },
|
{ startIndex: 9, type: '' },
|
||||||
{ startIndex: 11, type: ATTRIB_VALUE },
|
{ startIndex: 11, type: 'attribute.value.html' },
|
||||||
{ startIndex: 16, type: DELIM_END }
|
{ startIndex: 16, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -433,15 +417,15 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<abc foo = "bar">',
|
line: '<abc foo = "bar">',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('abc') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 4, type: '' },
|
{ startIndex: 4, type: '' },
|
||||||
{ startIndex: 5, type: ATTRIB_NAME },
|
{ startIndex: 5, type: 'attribute.name.html' },
|
||||||
{ startIndex: 8, type: '' },
|
{ startIndex: 8, type: '' },
|
||||||
{ startIndex: 9, type: DELIM_ASSIGN },
|
{ startIndex: 9, type: 'delimiter.html' },
|
||||||
{ startIndex: 10, type: '' },
|
{ startIndex: 10, type: '' },
|
||||||
{ startIndex: 11, type: ATTRIB_VALUE },
|
{ startIndex: 11, type: 'attribute.value.html' },
|
||||||
{ startIndex: 16, type: DELIM_END }
|
{ startIndex: 16, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -449,11 +433,11 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<abc foo>',
|
line: '<abc foo>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('abc') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 4, type: '' },
|
{ startIndex: 4, type: '' },
|
||||||
{ startIndex: 5, type: ATTRIB_NAME },
|
{ startIndex: 5, type: 'attribute.name.html' },
|
||||||
{ startIndex: 8, type: DELIM_END }
|
{ startIndex: 8, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -461,13 +445,13 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<abc foo bar>',
|
line: '<abc foo bar>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('abc') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 4, type: '' },
|
{ startIndex: 4, type: '' },
|
||||||
{ startIndex: 5, type: ATTRIB_NAME },
|
{ startIndex: 5, type: 'attribute.name.html' },
|
||||||
{ startIndex: 8, type: '' },
|
{ startIndex: 8, type: '' },
|
||||||
{ startIndex: 9, type: ATTRIB_NAME },
|
{ startIndex: 9, type: 'attribute.name.html' },
|
||||||
{ startIndex: 12, type: DELIM_END }
|
{ startIndex: 12, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -475,14 +459,14 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<abc foo!@#="bar">',
|
line: '<abc foo!@#="bar">',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('abc') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 4, type: '' },
|
{ startIndex: 4, type: '' },
|
||||||
{ startIndex: 5, type: ATTRIB_NAME },
|
{ startIndex: 5, type: 'attribute.name.html' },
|
||||||
{ startIndex: 8, type: '' },
|
{ startIndex: 8, type: '' },
|
||||||
{ startIndex: 11, type: DELIM_ASSIGN },
|
{ startIndex: 11, type: 'delimiter.html' },
|
||||||
{ startIndex: 12, type: ATTRIB_VALUE },
|
{ startIndex: 12, type: 'attribute.value.html' },
|
||||||
{ startIndex: 17, type: DELIM_END }
|
{ startIndex: 17, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -490,25 +474,25 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<abc #myinput (click)="bar" [value]="someProperty" *ngIf="someCondition">',
|
line: '<abc #myinput (click)="bar" [value]="someProperty" *ngIf="someCondition">',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('abc') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 4, type: '' },
|
{ startIndex: 4, type: '' },
|
||||||
{ startIndex: 6, type: ATTRIB_NAME },
|
{ startIndex: 6, type: 'attribute.name.html' },
|
||||||
{ startIndex: 13, type: '' },
|
{ startIndex: 13, type: '' },
|
||||||
{ startIndex: 15, type: ATTRIB_NAME },
|
{ startIndex: 15, type: 'attribute.name.html' },
|
||||||
{ startIndex: 20, type: '' },
|
{ startIndex: 20, type: '' },
|
||||||
{ startIndex: 21, type: DELIM_ASSIGN },
|
{ startIndex: 21, type: 'delimiter.html' },
|
||||||
{ startIndex: 22, type: ATTRIB_VALUE },
|
{ startIndex: 22, type: 'attribute.value.html' },
|
||||||
{ startIndex: 27, type: '' },
|
{ startIndex: 27, type: '' },
|
||||||
{ startIndex: 29, type: ATTRIB_NAME },
|
{ startIndex: 29, type: 'attribute.name.html' },
|
||||||
{ startIndex: 34, type: '' },
|
{ startIndex: 34, type: '' },
|
||||||
{ startIndex: 35, type: DELIM_ASSIGN },
|
{ startIndex: 35, type: 'delimiter.html' },
|
||||||
{ startIndex: 36, type: ATTRIB_VALUE },
|
{ startIndex: 36, type: 'attribute.value.html' },
|
||||||
{ startIndex: 50, type: '' },
|
{ startIndex: 50, type: '' },
|
||||||
{ startIndex: 52, type: ATTRIB_NAME },
|
{ startIndex: 52, type: 'attribute.name.html' },
|
||||||
{ startIndex: 56, type: DELIM_ASSIGN },
|
{ startIndex: 56, type: 'delimiter.html' },
|
||||||
{ startIndex: 57, type: ATTRIB_VALUE },
|
{ startIndex: 57, type: 'attribute.value.html' },
|
||||||
{ startIndex: 72, type: DELIM_END }
|
{ startIndex: 72, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -516,13 +500,13 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<abc foo=">',
|
line: '<abc foo=">',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('abc') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 4, type: '' },
|
{ startIndex: 4, type: '' },
|
||||||
{ startIndex: 5, type: ATTRIB_NAME },
|
{ startIndex: 5, type: 'attribute.name.html' },
|
||||||
{ startIndex: 8, type: DELIM_ASSIGN },
|
{ startIndex: 8, type: 'delimiter.html' },
|
||||||
{ startIndex: 9, type: '' },
|
{ startIndex: 9, type: '' },
|
||||||
{ startIndex: 10, type: DELIM_END }
|
{ startIndex: 10, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -530,9 +514,9 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<!--a-->',
|
line: '<!--a-->',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_COMMENT },
|
{ startIndex: 0, type: 'comment.html' },
|
||||||
{ startIndex: 4, type: COMMENT },
|
{ startIndex: 4, type: 'comment.content.html' },
|
||||||
{ startIndex: 5, type: DELIM_COMMENT }
|
{ startIndex: 5, type: 'comment.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -540,9 +524,9 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<!--a>foo bar</a -->',
|
line: '<!--a>foo bar</a -->',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_COMMENT },
|
{ startIndex: 0, type: 'comment.html' },
|
||||||
{ startIndex: 4, type: COMMENT },
|
{ startIndex: 4, type: 'comment.content.html' },
|
||||||
{ startIndex: 17, type: DELIM_COMMENT }
|
{ startIndex: 17, type: 'comment.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -550,19 +534,19 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<!--a>',
|
line: '<!--a>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_COMMENT },
|
{ startIndex: 0, type: 'comment.html' },
|
||||||
{ startIndex: 4, type: COMMENT }
|
{ startIndex: 4, type: 'comment.content.html' }
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
line: 'foo ',
|
line: 'foo ',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: COMMENT },
|
{ startIndex: 0, type: 'comment.content.html' },
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
line: 'bar</a -->',
|
line: 'bar</a -->',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: COMMENT },
|
{ startIndex: 0, type: 'comment.content.html' },
|
||||||
{ startIndex: 7, type: DELIM_COMMENT }
|
{ startIndex: 7, type: 'comment.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -570,9 +554,9 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<!DOCTYPE a>',
|
line: '<!DOCTYPE a>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_DOCTYPE },
|
{ startIndex: 0, type: 'metatag.html' },
|
||||||
{ startIndex: 9, type: DOCTYPE },
|
{ startIndex: 9, type: 'metatag.content.html' },
|
||||||
{ startIndex: 11, type: DELIM_DOCTYPE }
|
{ startIndex: 11, type: 'metatag.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -580,9 +564,9 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<!doctype a>',
|
line: '<!doctype a>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_DOCTYPE },
|
{ startIndex: 0, type: 'metatag.html' },
|
||||||
{ startIndex: 9, type: DOCTYPE },
|
{ startIndex: 9, type: 'metatag.content.html' },
|
||||||
{ startIndex: 11, type: DELIM_DOCTYPE }
|
{ startIndex: 11, type: 'metatag.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -590,14 +574,14 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<!DOCTYPE a',
|
line: '<!DOCTYPE a',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_DOCTYPE },
|
{ startIndex: 0, type: 'metatag.html' },
|
||||||
{ startIndex: 9, type: DOCTYPE },
|
{ startIndex: 9, type: 'metatag.content.html' },
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
line: '"foo" \'bar\'>',
|
line: '"foo" \'bar\'>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DOCTYPE },
|
{ startIndex: 0, type: 'metatag.content.html' },
|
||||||
{ startIndex: 11, type: DELIM_DOCTYPE }
|
{ startIndex: 11, type: 'metatag.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -605,13 +589,13 @@ testTokenization(['html', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<asdf:bar>asd</asdf:bar>',
|
line: '<asdf:bar>asd</asdf:bar>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: getTag('asdf:bar') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 9, type: DELIM_END },
|
{ startIndex: 9, type: 'delimiter.html' },
|
||||||
{ startIndex: 10, type: '' },
|
{ startIndex: 10, type: '' },
|
||||||
{ startIndex: 13, type: DELIM_START },
|
{ startIndex: 13, type: 'delimiter.html' },
|
||||||
{ startIndex: 15, type: getTag('asdf:bar') },
|
{ startIndex: 15, type: 'tag.html' },
|
||||||
{ startIndex: 23, type: DELIM_END }
|
{ startIndex: 23, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}]
|
}]
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
155
test/php.test.ts
155
test/php.test.ts
|
|
@ -6,7 +6,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { testTokenization } from './testRunner';
|
import { testTokenization } from './testRunner';
|
||||||
import { htmlTokenTypes } from '../src/php';
|
|
||||||
|
|
||||||
testTokenization(['php', 'css'], [
|
testTokenization(['php', 'css'], [
|
||||||
// Bug 13596:[ErrorTelemetry] Stream did not advance while tokenizing. Mode id is php (stuck)
|
// Bug 13596:[ErrorTelemetry] Stream did not advance while tokenizing. Mode id is php (stuck)
|
||||||
|
|
@ -1809,9 +1808,9 @@ testTokenization(['php', 'css'], [
|
||||||
{ startIndex: 6, type: 'delimiter.php' },
|
{ startIndex: 6, type: 'delimiter.php' },
|
||||||
{ startIndex: 7, type: 'number.php' },
|
{ startIndex: 7, type: 'number.php' },
|
||||||
{ startIndex: 8, type: 'metatag.php' },
|
{ startIndex: 8, type: 'metatag.php' },
|
||||||
{ startIndex: 10, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 10, type: 'delimiter.html' },
|
||||||
{ startIndex: 11, type: htmlTokenTypes.getTag('br') },
|
{ startIndex: 11, type: 'tag.html' },
|
||||||
{ startIndex: 13, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 13, type: 'delimiter.html' },
|
||||||
{ startIndex: 15, type: 'metatag.php' },
|
{ startIndex: 15, type: 'metatag.php' },
|
||||||
{ startIndex: 18, type: 'number.php' },
|
{ startIndex: 18, type: 'number.php' },
|
||||||
{ startIndex: 19, type: 'metatag.php' }
|
{ startIndex: 19, type: 'metatag.php' }
|
||||||
|
|
@ -1827,9 +1826,9 @@ testTokenization(['php', 'css'], [
|
||||||
{ startIndex: 6, type: 'delimiter.php' },
|
{ startIndex: 6, type: 'delimiter.php' },
|
||||||
{ startIndex: 7, type: 'number.php' },
|
{ startIndex: 7, type: 'number.php' },
|
||||||
{ startIndex: 8, type: 'metatag.php' },
|
{ startIndex: 8, type: 'metatag.php' },
|
||||||
{ startIndex: 10, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 10, type: 'delimiter.html' },
|
||||||
{ startIndex: 11, type: htmlTokenTypes.getTag('abc') },
|
{ startIndex: 11, type: 'tag.html' },
|
||||||
{ startIndex: 14, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 14, type: 'delimiter.html' },
|
||||||
{ startIndex: 15, type: 'metatag.php' },
|
{ startIndex: 15, type: 'metatag.php' },
|
||||||
{ startIndex: 18, type: 'number.php' },
|
{ startIndex: 18, type: 'number.php' },
|
||||||
{ startIndex: 19, type: 'metatag.php' }
|
{ startIndex: 19, type: 'metatag.php' }
|
||||||
|
|
@ -1840,17 +1839,17 @@ testTokenization(['php', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<abc><?php5+3?><abc>',
|
line: '<abc><?php5+3?><abc>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: htmlTokenTypes.getTag('abc') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 4, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 4, type: 'delimiter.html' },
|
||||||
{ startIndex: 5, type: 'metatag.php' },
|
{ startIndex: 5, type: 'metatag.php' },
|
||||||
{ startIndex: 10, type: 'number.php' },
|
{ startIndex: 10, type: 'number.php' },
|
||||||
{ startIndex: 11, type: 'delimiter.php' },
|
{ startIndex: 11, type: 'delimiter.php' },
|
||||||
{ startIndex: 12, type: 'number.php' },
|
{ startIndex: 12, type: 'number.php' },
|
||||||
{ startIndex: 13, type: 'metatag.php' },
|
{ startIndex: 13, type: 'metatag.php' },
|
||||||
{ startIndex: 15, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 15, type: 'delimiter.html' },
|
||||||
{ startIndex: 16, type: htmlTokenTypes.getTag('abc') },
|
{ startIndex: 16, type: 'tag.html' },
|
||||||
{ startIndex: 19, type: htmlTokenTypes.DELIM_END }
|
{ startIndex: 19, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -1858,24 +1857,24 @@ testTokenization(['php', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<abc><script>var i= 10;</script><?php5+3?><abc>',
|
line: '<abc><script>var i= 10;</script><?php5+3?><abc>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: htmlTokenTypes.getTag('abc') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 4, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 4, type: 'delimiter.html' },
|
||||||
// { startIndex:5, type: htmlTokenTypes.DELIM_START },
|
// { startIndex:5, type: 'delimiter.html' },
|
||||||
{ startIndex: 6, type: htmlTokenTypes.getTag('script') },
|
{ startIndex: 6, type: 'tag.html' },
|
||||||
{ startIndex: 12, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 12, type: 'delimiter.html' },
|
||||||
{ startIndex: 13, type: '' },
|
{ startIndex: 13, type: '' },
|
||||||
{ startIndex: 23, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 23, type: 'delimiter.html' },
|
||||||
{ startIndex: 25, type: htmlTokenTypes.getTag('script') },
|
{ startIndex: 25, type: 'tag.html' },
|
||||||
{ startIndex: 31, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 31, type: 'delimiter.html' },
|
||||||
{ startIndex: 32, type: 'metatag.php' },
|
{ startIndex: 32, type: 'metatag.php' },
|
||||||
{ startIndex: 37, type: 'number.php' },
|
{ startIndex: 37, type: 'number.php' },
|
||||||
{ startIndex: 38, type: 'delimiter.php' },
|
{ startIndex: 38, type: 'delimiter.php' },
|
||||||
{ startIndex: 39, type: 'number.php' },
|
{ startIndex: 39, type: 'number.php' },
|
||||||
{ startIndex: 40, type: 'metatag.php' },
|
{ startIndex: 40, type: 'metatag.php' },
|
||||||
{ startIndex: 42, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 42, type: 'delimiter.html' },
|
||||||
{ startIndex: 43, type: htmlTokenTypes.getTag('abc') },
|
{ startIndex: 43, type: 'tag.html' },
|
||||||
{ startIndex: 46, type: htmlTokenTypes.DELIM_END }
|
{ startIndex: 46, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -1883,28 +1882,28 @@ testTokenization(['php', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<abc><script>var i= 10;</script><?php5+3?><script>var x= 15;</script>',
|
line: '<abc><script>var i= 10;</script><?php5+3?><script>var x= 15;</script>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: htmlTokenTypes.getTag('abc') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 4, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 4, type: 'delimiter.html' },
|
||||||
// { startIndex:5, type: htmlTokenTypes.DELIM_START },
|
// { startIndex:5, type: 'delimiter.html' },
|
||||||
{ startIndex: 6, type: htmlTokenTypes.getTag('script') },
|
{ startIndex: 6, type: 'tag.html' },
|
||||||
{ startIndex: 12, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 12, type: 'delimiter.html' },
|
||||||
{ startIndex: 13, type: '' },
|
{ startIndex: 13, type: '' },
|
||||||
{ startIndex: 23, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 23, type: 'delimiter.html' },
|
||||||
{ startIndex: 25, type: htmlTokenTypes.getTag('script') },
|
{ startIndex: 25, type: 'tag.html' },
|
||||||
{ startIndex: 31, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 31, type: 'delimiter.html' },
|
||||||
{ startIndex: 32, type: 'metatag.php' },
|
{ startIndex: 32, type: 'metatag.php' },
|
||||||
{ startIndex: 37, type: 'number.php' },
|
{ startIndex: 37, type: 'number.php' },
|
||||||
{ startIndex: 38, type: 'delimiter.php' },
|
{ startIndex: 38, type: 'delimiter.php' },
|
||||||
{ startIndex: 39, type: 'number.php' },
|
{ startIndex: 39, type: 'number.php' },
|
||||||
{ startIndex: 40, type: 'metatag.php' },
|
{ startIndex: 40, type: 'metatag.php' },
|
||||||
{ startIndex: 42, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 42, type: 'delimiter.html' },
|
||||||
{ startIndex: 43, type: htmlTokenTypes.getTag('script') },
|
{ startIndex: 43, type: 'tag.html' },
|
||||||
{ startIndex: 49, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 49, type: 'delimiter.html' },
|
||||||
{ startIndex: 50, type: '' },
|
{ startIndex: 50, type: '' },
|
||||||
{ startIndex: 60, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 60, type: 'delimiter.html' },
|
||||||
{ startIndex: 62, type: htmlTokenTypes.getTag('script') },
|
{ startIndex: 62, type: 'tag.html' },
|
||||||
{ startIndex: 68, type: htmlTokenTypes.DELIM_END }
|
{ startIndex: 68, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -1912,16 +1911,16 @@ testTokenization(['php', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<html>',
|
line: '<html>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: htmlTokenTypes.getTag('html') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 5, type: htmlTokenTypes.DELIM_END }
|
{ startIndex: 5, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
line: '<style><?="div"?>{ color:blue; }</style>',
|
line: '<style><?="div"?>{ color:blue; }</style>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: htmlTokenTypes.getTag('style') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 6, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 6, type: 'delimiter.html' },
|
||||||
{ startIndex: 7, type: 'metatag.php' },
|
{ startIndex: 7, type: 'metatag.php' },
|
||||||
{ startIndex: 10, type: 'string.php' },
|
{ startIndex: 10, type: 'string.php' },
|
||||||
{ startIndex: 15, type: 'metatag.php' },
|
{ startIndex: 15, type: 'metatag.php' },
|
||||||
|
|
@ -1932,9 +1931,9 @@ testTokenization(['php', 'css'], [
|
||||||
{ startIndex: 29, type: 'delimiter.css' },
|
{ startIndex: 29, type: 'delimiter.css' },
|
||||||
{ startIndex: 30, type: '' },
|
{ startIndex: 30, type: '' },
|
||||||
{ startIndex: 31, type: 'delimiter.bracket.css' },
|
{ startIndex: 31, type: 'delimiter.bracket.css' },
|
||||||
{ startIndex: 32, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 32, type: 'delimiter.html' },
|
||||||
{ startIndex: 34, type: htmlTokenTypes.getTag('style') },
|
{ startIndex: 34, type: 'tag.html' },
|
||||||
{ startIndex: 39, type: htmlTokenTypes.DELIM_END }
|
{ startIndex: 39, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -1942,12 +1941,12 @@ testTokenization(['php', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<html><style><?="div"?> { color:blue; }</style><!--<?="HTML Comment"?>--><script>var x = 3;/* <?="JS Comment"/*</script>*/?> */var y = 4;</script></html><? $x = 3;?>',
|
line: '<html><style><?="div"?> { color:blue; }</style><!--<?="HTML Comment"?>--><script>var x = 3;/* <?="JS Comment"/*</script>*/?> */var y = 4;</script></html><? $x = 3;?>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: htmlTokenTypes.getTag('html') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 5, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 5, type: 'delimiter.html' },
|
||||||
// { startIndex:6, type: htmlTokenTypes.DELIM_START },
|
// { startIndex:6, type: 'delimiter.html' },
|
||||||
{ startIndex: 7, type: htmlTokenTypes.getTag('style') },
|
{ startIndex: 7, type: 'tag.html' },
|
||||||
{ startIndex: 12, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 12, type: 'delimiter.html' },
|
||||||
{ startIndex: 13, type: 'metatag.php' },
|
{ startIndex: 13, type: 'metatag.php' },
|
||||||
{ startIndex: 16, type: 'string.php' },
|
{ startIndex: 16, type: 'string.php' },
|
||||||
{ startIndex: 21, type: 'metatag.php' },
|
{ startIndex: 21, type: 'metatag.php' },
|
||||||
|
|
@ -1959,29 +1958,29 @@ testTokenization(['php', 'css'], [
|
||||||
{ startIndex: 36, type: 'delimiter.css' },
|
{ startIndex: 36, type: 'delimiter.css' },
|
||||||
{ startIndex: 37, type: '' },
|
{ startIndex: 37, type: '' },
|
||||||
{ startIndex: 38, type: 'delimiter.bracket.css' },
|
{ startIndex: 38, type: 'delimiter.bracket.css' },
|
||||||
{ startIndex: 39, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 39, type: 'delimiter.html' },
|
||||||
{ startIndex: 41, type: htmlTokenTypes.getTag('style') },
|
{ startIndex: 41, type: 'tag.html' },
|
||||||
{ startIndex: 46, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 46, type: 'delimiter.html' },
|
||||||
{ startIndex: 47, type: htmlTokenTypes.DELIM_COMMENT },
|
{ startIndex: 47, type: 'comment.html' },
|
||||||
{ startIndex: 51, type: 'metatag.php' },
|
{ startIndex: 51, type: 'metatag.php' },
|
||||||
{ startIndex: 54, type: 'string.php' },
|
{ startIndex: 54, type: 'string.php' },
|
||||||
{ startIndex: 68, type: 'metatag.php' },
|
{ startIndex: 68, type: 'metatag.php' },
|
||||||
{ startIndex: 70, type: htmlTokenTypes.DELIM_COMMENT },
|
{ startIndex: 70, type: 'comment.html' },
|
||||||
{ startIndex: 73, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 73, type: 'delimiter.html' },
|
||||||
{ startIndex: 74, type: htmlTokenTypes.getTag('script') },
|
{ startIndex: 74, type: 'tag.html' },
|
||||||
{ startIndex: 80, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 80, type: 'delimiter.html' },
|
||||||
{ startIndex: 81, type: '' },
|
{ startIndex: 81, type: '' },
|
||||||
{ startIndex: 94, type: 'metatag.php' },
|
{ startIndex: 94, type: 'metatag.php' },
|
||||||
{ startIndex: 97, type: 'string.php' },
|
{ startIndex: 97, type: 'string.php' },
|
||||||
{ startIndex: 109, type: 'comment.php' },
|
{ startIndex: 109, type: 'comment.php' },
|
||||||
{ startIndex: 122, type: 'metatag.php' },
|
{ startIndex: 122, type: 'metatag.php' },
|
||||||
{ startIndex: 124, type: '' },
|
{ startIndex: 124, type: '' },
|
||||||
{ startIndex: 137, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 137, type: 'delimiter.html' },
|
||||||
{ startIndex: 139, type: htmlTokenTypes.getTag('script') },
|
{ startIndex: 139, type: 'tag.html' },
|
||||||
{ startIndex: 145, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 145, type: 'delimiter.html' },
|
||||||
// { startIndex:146, type: htmlTokenTypes.DELIM_START },
|
// { startIndex:146, type: 'delimiter.html' },
|
||||||
{ startIndex: 148, type: htmlTokenTypes.getTag('html') },
|
{ startIndex: 148, type: 'tag.html' },
|
||||||
{ startIndex: 152, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 152, type: 'delimiter.html' },
|
||||||
{ startIndex: 153, type: 'metatag.php' },
|
{ startIndex: 153, type: 'metatag.php' },
|
||||||
{ startIndex: 155, type: '' },
|
{ startIndex: 155, type: '' },
|
||||||
{ startIndex: 156, type: 'variable.php' },
|
{ startIndex: 156, type: 'variable.php' },
|
||||||
|
|
@ -1998,9 +1997,9 @@ testTokenization(['php', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<!--c--><?',
|
line: '<!--c--><?',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: htmlTokenTypes.DELIM_COMMENT },
|
{ startIndex: 0, type: 'comment.html' },
|
||||||
{ startIndex: 4, type: htmlTokenTypes.COMMENT },
|
{ startIndex: 4, type: 'comment.content.html' },
|
||||||
{ startIndex: 5, type: htmlTokenTypes.DELIM_COMMENT },
|
{ startIndex: 5, type: 'comment.html' },
|
||||||
{ startIndex: 8, type: 'metatag.php' }
|
{ startIndex: 8, type: 'metatag.php' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
@ -2008,9 +2007,9 @@ testTokenization(['php', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<script>//<?',
|
line: '<script>//<?',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: htmlTokenTypes.getTag('script') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 7, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 7, type: 'delimiter.html' },
|
||||||
{ startIndex: 8, type: '' },
|
{ startIndex: 8, type: '' },
|
||||||
{ startIndex: 10, type: 'metatag.php' }
|
{ startIndex: 10, type: 'metatag.php' }
|
||||||
]
|
]
|
||||||
|
|
@ -2019,9 +2018,9 @@ testTokenization(['php', 'css'], [
|
||||||
[{
|
[{
|
||||||
line: '<script>"<?php5+3?>"',
|
line: '<script>"<?php5+3?>"',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 0, type: 'delimiter.html' },
|
||||||
{ startIndex: 1, type: htmlTokenTypes.getTag('script') },
|
{ startIndex: 1, type: 'tag.html' },
|
||||||
{ startIndex: 7, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 7, type: 'delimiter.html' },
|
||||||
{ startIndex: 8, type: '' },
|
{ startIndex: 8, type: '' },
|
||||||
{ startIndex: 9, type: 'metatag.php' },
|
{ startIndex: 9, type: 'metatag.php' },
|
||||||
{ startIndex: 14, type: 'number.php' },
|
{ startIndex: 14, type: 'number.php' },
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { testTokenization } from './testRunner';
|
import { testTokenization } from './testRunner';
|
||||||
import { htmlTokenTypes } from '../src/php';
|
|
||||||
|
|
||||||
const EMBED_CS = 'metatag.cs';
|
|
||||||
|
|
||||||
testTokenization('razor', [
|
testTokenization('razor', [
|
||||||
|
|
||||||
|
|
@ -16,22 +13,22 @@ testTokenization('razor', [
|
||||||
[{
|
[{
|
||||||
line: '@{ var x; <b>x</b> }',
|
line: '@{ var x; <b>x</b> }',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: EMBED_CS },
|
{ startIndex: 0, type: 'metatag.cs' },
|
||||||
{ startIndex: 2, type: '' },
|
{ startIndex: 2, type: '' },
|
||||||
{ startIndex: 3, type: 'keyword.cs' },
|
{ startIndex: 3, type: 'keyword.cs' },
|
||||||
{ startIndex: 6, type: '' },
|
{ startIndex: 6, type: '' },
|
||||||
{ startIndex: 7, type: 'identifier.cs' },
|
{ startIndex: 7, type: 'identifier.cs' },
|
||||||
{ startIndex: 8, type: 'delimiter.cs' },
|
{ startIndex: 8, type: 'delimiter.cs' },
|
||||||
{ startIndex: 9, type: '' },
|
{ startIndex: 9, type: '' },
|
||||||
{ startIndex: 10, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 10, type: 'delimiter.html' },
|
||||||
{ startIndex: 11, type: htmlTokenTypes.getTag('b') },
|
{ startIndex: 11, type: 'tag.html' },
|
||||||
{ startIndex: 12, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 12, type: 'delimiter.html' },
|
||||||
{ startIndex: 13, type: 'identifier.cs' },
|
{ startIndex: 13, type: 'identifier.cs' },
|
||||||
{ startIndex: 14, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 14, type: 'delimiter.html' },
|
||||||
{ startIndex: 16, type: htmlTokenTypes.getTag('b') },
|
{ startIndex: 16, type: 'tag.html' },
|
||||||
{ startIndex: 17, type: htmlTokenTypes.DELIM_END },
|
{ startIndex: 17, type: 'delimiter.html' },
|
||||||
{ startIndex: 18, type: '' },
|
{ startIndex: 18, type: '' },
|
||||||
{ startIndex: 19, type: EMBED_CS }
|
{ startIndex: 19, type: 'metatag.cs' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -39,7 +36,7 @@ testTokenization('razor', [
|
||||||
[{
|
[{
|
||||||
line: '@{ var x; @* comment *@ x= 0; }',
|
line: '@{ var x; @* comment *@ x= 0; }',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: EMBED_CS },
|
{ startIndex: 0, type: 'metatag.cs' },
|
||||||
{ startIndex: 2, type: '' },
|
{ startIndex: 2, type: '' },
|
||||||
{ startIndex: 3, type: 'keyword.cs' },
|
{ startIndex: 3, type: 'keyword.cs' },
|
||||||
{ startIndex: 6, type: '' },
|
{ startIndex: 6, type: '' },
|
||||||
|
|
@ -54,7 +51,7 @@ testTokenization('razor', [
|
||||||
{ startIndex: 27, type: 'number.cs' },
|
{ startIndex: 27, type: 'number.cs' },
|
||||||
{ startIndex: 28, type: 'delimiter.cs' },
|
{ startIndex: 28, type: 'delimiter.cs' },
|
||||||
{ startIndex: 29, type: '' },
|
{ startIndex: 29, type: '' },
|
||||||
{ startIndex: 30, type: EMBED_CS }
|
{ startIndex: 30, type: 'metatag.cs' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -62,7 +59,7 @@ testTokenization('razor', [
|
||||||
[{
|
[{
|
||||||
line: '@{ var total = 0; }',
|
line: '@{ var total = 0; }',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: EMBED_CS },
|
{ startIndex: 0, type: 'metatag.cs' },
|
||||||
{ startIndex: 2, type: '' },
|
{ startIndex: 2, type: '' },
|
||||||
{ startIndex: 3, type: 'keyword.cs' },
|
{ startIndex: 3, type: 'keyword.cs' },
|
||||||
{ startIndex: 6, type: '' },
|
{ startIndex: 6, type: '' },
|
||||||
|
|
@ -73,19 +70,19 @@ testTokenization('razor', [
|
||||||
{ startIndex: 15, type: 'number.cs' },
|
{ startIndex: 15, type: 'number.cs' },
|
||||||
{ startIndex: 16, type: 'delimiter.cs' },
|
{ startIndex: 16, type: 'delimiter.cs' },
|
||||||
{ startIndex: 17, type: '' },
|
{ startIndex: 17, type: '' },
|
||||||
{ startIndex: 18, type: EMBED_CS }
|
{ startIndex: 18, type: 'metatag.cs' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
// [{
|
// [{
|
||||||
// line: '@if(true){ var total = 0; }',
|
// line: '@if(true){ var total = 0; }',
|
||||||
// tokens: [
|
// tokens: [
|
||||||
// { startIndex: 0, type: EMBED_CS },
|
// { startIndex: 0, type: 'metatag.cs' },
|
||||||
// { startIndex: 1, type: 'keyword.cs' },
|
// { startIndex: 1, type: 'keyword.cs' },
|
||||||
// { startIndex: 3, type: 'punctuation.parenthesis.cs' },
|
// { startIndex: 3, type: 'punctuation.parenthesis.cs' },
|
||||||
// { startIndex: 4, type: 'keyword.cs' },
|
// { startIndex: 4, type: 'keyword.cs' },
|
||||||
// { startIndex: 8, type: 'punctuation.parenthesis.cs' },
|
// { startIndex: 8, type: 'punctuation.parenthesis.cs' },
|
||||||
// { startIndex: 9, type: EMBED_CS },
|
// { startIndex: 9, type: 'metatag.cs' },
|
||||||
// { startIndex: 10, type: '' },
|
// { startIndex: 10, type: '' },
|
||||||
// { startIndex: 11, type: 'keyword.cs' },
|
// { startIndex: 11, type: 'keyword.cs' },
|
||||||
// { startIndex: 14, type: '' },
|
// { startIndex: 14, type: '' },
|
||||||
|
|
@ -96,7 +93,7 @@ testTokenization('razor', [
|
||||||
// { startIndex: 23, type: 'number.cs' },
|
// { startIndex: 23, type: 'number.cs' },
|
||||||
// { startIndex: 24, type: 'delimiter.cs' },
|
// { startIndex: 24, type: 'delimiter.cs' },
|
||||||
// { startIndex: 25, type: '' },
|
// { startIndex: 25, type: '' },
|
||||||
// { startIndex: 26, type: EMBED_CS }
|
// { startIndex: 26, type: 'metatag.cs' }
|
||||||
// ]}],
|
// ]}],
|
||||||
|
|
||||||
// Expressions - csharp expressions in html
|
// Expressions - csharp expressions in html
|
||||||
|
|
@ -104,11 +101,11 @@ testTokenization('razor', [
|
||||||
line: 'test@xyz<br>',
|
line: 'test@xyz<br>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: '' },
|
{ startIndex: 0, type: '' },
|
||||||
{ startIndex: 4, type: EMBED_CS },
|
{ startIndex: 4, type: 'metatag.cs' },
|
||||||
{ startIndex: 5, type: 'identifier.cs' },
|
{ startIndex: 5, type: 'identifier.cs' },
|
||||||
{ startIndex: 8, type: htmlTokenTypes.DELIM_START },
|
{ startIndex: 8, type: 'delimiter.html' },
|
||||||
{ startIndex: 9, type: htmlTokenTypes.getTag('br') },
|
{ startIndex: 9, type: 'tag.html' },
|
||||||
{ startIndex: 11, type: htmlTokenTypes.DELIM_END }
|
{ startIndex: 11, type: 'delimiter.html' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|
@ -116,7 +113,7 @@ testTokenization('razor', [
|
||||||
line: 'test@xyz',
|
line: 'test@xyz',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: '' },
|
{ startIndex: 0, type: '' },
|
||||||
{ startIndex: 4, type: EMBED_CS },
|
{ startIndex: 4, type: 'metatag.cs' },
|
||||||
{ startIndex: 5, type: 'identifier.cs' }
|
{ startIndex: 5, type: 'identifier.cs' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
@ -125,7 +122,7 @@ testTokenization('razor', [
|
||||||
line: 'test @ xyz',
|
line: 'test @ xyz',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: '' },
|
{ startIndex: 0, type: '' },
|
||||||
{ startIndex: 5, type: EMBED_CS },
|
{ startIndex: 5, type: 'metatag.cs' },
|
||||||
{ startIndex: 6, type: 'identifier.cs' }
|
{ startIndex: 6, type: 'identifier.cs' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
@ -134,9 +131,9 @@ testTokenization('razor', [
|
||||||
line: 'test @(foo) xyz',
|
line: 'test @(foo) xyz',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: '' },
|
{ startIndex: 0, type: '' },
|
||||||
{ startIndex: 5, type: EMBED_CS },
|
{ startIndex: 5, type: 'metatag.cs' },
|
||||||
{ startIndex: 7, type: 'identifier.cs' },
|
{ startIndex: 7, type: 'identifier.cs' },
|
||||||
{ startIndex: 10, type: EMBED_CS },
|
{ startIndex: 10, type: 'metatag.cs' },
|
||||||
{ startIndex: 11, type: '' }
|
{ startIndex: 11, type: '' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
@ -145,12 +142,12 @@ testTokenization('razor', [
|
||||||
line: 'test @(foo(\")\")) xyz',
|
line: 'test @(foo(\")\")) xyz',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: '' },
|
{ startIndex: 0, type: '' },
|
||||||
{ startIndex: 5, type: EMBED_CS },
|
{ startIndex: 5, type: 'metatag.cs' },
|
||||||
{ startIndex: 7, type: 'identifier.cs' },
|
{ startIndex: 7, type: 'identifier.cs' },
|
||||||
{ startIndex: 10, type: 'delimiter.parenthesis.cs' },
|
{ startIndex: 10, type: 'delimiter.parenthesis.cs' },
|
||||||
{ startIndex: 11, type: 'string.cs' },
|
{ startIndex: 11, type: 'string.cs' },
|
||||||
{ startIndex: 14, type: 'delimiter.parenthesis.cs' },
|
{ startIndex: 14, type: 'delimiter.parenthesis.cs' },
|
||||||
{ startIndex: 15, type: EMBED_CS },
|
{ startIndex: 15, type: 'metatag.cs' },
|
||||||
{ startIndex: 16, type: '' }
|
{ startIndex: 16, type: '' }
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import {loadLanguage} from '../src/monaco.contribution';
|
||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
|
|
||||||
// Allow for running under nodejs/requirejs in tests
|
// Allow for running under nodejs/requirejs in tests
|
||||||
var _monaco: typeof monaco = (typeof monaco === 'undefined' ? (<any>self).monaco : monaco);
|
const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (<any>self).monaco : monaco);
|
||||||
|
|
||||||
export interface IRelaxedToken {
|
export interface IRelaxedToken {
|
||||||
startIndex: number;
|
startIndex: number;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue