mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 20:52:56 +01:00
Eliminate htmlTokenTypes
This commit is contained in:
parent
f661c5f826
commit
3c5417b252
37 changed files with 622 additions and 716 deletions
|
|
@ -6,22 +6,6 @@
|
|||
'use strict';
|
||||
|
||||
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'], [
|
||||
|
||||
|
|
@ -29,8 +13,8 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<abc',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('abc') }
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -38,8 +22,8 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<input',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('input') }
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -47,7 +31,7 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '< abc',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: '' }
|
||||
]
|
||||
}],
|
||||
|
|
@ -56,7 +40,7 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '< abc>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: '' }
|
||||
]
|
||||
}],
|
||||
|
|
@ -66,8 +50,8 @@ testTokenization(['html', 'css'], [
|
|||
line: 'i <len;',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: '' },
|
||||
{ startIndex: 2, type: DELIM_START },
|
||||
{ startIndex: 3, type: getTag('len') },
|
||||
{ startIndex: 2, type: 'delimiter.html' },
|
||||
{ startIndex: 3, type: 'tag.html' },
|
||||
{ startIndex: 6, type: '' }
|
||||
]
|
||||
}],
|
||||
|
|
@ -76,7 +60,7 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START }
|
||||
{ startIndex: 0, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -84,8 +68,8 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '</a',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 2, type: getTag('a') }
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 2, type: 'tag.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -93,9 +77,9 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<abc>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('abc') },
|
||||
{ startIndex: 4, type: DELIM_END }
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 4, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -103,10 +87,10 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<abc >',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('abc') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 4, type: '' },
|
||||
{ startIndex: 5, type: DELIM_END }
|
||||
{ startIndex: 5, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -114,9 +98,9 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<foo:bar>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('foo-bar') },
|
||||
{ startIndex: 8, type: DELIM_END }
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 8, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -124,9 +108,9 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '</abc>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 2, type: getTag('abc') },
|
||||
{ startIndex: 5, type: DELIM_END }
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 2, type: 'tag.html' },
|
||||
{ startIndex: 5, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -134,10 +118,10 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '</abc >',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 2, type: getTag('abc') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 2, type: 'tag.html' },
|
||||
{ startIndex: 5, type: '' },
|
||||
{ startIndex: 7, type: DELIM_END }
|
||||
{ startIndex: 7, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -145,10 +129,10 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<abc />',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('abc') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ 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>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('script') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 7, type: '' },
|
||||
{ startIndex: 8, type: ATTRIB_NAME },
|
||||
{ startIndex: 12, type: DELIM_ASSIGN },
|
||||
{ startIndex: 13, type: ATTRIB_VALUE },
|
||||
{ startIndex: 30, type: DELIM_END },
|
||||
{ startIndex: 8, type: 'attribute.name.html' },
|
||||
{ startIndex: 12, type: 'delimiter.html' },
|
||||
{ startIndex: 13, type: 'attribute.value.html' },
|
||||
{ startIndex: 30, type: 'delimiter.html' },
|
||||
{ startIndex: 31, type: '' },
|
||||
{ startIndex: 41, type: DELIM_START },
|
||||
{ startIndex: 43, type: getTag('script') },
|
||||
{ startIndex: 49, type: DELIM_END }
|
||||
{ startIndex: 41, type: 'delimiter.html' },
|
||||
{ startIndex: 43, type: 'tag.html' },
|
||||
{ startIndex: 49, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -174,13 +158,13 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<script type="text/javascript">',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('script') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 7, type: '' },
|
||||
{ startIndex: 8, type: ATTRIB_NAME },
|
||||
{ startIndex: 12, type: DELIM_ASSIGN },
|
||||
{ startIndex: 13, type: ATTRIB_VALUE },
|
||||
{ startIndex: 30, type: DELIM_END }
|
||||
{ startIndex: 8, type: 'attribute.name.html' },
|
||||
{ startIndex: 12, type: 'delimiter.html' },
|
||||
{ startIndex: 13, type: 'attribute.value.html' },
|
||||
{ startIndex: 30, type: 'delimiter.html' }
|
||||
]
|
||||
}, {
|
||||
line: 'var i= 10;',
|
||||
|
|
@ -190,9 +174,9 @@ testTokenization(['html', 'css'], [
|
|||
}, {
|
||||
line: '</script>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 2, type: getTag('script') },
|
||||
{ startIndex: 8, type: DELIM_END }
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 2, type: 'tag.html' },
|
||||
{ startIndex: 8, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -200,21 +184,21 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<script type="text/javascript">var i= 10;',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('script') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 7, type: '' },
|
||||
{ startIndex: 8, type: ATTRIB_NAME },
|
||||
{ startIndex: 12, type: DELIM_ASSIGN },
|
||||
{ startIndex: 13, type: ATTRIB_VALUE },
|
||||
{ startIndex: 30, type: DELIM_END },
|
||||
{ startIndex: 8, type: 'attribute.name.html' },
|
||||
{ startIndex: 12, type: 'delimiter.html' },
|
||||
{ startIndex: 13, type: 'attribute.value.html' },
|
||||
{ startIndex: 30, type: 'delimiter.html' },
|
||||
{ startIndex: 31, type: '' },
|
||||
]
|
||||
}, {
|
||||
line: '</script>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 2, type: getTag('script') },
|
||||
{ startIndex: 8, type: DELIM_END }
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 2, type: 'tag.html' },
|
||||
{ startIndex: 8, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -222,21 +206,21 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<script type="text/javascript">',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('script') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 7, type: '' },
|
||||
{ startIndex: 8, type: ATTRIB_NAME },
|
||||
{ startIndex: 12, type: DELIM_ASSIGN },
|
||||
{ startIndex: 13, type: ATTRIB_VALUE },
|
||||
{ startIndex: 30, type: DELIM_END }
|
||||
{ startIndex: 8, type: 'attribute.name.html' },
|
||||
{ startIndex: 12, type: 'delimiter.html' },
|
||||
{ startIndex: 13, type: 'attribute.value.html' },
|
||||
{ startIndex: 30, type: 'delimiter.html' }
|
||||
]
|
||||
}, {
|
||||
line: 'var i= 10;</script>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: '' },
|
||||
{ startIndex: 10, type: DELIM_START },
|
||||
{ startIndex: 12, type: getTag('script') },
|
||||
{ startIndex: 18, type: DELIM_END }
|
||||
{ startIndex: 10, type: 'delimiter.html' },
|
||||
{ startIndex: 12, type: 'tag.html' },
|
||||
{ startIndex: 18, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -244,22 +228,22 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<script type="text/plain">a',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('script') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 7, type: '' },
|
||||
{ startIndex: 8, type: ATTRIB_NAME },
|
||||
{ startIndex: 12, type: DELIM_ASSIGN },
|
||||
{ startIndex: 13, type: ATTRIB_VALUE },
|
||||
{ startIndex: 25, type: DELIM_END },
|
||||
{ startIndex: 8, type: 'attribute.name.html' },
|
||||
{ startIndex: 12, type: 'delimiter.html' },
|
||||
{ startIndex: 13, type: 'attribute.value.html' },
|
||||
{ startIndex: 25, type: 'delimiter.html' },
|
||||
{ startIndex: 26, type: '' },
|
||||
]
|
||||
}, {
|
||||
line: '<a</script>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: '' },
|
||||
{ startIndex: 2, type: DELIM_START },
|
||||
{ startIndex: 4, type: getTag('script') },
|
||||
{ startIndex: 10, type: DELIM_END }
|
||||
{ startIndex: 2, type: 'delimiter.html' },
|
||||
{ startIndex: 4, type: 'tag.html' },
|
||||
{ startIndex: 10, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -267,20 +251,20 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<script>a</script><script>b</script>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('script') },
|
||||
{ startIndex: 7, type: DELIM_END },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 7, type: 'delimiter.html' },
|
||||
{ startIndex: 8, type: '' },
|
||||
{ startIndex: 9, type: DELIM_START },
|
||||
{ startIndex: 11, type: getTag('script') },
|
||||
{ startIndex: 17, type: DELIM_END },
|
||||
// { startIndex:18, type: DELIM_START },
|
||||
{ startIndex: 19, type: getTag('script') },
|
||||
{ startIndex: 25, type: DELIM_END },
|
||||
{ startIndex: 9, type: 'delimiter.html' },
|
||||
{ startIndex: 11, type: 'tag.html' },
|
||||
{ startIndex: 17, type: 'delimiter.html' },
|
||||
// { startIndex:18, type: 'delimiter.html' },
|
||||
{ startIndex: 19, type: 'tag.html' },
|
||||
{ startIndex: 25, type: 'delimiter.html' },
|
||||
{ startIndex: 26, type: '' },
|
||||
{ startIndex: 27, type: DELIM_START },
|
||||
{ startIndex: 29, type: getTag('script') },
|
||||
{ startIndex: 35, type: DELIM_END }
|
||||
{ startIndex: 27, type: 'delimiter.html' },
|
||||
{ startIndex: 29, type: 'tag.html' },
|
||||
{ startIndex: 35, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -288,16 +272,16 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<script type="text/javascript"></script>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('script') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 7, type: '' },
|
||||
{ startIndex: 8, type: ATTRIB_NAME },
|
||||
{ startIndex: 12, type: DELIM_ASSIGN },
|
||||
{ startIndex: 13, type: ATTRIB_VALUE },
|
||||
{ startIndex: 30, type: DELIM_END },
|
||||
// { startIndex:31, type: DELIM_START },
|
||||
{ startIndex: 33, type: getTag('script') },
|
||||
{ startIndex: 39, type: DELIM_END }
|
||||
{ startIndex: 8, type: 'attribute.name.html' },
|
||||
{ startIndex: 12, type: 'delimiter.html' },
|
||||
{ startIndex: 13, type: 'attribute.value.html' },
|
||||
{ startIndex: 30, type: 'delimiter.html' },
|
||||
// { startIndex:31, type: 'delimiter.html' },
|
||||
{ startIndex: 33, type: 'tag.html' },
|
||||
{ startIndex: 39, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -305,13 +289,13 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<script>var i= 10;</script>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('script') },
|
||||
{ startIndex: 7, type: DELIM_END },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 7, type: 'delimiter.html' },
|
||||
{ startIndex: 8, type: '' },
|
||||
{ startIndex: 18, type: DELIM_START },
|
||||
{ startIndex: 20, type: getTag('script') },
|
||||
{ startIndex: 26, type: DELIM_END }
|
||||
{ startIndex: 18, type: 'delimiter.html' },
|
||||
{ startIndex: 20, type: 'tag.html' },
|
||||
{ startIndex: 26, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -319,20 +303,20 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<script type="text/javascript" src="main.js"></script>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('script') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 7, type: '' },
|
||||
{ startIndex: 8, type: ATTRIB_NAME },
|
||||
{ startIndex: 12, type: DELIM_ASSIGN },
|
||||
{ startIndex: 13, type: ATTRIB_VALUE },
|
||||
{ startIndex: 8, type: 'attribute.name.html' },
|
||||
{ startIndex: 12, type: 'delimiter.html' },
|
||||
{ startIndex: 13, type: 'attribute.value.html' },
|
||||
{ startIndex: 30, type: '' },
|
||||
{ startIndex: 31, type: ATTRIB_NAME },
|
||||
{ startIndex: 34, type: DELIM_ASSIGN },
|
||||
{ startIndex: 35, type: ATTRIB_VALUE },
|
||||
{ startIndex: 44, type: DELIM_END },
|
||||
// { startIndex:45, type: DELIM_START },
|
||||
{ startIndex: 47, type: getTag('script') },
|
||||
{ startIndex: 53, type: DELIM_END }
|
||||
{ startIndex: 31, type: 'attribute.name.html' },
|
||||
{ startIndex: 34, type: 'delimiter.html' },
|
||||
{ startIndex: 35, type: 'attribute.value.html' },
|
||||
{ startIndex: 44, type: 'delimiter.html' },
|
||||
// { startIndex:45, type: 'delimiter.html' },
|
||||
{ startIndex: 47, type: 'tag.html' },
|
||||
{ startIndex: 53, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -340,13 +324,13 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<abc foo="bar">',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('abc') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 4, type: '' },
|
||||
{ startIndex: 5, type: ATTRIB_NAME },
|
||||
{ startIndex: 8, type: DELIM_ASSIGN },
|
||||
{ startIndex: 9, type: ATTRIB_VALUE },
|
||||
{ startIndex: 14, type: DELIM_END }
|
||||
{ startIndex: 5, type: 'attribute.name.html' },
|
||||
{ startIndex: 8, type: 'delimiter.html' },
|
||||
{ startIndex: 9, type: 'attribute.value.html' },
|
||||
{ startIndex: 14, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -354,13 +338,13 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<abc foo=\'bar\'>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('abc') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 4, type: '' },
|
||||
{ startIndex: 5, type: ATTRIB_NAME },
|
||||
{ startIndex: 8, type: DELIM_ASSIGN },
|
||||
{ startIndex: 9, type: ATTRIB_VALUE },
|
||||
{ startIndex: 14, type: DELIM_END }
|
||||
{ startIndex: 5, type: 'attribute.name.html' },
|
||||
{ startIndex: 8, type: 'delimiter.html' },
|
||||
{ startIndex: 9, type: 'attribute.value.html' },
|
||||
{ startIndex: 14, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -368,13 +352,13 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<abc foo="">',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('abc') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 4, type: '' },
|
||||
{ startIndex: 5, type: ATTRIB_NAME },
|
||||
{ startIndex: 8, type: DELIM_ASSIGN },
|
||||
{ startIndex: 9, type: ATTRIB_VALUE },
|
||||
{ startIndex: 11, type: DELIM_END }
|
||||
{ startIndex: 5, type: 'attribute.name.html' },
|
||||
{ startIndex: 8, type: 'delimiter.html' },
|
||||
{ startIndex: 9, type: 'attribute.value.html' },
|
||||
{ startIndex: 11, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -382,17 +366,17 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<abc foo="bar" bar=\'foo\'>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('abc') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 4, type: '' },
|
||||
{ startIndex: 5, type: ATTRIB_NAME },
|
||||
{ startIndex: 8, type: DELIM_ASSIGN },
|
||||
{ startIndex: 9, type: ATTRIB_VALUE },
|
||||
{ startIndex: 5, type: 'attribute.name.html' },
|
||||
{ startIndex: 8, type: 'delimiter.html' },
|
||||
{ startIndex: 9, type: 'attribute.value.html' },
|
||||
{ startIndex: 14, type: '' },
|
||||
{ startIndex: 15, type: ATTRIB_NAME },
|
||||
{ startIndex: 18, type: DELIM_ASSIGN },
|
||||
{ startIndex: 19, type: ATTRIB_VALUE },
|
||||
{ startIndex: 24, type: DELIM_END }
|
||||
{ startIndex: 15, type: 'attribute.name.html' },
|
||||
{ startIndex: 18, type: 'delimiter.html' },
|
||||
{ startIndex: 19, type: 'attribute.value.html' },
|
||||
{ startIndex: 24, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -400,17 +384,17 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<abc foo=bar bar=help-me>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('abc') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 4, type: '' },
|
||||
{ startIndex: 5, type: ATTRIB_NAME },
|
||||
{ startIndex: 8, type: DELIM_ASSIGN },
|
||||
{ startIndex: 9, type: ATTRIB_NAME }, // slightly incorrect
|
||||
{ startIndex: 5, type: 'attribute.name.html' },
|
||||
{ startIndex: 8, type: 'delimiter.html' },
|
||||
{ startIndex: 9, type: 'attribute.name.html' }, // slightly incorrect
|
||||
{ startIndex: 12, type: '' },
|
||||
{ startIndex: 13, type: ATTRIB_NAME },
|
||||
{ startIndex: 16, type: DELIM_ASSIGN },
|
||||
{ startIndex: 17, type: ATTRIB_NAME }, // slightly incorrect
|
||||
{ startIndex: 24, type: DELIM_END }
|
||||
{ startIndex: 13, type: 'attribute.name.html' },
|
||||
{ startIndex: 16, type: 'delimiter.html' },
|
||||
{ startIndex: 17, type: 'attribute.name.html' }, // slightly incorrect
|
||||
{ startIndex: 24, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -418,14 +402,14 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<abc foo= "bar">',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('abc') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 4, type: '' },
|
||||
{ startIndex: 5, type: ATTRIB_NAME },
|
||||
{ startIndex: 8, type: DELIM_ASSIGN },
|
||||
{ startIndex: 5, type: 'attribute.name.html' },
|
||||
{ startIndex: 8, type: 'delimiter.html' },
|
||||
{ startIndex: 9, type: '' },
|
||||
{ startIndex: 11, type: ATTRIB_VALUE },
|
||||
{ startIndex: 16, type: DELIM_END }
|
||||
{ startIndex: 11, type: 'attribute.value.html' },
|
||||
{ startIndex: 16, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -433,15 +417,15 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<abc foo = "bar">',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('abc') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 4, type: '' },
|
||||
{ startIndex: 5, type: ATTRIB_NAME },
|
||||
{ startIndex: 5, type: 'attribute.name.html' },
|
||||
{ startIndex: 8, type: '' },
|
||||
{ startIndex: 9, type: DELIM_ASSIGN },
|
||||
{ startIndex: 9, type: 'delimiter.html' },
|
||||
{ startIndex: 10, type: '' },
|
||||
{ startIndex: 11, type: ATTRIB_VALUE },
|
||||
{ startIndex: 16, type: DELIM_END }
|
||||
{ startIndex: 11, type: 'attribute.value.html' },
|
||||
{ startIndex: 16, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -449,11 +433,11 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<abc foo>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('abc') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 4, type: '' },
|
||||
{ startIndex: 5, type: ATTRIB_NAME },
|
||||
{ startIndex: 8, type: DELIM_END }
|
||||
{ startIndex: 5, type: 'attribute.name.html' },
|
||||
{ startIndex: 8, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -461,13 +445,13 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<abc foo bar>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('abc') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 4, type: '' },
|
||||
{ startIndex: 5, type: ATTRIB_NAME },
|
||||
{ startIndex: 5, type: 'attribute.name.html' },
|
||||
{ startIndex: 8, type: '' },
|
||||
{ startIndex: 9, type: ATTRIB_NAME },
|
||||
{ startIndex: 12, type: DELIM_END }
|
||||
{ startIndex: 9, type: 'attribute.name.html' },
|
||||
{ startIndex: 12, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -475,14 +459,14 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<abc foo!@#="bar">',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('abc') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 4, type: '' },
|
||||
{ startIndex: 5, type: ATTRIB_NAME },
|
||||
{ startIndex: 5, type: 'attribute.name.html' },
|
||||
{ startIndex: 8, type: '' },
|
||||
{ startIndex: 11, type: DELIM_ASSIGN },
|
||||
{ startIndex: 12, type: ATTRIB_VALUE },
|
||||
{ startIndex: 17, type: DELIM_END }
|
||||
{ startIndex: 11, type: 'delimiter.html' },
|
||||
{ startIndex: 12, type: 'attribute.value.html' },
|
||||
{ startIndex: 17, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -490,25 +474,25 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<abc #myinput (click)="bar" [value]="someProperty" *ngIf="someCondition">',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('abc') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 4, type: '' },
|
||||
{ startIndex: 6, type: ATTRIB_NAME },
|
||||
{ startIndex: 6, type: 'attribute.name.html' },
|
||||
{ startIndex: 13, type: '' },
|
||||
{ startIndex: 15, type: ATTRIB_NAME },
|
||||
{ startIndex: 15, type: 'attribute.name.html' },
|
||||
{ startIndex: 20, type: '' },
|
||||
{ startIndex: 21, type: DELIM_ASSIGN },
|
||||
{ startIndex: 22, type: ATTRIB_VALUE },
|
||||
{ startIndex: 21, type: 'delimiter.html' },
|
||||
{ startIndex: 22, type: 'attribute.value.html' },
|
||||
{ startIndex: 27, type: '' },
|
||||
{ startIndex: 29, type: ATTRIB_NAME },
|
||||
{ startIndex: 29, type: 'attribute.name.html' },
|
||||
{ startIndex: 34, type: '' },
|
||||
{ startIndex: 35, type: DELIM_ASSIGN },
|
||||
{ startIndex: 36, type: ATTRIB_VALUE },
|
||||
{ startIndex: 35, type: 'delimiter.html' },
|
||||
{ startIndex: 36, type: 'attribute.value.html' },
|
||||
{ startIndex: 50, type: '' },
|
||||
{ startIndex: 52, type: ATTRIB_NAME },
|
||||
{ startIndex: 56, type: DELIM_ASSIGN },
|
||||
{ startIndex: 57, type: ATTRIB_VALUE },
|
||||
{ startIndex: 72, type: DELIM_END }
|
||||
{ startIndex: 52, type: 'attribute.name.html' },
|
||||
{ startIndex: 56, type: 'delimiter.html' },
|
||||
{ startIndex: 57, type: 'attribute.value.html' },
|
||||
{ startIndex: 72, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -516,13 +500,13 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<abc foo=">',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('abc') },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 4, type: '' },
|
||||
{ startIndex: 5, type: ATTRIB_NAME },
|
||||
{ startIndex: 8, type: DELIM_ASSIGN },
|
||||
{ startIndex: 5, type: 'attribute.name.html' },
|
||||
{ startIndex: 8, type: 'delimiter.html' },
|
||||
{ startIndex: 9, type: '' },
|
||||
{ startIndex: 10, type: DELIM_END }
|
||||
{ startIndex: 10, type: 'delimiter.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -530,9 +514,9 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<!--a-->',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_COMMENT },
|
||||
{ startIndex: 4, type: COMMENT },
|
||||
{ startIndex: 5, type: DELIM_COMMENT }
|
||||
{ startIndex: 0, type: 'comment.html' },
|
||||
{ startIndex: 4, type: 'comment.content.html' },
|
||||
{ startIndex: 5, type: 'comment.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -540,9 +524,9 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<!--a>foo bar</a -->',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_COMMENT },
|
||||
{ startIndex: 4, type: COMMENT },
|
||||
{ startIndex: 17, type: DELIM_COMMENT }
|
||||
{ startIndex: 0, type: 'comment.html' },
|
||||
{ startIndex: 4, type: 'comment.content.html' },
|
||||
{ startIndex: 17, type: 'comment.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -550,19 +534,19 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<!--a>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_COMMENT },
|
||||
{ startIndex: 4, type: COMMENT }
|
||||
{ startIndex: 0, type: 'comment.html' },
|
||||
{ startIndex: 4, type: 'comment.content.html' }
|
||||
]
|
||||
}, {
|
||||
line: 'foo ',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: COMMENT },
|
||||
{ startIndex: 0, type: 'comment.content.html' },
|
||||
]
|
||||
}, {
|
||||
line: 'bar</a -->',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: COMMENT },
|
||||
{ startIndex: 7, type: DELIM_COMMENT }
|
||||
{ startIndex: 0, type: 'comment.content.html' },
|
||||
{ startIndex: 7, type: 'comment.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -570,9 +554,9 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<!DOCTYPE a>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_DOCTYPE },
|
||||
{ startIndex: 9, type: DOCTYPE },
|
||||
{ startIndex: 11, type: DELIM_DOCTYPE }
|
||||
{ startIndex: 0, type: 'metatag.html' },
|
||||
{ startIndex: 9, type: 'metatag.content.html' },
|
||||
{ startIndex: 11, type: 'metatag.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -580,9 +564,9 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<!doctype a>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_DOCTYPE },
|
||||
{ startIndex: 9, type: DOCTYPE },
|
||||
{ startIndex: 11, type: DELIM_DOCTYPE }
|
||||
{ startIndex: 0, type: 'metatag.html' },
|
||||
{ startIndex: 9, type: 'metatag.content.html' },
|
||||
{ startIndex: 11, type: 'metatag.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -590,14 +574,14 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<!DOCTYPE a',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_DOCTYPE },
|
||||
{ startIndex: 9, type: DOCTYPE },
|
||||
{ startIndex: 0, type: 'metatag.html' },
|
||||
{ startIndex: 9, type: 'metatag.content.html' },
|
||||
]
|
||||
}, {
|
||||
line: '"foo" \'bar\'>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DOCTYPE },
|
||||
{ startIndex: 11, type: DELIM_DOCTYPE }
|
||||
{ startIndex: 0, type: 'metatag.content.html' },
|
||||
{ startIndex: 11, type: 'metatag.html' }
|
||||
]
|
||||
}],
|
||||
|
||||
|
|
@ -605,13 +589,13 @@ testTokenization(['html', 'css'], [
|
|||
[{
|
||||
line: '<asdf:bar>asd</asdf:bar>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: DELIM_START },
|
||||
{ startIndex: 1, type: getTag('asdf:bar') },
|
||||
{ startIndex: 9, type: DELIM_END },
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 9, type: 'delimiter.html' },
|
||||
{ startIndex: 10, type: '' },
|
||||
{ startIndex: 13, type: DELIM_START },
|
||||
{ startIndex: 15, type: getTag('asdf:bar') },
|
||||
{ startIndex: 23, type: DELIM_END }
|
||||
{ startIndex: 13, type: 'delimiter.html' },
|
||||
{ startIndex: 15, type: 'tag.html' },
|
||||
{ startIndex: 23, type: 'delimiter.html' }
|
||||
]
|
||||
}]
|
||||
]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue