Format sources

This commit is contained in:
Alex Dima 2017-06-08 18:54:55 +02:00
parent da162968ac
commit f661c5f826
65 changed files with 19255 additions and 17150 deletions

View file

@ -1,11 +1,12 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.trimTrailingWhitespace": true,
"search.exclude": {
"**/node_modules": true,
"**/release": true,
"**/out": true
},
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"editor.tabSize": 4,
"editor.insertSpaces": false,
"typescript.tsdk": "./node_modules/typescript/lib"

View file

@ -90,13 +90,22 @@ export var language = <ILanguage> {
],
string: [
[/[^\\"'%]+/, { cases: { '@eos': {token:'string', next:'@popall'}, '@default': 'string' }}],
[/[^\\"'%]+/, {
cases: {
'@eos': { token: 'string', next: '@popall' },
'@default': 'string'
}
}],
[/@escapes/, 'string.escape'],
[/\\./, 'string.escape.invalid'],
[/%[\w ]+%/, 'variable'],
[/%%[\w]+(?!\w)/, 'variable'],
[/["']/, { cases: { '$#==$S2' : { token: 'string', next: '@pop' },
'@default': 'string' }} ],
[/["']/, {
cases: {
'$#==$S2': { token: 'string', next: '@pop' },
'@default': 'string'
}
}],
[/$/, 'string', '@popall']
],

View file

@ -33,11 +33,6 @@ export var conf:IRichLanguageConfiguration = {
{ open: '"', close: '"' },
{ open: '\'', close: '\'' },
]
// enhancedBrackets: [
// { open: /for$/ }, { open: /while$/ }, { open: /loop$/ }, { open: /if$/ }, { open: /unless$/ },
// { open: /else$/ }, { open: /switch$/ }, { open: /try$/ }, { open: /catch$/ }, { open: /finally$/ },
// { open: /class$/ }, { open: /->$/ }
// ],
};
export var language = <ILanguage>{
@ -73,7 +68,8 @@ export var language = <ILanguage> {
// identifiers and keywords
[/\@[a-zA-Z_]\w*/, 'variable.predefined'],
[/[a-zA-Z_]\w*/, { cases: {
[/[a-zA-Z_]\w*/, {
cases: {
'this': 'variable.predefined',
'@keywords': { token: 'keyword.$0' },
'@default': ''
@ -105,9 +101,12 @@ export var language = <ILanguage> {
// delimiters
[/}/, { cases: {
'$S2==interpolatedstring' : { token: 'string', next: '@pop' }
, '@default' : '@brackets' } }],
[/}/, {
cases: {
'$S2==interpolatedstring': { token: 'string', next: '@pop' },
'@default': '@brackets'
}
}],
[/[{}()\[\]]/, '@brackets'],
[/@symbols/, 'delimiter'],
@ -124,8 +123,18 @@ export var language = <ILanguage> {
// strings:
[/"""/, 'string', '@herestring."""'],
[/'''/, 'string', '@herestring.\'\'\''],
[/"/, { cases: { '@eos': 'string', '@default': {token:'string', next:'@string."'} }} ],
[/'/, { cases: { '@eos': 'string', '@default': {token:'string', next:'@string.\''} }} ],
[/"/, {
cases: {
'@eos': 'string',
'@default': { token: 'string', next: '@string."' }
}
}],
[/'/, {
cases: {
'@eos': 'string',
'@default': { token: 'string', next: '@string.\'' }
}
}],
],
string: [
@ -134,14 +143,29 @@ export var language = <ILanguage> {
[/\./, 'string.escape.invalid'],
[/\./, 'string.escape.invalid'],
[/#{/, { cases: { '$S2=="': { token: 'string', next: 'root.interpolatedstring' }, '@default': 'string' }}],
[/#{/, {
cases: {
'$S2=="': { token: 'string', next: 'root.interpolatedstring' },
'@default': 'string'
}
}],
[/["']/, { cases: { '$#==$S2' : { token: 'string', next: '@pop' }, '@default': 'string' }} ],
[/["']/, {
cases: {
'$#==$S2': { token: 'string', next: '@pop' },
'@default': 'string'
}
}],
[/#/, 'string']
],
herestring: [
[/("""|''')/, { cases: { '$1==$S2': { token: 'string', next: '@pop' }, '@default': 'string' } }],
[/("""|''')/, {
cases: {
'$1==$S2': { token: 'string', next: '@pop' },
'@default': 'string'
}
}],
[/[^#\\'"]+/, 'string'],
[/['"]+/, 'string'],
[/@escapes/, 'string.escape'],

View file

@ -245,8 +245,12 @@ export var language = <ILanguage> {
tokenizer: {
root: [
// identifiers and keywords
[/[a-zA-Z_]\w*/, { cases: { '@keywords': {token:'keyword.$0'},
'@default': 'identifier' } }],
[/[a-zA-Z_]\w*/, {
cases: {
'@keywords': { token: 'keyword.$0' },
'@default': 'identifier'
}
}],
// whitespace
{ include: '@whitespace' },
@ -260,8 +264,12 @@ export var language = <ILanguage> {
// delimiters and operators
[/[{}()\[\]]/, '@brackets'],
[/[<>](?!@symbols)/, '@brackets'],
[/@symbols/, { cases: { '@operators': 'delimiter',
'@default' : '' } } ],
[/@symbols/, {
cases: {
'@operators': 'delimiter',
'@default': ''
}
}],
// numbers
[/\d*\d+[eE]([\-+]?\d+)?(@floatsuffix)/, 'number.float'],

View file

@ -89,7 +89,8 @@ export var language = <ILanguage> {
root: [
// identifiers and keywords
[/\@?[a-zA-Z_]\w*/, { cases: {
[/\@?[a-zA-Z_]\w*/, {
cases: {
'@namespaceFollows': { token: 'keyword.$0', next: '@namespace' },
'@keywords': { token: 'keyword.$0', next: '@qualified' },
'@default': { token: 'identifier', next: '@qualified' }
@ -100,13 +101,21 @@ export var language = <ILanguage> {
{ include: '@whitespace' },
// delimiters and operators
[/}/, { cases: {
'$S2==interpolatedstring' : { token: 'string.quote', next: '@pop' }
, '$S2==litinterpstring' : { token: 'string.quote', next: '@pop' }
, '@default' : '@brackets' } }],
[/}/, {
cases: {
'$S2==interpolatedstring': { token: 'string.quote', next: '@pop' },
'$S2==litinterpstring': { token: 'string.quote', next: '@pop' },
'@default': '@brackets'
}
}],
[/[{}()\[\]]/, '@brackets'],
[/[<>](?!@symbols)/, '@brackets'],
[/@symbols/, { cases: { '@operators': 'delimiter', '@default' : '' } } ],
[/@symbols/, {
cases: {
'@operators': 'delimiter',
'@default': ''
}
}],
// numbers
@ -132,9 +141,11 @@ export var language = <ILanguage> {
],
qualified: [
[/[a-zA-Z_][\w]*/, { cases:
{ '@keywords': {token:'keyword.$0'},
'@default': 'identifier' }
[/[a-zA-Z_][\w]*/, {
cases: {
'@keywords': { token: 'keyword.$0' },
'@default': 'identifier'
}
}],
[/\./, 'delimiter'],
['', '', '@pop'],

View file

@ -60,14 +60,34 @@ export var language = <ILanguage>{
{ include: '@whitespace' },
{ include: '@strings' },
[/(@variable)/, { cases: { '@eos': {token:'variable', next:'@popall'}, '@default': 'variable' }} ],
[/\\/, { cases: { '@eos': '', '@default': '' }}],
[/./, { cases: { '@eos': {token:'', next:'@popall'}, '@default': '' } }],
[/(@variable)/, {
cases: {
'@eos': { token: 'variable', next: '@popall' },
'@default': 'variable'
}
}],
[/\\/, {
cases: {
'@eos': '',
'@default': ''
}
}],
[/./, {
cases: {
'@eos': { token: '', next: '@popall' },
'@default': ''
}
}],
],
// Deal with white space, including comments
whitespace: [
[/\s+/, { cases: { '@eos': {token:'', next:'@popall'}, '@default': '' }}],
[/\s+/, {
cases: {
'@eos': { token: '', next: '@popall' },
'@default': ''
}
}],
],
comment: [
@ -82,7 +102,12 @@ export var language = <ILanguage>{
[/"/, 'string', '@dblStringBody']
],
stringBody: [
[/[^\\\$']/, { cases: { '@eos': {token:'string', next:'@popall'}, '@default': 'string' }}],
[/[^\\\$']/, {
cases: {
'@eos': { token: 'string', next: '@popall' },
'@default': 'string'
}
}],
[/\\./, 'string.escape'],
[/'$/, 'string', '@popall'],
@ -93,7 +118,12 @@ export var language = <ILanguage>{
[/$/, 'string', '@popall']
],
dblStringBody: [
[/[^\\\$"]/, { cases: { '@eos': {token:'string', next:'@popall'}, '@default': 'string' }}],
[/[^\\\$"]/, {
cases: {
'@eos': { token: 'string', next: '@popall' },
'@default': 'string'
}
}],
[/\\./, 'string.escape'],
[/"$/, 'string', '@popall'],

View file

@ -73,8 +73,12 @@ export var language = <ILanguage> {
tokenizer: {
root: [
// identifiers and keywords
[/[a-zA-Z_]\w*/, { cases: { '@keywords': {token:'keyword.$0'},
'@default': 'identifier' } }],
[/[a-zA-Z_]\w*/, {
cases: {
'@keywords': { token: 'keyword.$0' },
'@default': 'identifier'
}
}],
// whitespace
{ include: '@whitespace' },
@ -131,8 +135,12 @@ export var language = <ILanguage> {
[/[^\\"]+/, 'string'],
[/@escapes/, 'string.escape'],
[/\\./, 'string.escape.invalid'],
[/("""|"B?)/, { cases: { '$#==$S2' : { token: 'string', next: '@pop' },
'@default': 'string' }} ]
[/("""|"B?)/, {
cases: {
'$#==$S2': { token: 'string', next: '@pop' },
'@default': 'string'
}
}]
],
litstring: [

View file

@ -107,8 +107,12 @@ export var language = <ILanguage> {
tokenizer: {
root: [
// identifiers and keywords
[/[a-zA-Z_]\w*/, { cases: { '@keywords': {token:'keyword.$0'},
'@default': 'identifier' } }],
[/[a-zA-Z_]\w*/, {
cases: {
'@keywords': { token: 'keyword.$0' },
'@default': 'identifier'
}
}],
// whitespace
{ include: '@whitespace' },
@ -122,8 +126,12 @@ export var language = <ILanguage> {
// delimiters and operators
[/[{}()\[\]]/, '@brackets'],
[/[<>](?!@symbols)/, '@brackets'],
[/@symbols/, { cases: { '@operators': 'delimiter',
'@default' : '' } } ],
[/@symbols/, {
cases: {
'@operators': 'delimiter',
'@default': ''
}
}],
// numbers
[/\d*\d+[eE]([\-+]?\d+)?/, 'number.float'],

View file

@ -72,8 +72,12 @@ export var language = <ILanguage> {
[/[^\\"']+/, 'string'],
[/@escapes/, 'string.escape'],
[/\\./, 'string.escape.invalid'],
[/["']/, { cases: { '$#==$S2' : { token: 'string', next: '@pop' },
'@default': 'string' }} ]
[/["']/, {
cases: {
'$#==$S2': { token: 'string', next: '@pop' },
'@default': 'string'
}
}]
],
},
};

View file

@ -70,17 +70,35 @@ export var language = <ILanguage> {
// Tag or a keyword at start
[/^(\s*)([a-zA-Z_-][\w-]*)/,
{ cases: {
'$2@tags': { cases: { '@eos': ['', 'tag'], '@default': ['', { token: 'tag', next: '@tag.$1' }, ] } },
{
cases: {
'$2@tags': {
cases: {
'@eos': ['', 'tag'],
'@default': ['', { token: 'tag', next: '@tag.$1' },]
}
},
'$2@keywords': ['', { token: 'keyword.$2' },],
'@default': [ '', '', ]}}
'@default': ['', '',]
}
}
],
// id
[/^(\s*)(#[a-zA-Z_-][\w-]*)/, { cases: { '@eos': ['', 'tag.id'], '@default': ['', { token: 'tag.id', next: '@tag.$1' }] }}],
[/^(\s*)(#[a-zA-Z_-][\w-]*)/, {
cases: {
'@eos': ['', 'tag.id'],
'@default': ['', { token: 'tag.id', next: '@tag.$1' }]
}
}],
// class
[/^(\s*)(\.[a-zA-Z_-][\w-]*)/, { cases: { '@eos': ['', 'tag.class'], '@default': ['', { token: 'tag.class', next: '@tag.$1' }] } }],
[/^(\s*)(\.[a-zA-Z_-][\w-]*)/, {
cases: {
'@eos': ['', 'tag.class'],
'@default': ['', { token: 'tag.class', next: '@tag.$1' }]
}
}],
// plain text with pipe
[/^(\s*)(\|.*)$/, ''],
@ -88,8 +106,12 @@ export var language = <ILanguage> {
{ include: '@whitespace' },
// keywords
[/[a-zA-Z_$][\w$]*/, { cases: { '@keywords': {token:'keyword.$0'},
'@default': '' } }],
[/[a-zA-Z_$][\w$]*/, {
cases: {
'@keywords': { token: 'keyword.$0' },
'@default': ''
}
}],
// delimiters and operators
[/[{}()\[\]]/, '@brackets'],
@ -109,9 +131,19 @@ export var language = <ILanguage> {
[/\s+/, { token: '', next: '@simpleText' }],
// id
[/#[a-zA-Z_-][\w-]*/, { cases: { '@eos': { token: 'tag.id', next: '@pop' }, '@default': 'tag.id' } }],
[/#[a-zA-Z_-][\w-]*/, {
cases: {
'@eos': { token: 'tag.id', next: '@pop' },
'@default': 'tag.id'
}
}],
// class
[/\.[a-zA-Z_-][\w-]*/, { cases: { '@eos': { token: 'tag.class', next: '@pop' }, '@default': 'tag.class' } }],
[/\.[a-zA-Z_-][\w-]*/, {
cases: {
'@eos': { token: 'tag.class', next: '@pop' },
'@default': 'tag.class'
}
}],
// attributes
[/\(/, { token: 'delimiter.parenthesis', next: '@attributeList' }],
],
@ -121,9 +153,12 @@ export var language = <ILanguage> {
[/[^#]+/, { token: '' }],
// interpolation
[/(#{)([^}]*)(})/, { cases: {
[/(#{)([^}]*)(})/, {
cases: {
'@eos': ['interpolation.delimiter', 'interpolation', { token: 'interpolation.delimiter', next: '@popall' }],
'@default': ['interpolation.delimiter', 'interpolation', 'interpolation.delimiter'] }}],
'@default': ['interpolation.delimiter', 'interpolation', 'interpolation.delimiter']
}
}],
[/#$/, { token: '', next: '@popall' }],
[/#/, '']
@ -135,7 +170,12 @@ export var language = <ILanguage> {
[/\w+/, 'attribute.name'],
[/,/, { cases: { '@eos': { token: 'attribute.delimiter', next: '@popall' }, '@default': 'attribute.delimiter' } }],
[/,/, {
cases: {
'@eos': { token: 'attribute.delimiter', next: '@popall' },
'@default': 'attribute.delimiter'
}
}],
[/\)$/, { token: 'delimiter.parenthesis', next: '@popall' }],
[/\)/, { token: 'delimiter.parenthesis', next: '@pop' }],
@ -148,7 +188,12 @@ export var language = <ILanguage> {
],
blockText: [
[/^\s+.*$/, { cases: { '($S2\\s+.*$)': { token: '$S3' }, '@default': { token: '@rematch', next: '@popall' } } }],
[/^\s+.*$/, {
cases: {
'($S2\\s+.*$)': { token: '$S3' },
'@default': { token: '@rematch', next: '@popall' }
}
}],
[/./, { token: '@rematch', next: '@popall' }]
],
@ -160,20 +205,55 @@ export var language = <ILanguage> {
],
string: [
[/[^\\"'#]+/, { cases: { '@eos': { token: 'string', next: '@popall' }, '@default': 'string' } }],
[/@escapes/, { cases: { '@eos': { token: 'string.escape', next: '@popall' }, '@default': 'string.escape' }}],
[/\\./, { cases: { '@eos': { token: 'string.escape.invalid', next: '@popall' }, '@default': 'string.escape.invalid' }}],
[/[^\\"'#]+/, {
cases: {
'@eos': { token: 'string', next: '@popall' },
'@default': 'string'
}
}],
[/@escapes/, {
cases: {
'@eos': { token: 'string.escape', next: '@popall' },
'@default': 'string.escape'
}
}],
[/\\./, {
cases: {
'@eos': { token: 'string.escape.invalid', next: '@popall' },
'@default': 'string.escape.invalid'
}
}],
// interpolation
[/(#{)([^}]*)(})/, ['interpolation.delimiter', 'interpolation', 'interpolation.delimiter']],
[/#/, 'string'],
[/["']/, { cases: { '$#==$S2': { token: 'string', next: '@pop' }, '@default': { token: 'string' } } }],
[/["']/, {
cases: {
'$#==$S2': { token: 'string', next: '@pop' },
'@default': { token: 'string' }
}
}],
],
// Almost identical to above, except for escapes and the output token
value: [
[/[^\\"']+/, { cases: { '@eos': { token: 'attribute.value', next: '@popall' }, '@default': 'attribute.value' }}],
[/\\./, { cases: { '@eos': { token: 'attribute.value', next: '@popall' }, '@default': 'attribute.value' }}],
[/["']/, { cases: { '$#==$S2': { token: 'attribute.value', next: '@pop' }, '@default': { token: 'attribute.value' } } }],
[/[^\\"']+/, {
cases: {
'@eos': { token: 'attribute.value', next: '@popall' },
'@default': 'attribute.value'
}
}],
[/\\./, {
cases: {
'@eos': { token: 'attribute.value', next: '@popall' },
'@default': 'attribute.value'
}
}],
[/["']/, {
cases: {
'$#==$S2': { token: 'attribute.value', next: '@pop' },
'@default': { token: 'attribute.value' }
}
}],
],
},
};

View file

@ -71,8 +71,12 @@ export var language = <ILanguage> {
tokenizer: {
root: [
// identifiers and keywords
[/[a-zA-Z_$][\w$]*/, { cases: { '@keywords': {token:'keyword.$0'},
'@default': 'identifier' } }],
[/[a-zA-Z_$][\w$]*/, {
cases: {
'@keywords': { token: 'keyword.$0' },
'@default': 'identifier'
}
}],
// whitespace
{ include: '@whitespace' },
@ -80,8 +84,12 @@ export var language = <ILanguage> {
// delimiters and operators
[/[{}()\[\]]/, '@brackets'],
[/[<>](?!@symbols)/, '@brackets'],
[/@symbols/, { cases: { '@operators': 'delimiter',
'@default' : '' } } ],
[/@symbols/, {
cases: {
'@operators': 'delimiter',
'@default': ''
}
}],
// @ annotations.
[/@\s*[a-zA-Z_\$][\w\$]*/, 'annotation'],

View file

@ -65,8 +65,12 @@ export var language = <ILanguage> {
tokenizer: {
root: [
// identifiers and keywords
[/[a-zA-Z_]\w*/, { cases: { '@keywords': {token:'keyword.$0'},
'@default': 'identifier' } }],
[/[a-zA-Z_]\w*/, {
cases: {
'@keywords': { token: 'keyword.$0' },
'@default': 'identifier'
}
}],
// whitespace
{ include: '@whitespace' },
@ -76,8 +80,12 @@ export var language = <ILanguage> {
// delimiters and operators
[/[{}()\[\]]/, '@brackets'],
[/@symbols/, { cases: { '@operators': 'delimiter',
'@default' : '' } } ],
[/@symbols/, {
cases: {
'@operators': 'delimiter',
'@default': ''
}
}],
// numbers
[/\d*\.\d+([eE][\-+]?\d+)?/, 'number.float'],
@ -102,7 +110,12 @@ export var language = <ILanguage> {
comment: [
[/[^\]]+/, 'comment'],
[/\]([=]*)\]/, { cases: { '$1==$S2': { token: 'comment', next: '@pop' }, '@default' : 'comment' } } ],
[/\]([=]*)\]/, {
cases: {
'$1==$S2': { token: 'comment', next: '@pop' },
'@default': 'comment'
}
}],
[/./, 'comment']
],
@ -110,8 +123,12 @@ export var language = <ILanguage> {
[/[^\\"']+/, 'string'],
[/@escapes/, 'string.escape'],
[/\\./, 'string.escape.invalid'],
[/["']/, { cases: { '$#==$S2' : { token: 'string', next: '@pop' },
'@default': 'string' }} ]
[/["']/, {
cases: {
'$#==$S2': { token: 'string', next: '@pop' },
'@default': 'string'
}
}]
],
},

View file

@ -123,12 +123,13 @@ export var language = <ILanguage> {
{ include: '@complexIdentifiers' },
[/[;,.]/, 'delimiter'],
[/[({})]/, '@brackets'],
[/[a-z_][a-zA-Z0-9_]*/,
{ cases: { '@keywords': 'keyword'
, '@functions': 'keyword'
, '@default': 'identifier' }
[/[a-z_][a-zA-Z0-9_]*/, {
cases: {
'@keywords': 'keyword',
'@functions': 'keyword',
'@default': 'identifier'
}
],
}],
[/[<>=!%&+\-*/|~^]/, 'operator'],
],
whitespace: [

View file

@ -159,8 +159,12 @@ export var language = <ILanguage> {
[/[,:;]/, 'delimiter'],
[/[{}\[\]()<>]/, '@brackets'],
[/[a-zA-Z@#]\w*/, { cases: { '@keywords': 'keyword',
'@default': 'identifier' } }],
[/[a-zA-Z@#]\w*/, {
cases: {
'@keywords': 'keyword',
'@default': 'identifier'
}
}],
[/[<>=\\+\\-\\*\\/\\^\\|\\~,]|and\\b|or\\b|not\\b]/, 'operator'],
],
@ -182,8 +186,11 @@ export var language = <ILanguage> {
numbers: [
[/0[xX][0-9a-fA-F]*(_?[0-9a-fA-F])*/, 'number.hex'],
[/@decimal((\.@decpart)?([eE][\-+]?@decpart)?)[fF]*/, {
cases: { '(\\d)*': 'number',
'$0':'number.float' }} ]
cases: {
'(\\d)*': 'number',
'$0': 'number.float'
}
}]
],
// Recognize strings, including those broken across lines with \ (but not without)

View file

@ -507,7 +507,8 @@ export var language = <ILanguage> {
// lexing_DOLLAR:
// '$' IDENTFST IDENTRST* => lexing_IDENT_dlr, _ => lexing_IDENT_sym
{regex: /\$@IDENTFST@IDENTRST*/,
{
regex: /\$@IDENTFST@IDENTRST*/,
action: {
cases: {
'@keywords_dlr': { token: 'keyword.dlr' },
@ -517,7 +518,8 @@ export var language = <ILanguage> {
},
// lexing_SHARP:
// '#' IDENTFST IDENTRST* => lexing_ident_srp, _ => lexing_IDENT_sym
{regex: /\#@IDENTFST@IDENTRST*/,
{
regex: /\#@IDENTFST@IDENTRST*/,
action: {
cases: {
'@keywords_srp': { token: 'keyword.srp' },
@ -551,7 +553,8 @@ export var language = <ILanguage> {
// NOTE: (?!regex) is syntax for "not-followed-by" regex
// to resolve ambiguity such as foreach$fwork being incorrectly lexed as [for] [each$fwork]!
{ regex: /@irregular_keywords(?!@IDENTRST)/, action: { token: 'keyword' } },
{regex: /@IDENTFST@IDENTRST*[<!\[]?/,
{
regex: /@IDENTFST@IDENTRST*[<!\[]?/,
action: {
cases: {
// TODO: dynload and staload should be specially parsed
@ -572,7 +575,8 @@ export var language = <ILanguage> {
{ regex: /\/\*/, action: { token: 'comment', next: '@lexing_COMMENT_block_c' } },
// AS-20160627: specifically for effect annotations
{ regex: /-<|=</, action: { token: 'keyword', next: '@lexing_EFFECT_commaseq0' } },
{regex: /@symbolic+/,
{
regex: /@symbolic+/,
action: {
cases: {
'@operators': 'keyword',
@ -626,7 +630,8 @@ export var language = <ILanguage> {
// NOTE: added by AS, specifically for highlighting
lexing_EFFECT_commaseq0: [
{regex: /@IDENTFST@IDENTRST+|@digit+/,
{
regex: /@IDENTFST@IDENTRST+|@digit+/,
action: {
cases: {
'@keywords_effects': { token: 'type.effect' },

View file

@ -67,8 +67,12 @@ export var language = <ILanguage> {
root: [
// commands and keywords
[/[a-zA-Z_][\w-]*/, { cases: { '@keywords': {token:'keyword.$0'},
'@default': '' } }],
[/[a-zA-Z_][\w-]*/, {
cases: {
'@keywords': { token: 'keyword.$0' },
'@default': ''
}
}],
// whitespace
[/[ \t\r\n]+/, ''],
@ -98,28 +102,82 @@ export var language = <ILanguage> {
// strings:
[/\@"/, 'string', '@herestring."'],
[/\@'/, 'string', '@herestring.\''],
[/"/, { cases: { '@eos': 'string', '@default': {token:'string', next:'@string."'} }} ],
[/'/, { cases: { '@eos': 'string', '@default': {token:'string', next:'@string.\''} }} ],
[/"/, {
cases: {
'@eos': 'string',
'@default': { token: 'string', next: '@string."' }
}
}],
[/'/, {
cases: {
'@eos': 'string',
'@default': { token: 'string', next: '@string.\'' }
}
}],
],
string: [
[/[^"'\$`]+/, { cases: { '@eos': {token:'string', next:'@popall'}, '@default': 'string' }}],
[/@escapes/, { cases: { '@eos': {token:'string.escape', next:'@popall'}, '@default': 'string.escape' }}],
[/`./, { cases: { '@eos': {token:'string.escape.invalid', next:'@popall'}, '@default': 'string.escape.invalid' }}],
[/[^"'\$`]+/, {
cases: {
'@eos': { token: 'string', next: '@popall' },
'@default': 'string'
}
}],
[/@escapes/, {
cases: {
'@eos': { token: 'string.escape', next: '@popall' },
'@default': 'string.escape'
}
}],
[/`./, {
cases: {
'@eos': { token: 'string.escape.invalid', next: '@popall' },
'@default': 'string.escape.invalid'
}
}],
[/\$[\w]+$/, { cases: { '$S2=="': { token: 'variable', next: '@popall' }, '@default': { token: 'string', next: '@popall' } } }],
[/\$[\w]+/, { cases: { '$S2=="': 'variable', '@default': 'string' }}],
[/\$[\w]+$/, {
cases: {
'$S2=="': { token: 'variable', next: '@popall' },
'@default': { token: 'string', next: '@popall' }
}
}],
[/\$[\w]+/, {
cases: {
'$S2=="': 'variable',
'@default': 'string'
}
}],
[/["']/, { cases: { '$#==$S2' : { token: 'string', next: '@pop' },
'@default': { cases: { '@eos': {token:'string', next:'@popall'}, '@default': 'string' }} }} ],
[/["']/, {
cases: {
'$#==$S2': { token: 'string', next: '@pop' },
'@default': {
cases: {
'@eos': { token: 'string', next: '@popall' },
'@default': 'string'
}
}
}
}],
],
herestring: [
[/^\s*(["'])@/, { cases: { '$1==$S2': { token: 'string', next: '@pop' }, '@default': 'string' } }],
[/^\s*(["'])@/, {
cases: {
'$1==$S2': { token: 'string', next: '@pop' },
'@default': 'string'
}
}],
[/[^\$`]+/, 'string'],
[/@escapes/, 'string.escape'],
[/`./, 'string.escape.invalid'],
[/\$[\w]+/, { cases: { '$S2=="': 'variable', '@default': 'string' } }],
[/\$[\w]+/, {
cases: {
'$S2=="': 'variable',
'@default': 'string'
}
}],
],
comment: [

View file

@ -187,8 +187,12 @@ export var language = <ILanguage> {
[/[{}\[\]()]/, '@brackets'],
[/@[a-zA-Z]\w*/, 'tag'],
[/[a-zA-Z]\w*/, { cases: { '@keywords': 'keyword',
'@default': 'identifier' } }]
[/[a-zA-Z]\w*/, {
cases: {
'@keywords': 'keyword',
'@default': 'identifier'
}
}]
],
// Deal with white space, including single and multi-line comments

View file

@ -150,20 +150,28 @@ export var language = <ILanguage> {
// most complexity here is due to matching 'end' correctly with declarations.
// We distinguish a declaration that comes first on a line, versus declarations further on a line (which are most likey modifiers)
[/^(\s*)([a-z_]\w*[!?=]?)/, ['white',
{ cases: { 'for|until|while': { token: 'keyword.$2', next: '@dodecl.$2' },
{
cases: {
'for|until|while': { token: 'keyword.$2', next: '@dodecl.$2' },
'@declarations': { token: 'keyword.$2', next: '@root.$2' },
'end': { token: 'keyword.$S2', next: '@pop' },
'@keywords': 'keyword',
'@builtins': 'predefined',
'@default': 'identifier' } }]],
'@default': 'identifier'
}
}]],
[/[a-z_]\w*[!?=]?/,
{ cases: { 'if|unless|while|until': { token: 'keyword.$0x', next: '@modifier.$0x' },
{
cases: {
'if|unless|while|until': { token: 'keyword.$0x', next: '@modifier.$0x' },
'for': { token: 'keyword.$2', next: '@dodecl.$2' },
'@linedecls': { token: 'keyword.$0', next: '@root.$0' },
'end': { token: 'keyword.$S2', next: '@pop' },
'@keywords': 'keyword',
'@builtins': 'predefined',
'@default': 'identifier' } }],
'@default': 'identifier'
}
}],
[/[A-Z][\w]*[!?=]?/, 'constructor.identifier'], // constant
[/\$[\w]*/, 'global.constant'], // global
@ -197,9 +205,13 @@ export var language = <ILanguage> {
// delimiters and operators
[/[{}()\[\]]/, '@brackets'],
[/@symbols/, { cases: { '@keywordops': 'keyword',
[/@symbols/, {
cases: {
'@keywordops': 'keyword',
'@operators': 'operator',
'@default' : '' } } ],
'@default': ''
}
}],
[/[;,]/, 'delimiter'],
@ -208,8 +220,12 @@ export var language = <ILanguage> {
[/0[_oO][0-7](_?[0-7])*/, 'number.octal'],
[/0[bB][01](_?[01])*/, 'number.binary'],
[/0[dD]@decpart/, 'number'],
[/@decimal((\.@decpart)?([eE][\-+]?@decpart)?)/, { cases: { '$1': 'number.float',
'@default': 'number' }}],
[/@decimal((\.@decpart)?([eE][\-+]?@decpart)?)/, {
cases: {
'$1': 'number.float',
'@default': 'number'
}
}],
],
@ -218,12 +234,16 @@ export var language = <ILanguage> {
// dodecl.<decl> where decl is the declarations started, like 'while'
dodecl: [
[/^/, { token: '', switchTo: '@root.$S2' }], // get out of do-skipping mode on a new line
[/[a-z_]\w*[!?=]?/, { cases: { 'end': { token: 'keyword.$S2', next: '@pop' }, // end on same line
[/[a-z_]\w*[!?=]?/, {
cases: {
'end': { token: 'keyword.$S2', next: '@pop' }, // end on same line
'do': { token: 'keyword', switchTo: '@root.$S2' }, // do on same line: not an open bracket here
'@linedecls': { token: '@rematch', switchTo: '@root.$S2' }, // other declaration on same line: rematch
'@keywords': 'keyword',
'@builtins': 'predefined',
'@default': 'identifier' } }],
'@default': 'identifier'
}
}],
{ include: '@root' }
],
@ -232,12 +252,16 @@ export var language = <ILanguage> {
// modifier.<decl>x where decl is the declaration starter, like 'if'
modifier: [
[/^/, '', '@pop'], // it was a modifier: get out of modifier mode on a new line
[/[a-z_]\w*[!?=]?/, { cases: { 'end': { token: 'keyword.$S2', next: '@pop' }, // end on same line
[/[a-z_]\w*[!?=]?/, {
cases: {
'end': { token: 'keyword.$S2', next: '@pop' }, // end on same line
'then|else|elsif|do': { token: 'keyword', switchTo: '@root.$S2' }, // real declaration and not a modifier
'@linedecls': { token: '@rematch', switchTo: '@root.$S2' }, // other declaration => not a modifier
'@keywords': 'keyword',
'@builtins': 'predefined',
'@default': 'identifier' } }],
'@default': 'identifier'
}
}],
{ include: '@root' }
],
@ -259,15 +283,23 @@ export var language = <ILanguage> {
[/\\$/, 'string.$S2.escape'],
[/@escapes/, 'string.$S2.escape'],
[/\\./, 'string.$S2.escape.invalid'],
[/[`"]/, { cases: { '$#==$S3': { token: 'string.$S2.delim', next: '@pop'},
'@default': 'string.$S2' } } ]
[/[`"]/, {
cases: {
'$#==$S3': { token: 'string.$S2.delim', next: '@pop' },
'@default': 'string.$S2'
}
}]
],
// literal documents
// heredoc.<close> where close is the closing delimiter
heredoc: [
[/^(\s*)(@heredelim)$/, { cases: { '$2==$S2': ['string.heredoc', { token: 'string.heredoc.delimiter', next: '@pop' }],
'@default': ['string.heredoc','string.heredoc'] }}],
[/^(\s*)(@heredelim)$/, {
cases: {
'$2==$S2': ['string.heredoc', { token: 'string.heredoc.delimiter', next: '@pop' }],
'@default': ['string.heredoc', 'string.heredoc']
}
}],
[/.*/, 'string.heredoc'],
],
@ -293,11 +325,15 @@ export var language = <ILanguage> {
// turns out that you can quote using regex control characters, aargh!
// for example; %r|kgjgaj| is ok (even though | is used for alternation)
// so, we need to match those first
[/[^\(\{\[\\]/, { cases: { '$#==$S3' : { token: 'regexp.delim', next: '@pop' },
[/[^\(\{\[\\]/, {
cases: {
'$#==$S3': { token: 'regexp.delim', next: '@pop' },
'$#==$S2': { token: 'regexp.delim', next: '@push' }, // nested delimiters are allowed..
'~[)}\\]]': '@brackets.regexp.escape.control',
'~@regexpctl': 'regexp.escape.control',
'@default': 'regexp' }}],
'@default': 'regexp'
}
}],
{ include: '@regexcontrol' },
],
@ -369,9 +405,13 @@ export var language = <ILanguage> {
qstring: [
[/\\$/, 'string.$S2.escape'],
[/\\./, 'string.$S2.escape'],
[/./, { cases: { '$#==$S4' : { token: 'string.$S2.delim', next: '@pop' },
[/./, {
cases: {
'$#==$S4': { token: 'string.$S2.delim', next: '@pop' },
'$#==$S3': { token: 'string.$S2.delim', next: '@push' }, // nested delimiters are allowed..
'@default': 'string.$S2' }}],
'@default': 'string.$S2'
}
}],
],
// expanded quoted string.

View file

@ -105,8 +105,12 @@ export var language = <ILanguage> {
tokenizer: {
root: [
// identifiers and keywords
[/[a-zA-Z_]\w*/, { cases: { '@keywords': {token:'keyword.$0'},
'@default': 'identifier' } }],
[/[a-zA-Z_]\w*/, {
cases: {
'@keywords': { token: 'keyword.$0' },
'@default': 'identifier'
}
}],
// whitespace
{ include: '@whitespace' },
@ -123,8 +127,12 @@ export var language = <ILanguage> {
// delimiters and operators
[/[{}()\[\]]/, '@brackets'],
[/[<>](?!@symbols)/, '@brackets'],
[/@symbols/, { cases: { '@operators': 'delimiter',
'@default' : '' } } ],
[/@symbols/, {
cases: {
'@operators': 'delimiter',
'@default': ''
}
}],
// numbers
[/\d*\d+[eE]([\-+]?\d+)?(@floatsuffix)/, 'number.float'],

View file

@ -1066,12 +1066,14 @@ export var language = <ILanguage> {
{ include: '@scopes' },
[/[;,.]/, 'delimiter'],
[/[()]/, '@brackets'],
[/[\w@#$]+/, { cases: {
[/[\w@#$]+/, {
cases: {
'@keywords': 'keyword',
'@operators': 'operator',
'@builtinVariables': 'predefined',
'@builtinFunctions': 'predefined',
'@default': 'identifier' }
'@default': 'identifier'
}
}],
[/[<>=!%&+\-*/|~^]/, 'operator'],
],
@ -1091,10 +1093,12 @@ export var language = <ILanguage> {
[/./, 'comment']
],
pseudoColumns: [
[/[$][A-Za-z_][\w@#$]*/, { cases: {
[/[$][A-Za-z_][\w@#$]*/, {
cases: {
'@pseudoColumns': 'predefined',
'@default': 'identifier'
}}],
}
}],
],
numbers: [
[/0[xX][0-9a-fA-F]*/, 'number'],

View file

@ -105,7 +105,12 @@ export var language = <ILanguage> {
],
attribute: [
[ /\@@identifier/, { cases: { '@attributes': 'keyword.control', '@default': '' } } ]
[/\@@identifier/, {
cases: {
'@attributes': 'keyword.control',
'@default': ''
}
}]
],
literal: [
@ -135,7 +140,12 @@ export var language = <ILanguage> {
keyword: [
[/`/, { token: 'operator', next: '@escapedkeyword' }],
[ /@identifier/, { cases: { '@keywords': 'keyword', '[A-Z][\a-zA-Z0-9$]*': 'type.identifier', '@default': 'identifier' } }]
[/@identifier/, {
cases: {
'@keywords': 'keyword', '[A-Z][\a-zA-Z0-9$]*': 'type.identifier',
'@default': 'identifier'
}
}]
],
escapedkeyword: [
@ -149,7 +159,12 @@ export var language = <ILanguage> {
// ],
invokedmethod: [
[/([.])(@identifier)/, { cases: { '$2': ['delimeter', 'type.identifier'], '@default': '' } }],
[/([.])(@identifier)/, {
cases: {
'$2': ['delimeter', 'type.identifier'],
'@default': ''
}
}],
]
}
};

View file

@ -137,9 +137,13 @@ export var language = <ILanguage> {
[/end\s+(?!for|do)([a-zA-Z_]\w*)/, { token: 'keyword.tag-$1' }],
// identifiers, tagwords, and keywords
[/[a-zA-Z_]\w*/, { cases: { '@tagwords': {token:'keyword.tag-$0'},
[/[a-zA-Z_]\w*/, {
cases: {
'@tagwords': { token: 'keyword.tag-$0' },
'@keywords': { token: 'keyword.$0' },
'@default': 'identifier' } }],
'@default': 'identifier'
}
}],
// Preprocessor directive
[/^\s*#\w+/, 'keyword'],

View file

@ -81,7 +81,12 @@ export const language = <ILanguage> {
{ include: '@flowScalars' },
// String nodes
[/.+$/, {cases: {'@keywords': 'keyword', '@default': 'string'}}]
[/.+$/, {
cases: {
'@keywords': 'keyword',
'@default': 'string'
}
}]
],
// Flow Collection: Flow Mapping
@ -111,7 +116,12 @@ export const language = <ILanguage> {
{ include: '@flowNumber' },
// Other value (keyword or string)
[/[^\},]+/, {cases: {'@keywords': 'keyword', '@default': 'string'}}]
[/[^\},]+/, {
cases: {
'@keywords': 'keyword',
'@default': 'string'
}
}]
],
// Flow Collection: Flow Sequence
@ -135,7 +145,12 @@ export const language = <ILanguage> {
{ include: '@flowNumber' },
// Other value (keyword or string)
[/[^\],]+/, {cases: {'@keywords': 'keyword', '@default': 'string'}}]
[/[^\],]+/, {
cases: {
'@keywords': 'keyword',
'@default': 'string'
}
}]
],
// Flow Scalars (quoted strings)
@ -143,7 +158,12 @@ export const language = <ILanguage> {
[/[^\\"']+/, 'string'],
[/@escapes/, 'string.escape'],
[/\\./, 'string.escape.invalid'],
[/["']/, {cases: {'$#==$S2': {token: 'string', next: '@pop'}, '@default': 'string'}}]
[/["']/, {
cases: {
'$#==$S2': { token: 'string', next: '@pop' },
'@default': 'string'
}
}]
],
// First line of a Block Style
@ -154,7 +174,12 @@ export const language = <ILanguage> {
// Further lines of a Block Style
// Workaround for indentation detection
multiStringContinued: [
[/^( *).+$/, {cases: {'$1==$S2': 'string', '@default': {token: '@rematch', next: '@popall'}}}]
[/^( *).+$/, {
cases: {
'$1==$S2': 'string',
'@default': { token: '@rematch', next: '@popall' }
}
}]
],
whitespace: [

View file

@ -16,76 +16,88 @@ testTokenization('bat', [
{ startIndex: 5, type: '' },
{ startIndex: 10, type: 'keyword.title.bat' },
{ startIndex: 15, type: '' }
]}],
]
}],
// Comments - single line
[{
line: 'REM',
tokens: [
{ startIndex: 0, type: 'comment.bat' }
]}],
]
}],
[{
line: ' REM a comment',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'comment.bat' }
]}],
]
}],
[{
line: 'REM a comment',
tokens: [
{ startIndex: 0, type: 'comment.bat' }
]}],
]
}],
[{
line: 'REMnot a comment',
tokens: [
{ startIndex: 0, type: '' }
]}],
]
}],
// number
[{
line: '0',
tokens: [
{ startIndex: 0, type: 'number.bat' }
]}],
]
}],
[{
line: '0.0',
tokens: [
{ startIndex: 0, type: 'number.float.bat' }
]}],
]
}],
[{
line: '0x123',
tokens: [
{ startIndex: 0, type: 'number.hex.bat' }
]}],
]
}],
[{
line: '23.5',
tokens: [
{ startIndex: 0, type: 'number.float.bat' }
]}],
]
}],
[{
line: '23.5e3',
tokens: [
{ startIndex: 0, type: 'number.float.bat' }
]}],
]
}],
[{
line: '23.5E3',
tokens: [
{ startIndex: 0, type: 'number.float.bat' }
]}],
]
}],
[{
line: '1.72e-3',
tokens: [
{ startIndex: 0, type: 'number.float.bat' }
]}],
]
}],
[{
line: '0+0',
@ -93,7 +105,8 @@ testTokenization('bat', [
{ startIndex: 0, type: 'number.bat' },
{ startIndex: 1, type: 'delimiter.bat' },
{ startIndex: 2, type: 'number.bat' }
]}],
]
}],
[{
line: '100+10',
@ -101,7 +114,8 @@ testTokenization('bat', [
{ startIndex: 0, type: 'number.bat' },
{ startIndex: 3, type: 'delimiter.bat' },
{ startIndex: 4, type: 'number.bat' }
]}],
]
}],
[{
line: '0 + 0',
@ -111,7 +125,8 @@ testTokenization('bat', [
{ startIndex: 2, type: 'delimiter.bat' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'number.bat' }
]}],
]
}],
// Strings
[{
@ -122,14 +137,16 @@ testTokenization('bat', [
{ startIndex: 6, type: 'delimiter.bat' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'string.bat' }
]}],
]
}],
[{
line: '"use strict";',
tokens: [
{ startIndex: 0, type: 'string.bat' },
{ startIndex: 12, type: 'delimiter.bat' }
]}],
]
}],
// Tags
[{
@ -138,7 +155,8 @@ testTokenization('bat', [
{ startIndex: 0, type: 'keyword.tag-setlocal.bat' },
{ startIndex: 8, type: '' },
{ startIndex: 9, type: 'keyword.tag-setlocal.bat' }
]}],
]
}],
[{
line: 'setlocal ENDLOCAL',
@ -146,7 +164,8 @@ testTokenization('bat', [
{ startIndex: 0, type: 'keyword.tag-setlocal.bat' },
{ startIndex: 8, type: '' },
{ startIndex: 9, type: 'keyword.tag-setlocal.bat' }
]}],
]
}],
[{
line: 'SETLOCAL endlocal',
@ -154,7 +173,8 @@ testTokenization('bat', [
{ startIndex: 0, type: 'keyword.tag-setlocal.bat' },
{ startIndex: 8, type: '' },
{ startIndex: 9, type: 'keyword.tag-setlocal.bat' }
]}],
]
}],
[{
line: 'setlocal setlocal endlocal',
@ -164,115 +184,140 @@ testTokenization('bat', [
{ startIndex: 9, type: 'keyword.tag-setlocal.bat' },
{ startIndex: 17, type: '' },
{ startIndex: 18, type: 'keyword.tag-setlocal.bat' }
]}],
]
}],
// Monarch generated
[{
line: 'rem asdf',
tokens: [
{ startIndex: 0, type: 'comment.bat' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'REM',
tokens: [
{ startIndex: 0, type: 'comment.bat' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'REMOVED not a comment really',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 8, type: 'keyword.not.bat' },
{ startIndex: 11, type: '' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'echo cool',
tokens: [
{ startIndex: 0, type: 'keyword.echo.bat' },
{ startIndex: 4, type: '' }
]}, {
]
}, {
line: '@echo off',
tokens: [
{ startIndex: 0, type: 'keyword.bat' },
{ startIndex: 1, type: 'keyword.echo.bat' },
{ startIndex: 5, type: '' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'setlocAL',
tokens: [
{ startIndex: 0, type: 'keyword.tag-setlocal.bat' }
]}, {
]
}, {
line: ' asdf',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: ' asdf',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: 'endLocaL',
tokens: [
{ startIndex: 0, type: 'keyword.tag-setlocal.bat' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'call',
tokens: [
{ startIndex: 0, type: 'keyword.call.bat' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: ':MyLabel',
tokens: [
{ startIndex: 0, type: 'metatag.bat' }
]}, {
]
}, {
line: 'some command',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: '%sdfsdf% ',
tokens: [
{ startIndex: 0, type: 'variable.bat' },
{ startIndex: 8, type: '' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'this is "a string %sdf% asdf"',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 8, type: 'string.bat' },
{ startIndex: 18, type: 'variable.bat' },
{ startIndex: 23, type: 'string.bat' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'FOR %%A IN (1 2 3) DO (',
tokens: [
{ startIndex: 0, type: 'keyword.for.bat' },
@ -288,7 +333,8 @@ testTokenization('bat', [
{ startIndex: 17, type: 'delimiter.parenthesis.bat' },
{ startIndex: 18, type: '' },
{ startIndex: 22, type: 'delimiter.parenthesis.bat' }
]}, {
]
}, {
line: ' SET VAR1=%VAR1%%%A',
tokens: [
{ startIndex: 0, type: '' },
@ -296,7 +342,8 @@ testTokenization('bat', [
{ startIndex: 4, type: '' },
{ startIndex: 9, type: 'delimiter.bat' },
{ startIndex: 10, type: 'variable.bat' }
]}, {
]
}, {
line: ' SET VAR2=%VAR2%%%A',
tokens: [
{ startIndex: 0, type: '' },
@ -304,29 +351,34 @@ testTokenization('bat', [
{ startIndex: 4, type: '' },
{ startIndex: 9, type: 'delimiter.bat' },
{ startIndex: 10, type: 'variable.bat' }
]}, {
]
}, {
line: ' use \'string %%a asdf asdf\'',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 5, type: 'string.bat' },
{ startIndex: 13, type: 'variable.bat' },
{ startIndex: 16, type: 'string.bat' }
]}, {
]
}, {
line: ' non terminated "string %%aaa sdf',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 16, type: 'string.bat' },
{ startIndex: 24, type: 'variable.bat' },
{ startIndex: 29, type: 'string.bat' }
]}, {
]
}, {
line: ' this shold NOT BE red',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 12, type: 'keyword.not.bat' },
{ startIndex: 15, type: '' }
]}, {
]
}, {
line: ')',
tokens: [
{ startIndex: 0, type: 'delimiter.parenthesis.bat' }
]}]
]
}]
]);

File diff suppressed because it is too large Load diff

View file

@ -27,33 +27,38 @@ testTokenization('cpp', [
{ startIndex: 29, type: 'identifier.cpp' },
{ startIndex: 33, type: 'delimiter.square.cpp' },
{ startIndex: 35, type: 'delimiter.parenthesis.cpp' }
]}],
]
}],
// Comments - single line
[{
line: '//',
tokens: [
{ startIndex: 0, type: 'comment.cpp' }
]}],
]
}],
[{
line: ' // a comment',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'comment.cpp' }
]}],
]
}],
[{
line: '// a comment',
tokens: [
{ startIndex: 0, type: 'comment.cpp' }
]}],
]
}],
[{
line: '//sticky comment',
tokens: [
{ startIndex: 0, type: 'comment.cpp' }
]}],
]
}],
[{
line: '/almost a comment',
@ -64,7 +69,8 @@ testTokenization('cpp', [
{ startIndex: 8, type: 'identifier.cpp' },
{ startIndex: 9, type: '' },
{ startIndex: 10, type: 'identifier.cpp' }
]}],
]
}],
[{
line: '/* //*/ a',
@ -72,7 +78,8 @@ testTokenization('cpp', [
{ startIndex: 0, type: 'comment.cpp' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'identifier.cpp' }
]}],
]
}],
[{
line: '1 / 2; /* comment',
@ -85,7 +92,8 @@ testTokenization('cpp', [
{ startIndex: 5, type: 'delimiter.cpp' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'comment.cpp' }
]}],
]
}],
[{
line: 'int x = 1; // my comment // is a nice one',
@ -100,14 +108,16 @@ testTokenization('cpp', [
{ startIndex: 9, type: 'delimiter.cpp' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'comment.cpp' }
]}],
]
}],
// Comments - range comment, single line
[{
line: '/* a simple comment */',
tokens: [
{ startIndex: 0, type: 'comment.cpp' }
]}],
]
}],
[{
line: 'int x = /* a simple comment */ 1;',
@ -122,7 +132,8 @@ testTokenization('cpp', [
{ startIndex: 30, type: '' },
{ startIndex: 31, type: 'number.cpp' },
{ startIndex: 32, type: 'delimiter.cpp' }
]}],
]
}],
[{
line: 'int x = /* comment */ 1; */',
@ -138,7 +149,8 @@ testTokenization('cpp', [
{ startIndex: 22, type: 'number.cpp' },
{ startIndex: 23, type: 'delimiter.cpp' },
{ startIndex: 24, type: '' }
]}],
]
}],
[{
line: 'x = /**/;',
@ -149,7 +161,8 @@ testTokenization('cpp', [
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'comment.cpp' },
{ startIndex: 8, type: 'delimiter.cpp' }
]}],
]
}],
[{
line: 'x = /*/;',
@ -159,164 +172,191 @@ testTokenization('cpp', [
{ startIndex: 2, type: 'delimiter.cpp' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'comment.cpp' }
]}],
]
}],
// Numbers
[{
line: '0',
tokens: [
{ startIndex: 0, type: 'number.cpp' }
]}],
]
}],
[{
line: '12l',
tokens: [
{ startIndex: 0, type: 'number.cpp' }
]}],
]
}],
[{
line: '34U',
tokens: [
{ startIndex: 0, type: 'number.cpp' }
]}],
]
}],
[{
line: '55LL',
tokens: [
{ startIndex: 0, type: 'number.cpp' }
]}],
]
}],
[{
line: '34ul',
tokens: [
{ startIndex: 0, type: 'number.cpp' }
]}],
]
}],
[{
line: '55llU',
tokens: [
{ startIndex: 0, type: 'number.cpp' }
]}],
]
}],
[{
line: '5\'5llU',
tokens: [
{ startIndex: 0, type: 'number.cpp' }
]}],
]
}],
[{
line: '100\'000\'000',
tokens: [
{ startIndex: 0, type: 'number.cpp' }
]}],
]
}],
[{
line: '0x100\'aafllU',
tokens: [
{ startIndex: 0, type: 'number.hex.cpp' }
]}],
]
}],
[{
line: '0342\'325',
tokens: [
{ startIndex: 0, type: 'number.octal.cpp' }
]}],
]
}],
[{
line: '0x123',
tokens: [
{ startIndex: 0, type: 'number.hex.cpp' }
]}],
]
}],
[{
line: '23.5',
tokens: [
{ startIndex: 0, type: 'number.float.cpp' }
]}],
]
}],
[{
line: '23.5e3',
tokens: [
{ startIndex: 0, type: 'number.float.cpp' }
]}],
]
}],
[{
line: '23.5E3',
tokens: [
{ startIndex: 0, type: 'number.float.cpp' }
]}],
]
}],
[{
line: '23.5F',
tokens: [
{ startIndex: 0, type: 'number.float.cpp' }
]}],
]
}],
[{
line: '23.5f',
tokens: [
{ startIndex: 0, type: 'number.float.cpp' }
]}],
]
}],
[{
line: '1.72E3F',
tokens: [
{ startIndex: 0, type: 'number.float.cpp' }
]}],
]
}],
[{
line: '1.72E3f',
tokens: [
{ startIndex: 0, type: 'number.float.cpp' }
]}],
]
}],
[{
line: '1.72e3F',
tokens: [
{ startIndex: 0, type: 'number.float.cpp' }
]}],
]
}],
[{
line: '1.72e3f',
tokens: [
{ startIndex: 0, type: 'number.float.cpp' }
]}],
]
}],
[{
line: '23.5L',
tokens: [
{ startIndex: 0, type: 'number.float.cpp' }
]}],
]
}],
[{
line: '23.5l',
tokens: [
{ startIndex: 0, type: 'number.float.cpp' }
]}],
]
}],
[{
line: '1.72E3L',
tokens: [
{ startIndex: 0, type: 'number.float.cpp' }
]}],
]
}],
[{
line: '1.72E3l',
tokens: [
{ startIndex: 0, type: 'number.float.cpp' }
]}],
]
}],
[{
line: '1.72e3L',
tokens: [
{ startIndex: 0, type: 'number.float.cpp' }
]}],
]
}],
[{
line: '1.72e3l',
tokens: [
{ startIndex: 0, type: 'number.float.cpp' }
]}],
]
}],
[{
line: '0+0',
@ -324,7 +364,8 @@ testTokenization('cpp', [
{ startIndex: 0, type: 'number.cpp' },
{ startIndex: 1, type: 'delimiter.cpp' },
{ startIndex: 2, type: 'number.cpp' }
]}],
]
}],
[{
line: '100+10',
@ -332,7 +373,8 @@ testTokenization('cpp', [
{ startIndex: 0, type: 'number.cpp' },
{ startIndex: 3, type: 'delimiter.cpp' },
{ startIndex: 4, type: 'number.cpp' }
]}],
]
}],
[{
line: '0 + 0',
@ -342,7 +384,8 @@ testTokenization('cpp', [
{ startIndex: 2, type: 'delimiter.cpp' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'number.cpp' }
]}],
]
}],
// Monarch Generated
[{
@ -352,23 +395,27 @@ testTokenization('cpp', [
{ startIndex: 8, type: 'delimiter.angle.cpp' },
{ startIndex: 9, type: 'identifier.cpp' },
{ startIndex: 17, type: 'delimiter.angle.cpp' }
]}, {
]
}, {
line: '#include "/path/to/my/file.h"',
tokens: [
{ startIndex: 0, type: 'keyword.cpp' },
{ startIndex: 8, type: '' },
{ startIndex: 9, type: 'string.cpp' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: '#ifdef VAR',
tokens: [
{ startIndex: 0, type: 'keyword.cpp' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'identifier.cpp' }
]}, {
]
}, {
line: '#define SUM(A,B) (A) + (B)',
tokens: [
{ startIndex: 0, type: 'keyword.cpp' },
@ -389,11 +436,13 @@ testTokenization('cpp', [
{ startIndex: 23, type: 'delimiter.parenthesis.cpp' },
{ startIndex: 24, type: 'identifier.cpp' },
{ startIndex: 25, type: 'delimiter.parenthesis.cpp' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'int main(int argc, char** argv)',
tokens: [
{ startIndex: 0, type: 'keyword.int.cpp' },
@ -409,11 +458,13 @@ testTokenization('cpp', [
{ startIndex: 23, type: '' },
{ startIndex: 26, type: 'identifier.cpp' },
{ startIndex: 30, type: 'delimiter.parenthesis.cpp' }
]}, {
]
}, {
line: '{',
tokens: [
{ startIndex: 0, type: 'delimiter.curly.cpp' }
]}, {
]
}, {
line: ' return 0;',
tokens: [
{ startIndex: 0, type: '' },
@ -421,25 +472,30 @@ testTokenization('cpp', [
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'number.cpp' },
{ startIndex: 9, type: 'delimiter.cpp' }
]}, {
]
}, {
line: '}',
tokens: [
{ startIndex: 0, type: 'delimiter.curly.cpp' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'namespace TestSpace',
tokens: [
{ startIndex: 0, type: 'keyword.namespace.cpp' },
{ startIndex: 9, type: '' },
{ startIndex: 10, type: 'identifier.cpp' }
]}, {
]
}, {
line: '{',
tokens: [
{ startIndex: 0, type: 'delimiter.curly.cpp' }
]}, {
]
}, {
line: ' using Asdf.CDE;',
tokens: [
{ startIndex: 0, type: '' },
@ -449,7 +505,8 @@ testTokenization('cpp', [
{ startIndex: 11, type: 'delimiter.cpp' },
{ startIndex: 12, type: 'identifier.cpp' },
{ startIndex: 15, type: 'delimiter.cpp' }
]}, {
]
}, {
line: ' template <typename T>',
tokens: [
{ startIndex: 0, type: '' },
@ -460,7 +517,8 @@ testTokenization('cpp', [
{ startIndex: 19, type: '' },
{ startIndex: 20, type: 'identifier.cpp' },
{ startIndex: 21, type: 'delimiter.angle.cpp' }
]}, {
]
}, {
line: ' class CoolClass : protected BaseClass',
tokens: [
{ startIndex: 0, type: '' },
@ -473,22 +531,26 @@ testTokenization('cpp', [
{ startIndex: 19, type: 'keyword.protected.cpp' },
{ startIndex: 28, type: '' },
{ startIndex: 29, type: 'identifier.cpp' }
]}, {
]
}, {
line: ' {',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'delimiter.curly.cpp' }
]}, {
]
}, {
line: ' private:',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'keyword.private.cpp' },
{ startIndex: 9, type: 'delimiter.cpp' }
]}, {
]
}, {
line: ' ',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: ' static T field;',
tokens: [
{ startIndex: 0, type: '' },
@ -498,26 +560,31 @@ testTokenization('cpp', [
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'identifier.cpp' },
{ startIndex: 16, type: 'delimiter.cpp' }
]}, {
]
}, {
line: ' ',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: ' public:',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'keyword.public.cpp' },
{ startIndex: 8, type: 'delimiter.cpp' }
]}, {
]
}, {
line: ' ',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: ' [[deprecated]]',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'annotation.cpp' }
]}, {
]
}, {
line: ' foo method() const override',
tokens: [
{ startIndex: 0, type: '' },
@ -529,12 +596,14 @@ testTokenization('cpp', [
{ startIndex: 15, type: 'keyword.const.cpp' },
{ startIndex: 20, type: '' },
{ startIndex: 21, type: 'keyword.override.cpp' }
]}, {
]
}, {
line: ' {',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'delimiter.curly.cpp' }
]}, {
]
}, {
line: ' auto s = new Bar();',
tokens: [
{ startIndex: 0, type: '' },
@ -549,11 +618,13 @@ testTokenization('cpp', [
{ startIndex: 16, type: 'identifier.cpp' },
{ startIndex: 19, type: 'delimiter.parenthesis.cpp' },
{ startIndex: 21, type: 'delimiter.cpp' }
]}, {
]
}, {
line: ' ',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: ' if (s.field) {',
tokens: [
{ startIndex: 0, type: '' },
@ -566,7 +637,8 @@ testTokenization('cpp', [
{ startIndex: 14, type: 'delimiter.parenthesis.cpp' },
{ startIndex: 15, type: '' },
{ startIndex: 16, type: 'delimiter.curly.cpp' }
]}, {
]
}, {
line: ' for(const auto & b : s.field) {',
tokens: [
{ startIndex: 0, type: '' },
@ -588,32 +660,38 @@ testTokenization('cpp', [
{ startIndex: 32, type: 'delimiter.parenthesis.cpp' },
{ startIndex: 33, type: '' },
{ startIndex: 34, type: 'delimiter.curly.cpp' }
]}, {
]
}, {
line: ' break;',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 5, type: 'keyword.break.cpp' },
{ startIndex: 10, type: 'delimiter.cpp' }
]}, {
]
}, {
line: ' }',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'delimiter.curly.cpp' }
]}, {
]
}, {
line: ' }',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 3, type: 'delimiter.curly.cpp' }
]}, {
]
}, {
line: ' }',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'delimiter.curly.cpp' }
]}, {
]
}, {
line: ' ',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: ' std::string s = "hello wordld\\n";',
tokens: [
{ startIndex: 0, type: '' },
@ -629,11 +707,13 @@ testTokenization('cpp', [
{ startIndex: 31, type: 'string.escape.cpp' },
{ startIndex: 33, type: 'string.cpp' },
{ startIndex: 34, type: 'delimiter.cpp' }
]}, {
]
}, {
line: ' ',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: ' int number = 123\'123\'123Ull;',
tokens: [
{ startIndex: 0, type: '' },
@ -645,22 +725,27 @@ testTokenization('cpp', [
{ startIndex: 14, type: '' },
{ startIndex: 15, type: 'number.cpp' },
{ startIndex: 29, type: 'delimiter.cpp' }
]}, {
]
}, {
line: ' }',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'delimiter.curly.cpp' }
]}, {
]
}, {
line: '}',
tokens: [
{ startIndex: 0, type: 'delimiter.curly.cpp' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: '#endif',
tokens: [
{ startIndex: 0, type: 'keyword.cpp' }
]}]
]
}]
]);

View file

@ -17,7 +17,8 @@ testTokenization('csharp', [
{ startIndex: 5, type: '' },
{ startIndex: 6, type: 'namespace.cs' },
{ startIndex: 12, type: 'delimiter.cs' }
]}, {
]
}, {
line: 'using System.Collections.Generic;',
tokens: [
{ startIndex: 0, type: 'keyword.using.cs' },
@ -28,7 +29,8 @@ testTokenization('csharp', [
{ startIndex: 24, type: 'delimiter.cs' },
{ startIndex: 25, type: 'namespace.cs' },
{ startIndex: 32, type: 'delimiter.cs' }
]}, {
]
}, {
line: 'using System.Diagnostics;',
tokens: [
{ startIndex: 0, type: 'keyword.using.cs' },
@ -37,7 +39,8 @@ testTokenization('csharp', [
{ startIndex: 12, type: 'delimiter.cs' },
{ startIndex: 13, type: 'namespace.cs' },
{ startIndex: 24, type: 'delimiter.cs' }
]}, {
]
}, {
line: 'using System.Linq;',
tokens: [
{ startIndex: 0, type: 'keyword.using.cs' },
@ -46,7 +49,8 @@ testTokenization('csharp', [
{ startIndex: 12, type: 'delimiter.cs' },
{ startIndex: 13, type: 'namespace.cs' },
{ startIndex: 17, type: 'delimiter.cs' }
]}, {
]
}, {
line: 'using System.Text;',
tokens: [
{ startIndex: 0, type: 'keyword.using.cs' },
@ -55,7 +59,8 @@ testTokenization('csharp', [
{ startIndex: 12, type: 'delimiter.cs' },
{ startIndex: 13, type: 'namespace.cs' },
{ startIndex: 17, type: 'delimiter.cs' }
]}, {
]
}, {
line: 'using System.Threading.Tasks;',
tokens: [
{ startIndex: 0, type: 'keyword.using.cs' },
@ -66,33 +71,39 @@ testTokenization('csharp', [
{ startIndex: 22, type: 'delimiter.cs' },
{ startIndex: 23, type: 'namespace.cs' },
{ startIndex: 28, type: 'delimiter.cs' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'namespace VS',
tokens: [
{ startIndex: 0, type: 'keyword.namespace.cs' },
{ startIndex: 9, type: '' },
{ startIndex: 10, type: 'namespace.cs' }
]}, {
]
}, {
line: '{',
tokens: [
{ startIndex: 0, type: 'delimiter.curly.cs' }
]}, {
]
}, {
line: ' class Program',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'keyword.class.cs' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'identifier.cs' }
]}, {
]
}, {
line: ' {',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'delimiter.curly.cs' }
]}, {
]
}, {
line: ' static void Main(string[] args)',
tokens: [
{ startIndex: 0, type: '' },
@ -107,12 +118,14 @@ testTokenization('csharp', [
{ startIndex: 27, type: '' },
{ startIndex: 28, type: 'identifier.cs' },
{ startIndex: 32, type: 'delimiter.parenthesis.cs' }
]}, {
]
}, {
line: ' {',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'delimiter.curly.cs' }
]}, {
]
}, {
line: ' ProcessStartInfo si = new ProcessStartInfo();',
tokens: [
{ startIndex: 0, type: '' },
@ -127,7 +140,8 @@ testTokenization('csharp', [
{ startIndex: 29, type: 'identifier.cs' },
{ startIndex: 45, type: 'delimiter.parenthesis.cs' },
{ startIndex: 47, type: 'delimiter.cs' }
]}, {
]
}, {
line: ' float load= 3.2e02f;',
tokens: [
{ startIndex: 0, type: '' },
@ -138,11 +152,13 @@ testTokenization('csharp', [
{ startIndex: 14, type: '' },
{ startIndex: 15, type: 'number.float.cs' },
{ startIndex: 22, type: 'delimiter.cs' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: ' si.FileName = @"tools\\\\node.exe";',
tokens: [
{ startIndex: 0, type: '' },
@ -156,7 +172,8 @@ testTokenization('csharp', [
{ startIndex: 19, type: 'string.cs' },
{ startIndex: 34, type: 'string.quote.cs' },
{ startIndex: 35, type: 'delimiter.cs' }
]}, {
]
}, {
line: ' si.Arguments = "tools\\\\simpl3server.js";',
tokens: [
{ startIndex: 0, type: '' },
@ -172,11 +189,13 @@ testTokenization('csharp', [
{ startIndex: 26, type: 'string.cs' },
{ startIndex: 41, type: 'string.quote.cs' },
{ startIndex: 42, type: 'delimiter.cs' }
]}, {
]
}, {
line: ' ',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: ' string someString = $"hello{outside+variable}the string again {{ escaped";',
tokens: [
{ startIndex: 0, type: '' },
@ -198,7 +217,8 @@ testTokenization('csharp', [
{ startIndex: 67, type: 'string.cs' },
{ startIndex: 75, type: 'string.quote.cs' },
{ startIndex: 76, type: 'delimiter.cs' }
]}, {
]
}, {
line: ' var @string = 5;',
tokens: [
{ startIndex: 0, type: '' },
@ -210,11 +230,13 @@ testTokenization('csharp', [
{ startIndex: 16, type: '' },
{ startIndex: 17, type: 'number.cs' },
{ startIndex: 18, type: 'delimiter.cs' }
]}, {
]
}, {
line: ' ',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: ' if (x == 4)',
tokens: [
{ startIndex: 0, type: '' },
@ -227,12 +249,14 @@ testTokenization('csharp', [
{ startIndex: 11, type: '' },
{ startIndex: 12, type: 'number.cs' },
{ startIndex: 13, type: 'delimiter.parenthesis.cs' }
]}, {
]
}, {
line: ' {',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 3, type: 'delimiter.curly.cs' }
]}, {
]
}, {
line: ' for (int i = 4; i<10; i++)',
tokens: [
{ startIndex: 0, type: '' },
@ -256,12 +280,14 @@ testTokenization('csharp', [
{ startIndex: 26, type: 'identifier.cs' },
{ startIndex: 27, type: 'delimiter.cs' },
{ startIndex: 29, type: 'delimiter.parenthesis.cs' }
]}, {
]
}, {
line: ' {',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'delimiter.curly.cs' }
]}, {
]
}, {
line: ' var d = i;',
tokens: [
{ startIndex: 0, type: '' },
@ -273,46 +299,55 @@ testTokenization('csharp', [
{ startIndex: 12, type: '' },
{ startIndex: 13, type: 'identifier.cs' },
{ startIndex: 14, type: 'delimiter.cs' }
]}, {
]
}, {
line: ' }',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'delimiter.curly.cs' }
]}, {
]
}, {
line: ' }',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 3, type: 'delimiter.curly.cs' }
]}, {
]
}, {
line: ' else',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 3, type: 'keyword.else.cs' }
]}, {
]
}, {
line: ' {',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 3, type: 'delimiter.curly.cs' }
]}, {
]
}, {
line: ' return;',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'keyword.return.cs' },
{ startIndex: 10, type: 'delimiter.cs' }
]}, {
]
}, {
line: ' }',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 3, type: 'delimiter.curly.cs' }
]}, {
]
}, {
line: ' ',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: ' Process.Start(si);',
tokens: [
{ startIndex: 0, type: '' },
@ -323,29 +358,35 @@ testTokenization('csharp', [
{ startIndex: 17, type: 'identifier.cs' },
{ startIndex: 19, type: 'delimiter.parenthesis.cs' },
{ startIndex: 20, type: 'delimiter.cs' }
]}, {
]
}, {
line: ' }',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'delimiter.curly.cs' }
]}, {
]
}, {
line: ' }',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'delimiter.curly.cs' }
]}, {
]
}, {
line: '}',
tokens: [
{ startIndex: 0, type: 'delimiter.curly.cs' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: '#pragma region /MapLayer/*Image* /// ',
tokens: [
{ startIndex: 0, type: 'namespace.cpp.cs' }
]}, {
]
}, {
line: 'namespace ShouldNotBeAComment {}',
tokens: [
{ startIndex: 0, type: 'keyword.namespace.cs' },
@ -353,11 +394,13 @@ testTokenization('csharp', [
{ startIndex: 10, type: 'namespace.cs' },
{ startIndex: 29, type: '' },
{ startIndex: 30, type: 'delimiter.curly.cs' }
]}, {
]
}, {
line: '#pragma endregion Region_1',
tokens: [
{ startIndex: 0, type: 'namespace.cpp.cs' }
]}],
]
}],
// Keywords
[{
@ -392,33 +435,38 @@ testTokenization('csharp', [
{ startIndex: 66, type: 'delimiter.curly.cs' },
{ startIndex: 67, type: '' },
{ startIndex: 68, type: 'delimiter.curly.cs' }
]}],
]
}],
// Comments - single line
[{
line: '//',
tokens: [
{ startIndex: 0, type: 'comment.cs' }
]}],
]
}],
[{
line: ' // a comment',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'comment.cs' }
]}],
]
}],
[{
line: '// a comment',
tokens: [
{ startIndex: 0, type: 'comment.cs' }
]}],
]
}],
[{
line: '//sticky comment',
tokens: [
{ startIndex: 0, type: 'comment.cs' }
]}],
]
}],
[{
line: '/almost a comment',
@ -429,7 +477,8 @@ testTokenization('csharp', [
{ startIndex: 8, type: 'identifier.cs' },
{ startIndex: 9, type: '' },
{ startIndex: 10, type: 'identifier.cs' }
]}],
]
}],
[{
line: '1 / 2; /* comment',
@ -442,7 +491,8 @@ testTokenization('csharp', [
{ startIndex: 5, type: 'delimiter.cs' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'comment.cs' }
]}],
]
}],
[{
line: 'var x = 1; // my comment // is a nice one',
@ -457,14 +507,16 @@ testTokenization('csharp', [
{ startIndex: 9, type: 'delimiter.cs' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'comment.cs' }
]}],
]
}],
// Comments - range comment, single line
[{
line: '/* a simple comment */',
tokens: [
{ startIndex: 0, type: 'comment.cs' }
]}],
]
}],
[{
line: 'var x = /* a simple comment */ 1;',
@ -479,7 +531,8 @@ testTokenization('csharp', [
{ startIndex: 30, type: '' },
{ startIndex: 31, type: 'number.cs' },
{ startIndex: 32, type: 'delimiter.cs' }
]}],
]
}],
[{
line: 'var x = /* comment */ 1; */',
@ -495,7 +548,8 @@ testTokenization('csharp', [
{ startIndex: 22, type: 'number.cs' },
{ startIndex: 23, type: 'delimiter.cs' },
{ startIndex: 24, type: '' }
]}],
]
}],
[{
line: 'x = /**/;',
@ -506,7 +560,8 @@ testTokenization('csharp', [
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'comment.cs' },
{ startIndex: 8, type: 'delimiter.cs' }
]}],
]
}],
[{
line: 'x = /*/;',
@ -516,172 +571,200 @@ testTokenization('csharp', [
{ startIndex: 2, type: 'delimiter.cs' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'comment.cs' }
]}],
]
}],
// Numbers
[{
line: '0',
tokens: [
{ startIndex: 0, type: 'number.cs' }
]}],
]
}],
[{
line: '123_456',
tokens: [
{ startIndex: 0, type: 'number.cs' }
]}],
]
}],
[{
line: '0x',
tokens: [
{ startIndex: 0, type: 'number.cs' },
{ startIndex: 1, type: 'identifier.cs' }
]}],
]
}],
[{
line: '0b',
tokens: [
{ startIndex: 0, type: 'number.cs' },
{ startIndex: 1, type: 'identifier.cs' }
]}],
]
}],
[{
line: '0x123',
tokens: [
{ startIndex: 0, type: 'number.hex.cs' }
]}],
]
}],
[{
line: '0x123_456',
tokens: [
{ startIndex: 0, type: 'number.hex.cs' }
]}],
]
}],
[{
line: '0b101',
tokens: [
{ startIndex: 0, type: 'number.hex.cs' }
]}],
]
}],
[{
line: '0b1010_0001',
tokens: [
{ startIndex: 0, type: 'number.hex.cs' }
]}],
]
}],
[{
line: '23.5',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
]
}],
[{
line: '1_23.5',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
]
}],
[{
line: '23.5e3',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
]
}],
[{
line: '23.5E3',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
]
}],
[{
line: '23.5F',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
]
}],
[{
line: '23.5f',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
]
}],
[{
line: '2_3.5f',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
]
}],
[{
line: '1.72E3F',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
]
}],
[{
line: '1.72E3f',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
]
}],
[{
line: '1.72e3F',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
]
}],
[{
line: '1.72e3f',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
]
}],
[{
line: '23.5D',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
]
}],
[{
line: '456_123.5D',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
]
}],
[{
line: '23.5d',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
]
}],
[{
line: '1.72E3D',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
]
}],
[{
line: '1.72E3d',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
]
}],
[{
line: '1.720_123E3d',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
]
}],
[{
line: '1.72e3D',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
]
}],
[{
line: '1.72e3d',
tokens: [
{ startIndex: 0, type: 'number.float.cs' }
]}],
]
}],
[{
line: '0+0',
@ -689,7 +772,8 @@ testTokenization('csharp', [
{ startIndex: 0, type: 'number.cs' },
{ startIndex: 1, type: 'delimiter.cs' },
{ startIndex: 2, type: 'number.cs' }
]}],
]
}],
[{
line: '100+10',
@ -697,7 +781,8 @@ testTokenization('csharp', [
{ startIndex: 0, type: 'number.cs' },
{ startIndex: 3, type: 'delimiter.cs' },
{ startIndex: 4, type: 'number.cs' }
]}],
]
}],
[{
line: '0 + 0',
@ -707,7 +792,8 @@ testTokenization('csharp', [
{ startIndex: 2, type: 'delimiter.cs' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'number.cs' }
]}],
]
}],
// Strings
[{
@ -721,7 +807,8 @@ testTokenization('csharp', [
{ startIndex: 5, type: 'string.cs' },
{ startIndex: 11, type: 'string.quote.cs' },
{ startIndex: 12, type: 'delimiter.cs' }
]}],
]
}],
[{
line: 'x = "stri\\"ng";',
@ -736,7 +823,8 @@ testTokenization('csharp', [
{ startIndex: 11, type: 'string.cs' },
{ startIndex: 13, type: 'string.quote.cs' },
{ startIndex: 14, type: 'delimiter.cs' }
]}],
]
}],
// Verbatim Strings
[{
@ -750,7 +838,8 @@ testTokenization('csharp', [
{ startIndex: 6, type: 'string.cs' },
{ startIndex: 20, type: 'string.quote.cs' },
{ startIndex: 21, type: 'delimiter.cs' }
]}],
]
}],
[{
line: 'x = @"verbatim""string";',
@ -765,7 +854,8 @@ testTokenization('csharp', [
{ startIndex: 16, type: 'string.cs' },
{ startIndex: 22, type: 'string.quote.cs' },
{ startIndex: 23, type: 'delimiter.cs' }
]}],
]
}],
[{
line: 'x = @"verbatim\\string\\";',
@ -778,7 +868,8 @@ testTokenization('csharp', [
{ startIndex: 6, type: 'string.cs' },
{ startIndex: 22, type: 'string.quote.cs' },
{ startIndex: 23, type: 'delimiter.cs' }
]}],
]
}],
[{
line: 'x = @"verbatim',
@ -789,13 +880,15 @@ testTokenization('csharp', [
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'string.quote.cs' },
{ startIndex: 6, type: 'string.cs' }
]},{
]
}, {
line: 'string";',
tokens: [
{ startIndex: 0, type: 'string.cs' },
{ startIndex: 6, type: 'string.quote.cs' },
{ startIndex: 7, type: 'delimiter.cs' }
]}],
]
}],
[{
line: 'x = $@"verbatim {interpolated} string{{}}"" ";',
@ -816,5 +909,6 @@ testTokenization('csharp', [
{ startIndex: 43, type: "string.cs" },
{ startIndex: 44, type: "string.quote.cs" },
{ startIndex: 45, type: "delimiter.cs" },
]}],
]
}],
]);

View file

@ -13,7 +13,8 @@ testTokenization('css', [
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 6, type: 'tag.css' }
]}],
]
}],
// CSS rule
// body {
@ -29,7 +30,8 @@ testTokenization('css', [
{ startIndex: 0, type: 'tag.css' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'delimiter.bracket.css' }
]}, {
]
}, {
line: ' margin: 0;',
tokens: [
{ startIndex: 0, type: '' },
@ -37,7 +39,8 @@ testTokenization('css', [
{ startIndex: 9, type: '' },
{ startIndex: 10, type: 'attribute.value.number.css' },
{ startIndex: 11, type: 'delimiter.css' }
]}, {
]
}, {
line: ' padding: 3em 6em;',
tokens: [
{ startIndex: 0, type: '' },
@ -49,7 +52,8 @@ testTokenization('css', [
{ startIndex: 15, type: 'attribute.value.number.css' },
{ startIndex: 16, type: 'attribute.value.unit.css' },
{ startIndex: 18, type: 'delimiter.css' }
]}, {
]
}, {
line: ' font-family: tahoma, arial, sans-serif;',
tokens: [
{ startIndex: 0, type: '' },
@ -63,7 +67,8 @@ testTokenization('css', [
{ startIndex: 29, type: '' },
{ startIndex: 30, type: 'attribute.value.css' },
{ startIndex: 40, type: 'delimiter.css' }
]}, {
]
}, {
line: ' text-decoration: none !important;',
tokens: [
{ startIndex: 0, type: '' },
@ -73,19 +78,22 @@ testTokenization('css', [
{ startIndex: 23, type: '' },
{ startIndex: 24, type: 'keyword.css' },
{ startIndex: 34, type: 'delimiter.css' }
]}, {
]
}, {
line: ' color: #000',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'attribute.name.css' },
{ startIndex: 8, type: '' },
{ startIndex: 9, type: 'attribute.value.hex.css' }
]}, {
]
}, {
line: ' }',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'delimiter.bracket.css' }
]}],
]
}],
// CSS units and numbers
[{
@ -108,7 +116,8 @@ testTokenization('css', [
{ startIndex: 28, type: 'delimiter.css' },
{ startIndex: 29, type: '' },
{ startIndex: 30, type: 'delimiter.bracket.css' }
]}],
]
}],
// CSS unfinished unit and numbers
[{
@ -121,7 +130,8 @@ testTokenization('css', [
{ startIndex: 4, type: 'attribute.name.css' },
{ startIndex: 12, type: '' },
{ startIndex: 13, type: 'delimiter.css' }
]}],
]
}],
// CSS single line comment
// h1 /*comment*/ p {
@ -135,7 +145,8 @@ testTokenization('css', [
{ startIndex: 15, type: 'tag.css' },
{ startIndex: 16, type: '' },
{ startIndex: 17, type: 'delimiter.bracket.css' }
]}],
]
}],
// CSS multi line comment
// h1 /*com
@ -146,13 +157,15 @@ testTokenization('css', [
{ startIndex: 0, type: 'tag.css' },
{ startIndex: 2, type: '' },
{ startIndex: 3, type: 'comment.css' }
]}, {
]
}, {
line: 'ment*/ p',
tokens: [
{ startIndex: 0, type: 'comment.css' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'tag.css' }
]}],
]
}],
// CSS ID rule
[{
@ -161,7 +174,8 @@ testTokenization('css', [
{ startIndex: 0, type: 'tag.css' },
{ startIndex: 5, type: '' },
{ startIndex: 6, type: 'delimiter.bracket.css' }
]}],
]
}],
// CSS Class rules
[{
@ -170,7 +184,8 @@ testTokenization('css', [
{ startIndex: 0, type: 'tag.css' },
{ startIndex: 5, type: '' },
{ startIndex: 6, type: 'delimiter.bracket.css' }
]}],
]
}],
// CSS @import etc
[{
@ -183,7 +198,8 @@ testTokenization('css', [
{ startIndex: 12, type: 'string.css' },
{ startIndex: 27, type: 'delimiter.parenthesis.css' },
{ startIndex: 28, type: 'delimiter.css' }
]}],
]
}],
// CSS multi-line string with an escaped newline
// body {
@ -195,19 +211,22 @@ testTokenization('css', [
{ startIndex: 0, type: 'tag.css' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'delimiter.bracket.css' },
]}, {
]
}, {
line: ' content: \"con\\',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'attribute.name.css' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'string.css' }
]}, {
]
}, {
line: 'tent\";',
tokens: [
{ startIndex: 0, type: 'string.css' },
{ startIndex: 5, type: 'delimiter.css' }
]}],
]
}],
// CSS empty string value
// body {
@ -218,7 +237,8 @@ testTokenization('css', [
{ startIndex: 0, type: 'tag.css' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'delimiter.bracket.css' },
]}, {
]
}, {
line: ' content: \"\";',
tokens: [
{ startIndex: 0, type: '' },
@ -226,7 +246,8 @@ testTokenization('css', [
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'string.css' },
{ startIndex: 13, type: 'delimiter.css' }
]}],
]
}],
// CSS font face
// @font-face {
@ -238,7 +259,8 @@ testTokenization('css', [
{ startIndex: 0, type: 'keyword.css' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'delimiter.bracket.css' }
]}, {
]
}, {
line: ' font-family: "Opificio";',
tokens: [
{ startIndex: 0, type: '' },
@ -246,7 +268,8 @@ testTokenization('css', [
{ startIndex: 14, type: '' },
{ startIndex: 15, type: 'string.css' },
{ startIndex: 25, type: 'delimiter.css' }
]}],
]
}],
// CSS string with escaped quotes
// 's\"tr'
@ -255,7 +278,8 @@ testTokenization('css', [
tokens: [
{ startIndex: 0, type: 'string.css' },
{ startIndex: 7, type: '' }
]}],
]
}],
// CSS key frame animation syntax
//@-webkit-keyframes infinite-spinning {
@ -274,14 +298,16 @@ testTokenization('css', [
{ startIndex: 19, type: 'attribute.value.css' },
{ startIndex: 36, type: '' },
{ startIndex: 37, type: 'delimiter.bracket.css' }
]}, {
]
}, {
line: ' from {',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'attribute.value.css' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'delimiter.bracket.css' }
]}, {
]
}, {
line: ' -webkit-transform: rotate(0deg);',
tokens: [
{ startIndex: 0, type: '' },
@ -292,19 +318,22 @@ testTokenization('css', [
{ startIndex: 29, type: 'attribute.value.unit.css' },
{ startIndex: 32, type: 'attribute.value.css' },
{ startIndex: 33, type: 'delimiter.css' }
]}, {
]
}, {
line: ' }',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'delimiter.bracket.css' }
]}, {
]
}, {
line: ' to {',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'attribute.value.css' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'delimiter.bracket.css' }
]}, {
]
}, {
line: ' -webkit-transform: rotate(360deg);',
tokens: [
{ startIndex: 0, type: '' },
@ -315,16 +344,19 @@ testTokenization('css', [
{ startIndex: 31, type: 'attribute.value.unit.css' },
{ startIndex: 34, type: 'attribute.value.css' },
{ startIndex: 35, type: 'delimiter.css' }
]}, {
]
}, {
line: ' }',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'delimiter.bracket.css' }
]}, {
]
}, {
line: '}',
tokens: [
{ startIndex: 0, type: 'delimiter.bracket.css' }
]}],
]
}],
// CSS @import related coloring bug 9553
// @import url('something.css');
@ -340,36 +372,42 @@ testTokenization('css', [
{ startIndex: 12, type: 'string.css' },
{ startIndex: 27, type: 'delimiter.parenthesis.css' },
{ startIndex: 28, type: 'delimiter.css' }
]}, {
]
}, {
line: '.rule1{}',
tokens: [
{ startIndex: 0, type: 'tag.css' },
{ startIndex: 6, type: 'delimiter.bracket.css' },
]}, {
]
}, {
line: '.rule2{}',
tokens: [
{ startIndex: 0, type: 'tag.css' },
{ startIndex: 6, type: 'delimiter.bracket.css' },
]}],
]
}],
// Triple quotes - bug #9870
[{
line: '"""',
tokens: [
{ startIndex: 0, type: 'string.css' }
]}],
]
}],
[{
line: '""""',
tokens: [
{ startIndex: 0, type: 'string.css' }
]}],
]
}],
[{
line: '"""""',
tokens: [
{ startIndex: 0, type: 'string.css' }
]}],
]
}],
// import statement - bug #10308
// @import url('something.css');@import url('something.css');
@ -390,7 +428,8 @@ testTokenization('css', [
{ startIndex: 41, type: 'string.css' },
{ startIndex: 56, type: 'delimiter.parenthesis.css' },
{ startIndex: 57, type: 'delimiter.css' }
]}],
]
}],
// !important - bug #9578
// .a{background:#f5f9fc !important}.b{font-family:"Helvetica Neue", Helvetica;height:31px;}
@ -417,7 +456,8 @@ testTokenization('css', [
{ startIndex: 85, type: 'attribute.value.unit.css' },
{ startIndex: 87, type: 'delimiter.css' },
{ startIndex: 88, type: 'delimiter.bracket.css' }
]}],
]
}],
// base64-encoded data uris - bug #9580
//.even { background: #fff url(data:image/gif;base64,R0lGODlhBgASALMAAOfn5+rq6uvr6+zs7O7u7vHx8fPz8/b29vj4+P39/f///wAAAAAAAAAAAAAAAAAAACwAAAAABgASAAAIMAAVCBxIsKDBgwgTDkzAsKGAhxARSJx4oKJFAxgzFtjIkYDHjwNCigxAsiSAkygDAgA7) repeat-x bottom}
@ -441,7 +481,8 @@ testTokenization('css', [
{ startIndex: 225, type: '' },
{ startIndex: 226, type: 'attribute.value.css' },
{ startIndex: 232, type: 'delimiter.bracket.css' }
]}],
]
}],
// /a colorization is incorrect in url - bug #9581
//.a{background:url(/a.jpg)}
@ -456,7 +497,8 @@ testTokenization('css', [
{ startIndex: 18, type: 'string.css' },
{ startIndex: 24, type: 'delimiter.parenthesis.css' },
{ startIndex: 25, type: 'delimiter.bracket.css' }
]}],
]
}],
// Bracket Matching
[{
@ -464,7 +506,8 @@ testTokenization('css', [
tokens: [
{ startIndex: 0, type: 'tag.css' },
{ startIndex: 1, type: 'delimiter.bracket.css' },
]}],
]
}],
[{
line: 'p:nth() {}',
@ -472,5 +515,6 @@ testTokenization('css', [
{ startIndex: 0, type: 'tag.css' },
{ startIndex: 5, type: '' },
{ startIndex: 8, type: 'delimiter.bracket.css' }
]}],
]
}],
]);

View file

@ -14,45 +14,53 @@ testTokenization('dockerfile', [
tokens: [
{ startIndex: 0, type: 'keyword.dockerfile' },
{ startIndex: 4, type: '' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'ENV KRE_FEED https://www.myget.org/F/aspnetvnext/api/v2',
tokens: [
{ startIndex: 0, type: 'keyword.dockerfile' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'variable.dockerfile' },
{ startIndex: 12, type: '' }
]}, {
]
}, {
line: 'ENV KRE_USER_HOME /opt/kre',
tokens: [
{ startIndex: 0, type: 'keyword.dockerfile' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'variable.dockerfile' },
{ startIndex: 17, type: '' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'RUN apt-get -qq update && apt-get -qqy install unzip ',
tokens: [
{ startIndex: 0, type: 'keyword.dockerfile' },
{ startIndex: 3, type: '' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'ONBUILD RUN curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/kvminstall.sh | sh',
tokens: [
{ startIndex: 0, type: 'keyword.dockerfile' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'keyword.dockerfile' },
{ startIndex: 11, type: '' }
]}, {
]
}, {
line: 'ONBUILD RUN bash -c "source $KRE_USER_HOME/kvm/kvm.sh \\',
tokens: [
{ startIndex: 0, type: 'keyword.dockerfile' },
@ -62,11 +70,13 @@ testTokenization('dockerfile', [
{ startIndex: 20, type: 'string.dockerfile' },
{ startIndex: 28, type: 'variable.dockerfile' },
{ startIndex: 42, type: 'string.dockerfile' }
]}, {
]
}, {
line: ' && kvm install latest -a default \\',
tokens: [
{ startIndex: 0, type: 'string.dockerfile' }
]}, {
]
}, {
line: ' && kvm alias default | xargs -i ln -s $KRE_USER_HOME/packages/{} $KRE_USER_HOME/packages/default"',
tokens: [
{ startIndex: 0, type: 'string.dockerfile' },
@ -74,71 +84,86 @@ testTokenization('dockerfile', [
{ startIndex: 56, type: 'string.dockerfile' },
{ startIndex: 69, type: 'variable.dockerfile' },
{ startIndex: 83, type: 'string.dockerfile' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: '# Install libuv for Kestrel from source code (binary is not in wheezy and one in jessie is still too old)',
tokens: [
{ startIndex: 0, type: 'comment.dockerfile' }
]}, {
]
}, {
line: 'RUN apt-get -qqy install \\',
tokens: [
{ startIndex: 0, type: 'keyword.dockerfile' },
{ startIndex: 3, type: '' }
]}, {
]
}, {
line: ' autoconf \\',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: ' automake \\',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: ' build-essential \\',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: ' libtool ',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: 'RUN LIBUV_VERSION=1.0.0-rc2 \\',
tokens: [
{ startIndex: 0, type: 'keyword.dockerfile' },
{ startIndex: 3, type: '' }
]}, {
]
}, {
line: ' && curl -sSL https://github.com/joyent/libuv/archive/v${LIBUV_VERSION}.tar.gz | tar zxfv - -C /usr/local/src \\',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 58, type: 'variable.dockerfile' },
{ startIndex: 74, type: '' }
]}, {
]
}, {
line: ' && cd /usr/local/src/libuv-$LIBUV_VERSION \\',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 31, type: 'variable.dockerfile' },
{ startIndex: 45, type: '' }
]}, {
]
}, {
line: ' && sh autogen.sh && ./configure && make && make install \\',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: ' && rm -rf /usr/local/src/libuv-$LIBUV_VERSION \\',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 35, type: 'variable.dockerfile' },
{ startIndex: 49, type: '' }
]}, {
]
}, {
line: ' && ldconfig',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'ENV PATH $PATH:$KRE_USER_HOME/packages/default/bin',
tokens: [
{ startIndex: 0, type: 'keyword.dockerfile' },
@ -149,33 +174,39 @@ testTokenization('dockerfile', [
{ startIndex: 14, type: '' },
{ startIndex: 15, type: 'variable.dockerfile' },
{ startIndex: 29, type: '' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: '# Extra things to test',
tokens: [
{ startIndex: 0, type: 'comment.dockerfile' }
]}, {
]
}, {
line: 'RUN echo "string at end"',
tokens: [
{ startIndex: 0, type: 'keyword.dockerfile' },
{ startIndex: 3, type: '' },
{ startIndex: 9, type: 'string.dockerfile' }
]}, {
]
}, {
line: 'RUN echo must work \'some str\' and some more',
tokens: [
{ startIndex: 0, type: 'keyword.dockerfile' },
{ startIndex: 3, type: '' },
{ startIndex: 19, type: 'string.dockerfile' },
{ startIndex: 29, type: '' }
]}, {
]
}, {
line: 'RUN echo hi this is # not a comment',
tokens: [
{ startIndex: 0, type: 'keyword.dockerfile' },
{ startIndex: 3, type: '' }
]}, {
]
}, {
line: 'RUN echo \'String with ${VAR} and another $one here\'',
tokens: [
{ startIndex: 0, type: 'keyword.dockerfile' },
@ -185,5 +216,6 @@ testTokenization('dockerfile', [
{ startIndex: 28, type: 'string.dockerfile' },
{ startIndex: 41, type: 'variable.dockerfile' },
{ startIndex: 45, type: 'string.dockerfile' }
]}]
]
}]
]);

View file

@ -13,32 +13,37 @@ testTokenization('fsharp', [
line: '// one line comment',
tokens: [
{ startIndex: 0, type: 'comment.fs' }
]}],
]
}],
[{
line: '//',
tokens: [
{ startIndex: 0, type: 'comment.fs' }
]}],
]
}],
[{
line: ' // a comment',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'comment.fs' }
]}],
]
}],
[{
line: '// a comment',
tokens: [
{ startIndex: 0, type: 'comment.fs' }
]}],
]
}],
[{
line: '//sticky comment',
tokens: [
{ startIndex: 0, type: 'comment.fs' }
]}],
]
}],
[{
line: '/almost a comment',
@ -49,7 +54,8 @@ testTokenization('fsharp', [
{ startIndex: 8, type: 'identifier.fs' },
{ startIndex: 9, type: '' },
{ startIndex: 10, type: 'identifier.fs' }
]}],
]
}],
[{
line: '(/*almost a comment',
@ -61,7 +67,8 @@ testTokenization('fsharp', [
{ startIndex: 10, type: 'identifier.fs' },
{ startIndex: 11, type: '' },
{ startIndex: 12, type: 'identifier.fs' }
]}],
]
}],
[{
line: '1 / 2; (* comment',
@ -74,7 +81,8 @@ testTokenization('fsharp', [
{ startIndex: 5, type: 'delimiter.fs' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'comment.fs' }
]}],
]
}],
[{
line: 'let x = 1; // my comment // is a nice one',
@ -89,7 +97,8 @@ testTokenization('fsharp', [
{ startIndex: 9, type: 'delimiter.fs' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'comment.fs' }
]}],
]
}],
// Keywords
[{
@ -98,7 +107,8 @@ testTokenization('fsharp', [
{ startIndex: 0, type: 'keyword.namespace.fs' },
{ startIndex: 9, type: '' },
{ startIndex: 10, type: 'identifier.fs' }
]}],
]
}],
[{
line: 'type MyType',
@ -106,7 +116,8 @@ testTokenization('fsharp', [
{ startIndex: 0, type: 'keyword.type.fs' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'identifier.fs' }
]}],
]
}],
[{
line: 'module App =',
@ -116,7 +127,8 @@ testTokenization('fsharp', [
{ startIndex: 7, type: 'identifier.fs' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'delimiter.fs' }
]}],
]
}],
[{
line: 'let AppName = "App1"',
@ -128,14 +140,16 @@ testTokenization('fsharp', [
{ startIndex: 12, type: 'delimiter.fs' },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'string.fs' }
]}],
]
}],
// Comments - range comment
[{
line: '(* a simple comment *)',
tokens: [
{ startIndex: 0, type: 'comment.fs' }
]}],
]
}],
[{
line: 'let x = (* a simple comment *) 1',
@ -149,7 +163,8 @@ testTokenization('fsharp', [
{ startIndex: 8, type: 'comment.fs' },
{ startIndex: 30, type: '' },
{ startIndex: 31, type: 'number.fs' }
]}],
]
}],
[{
line: 'x = (**)',
@ -159,7 +174,8 @@ testTokenization('fsharp', [
{ startIndex: 2, type: 'delimiter.fs' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'comment.fs' }
]}],
]
}],
[{
line: 'x = (*)',
@ -169,110 +185,128 @@ testTokenization('fsharp', [
{ startIndex: 2, type: 'delimiter.fs' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'comment.fs' }
]}],
]
}],
// Numbers
[{
line: '0',
tokens: [
{ startIndex: 0, type: 'number.fs' }
]}],
]
}],
[{
line: '0x123',
tokens: [
{ startIndex: 0, type: 'number.hex.fs' }
]}],
]
}],
[{
line: '23.5',
tokens: [
{ startIndex: 0, type: 'number.float.fs' }
]}],
]
}],
[{
line: '23.5e3',
tokens: [
{ startIndex: 0, type: 'number.float.fs' }
]}],
]
}],
[{
line: '23.5E3',
tokens: [
{ startIndex: 0, type: 'number.float.fs' }
]}],
]
}],
[{
line: '23.5F',
tokens: [
{ startIndex: 0, type: 'number.float.fs' }
]}],
]
}],
[{
line: '23.5f',
tokens: [
{ startIndex: 0, type: 'number.float.fs' }
]}],
]
}],
[{
line: '1.72E3F',
tokens: [
{ startIndex: 0, type: 'number.float.fs' }
]}],
]
}],
[{
line: '1.72E3f',
tokens: [
{ startIndex: 0, type: 'number.float.fs' }
]}],
]
}],
[{
line: '1.72e3F',
tokens: [
{ startIndex: 0, type: 'number.float.fs' }
]}],
]
}],
[{
line: '1.72e3f',
tokens: [
{ startIndex: 0, type: 'number.float.fs' }
]}],
]
}],
[{
line: '23.5M',
tokens: [
{ startIndex: 0, type: 'number.float.fs' }
]}],
]
}],
[{
line: '23.5m',
tokens: [
{ startIndex: 0, type: 'number.float.fs' }
]}],
]
}],
[{
line: '1.72E3M',
tokens: [
{ startIndex: 0, type: 'number.float.fs' }
]}],
]
}],
[{
line: '1.72E3m',
tokens: [
{ startIndex: 0, type: 'number.float.fs' }
]}],
]
}],
[{
line: '1.72e3M',
tokens: [
{ startIndex: 0, type: 'number.float.fs' }
]}],
]
}],
[{
line: '1.72e3m',
tokens: [
{ startIndex: 0, type: 'number.float.fs' }
]}],
]
}],
[{
line: '0+0',
@ -280,7 +314,8 @@ testTokenization('fsharp', [
{ startIndex: 0, type: 'number.fs' },
{ startIndex: 1, type: 'delimiter.fs' },
{ startIndex: 2, type: 'number.fs' }
]}],
]
}],
[{
line: '100+10',
@ -288,7 +323,8 @@ testTokenization('fsharp', [
{ startIndex: 0, type: 'number.fs' },
{ startIndex: 3, type: 'delimiter.fs' },
{ startIndex: 4, type: 'number.fs' }
]}],
]
}],
[{
line: '0 + 0',
@ -298,95 +334,111 @@ testTokenization('fsharp', [
{ startIndex: 2, type: 'delimiter.fs' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'number.fs' }
]}],
]
}],
[{
line: '0b00000101',
tokens: [
{ startIndex: 0, type: 'number.bin.fs' }
]}],
]
}],
[{
line: '86y',
tokens: [
{ startIndex: 0, type: 'number.fs' }
]}],
]
}],
[{
line: '0b00000101y',
tokens: [
{ startIndex: 0, type: 'number.bin.fs' }
]}],
]
}],
[{
line: '86s',
tokens: [
{ startIndex: 0, type: 'number.fs' }
]}],
]
}],
[{
line: '86us',
tokens: [
{ startIndex: 0, type: 'number.fs' }
]}],
]
}],
[{
line: '86',
tokens: [
{ startIndex: 0, type: 'number.fs' }
]}],
]
}],
[{
line: '86l',
tokens: [
{ startIndex: 0, type: 'number.fs' }
]}],
]
}],
[{
line: '86u',
tokens: [
{ startIndex: 0, type: 'number.fs' }
]}],
]
}],
[{
line: '86ul',
tokens: [
{ startIndex: 0, type: 'number.fs' }
]}],
]
}],
[{
line: '0x00002D3Fn',
tokens: [
{ startIndex: 0, type: 'number.hex.fs' }
]}],
]
}],
[{
line: '0x00002D3Fun',
tokens: [
{ startIndex: 0, type: 'number.hex.fs' }
]}],
]
}],
[{
line: '86L',
tokens: [
{ startIndex: 0, type: 'number.fs' }
]}],
]
}],
[{
line: '86UL',
tokens: [
{ startIndex: 0, type: 'number.fs' }
]}],
]
}],
[{
line: '9999999999999999999999999999I',
tokens: [
{ startIndex: 0, type: 'number.fs' }
]}],
]
}],
[{
line: '0x00002D3FLF',
tokens: [
{ startIndex: 0, type: 'number.float.fs' }
]}]
]
}]
]);

File diff suppressed because it is too large Load diff

View file

@ -14,7 +14,8 @@ testTokenization('jade', [
tokens: [
{ startIndex: 0, type: 'tag.jade' },
{ startIndex: 1, type: '' }
]}],
]
}],
[{
line: 'div#container.stuff',
@ -22,7 +23,8 @@ testTokenization('jade', [
{ startIndex: 0, type: 'tag.jade' },
{ startIndex: 3, type: 'tag.id.jade' },
{ startIndex: 13, type: 'tag.class.jade' }
]}],
]
}],
[{
line: 'div.container#stuff',
@ -30,7 +32,8 @@ testTokenization('jade', [
{ startIndex: 0, type: 'tag.jade' },
{ startIndex: 3, type: 'tag.class.jade' },
{ startIndex: 13, type: 'tag.id.jade' }
]}],
]
}],
[{
line: 'div.container#stuff .container',
@ -39,19 +42,22 @@ testTokenization('jade', [
{ startIndex: 3, type: 'tag.class.jade' },
{ startIndex: 13, type: 'tag.id.jade' },
{ startIndex: 19, type: '' }
]}],
]
}],
[{
line: '#tag-id-1',
tokens: [
{ startIndex: 0, type: 'tag.id.jade' }
]}],
]
}],
[{
line: '.tag-id-1',
tokens: [
{ startIndex: 0, type: 'tag.class.jade' }
]}],
]
}],
// Attributes - Single Line [Jade]
[{
@ -63,14 +69,16 @@ testTokenization('jade', [
{ startIndex: 10, type: 'delimiter.jade' },
{ startIndex: 11, type: 'attribute.value.jade' },
{ startIndex: 21, type: 'delimiter.parenthesis.jade' }
]}],
]
}],
[{
line: 'input (type="checkbox")',
tokens: [
{ startIndex: 0, type: 'tag.jade' },
{ startIndex: 5, type: '' }
]}],
]
}],
[{
line: 'input(type="checkbox",name="agreement",checked)',
@ -87,7 +95,8 @@ testTokenization('jade', [
{ startIndex: 38, type: 'attribute.delimiter.jade' },
{ startIndex: 39, type: 'attribute.name.jade' },
{ startIndex: 46, type: 'delimiter.parenthesis.jade' }
]}],
]
}],
[{
line: 'input(type="checkbox"',
@ -97,22 +106,26 @@ testTokenization('jade', [
{ startIndex: 6, type: 'attribute.name.jade' },
{ startIndex: 10, type: 'delimiter.jade' },
{ startIndex: 11, type: 'attribute.value.jade' }
]}, {
]
}, {
line: 'name="agreement"',
tokens: [
{ startIndex: 0, type: 'attribute.name.jade' },
{ startIndex: 4, type: 'delimiter.jade' },
{ startIndex: 5, type: 'attribute.value.jade' }
]}, {
]
}, {
line: 'checked)',
tokens: [
{ startIndex: 0, type: 'attribute.name.jade' },
{ startIndex: 7, type: 'delimiter.parenthesis.jade' }
]}, {
]
}, {
line: 'body',
tokens: [
{ startIndex: 0, type: 'tag.jade' }
]}],
]
}],
// Attributes - MultiLine [Jade]
[{
@ -123,20 +136,24 @@ testTokenization('jade', [
{ startIndex: 6, type: 'attribute.name.jade' },
{ startIndex: 10, type: 'delimiter.jade' },
{ startIndex: 11, type: 'attribute.value.jade' }
]}, {
]
}, {
line: 'disabled',
tokens: [
{ startIndex: 0, type: 'attribute.name.jade' }
]}, {
]
}, {
line: 'checked)',
tokens: [
{ startIndex: 0, type: 'attribute.name.jade' },
{ startIndex: 7, type: 'delimiter.parenthesis.jade' }
]}, {
]
}, {
line: 'body',
tokens: [
{ startIndex: 0, type: 'tag.jade' }
]}],
]
}],
// Interpolation [Jade]
[{
@ -148,7 +165,8 @@ testTokenization('jade', [
{ startIndex: 10, type: 'interpolation.jade' },
{ startIndex: 15, type: 'interpolation.delimiter.jade' },
{ startIndex: 16, type: '' }
]}],
]
}],
[{
line: 'p print "#{count}" lines',
@ -159,7 +177,8 @@ testTokenization('jade', [
{ startIndex: 11, type: 'interpolation.jade' },
{ startIndex: 16, type: 'interpolation.delimiter.jade' },
{ startIndex: 17, type: '' }
]}],
]
}],
[{
line: '{ key: 123 }',
@ -171,41 +190,48 @@ testTokenization('jade', [
{ startIndex: 7, type: 'number.jade' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'delimiter.curly.jade' }
]}],
]
}],
// Comments - Single Line [Jade]
[{
line: '// html#id1.class1',
tokens: [
{ startIndex: 0, type: 'comment.jade' }
]}],
]
}],
[{
line: 'body hello // not a comment 123',
tokens: [
{ startIndex: 0, type: 'tag.jade' },
{ startIndex: 4, type: '' }
]}],
]
}],
// Comments - MultiLine [Jade]
[{
line: '//',
tokens: [
{ startIndex: 0, type: 'comment.jade' }
]}, {
]
}, {
line: ' should be a comment',
tokens: [
{ startIndex: 0, type: 'comment.jade' }
]}, {
]
}, {
line: ' should still be a comment',
tokens: [
{ startIndex: 0, type: 'comment.jade' }
]}, {
]
}, {
line: 'div should not be a comment',
tokens: [
{ startIndex: 0, type: 'tag.jade' },
{ startIndex: 3, type: '' }
]}],
]
}],
// Code [Jade]
[{
@ -217,7 +243,8 @@ testTokenization('jade', [
{ startIndex: 8, type: 'delimiter.jade' },
{ startIndex: 9, type: '' },
{ startIndex: 10, type: 'number.jade' }
]}],
]
}],
[{
line: 'each item in items',
@ -226,7 +253,8 @@ testTokenization('jade', [
{ startIndex: 4, type: '' },
{ startIndex: 10, type: 'keyword.in.jade' },
{ startIndex: 12, type: '' }
]}],
]
}],
[{
line: '- var html = "<script></script>"',
@ -237,7 +265,8 @@ testTokenization('jade', [
{ startIndex: 11, type: 'delimiter.jade' },
{ startIndex: 12, type: '' },
{ startIndex: 13, type: 'string.jade' }
]}],
]
}],
// Generated from sample
[{
@ -246,7 +275,8 @@ testTokenization('jade', [
{ startIndex: 0, type: 'keyword.doctype.jade' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'number.jade' }
]}, {
]
}, {
line: 'html(lang="en")',
tokens: [
{ startIndex: 0, type: 'tag.jade' },
@ -255,18 +285,21 @@ testTokenization('jade', [
{ startIndex: 9, type: 'delimiter.jade' },
{ startIndex: 10, type: 'attribute.value.jade' },
{ startIndex: 14, type: 'delimiter.parenthesis.jade' }
]}, {
]
}, {
line: ' head',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'tag.jade' }
]}, {
]
}, {
line: ' title= pageTitle',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 8, type: 'tag.jade' },
{ startIndex: 13, type: '' }
]}, {
]
}, {
line: ' script(type=\'text/javascript\')',
tokens: [
{ startIndex: 0, type: '' },
@ -276,7 +309,8 @@ testTokenization('jade', [
{ startIndex: 19, type: 'delimiter.jade' },
{ startIndex: 20, type: 'attribute.value.jade' },
{ startIndex: 37, type: 'delimiter.parenthesis.jade' }
]}, {
]
}, {
line: ' if (foo) {',
tokens: [
{ startIndex: 0, type: '' },
@ -287,94 +321,113 @@ testTokenization('jade', [
{ startIndex: 19, type: 'delimiter.parenthesis.jade' },
{ startIndex: 20, type: '' },
{ startIndex: 21, type: 'delimiter.curly.jade' }
]}, {
]
}, {
line: ' bar()',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 19, type: 'delimiter.parenthesis.jade' }
]}, {
]
}, {
line: ' }',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 12, type: 'delimiter.curly.jade' }
]}, {
]
}, {
line: ' body',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'tag.jade' }
]}, {
]
}, {
line: ' // Disclaimer: You will need to turn insertSpaces to true in order for the',
tokens: [
{ startIndex: 0, type: 'comment.jade' }
]}, {
]
}, {
line: ' syntax highlighting to kick in properly (especially for comments)',
tokens: [
{ startIndex: 0, type: 'comment.jade' }
]}, {
]
}, {
line: ' Enjoy :)',
tokens: [
{ startIndex: 0, type: 'comment.jade' }
]}, {
]
}, {
line: ' h1 Jade - node template engine if in',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 8, type: 'tag.jade' },
{ startIndex: 10, type: '' }
]}, {
]
}, {
line: ' p.',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 8, type: 'tag.jade' },
{ startIndex: 9, type: 'delimiter.jade' }
]}, {
]
}, {
line: ' text ',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: ' text',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: ' #container',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: ' #container',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: ' #container',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 8, type: 'tag.id.jade' }
]}, {
]
}, {
line: ' if youAreUsingJade',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 10, type: 'keyword.if.jade' },
{ startIndex: 12, type: '' }
]}, {
]
}, {
line: ' p You are amazing',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 12, type: 'tag.jade' },
{ startIndex: 13, type: '' }
]}, {
]
}, {
line: ' else',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 10, type: 'keyword.else.jade' }
]}, {
]
}, {
line: ' p Get on it!',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 12, type: 'tag.jade' },
{ startIndex: 13, type: '' }
]}, {
]
}, {
line: ' p Text can be included in a number of different ways.',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 5, type: 'tag.jade' },
{ startIndex: 6, type: '' }
]}]
]
}]
]);

View file

@ -13,14 +13,16 @@ testTokenization('java', [
line: '//',
tokens: [
{ startIndex: 0, type: 'comment.java' }
]}],
]
}],
[{
line: ' // a comment',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'comment.java' }
]}],
]
}],
// Broken nested tokens due to invalid comment tokenization
[{
@ -29,19 +31,22 @@ testTokenization('java', [
{ startIndex: 0, type: 'comment.java' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'identifier.java' }
]}],
]
}],
[{
line: '// a comment',
tokens: [
{ startIndex: 0, type: 'comment.java' }
]}],
]
}],
[{
line: '//sticky comment',
tokens: [
{ startIndex: 0, type: 'comment.java' }
]}],
]
}],
[{
line: '/almost a comment',
@ -52,7 +57,8 @@ testTokenization('java', [
{ startIndex: 8, type: 'identifier.java' },
{ startIndex: 9, type: '' },
{ startIndex: 10, type: 'identifier.java' }
]}],
]
}],
[{
line: '1 / 2; /* comment',
@ -65,7 +71,8 @@ testTokenization('java', [
{ startIndex: 5, type: 'delimiter.java' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'comment.java' }
]}],
]
}],
[{
line: 'int x = 1; // my comment // is a nice one',
@ -80,14 +87,16 @@ testTokenization('java', [
{ startIndex: 9, type: 'delimiter.java' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'comment.java' }
]}],
]
}],
// Comments - range comment, single line
[{
line: '/* a simple comment */',
tokens: [
{ startIndex: 0, type: 'comment.java' }
]}],
]
}],
[{
line: 'int x = /* a simple comment */ 1;',
@ -102,7 +111,8 @@ testTokenization('java', [
{ startIndex: 30, type: '' },
{ startIndex: 31, type: 'number.java' },
{ startIndex: 32, type: 'delimiter.java' }
]}],
]
}],
[{
line: 'int x = /* comment */ 1; */',
@ -118,7 +128,8 @@ testTokenization('java', [
{ startIndex: 22, type: 'number.java' },
{ startIndex: 23, type: 'delimiter.java' },
{ startIndex: 24, type: '' }
]}],
]
}],
[{
line: 'x = /**/;',
@ -129,7 +140,8 @@ testTokenization('java', [
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'comment.java' },
{ startIndex: 8, type: 'delimiter.java' }
]}],
]
}],
[{
line: 'x = /*/;',
@ -139,22 +151,26 @@ testTokenization('java', [
{ startIndex: 2, type: 'delimiter.java' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'comment.java' }
]}],
]
}],
// Comments - range comment, multiple lines
[{
line: '/* start of multiline comment',
tokens: [
{ startIndex: 0, type: 'comment.java' }
]}, {
]
}, {
line: 'a comment between without a star',
tokens: [
{ startIndex: 0, type: 'comment.java' }
]}, {
]
}, {
line: 'end of multiline comment*/',
tokens: [
{ startIndex: 0, type: 'comment.java' }
]}],
]
}],
[{
line: 'int x = /* start a comment',
@ -166,33 +182,39 @@ testTokenization('java', [
{ startIndex: 6, type: 'delimiter.java' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'comment.java' }
]}, {
]
}, {
line: ' a ',
tokens: [
{ startIndex: 0, type: 'comment.java' }
]}, {
]
}, {
line: 'and end it */ 2;',
tokens: [
{ startIndex: 0, type: 'comment.java' },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'number.java' },
{ startIndex: 15, type: 'delimiter.java' }
]}],
]
}],
// Java Doc, multiple lines
[{
line: '/** start of Java Doc',
tokens: [
{ startIndex: 0, type: 'comment.doc.java' }
]}, {
]
}, {
line: 'a comment between without a star',
tokens: [
{ startIndex: 0, type: 'comment.doc.java' }
]}, {
]
}, {
line: 'end of multiline comment*/',
tokens: [
{ startIndex: 0, type: 'comment.doc.java' }
]}],
]
}],
// Keywords
[{
@ -226,201 +248,234 @@ testTokenization('java', [
{ startIndex: 65, type: 'delimiter.curly.java' },
{ startIndex: 66, type: '' },
{ startIndex: 67, type: 'delimiter.curly.java' }
]}],
]
}],
// Numbers
[{
line: '0',
tokens: [
{ startIndex: 0, type: 'number.java' }
]}],
]
}],
[{
line: '0.10',
tokens: [
{ startIndex: 0, type: 'number.float.java' }
]}],
]
}],
[{
line: '0x',
tokens: [
{ startIndex: 0, type: 'number.java' },
{ startIndex: 1, type: 'identifier.java' }
]}],
]
}],
[{
line: '0x123',
tokens: [
{ startIndex: 0, type: 'number.hex.java' }
]}],
]
}],
[{
line: '0x5_2',
tokens: [
{ startIndex: 0, type: 'number.hex.java' }
]}],
]
}],
[{
line: '023L',
tokens: [
{ startIndex: 0, type: 'number.octal.java' }
]}],
]
}],
[{
line: '0123l',
tokens: [
{ startIndex: 0, type: 'number.octal.java' }
]}],
]
}],
[{
line: '05_2',
tokens: [
{ startIndex: 0, type: 'number.octal.java' }
]}],
]
}],
[{
line: '0b1010_0101',
tokens: [
{ startIndex: 0, type: 'number.binary.java' }
]}],
]
}],
[{
line: '0B001',
tokens: [
{ startIndex: 0, type: 'number.binary.java' }
]}],
]
}],
[{
line: '10e3',
tokens: [
{ startIndex: 0, type: 'number.float.java' }
]}],
]
}],
[{
line: '10f',
tokens: [
{ startIndex: 0, type: 'number.float.java' }
]}],
]
}],
[{
line: '23.5',
tokens: [
{ startIndex: 0, type: 'number.float.java' }
]}],
]
}],
[{
line: '23.5e3',
tokens: [
{ startIndex: 0, type: 'number.float.java' }
]}],
]
}],
[{
line: '23.5e-3',
tokens: [
{ startIndex: 0, type: 'number.float.java' }
]}],
]
}],
[{
line: '23.5E3',
tokens: [
{ startIndex: 0, type: 'number.float.java' }
]}],
]
}],
[{
line: '23.5E-3',
tokens: [
{ startIndex: 0, type: 'number.float.java' }
]}],
]
}],
[{
line: '23.5F',
tokens: [
{ startIndex: 0, type: 'number.float.java' }
]}],
]
}],
[{
line: '23.5f',
tokens: [
{ startIndex: 0, type: 'number.float.java' }
]}],
]
}],
[{
line: '23.5D',
tokens: [
{ startIndex: 0, type: 'number.float.java' }
]}],
]
}],
[{
line: '23.5d',
tokens: [
{ startIndex: 0, type: 'number.float.java' }
]}],
]
}],
[{
line: '1.72E3D',
tokens: [
{ startIndex: 0, type: 'number.float.java' }
]}],
]
}],
[{
line: '1.72E3d',
tokens: [
{ startIndex: 0, type: 'number.float.java' }
]}],
]
}],
[{
line: '1.72E-3d',
tokens: [
{ startIndex: 0, type: 'number.float.java' }
]}],
]
}],
[{
line: '1.72e3D',
tokens: [
{ startIndex: 0, type: 'number.float.java' }
]}],
]
}],
[{
line: '1.72e3d',
tokens: [
{ startIndex: 0, type: 'number.float.java' }
]}],
]
}],
[{
line: '1.72e-3d',
tokens: [
{ startIndex: 0, type: 'number.float.java' }
]}],
]
}],
[{
line: '23L',
tokens: [
{ startIndex: 0, type: 'number.java' }
]}],
]
}],
[{
line: '23l',
tokens: [
{ startIndex: 0, type: 'number.java' }
]}],
]
}],
[{
line: '0_52',
tokens: [
{ startIndex: 0, type: 'number.java' }
]}],
]
}],
[{
line: '5_2',
tokens: [
{ startIndex: 0, type: 'number.java' }
]}],
]
}],
[{
line: '5_______2',
tokens: [
{ startIndex: 0, type: 'number.java' }
]}],
]
}],
[{
line: '3_.1415F',
@ -429,7 +484,8 @@ testTokenization('java', [
{ startIndex: 1, type: 'identifier.java' },
{ startIndex: 2, type: 'delimiter.java' },
{ startIndex: 3, type: 'number.float.java' }
]}],
]
}],
[{
line: '3._1415F',
@ -437,56 +493,64 @@ testTokenization('java', [
{ startIndex: 0, type: 'number.java' },
{ startIndex: 1, type: 'delimiter.java' },
{ startIndex: 2, type: 'identifier.java' }
]}],
]
}],
[{
line: '999_99_9999_L',
tokens: [
{ startIndex: 0, type: 'number.java' },
{ startIndex: 11, type: 'identifier.java' }
]}],
]
}],
[{
line: '52_',
tokens: [
{ startIndex: 0, type: 'number.java' },
{ startIndex: 2, type: 'identifier.java' }
]}],
]
}],
[{
line: '0_x52',
tokens: [
{ startIndex: 0, type: 'number.java' },
{ startIndex: 1, type: 'identifier.java' }
]}],
]
}],
[{
line: '0x_52',
tokens: [
{ startIndex: 0, type: 'number.java' },
{ startIndex: 1, type: 'identifier.java' }
]}],
]
}],
[{
line: '0x52_',
tokens: [
{ startIndex: 0, type: 'number.hex.java' },
{ startIndex: 4, type: 'identifier.java' }
]}],
]
}],
[{
line: '052_',
tokens: [
{ startIndex: 0, type: 'number.octal.java' },
{ startIndex: 3, type: 'identifier.java' }
]}],
]
}],
[{
line: '23.5L',
tokens: [
{ startIndex: 0, type: 'number.float.java' },
{ startIndex: 4, type: 'identifier.java' }
]}],
]
}],
[{
line: '0+0',
@ -494,7 +558,8 @@ testTokenization('java', [
{ startIndex: 0, type: 'number.java' },
{ startIndex: 1, type: 'delimiter.java' },
{ startIndex: 2, type: 'number.java' }
]}],
]
}],
[{
line: '100+10',
@ -502,7 +567,8 @@ testTokenization('java', [
{ startIndex: 0, type: 'number.java' },
{ startIndex: 3, type: 'delimiter.java' },
{ startIndex: 4, type: 'number.java' }
]}],
]
}],
[{
line: '0 + 0',
@ -512,7 +578,8 @@ testTokenization('java', [
{ startIndex: 2, type: 'delimiter.java' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'number.java' }
]}],
]
}],
// single line Strings
[{
@ -526,7 +593,8 @@ testTokenization('java', [
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'string.java' },
{ startIndex: 30, type: 'delimiter.java' }
]}],
]
}],
[{
line: 'String s = "concatenated" + " String" ;',
@ -544,13 +612,15 @@ testTokenization('java', [
{ startIndex: 28, type: 'string.java' },
{ startIndex: 37, type: '' },
{ startIndex: 38, type: 'delimiter.java' }
]}],
]
}],
[{
line: '"quote in a string"',
tokens: [
{ startIndex: 0, type: 'string.java' }
]}],
]
}],
[{
line: '"escaping \\"quotes\\" is cool"',
@ -560,26 +630,30 @@ testTokenization('java', [
{ startIndex: 12, type: 'string.java' },
{ startIndex: 18, type: 'string.escape.java' },
{ startIndex: 20, type: 'string.java' }
]}],
]
}],
[{
line: '"\\"',
tokens: [
{ startIndex: 0, type: 'string.invalid.java' }
]}],
]
}],
// Annotations
[{
line: '@',
tokens: [
{ startIndex: 0, type: '' }
]}],
]
}],
[{
line: '@Override',
tokens: [
{ startIndex: 0, type: 'annotation.java' }
]}],
]
}],
[{
line: '@SuppressWarnings(value = "aString")',
@ -592,7 +666,8 @@ testTokenization('java', [
{ startIndex: 25, type: '' },
{ startIndex: 26, type: 'string.java' },
{ startIndex: 35, type: 'delimiter.parenthesis.java' }
]}],
]
}],
[{
line: '@ AnnotationWithKeywordAfter private',
@ -600,6 +675,7 @@ testTokenization('java', [
{ startIndex: 0, type: 'annotation.java' },
{ startIndex: 28, type: '' },
{ startIndex: 29, type: 'keyword.private.java' }
]}]
]
}]
]);

View file

@ -18,7 +18,8 @@ testTokenization(['less'], [
{ startIndex: 9, type: 'attribute.value.number.less' },
{ startIndex: 11, type: 'delimiter.parenthesis.less' },
{ startIndex: 12, type: 'delimiter.less' }
]}],
]
}],
[{
line: 'iskeyword(@test) ;mix',
@ -30,13 +31,15 @@ testTokenization(['less'], [
{ startIndex: 16, type: '' },
{ startIndex: 17, type: 'delimiter.less' },
{ startIndex: 18, type: 'keyword.less' }
]}],
]
}],
[{
line: 'whenn',
tokens: [
{ startIndex: 0, type: 'tag.less' },
]}],
]
}],
[{
line: ' round ',
@ -44,7 +47,8 @@ testTokenization(['less'], [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'keyword.less' },
{ startIndex: 9, type: '' }
]}],
]
}],
// Units
[{
@ -56,14 +60,16 @@ testTokenization(['less'], [
{ startIndex: 11, type: 'attribute.value.unit.less' },
{ startIndex: 13, type: 'delimiter.parenthesis.less' },
{ startIndex: 14, type: 'delimiter.less' }
]}],
]
}],
[{
line: 'pxx ',
tokens: [
{ startIndex: 0, type: 'tag.less' },
{ startIndex: 3, type: '' }
]}],
]
}],
// single line Strings
[{
@ -76,7 +82,8 @@ testTokenization(['less'], [
{ startIndex: 8, type: 'string.less' },
{ startIndex: 25, type: 'string.delimiter.less' },
{ startIndex: 26, type: 'delimiter.less' }
]}],
]
}],
[{
line: '@test: "concatenated" + "String";',
@ -94,7 +101,8 @@ testTokenization(['less'], [
{ startIndex: 25, type: 'string.less' },
{ startIndex: 31, type: 'string.delimiter.less' },
{ startIndex: 32, type: 'delimiter.less' }
]}],
]
}],
[{
line: '@test: "quote in\'adasdsa\\"asd\' a string"',
@ -105,7 +113,8 @@ testTokenization(['less'], [
{ startIndex: 7, type: 'string.delimiter.less' },
{ startIndex: 8, type: 'string.less' },
{ startIndex: 39, type: 'string.delimiter.less' },
]}],
]
}],
[{
line: '@test: \'doublequote in\"ada\\\'sds\\\'a\"asd a string\'',
@ -116,53 +125,62 @@ testTokenization(['less'], [
{ startIndex: 7, type: 'string.delimiter.less' },
{ startIndex: 8, type: 'string.less' },
{ startIndex: 47, type: 'string.delimiter.less' }
]}],
]
}],
// Comments - range comment, multiple lines
[{
line: '/* start of multiline comment',
tokens: [
{ startIndex: 0, type: 'comment.less' }
]},{
]
}, {
line: 'a comment between without a star',
tokens: [
{ startIndex: 0, type: 'comment.less' }
]}, {
]
}, {
line: 'end of multiline comment*/',
tokens: [
{ startIndex: 0, type: 'comment.less' }
]}, {
]
}, {
line: 'when /* start a comment',
tokens: [
{ startIndex: 0, type: 'keyword.less' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'comment.less' },
]}, {
]
}, {
line: ' a ',
tokens: [
{ startIndex: 0, type: 'comment.less' }
]}, {
]
}, {
line: 'and end it */ 2;',
tokens: [
{ startIndex: 0, type: 'comment.less' },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'attribute.value.number.less' },
{ startIndex: 15, type: 'delimiter.less' }
]}],
]
}],
// Numbers
[{
line: '0',
tokens: [
{ startIndex: 0, type: 'attribute.value.number.less' }
]}],
]
}],
[{
line: ' 0',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'attribute.value.number.less' }
]}],
]
}],
[{
line: ' 0 ',
@ -170,14 +188,16 @@ testTokenization(['less'], [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'attribute.value.number.less' },
{ startIndex: 2, type: '' }
]}],
]
}],
[{
line: '0 ',
tokens: [
{ startIndex: 0, type: 'attribute.value.number.less' },
{ startIndex: 1, type: '' }
]}],
]
}],
[{
line: '@test: 0+0',
@ -188,7 +208,8 @@ testTokenization(['less'], [
{ startIndex: 7, type: 'attribute.value.number.less' },
{ startIndex: 8, type: 'operator.less' },
{ startIndex: 9, type: 'attribute.value.number.less' }
]}],
]
}],
[{
line: '@test: 100+10.00',
@ -199,7 +220,8 @@ testTokenization(['less'], [
{ startIndex: 7, type: 'attribute.value.number.less' },
{ startIndex: 10, type: 'operator.less' },
{ startIndex: 11, type: 'attribute.value.number.less' }
]}],
]
}],
[{
line: '@test: 0 + 0',
@ -212,15 +234,18 @@ testTokenization(['less'], [
{ startIndex: 9, type: 'operator.less' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'attribute.value.number.less' }
]}],
]
}],
[{
line: '0123',
tokens: [{ startIndex:0, type: 'attribute.value.number.less' }]}],
tokens: [{ startIndex: 0, type: 'attribute.value.number.less' }]
}],
[{
line: '#012343',
tokens: [{ startIndex: 0, type: 'attribute.value.hex.less' }]}],
tokens: [{ startIndex: 0, type: 'attribute.value.hex.less' }]
}],
// Bracket Matching
[{
@ -233,7 +258,8 @@ testTokenization(['less'], [
{ startIndex: 4, type: 'delimiter.less' },
{ startIndex: 5, type: 'attribute.value.number.less' },
{ startIndex: 6, type: 'delimiter.bracket.less' }
]}],
]
}],
[{
line: 'foo(123);',
@ -243,7 +269,8 @@ testTokenization(['less'], [
{ startIndex: 4, type: 'attribute.value.number.less' },
{ startIndex: 7, type: 'delimiter.parenthesis.less' },
{ startIndex: 8, type: 'delimiter.less' }
]}],
]
}],
// No Bracket Matching inside strings
[{
@ -255,27 +282,32 @@ testTokenization(['less'], [
{ startIndex: 7, type: 'string.delimiter.less' },
{ startIndex: 8, type: 'string.less' },
{ startIndex: 14, type: 'string.delimiter.less' }
]}],
]
}],
// Singleline Comments
[{
line: '//',
tokens: [{ startIndex:0, type: 'comment.less' }]}],
tokens: [{ startIndex: 0, type: 'comment.less' }]
}],
[{
line: ' // a comment',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'comment.less' }
]}],
]
}],
[{
line: '// a comment',
tokens: [{ startIndex:0, type: 'comment.less' }]}],
tokens: [{ startIndex: 0, type: 'comment.less' }]
}],
[{
line: '//sticky comment',
tokens: [{ startIndex:0, type: 'comment.less' }]}],
tokens: [{ startIndex: 0, type: 'comment.less' }]
}],
[{
line: '@something : 2; // my comment // this is a nice one',
@ -288,7 +320,8 @@ testTokenization(['less'], [
{ startIndex: 14, type: 'delimiter.less' },
{ startIndex: 15, type: '' },
{ startIndex: 16, type: 'comment.less' }
]}],
]
}],
[{
line: '.something(@some, @other) when (iscolor(@other)) { aname// my commen',
@ -313,7 +346,8 @@ testTokenization(['less'], [
{ startIndex: 50, type: '' },
{ startIndex: 51, type: 'tag.less' },
{ startIndex: 56, type: 'comment.less' }
]}],
]
}],
[{
line: '.something(@some//mycomment',
@ -322,7 +356,8 @@ testTokenization(['less'], [
{ startIndex: 10, type: 'delimiter.parenthesis.less' },
{ startIndex: 11, type: 'variable.less' },
{ startIndex: 16, type: 'comment.less' }
]}],
]
}],
[{
line: '@something : #2;',
@ -333,24 +368,29 @@ testTokenization(['less'], [
{ startIndex: 12, type: '' },
{ startIndex: 13, type: 'attribute.value.hex.less' },
{ startIndex: 15, type: 'delimiter.less' }
]}],
]
}],
// Singleline Range-Comments
[{
line: '/*slcomment*/',
tokens: [{ startIndex:0, type: 'comment.less' }]}],
tokens: [{ startIndex: 0, type: 'comment.less' }]
}],
[{
line: '/* slcomment */',
tokens: [{ startIndex: 0, type: 'comment.less' }]}],
tokens: [{ startIndex: 0, type: 'comment.less' }]
}],
[{
line: '/*sl/com* ment*/',
tokens: [{ startIndex: 0, type: 'comment.less' }]}],
tokens: [{ startIndex: 0, type: 'comment.less' }]
}],
[{
line: '/**/',
tokens: [{ startIndex: 0, type: 'comment.less' }]}],
tokens: [{ startIndex: 0, type: 'comment.less' }]
}],
[{
line: '@something: /*comm/* * /ent*/2;',
@ -361,7 +401,8 @@ testTokenization(['less'], [
{ startIndex: 12, type: 'comment.less' },
{ startIndex: 29, type: 'attribute.value.number.less' },
{ startIndex: 30, type: 'delimiter.less' }
]}],
]
}],
[{
line: '@something: /*comment*/ 2;',
@ -373,22 +414,26 @@ testTokenization(['less'], [
{ startIndex: 23, type: '' },
{ startIndex: 24, type: 'attribute.value.number.less' },
{ startIndex: 25, type: 'delimiter.less' }
]}],
]
}],
// Comments - range comment, multi lines
[{
line: '/* a multiline comment',
tokens: [
{ startIndex: 0, type: 'comment.less' }
]}, {
]
}, {
line: 'can actually span',
tokens: [
{ startIndex: 0, type: 'comment.less' }
]}, {
]
}, {
line: 'multiple lines */',
tokens: [
{ startIndex: 0, type: 'comment.less' }
]}],
]
}],
[{
line: '@some /* start a comment here',
@ -396,11 +441,13 @@ testTokenization(['less'], [
{ startIndex: 0, type: 'variable.less' },
{ startIndex: 5, type: '' },
{ startIndex: 6, type: 'comment.less' }
]}, {
]
}, {
line: ' span over this line and ',
tokens: [
{ startIndex: 0, type: 'comment.less' }
]}, {
]
}, {
line: 'end it there */ : 2;',
tokens: [
{ startIndex: 0, type: 'comment.less' },
@ -409,7 +456,8 @@ testTokenization(['less'], [
{ startIndex: 17, type: '' },
{ startIndex: 18, type: 'attribute.value.number.less' },
{ startIndex: 19, type: 'delimiter.less' }
]}],
]
}],
// Escape Strings
[{
@ -426,7 +474,8 @@ testTokenization(['less'], [
{ startIndex: 19, type: 'string.less' },
{ startIndex: 55, type: 'string.delimiter.less' },
{ startIndex: 56, type: 'delimiter.less' }
]}],
]
}],
// Guards
[{
@ -464,7 +513,8 @@ testTokenization(['less'], [
{ startIndex: 47, type: 'delimiter.curly.less' },
{ startIndex: 48, type: '' },
{ startIndex: 49, type: 'delimiter.curly.less' }
]}],
]
}],
[{
line: '.truth (@a) when (@a = true) { }',
@ -488,7 +538,8 @@ testTokenization(['less'], [
{ startIndex: 29, type: 'delimiter.curly.less' },
{ startIndex: 30, type: '' },
{ startIndex: 31, type: 'delimiter.curly.less' }
]}],
]
}],
[{
line: '.max (@a, @b) when (@a > @b) { width: @a; }',
@ -521,7 +572,8 @@ testTokenization(['less'], [
{ startIndex: 40, type: 'delimiter.less' },
{ startIndex: 41, type: '' },
{ startIndex: 42, type: 'delimiter.curly.less' }
]}],
]
}],
[{
line: '.mixin (@a, @b: 0) when (isnumber(@b)) { }',
@ -549,7 +601,8 @@ testTokenization(['less'], [
{ startIndex: 39, type: 'delimiter.curly.less' },
{ startIndex: 40, type: '' },
{ startIndex: 41, type: 'delimiter.curly.less' }
]}],
]
}],
[{
line: '.mixin (@a, @b: black) when (iscolor(@b)) { }',
@ -577,7 +630,8 @@ testTokenization(['less'], [
{ startIndex: 42, type: 'delimiter.curly.less' },
{ startIndex: 43, type: '' },
{ startIndex: 44, type: 'delimiter.curly.less' }
]}],
]
}],
// Nested JavaScript
[{
@ -591,7 +645,8 @@ testTokenization(['less'], [
{ startIndex: 26, type: 'delimiter.backtick.less' },
{ startIndex: 27, type: '' },
{ startIndex: 28, type: 'comment.less' }
]}],
]
}],
// Attribute in a .class(...)
[{
@ -639,7 +694,8 @@ testTokenization(['less'], [
{ startIndex: 70, type: 'attribute.value.number.less' },
{ startIndex: 72, type: 'delimiter.parenthesis.less' },
{ startIndex: 74, type: 'delimiter.less' }
]}],
]
}],
// Difficult little bugs... => String mismatches
[{
@ -653,7 +709,8 @@ testTokenization(['less'], [
{ startIndex: 12, type: 'string.less' },
{ startIndex: 17, type: 'string.delimiter.less' },
{ startIndex: 18, type: 'delimiter.bracket.less' }
]}],
]
}],
[{
line: '~\'.offset@{index}\')',
@ -662,7 +719,8 @@ testTokenization(['less'], [
{ startIndex: 2, type: 'string.less' },
{ startIndex: 17, type: 'string.delimiter.less' },
{ startIndex: 18, type: 'delimiter.parenthesis.less' }
]}],
]
}],
[{
line: 'some("\\42");',
@ -674,7 +732,8 @@ testTokenization(['less'], [
{ startIndex: 9, type: 'string.delimiter.less' },
{ startIndex: 10, type: 'delimiter.parenthesis.less' },
{ startIndex: 11, type: 'delimiter.less' }
]}],
]
}],
[{
line: ' ~ "icon-"',
@ -685,7 +744,8 @@ testTokenization(['less'], [
{ startIndex: 3, type: 'string.delimiter.less' },
{ startIndex: 4, type: 'string.less' },
{ startIndex: 9, type: 'string.delimiter.less' }
]}],
]
}],
// Difficult little bugs... => Operator mismatches
[{
@ -696,7 +756,8 @@ testTokenization(['less'], [
{ startIndex: 7, type: 'string.delimiter.less' },
{ startIndex: 8, type: 'string.less' },
{ startIndex: 13, type: 'string.delimiter.less' }
]}],
]
}],
[{
line: 'class*="icon-"',
@ -706,7 +767,8 @@ testTokenization(['less'], [
{ startIndex: 7, type: 'string.delimiter.less' },
{ startIndex: 8, type: 'string.less' },
{ startIndex: 13, type: 'string.delimiter.less' }
]}],
]
}],
[{
line: 'class~="icon-"',
@ -716,7 +778,8 @@ testTokenization(['less'], [
{ startIndex: 7, type: 'string.delimiter.less' },
{ startIndex: 8, type: 'string.less' },
{ startIndex: 13, type: 'string.delimiter.less' }
]}],
]
}],
[{
line: 'class ~ = "icon-"',
@ -730,7 +793,8 @@ testTokenization(['less'], [
{ startIndex: 10, type: 'string.delimiter.less' },
{ startIndex: 11, type: 'string.less' },
{ startIndex: 16, type: 'string.delimiter.less' }
]}],
]
}],
[{
line: 'class|="icon-"',
@ -740,7 +804,8 @@ testTokenization(['less'], [
{ startIndex: 7, type: 'string.delimiter.less' },
{ startIndex: 8, type: 'string.less' },
{ startIndex: 13, type: 'string.delimiter.less' }
]}],
]
}],
[{
line: '.hide-text { font: 0/0 a; }',
@ -760,7 +825,8 @@ testTokenization(['less'], [
{ startIndex: 24, type: 'delimiter.less' },
{ startIndex: 25, type: '' },
{ startIndex: 26, type: 'delimiter.curly.less' }
]}],
]
}],
// Difficult little bugs... => Numbers in classes
[{
@ -795,7 +861,8 @@ testTokenization(['less'], [
{ startIndex: 69, type: 'delimiter.less' },
{ startIndex: 70, type: '' },
{ startIndex: 71, type: 'delimiter.curly.less' }
]}],
]
}],
// Difficult little bugs... => Generic mismatches, worst case...
[{
@ -820,7 +887,8 @@ testTokenization(['less'], [
{ startIndex: 40, type: 'string.less' },
{ startIndex: 46, type: 'string.delimiter.less' },
{ startIndex: 47, type: 'delimiter.bracket.less' }
]}],
]
}],
[{
line: '.bw-gradient(@color: #F5F5F5, @start: 0, @stop: 255) { background: -webkit-gradient(color-stop(0, rgb(@start,@start,@start)), color-stop(1, rgb(@stop,@stop,@stop))); }',
@ -883,7 +951,8 @@ testTokenization(['less'], [
{ startIndex: 164, type: 'delimiter.less' },
{ startIndex: 165, type: '' },
{ startIndex: 166, type: 'delimiter.curly.less' }
]}],
]
}],
// Here CSS Tests from CSS File
// Skip whitespace
@ -893,7 +962,8 @@ testTokenization(['less'], [
{ startIndex: 0, type: '' },
{ startIndex: 6, type: 'tag.less' },
{ startIndex: 10, type: '' }
]}],
]
}],
// CSS rule
// body {
@ -909,7 +979,8 @@ testTokenization(['less'], [
{ startIndex: 0, type: 'tag.less' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'delimiter.curly.less' }
]}, {
]
}, {
line: ' margin: 0;',
tokens: [
{ startIndex: 0, type: '' },
@ -918,7 +989,8 @@ testTokenization(['less'], [
{ startIndex: 9, type: '' },
{ startIndex: 10, type: 'attribute.value.number.less' },
{ startIndex: 11, type: 'delimiter.less' }
]}, {
]
}, {
line: ' padding: 3em 6em;',
tokens: [
{ startIndex: 0, type: '' },
@ -931,7 +1003,8 @@ testTokenization(['less'], [
{ startIndex: 15, type: 'attribute.value.number.less' },
{ startIndex: 16, type: 'attribute.value.unit.less' },
{ startIndex: 18, type: 'delimiter.less' }
]}, {
]
}, {
line: ' font-family: tahoma, arial, sans-serif;',
tokens: [
{ startIndex: 0, type: '' },
@ -946,7 +1019,8 @@ testTokenization(['less'], [
{ startIndex: 29, type: '' },
{ startIndex: 30, type: 'attribute.value.less' },
{ startIndex: 40, type: 'delimiter.less' }
]}, {
]
}, {
line: ' text-decoration: none !important;',
tokens: [
{ startIndex: 0, type: '' },
@ -957,7 +1031,8 @@ testTokenization(['less'], [
{ startIndex: 23, type: '' },
{ startIndex: 24, type: 'keyword.less' },
{ startIndex: 34, type: 'delimiter.less' }
]}, {
]
}, {
line: ' color: #000;',
tokens: [
{ startIndex: 0, type: '' },
@ -966,12 +1041,14 @@ testTokenization(['less'], [
{ startIndex: 8, type: '' },
{ startIndex: 9, type: 'attribute.value.hex.less' },
{ startIndex: 13, type: 'delimiter.less' }
]}, {
]
}, {
line: ' }',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'delimiter.curly.less' }
]}],
]
}],
// CSS units and numbers
[{
@ -997,7 +1074,8 @@ testTokenization(['less'], [
{ startIndex: 28, type: 'delimiter.less' },
{ startIndex: 29, type: '' },
{ startIndex: 30, type: 'delimiter.curly.less' }
]}],
]
}],
// CSS single line comment
// h1 /*comment*/ p {
@ -1011,7 +1089,8 @@ testTokenization(['less'], [
{ startIndex: 15, type: 'tag.less' },
{ startIndex: 16, type: '' },
{ startIndex: 17, type: 'delimiter.curly.less' }
]}],
]
}],
// CSS multi line comment
// h1 /*com
@ -1022,13 +1101,15 @@ testTokenization(['less'], [
{ startIndex: 0, type: 'tag.less' },
{ startIndex: 2, type: '' },
{ startIndex: 3, type: 'comment.less' }
]}, {
]
}, {
line: 'ment*/ p',
tokens: [
{ startIndex: 0, type: 'comment.less' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'tag.less' }
]}],
]
}],
// CSS ID rule
// #myID {
@ -1041,7 +1122,8 @@ testTokenization(['less'], [
{ startIndex: 0, type: 'tag.id.less' },
{ startIndex: 5, type: '' },
{ startIndex: 6, type: 'delimiter.curly.less' }
]}],
]
}],
// CSS Class rules
// .myID {
@ -1052,7 +1134,8 @@ testTokenization(['less'], [
{ startIndex: 0, type: 'tag.class.less' },
{ startIndex: 5, type: '' },
{ startIndex: 6, type: 'delimiter.curly.less' }
]}],
]
}],
// CSS @import etc
// @import url('something.less'); {
@ -1067,7 +1150,8 @@ testTokenization(['less'], [
{ startIndex: 27, type: 'string.delimiter.less' },
{ startIndex: 28, type: 'delimiter.parenthesis.less' },
{ startIndex: 29, type: 'delimiter.less' }
]}],
]
}],
// CSS multi-line string with an escaped newline
// body {
@ -1079,7 +1163,8 @@ testTokenization(['less'], [
{ startIndex: 0, type: 'tag.less' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'delimiter.curly.less' },
]}, {
]
}, {
line: ' content: \"con\\',
tokens: [
{ startIndex: 0, type: '' },
@ -1088,13 +1173,15 @@ testTokenization(['less'], [
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'string.delimiter.less' },
{ startIndex: 12, type: 'string.less' }
]}, {
]
}, {
line: 'tent\";',
tokens: [
{ startIndex: 0, type: 'string.less' },
{ startIndex: 4, type: 'string.delimiter.less' },
{ startIndex: 5, type: 'delimiter.less' }
]}],
]
}],
// CSS empty string value
// body {
@ -1105,7 +1192,8 @@ testTokenization(['less'], [
{ startIndex: 0, type: 'tag.less' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'delimiter.curly.less' },
]}, {
]
}, {
line: ' content: \"\";',
tokens: [
{ startIndex: 0, type: '' },
@ -1114,7 +1202,8 @@ testTokenization(['less'], [
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'string.delimiter.less' },
{ startIndex: 13, type: 'delimiter.less' }
]}],
]
}],
// CSS font face
@ -1127,7 +1216,8 @@ testTokenization(['less'], [
{ startIndex: 0, type: 'variable.less' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'delimiter.curly.less' }
]}, {
]
}, {
line: ' font-family: "Opificio";',
tokens: [
{ startIndex: 0, type: '' },
@ -1138,7 +1228,8 @@ testTokenization(['less'], [
{ startIndex: 16, type: 'string.less' },
{ startIndex: 24, type: 'string.delimiter.less' },
{ startIndex: 25, type: 'delimiter.less' }
]}],
]
}],
// CSS string with escaped quotes
// 's\"tr'
@ -1147,7 +1238,8 @@ testTokenization(['less'], [
tokens: [
{ startIndex: 0, type: 'string.delimiter.less' },
{ startIndex: 1, type: 'string.less' }
]}],
]
}],
// EG: Bracket Matching
[{
@ -1155,7 +1247,8 @@ testTokenization(['less'], [
tokens: [
{ startIndex: 0, type: 'tag.less' },
{ startIndex: 1, type: 'delimiter.curly.less' },
]}],
]
}],
[{
line: 'p:nth() {}',
@ -1164,7 +1257,8 @@ testTokenization(['less'], [
{ startIndex: 5, type: 'delimiter.parenthesis.less' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'delimiter.curly.less' },
]}],
]
}],
// EG: import statement - bug #10308
// @import url('something.css');@import url('something.css');
@ -1187,14 +1281,16 @@ testTokenization(['less'], [
{ startIndex: 55, type: 'string.delimiter.less' },
{ startIndex: 56, type: 'delimiter.parenthesis.less' },
{ startIndex: 57, type: 'delimiter.less' }
]}],
]
}],
// EG: Triple quotes - bug #9870
[{
line: '""""',
tokens: [
{ startIndex: 0, type: 'string.delimiter.less' },
]}],
]
}],
// EG: CSS @import related coloring bug 9553
// @import url('something.css');
@ -1211,17 +1307,20 @@ testTokenization(['less'], [
{ startIndex: 26, type: 'string.delimiter.less' },
{ startIndex: 27, type: 'delimiter.parenthesis.less' },
{ startIndex: 28, type: 'delimiter.less' }
]}, {
]
}, {
line: '.rule1{}',
tokens: [
{ startIndex: 0, type: 'tag.class.less' },
{ startIndex: 6, type: 'delimiter.curly.less' },
]}, {
]
}, {
line: '.rule2{}',
tokens: [
{ startIndex: 0, type: 'tag.class.less' },
{ startIndex: 6, type: 'delimiter.curly.less' },
]}],
]
}],
// EG: CSS key frame animation syntax
[{
@ -1232,14 +1331,16 @@ testTokenization(['less'], [
{ startIndex: 19, type: 'tag.less' },
{ startIndex: 36, type: '' },
{ startIndex: 37, type: 'delimiter.curly.less' }
]}, {
]
}, {
line: ' from {',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'tag.less' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'delimiter.curly.less' }
]}, {
]
}, {
line: ' -webkit-transform: rotate(0deg);',
tokens: [
{ startIndex: 0, type: '' },
@ -1252,19 +1353,22 @@ testTokenization(['less'], [
{ startIndex: 29, type: 'attribute.value.unit.less' },
{ startIndex: 32, type: 'delimiter.parenthesis.less' },
{ startIndex: 33, type: 'delimiter.less' }
]}, {
]
}, {
line: ' }',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'delimiter.curly.less' }
]}, {
]
}, {
line: ' to {',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'tag.less' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'delimiter.curly.less' }
]}, {
]
}, {
line: ' -webkit-transform: rotate(360deg);',
tokens: [
{ startIndex: 0, type: '' },
@ -1277,14 +1381,17 @@ testTokenization(['less'], [
{ startIndex: 31, type: 'attribute.value.unit.less' },
{ startIndex: 34, type: 'delimiter.parenthesis.less' },
{ startIndex: 35, type: 'delimiter.less' }
]}, {
]
}, {
line: ' }',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'delimiter.curly.less' }
]}, {
]
}, {
line: '}',
tokens: [
{ startIndex: 0, type: 'delimiter.curly.less' }
]}]
]
}]
]);

View file

@ -26,7 +26,8 @@ testTokenization('lua', [
{ startIndex: 14, type: 'delimiter.lua' },
{ startIndex: 15, type: '' },
{ startIndex: 16, type: 'number.lua' }
]}],
]
}],
[{
line: 'foo = "Hello" .. "World"; local foo = foo',
@ -49,7 +50,8 @@ testTokenization('lua', [
{ startIndex: 36, type: 'delimiter.lua' },
{ startIndex: 37, type: '' },
{ startIndex: 38, type: 'identifier.lua' }
]}],
]
}],
// Comments
[{
@ -58,7 +60,8 @@ testTokenization('lua', [
{ startIndex: 0, type: 'comment.lua' },
{ startIndex: 12, type: '' },
{ startIndex: 13, type: 'identifier.lua' }
]}],
]
}],
[{
line: '--[===[ text ]===] x',
@ -66,11 +69,13 @@ testTokenization('lua', [
{ startIndex: 0, type: 'comment.lua' },
{ startIndex: 18, type: '' },
{ startIndex: 19, type: 'identifier.lua' }
]}],
]
}],
[{
line: '--[===[ text ]==] x',
tokens: [
{ startIndex: 0, type: 'comment.lua' }
]}]
]
}]
]);

View file

@ -13,7 +13,8 @@ testTokenization('msdax', [
line: '// a comment',
tokens: [
{ startIndex: 0, type: 'comment.msdax' }
]}],
]
}],
[{
line: '-almost a comment',
@ -24,7 +25,8 @@ testTokenization('msdax', [
{ startIndex: 8, type: 'identifier.msdax' },
{ startIndex: 9, type: 'white.msdax' },
{ startIndex: 10, type: 'identifier.msdax' }
]}],
]
}],
[{
line: '/* a full line comment */',
@ -32,7 +34,8 @@ testTokenization('msdax', [
{ startIndex: 0, type: 'comment.quote.msdax' },
{ startIndex: 2, type: 'comment.msdax' },
{ startIndex: 23, type: 'comment.quote.msdax' }
]}],
]
}],
[{
line: '/* /// *** /// */',
@ -40,7 +43,8 @@ testTokenization('msdax', [
{ startIndex: 0, type: 'comment.quote.msdax' },
{ startIndex: 2, type: 'comment.msdax' },
{ startIndex: 15, type: 'comment.quote.msdax' }
]}],
]
}],
[{
line: 'define measure x = /* a simple comment */ 1;',
@ -59,149 +63,173 @@ testTokenization('msdax', [
{ startIndex: 41, type: 'white.msdax' },
{ startIndex: 42, type: 'number.msdax' },
{ startIndex: 43, type: 'delimiter.msdax' }
]}],
]
}],
// Numbers
[{
line: '123',
tokens: [
{ startIndex: 0, type: 'number.msdax' }
]}],
]
}],
[{
line: '-123',
tokens: [
{ startIndex: 0, type: 'operator.msdax' },
{ startIndex: 1, type: 'number.msdax' }
]}],
]
}],
[{
line: '0xaBc123',
tokens: [
{ startIndex: 0, type: 'number.msdax' }
]}],
]
}],
[{
line: '0XaBc123',
tokens: [
{ startIndex: 0, type: 'number.msdax' }
]}],
]
}],
[{
line: '0x',
tokens: [
{ startIndex: 0, type: 'number.msdax' }
]}],
]
}],
[{
line: '0x0',
tokens: [
{ startIndex: 0, type: 'number.msdax' }
]}],
]
}],
[{
line: '0xAB_CD',
tokens: [
{ startIndex: 0, type: 'number.msdax' },
{ startIndex: 4, type: 'identifier.msdax' }
]}],
]
}],
[{
line: '.',
tokens: [
{ startIndex: 0, type: 'delimiter.msdax' }
]}],
]
}],
[{
line: '123',
tokens: [
{ startIndex: 0, type: 'number.msdax' }
]}],
]
}],
[{
line: '123.5678',
tokens: [
{ startIndex: 0, type: 'number.msdax' }
]}],
]
}],
[{
line: '0.99',
tokens: [
{ startIndex: 0, type: 'number.msdax' }
]}],
]
}],
[{
line: '.99',
tokens: [
{ startIndex: 0, type: 'number.msdax' }
]}],
]
}],
[{
line: '99.',
tokens: [
{ startIndex: 0, type: 'number.msdax' }
]}],
]
}],
[{
line: '0.',
tokens: [
{ startIndex: 0, type: 'number.msdax' }
]}],
]
}],
[{
line: '.0',
tokens: [
{ startIndex: 0, type: 'number.msdax' }
]}],
]
}],
[{
line: '1E-2',
tokens: [
{ startIndex: 0, type: 'number.msdax' }
]}],
]
}],
[{
line: '1E+2',
tokens: [
{ startIndex: 0, type: 'number.msdax' }
]}],
]
}],
[{
line: '1E2',
tokens: [
{ startIndex: 0, type: 'number.msdax' }
]}],
]
}],
[{
line: '0.1E2',
tokens: [
{ startIndex: 0, type: 'number.msdax' }
]}],
]
}],
[{
line: '1.E2',
tokens: [
{ startIndex: 0, type: 'number.msdax' }
]}],
]
}],
[{
line: '.1E2',
tokens: [
{ startIndex: 0, type: 'number.msdax' }
]}],
]
}],
// Identifiers
[{
line: '_abc01',
tokens: [
{ startIndex: 0, type: 'identifier.msdax' }
]}],
]
}],
[{
line: 'abc01',
tokens: [
{ startIndex: 0, type: 'identifier.msdax' }
]}],
]
}],
[{
line: 'evaluate filter',
@ -209,7 +237,8 @@ testTokenization('msdax', [
{ startIndex: 0, type: 'keyword.msdax' },
{ startIndex: 8, type: 'white.msdax' },
{ startIndex: 9, type: 'keyword.msdax' }
]}],
]
}],
[{
line: '[abc[[ 321 ]] xyz]',
@ -217,14 +246,16 @@ testTokenization('msdax', [
{ startIndex: 0, type: 'identifier.quote.msdax' },
{ startIndex: 1, type: 'identifier.msdax' },
{ startIndex: 17, type: 'identifier.quote.msdax' }
]}],
]
}],
[{
line: '[abc',
tokens: [
{ startIndex: 0, type: 'identifier.quote.msdax' },
{ startIndex: 1, type: 'identifier.msdax' }
]}],
]
}],
[{
line: 'define measure \'abc\'[def]',
@ -238,13 +269,15 @@ testTokenization('msdax', [
{ startIndex: 19, type: 'identifier.quote.msdax' },
{ startIndex: 21, type: 'identifier.msdax' },
{ startIndex: 24, type: 'identifier.quote.msdax' }
]}],
]
}],
[{
line: 'int',
tokens: [
{ startIndex: 0, type: 'keyword.msdax' }
]}],
]
}],
[{
line: '[int]',
@ -252,14 +285,16 @@ testTokenization('msdax', [
{ startIndex: 0, type: 'identifier.quote.msdax' },
{ startIndex: 1, type: 'identifier.msdax' },
{ startIndex: 4, type: 'identifier.quote.msdax' }
]}],
]
}],
// Strings
[{
line: '"abc"" 321 "" xyz"',
tokens: [
{ startIndex: 0, type: 'string.msdax' }
]}],
]
}],
[{
line: 'define var x=\"a string\"',
@ -271,31 +306,36 @@ testTokenization('msdax', [
{ startIndex: 11, type: 'identifier.msdax' },
{ startIndex: 12, type: 'operator.msdax' },
{ startIndex: 13, type: 'string.msdax' }
]}],
]
}],
[{
line: '"a "" string with quotes"',
tokens: [
{ startIndex: 0, type: 'string.msdax' },
]}],
]
}],
[{
line: '"a // string with comment"',
tokens: [
{ startIndex: 0, type: 'string.msdax' },
]}],
]
}],
[{
line: 'N"a unicode string"',
tokens: [
{ startIndex: 0, type: 'string.msdax' },
]}],
]
}],
[{
line: '"a endless string',
tokens: [
{ startIndex: 0, type: 'string.msdax' },
]}],
]
}],
// Operators
[{
@ -310,7 +350,8 @@ testTokenization('msdax', [
{ startIndex: 13, type: 'number.msdax' },
{ startIndex: 14, type: 'operator.msdax' },
{ startIndex: 15, type: 'number.msdax' }
]}],
]
}],
[{
line: 'define var x=1^+abc',
@ -324,7 +365,8 @@ testTokenization('msdax', [
{ startIndex: 13, type: 'number.msdax' },
{ startIndex: 14, type: 'operator.msdax' },
{ startIndex: 16, type: 'identifier.msdax' }
]}],
]
}],
// Realistic queries and expressions
[{
@ -345,7 +387,8 @@ testTokenization('msdax', [
{ startIndex: 40, type: 'identifier.quote.msdax' },
{ startIndex: 41, type: 'white.msdax' },
{ startIndex: 42, type: 'keyword.msdax' }
]}],
]
}],
[{
line: 'DATATABLE("Price", STRING, {{"Low"},{"Medium"}})',
@ -366,5 +409,6 @@ testTokenization('msdax', [
{ startIndex: 37, type: 'string.msdax' },
{ startIndex: 45, type: 'delimiter.brackets.msdax' },
{ startIndex: 47, type: 'delimiter.parenthesis.msdax' }
]}]
]
}]
]);

View file

@ -38,33 +38,38 @@ testTokenization('objective-c', [
{ startIndex: 86, type: 'delimiter.parenthesis.objective-c' },
{ startIndex: 87, type: 'white.objective-c' },
{ startIndex: 88, type: 'identifier.objective-c' }
]}],
]
}],
// Comments - single line
[{
line: '//',
tokens: [
{ startIndex: 0, type: 'comment.objective-c' }
]}],
]
}],
[{
line: ' // a comment',
tokens: [
{ startIndex: 0, type: 'white.objective-c' },
{ startIndex: 4, type: 'comment.objective-c' }
]}],
]
}],
[{
line: '// a comment',
tokens: [
{ startIndex: 0, type: 'comment.objective-c' }
]}],
]
}],
[{
line: '//sticky comment',
tokens: [
{ startIndex: 0, type: 'comment.objective-c' }
]}],
]
}],
[{
line: '/almost a comment',
@ -75,7 +80,8 @@ testTokenization('objective-c', [
{ startIndex: 8, type: 'identifier.objective-c' },
{ startIndex: 9, type: 'white.objective-c' },
{ startIndex: 10, type: 'identifier.objective-c' }
]}],
]
}],
[{
line: '1 / 2; /* comment',
@ -88,7 +94,8 @@ testTokenization('objective-c', [
{ startIndex: 5, type: 'delimiter.objective-c' },
{ startIndex: 6, type: 'white.objective-c' },
{ startIndex: 7, type: 'comment.objective-c' }
]}],
]
}],
[{
line: 'int x = 1; // my comment // is a nice one',
@ -103,14 +110,16 @@ testTokenization('objective-c', [
{ startIndex: 9, type: 'delimiter.objective-c' },
{ startIndex: 10, type: 'white.objective-c' },
{ startIndex: 11, type: 'comment.objective-c' }
]}],
]
}],
// Comments - range comment, single line
[{
line: '/* a simple comment */',
tokens: [
{ startIndex: 0, type: 'comment.objective-c' }
]}],
]
}],
[{
line: 'int x = /* embedded comment */ 1;',
@ -125,7 +134,8 @@ testTokenization('objective-c', [
{ startIndex: 30, type: 'white.objective-c' },
{ startIndex: 31, type: 'number.objective-c' },
{ startIndex: 32, type: 'delimiter.objective-c' }
]}],
]
}],
[{
line: 'int x = /* comment and syntax error*/ 1; */',
@ -142,7 +152,8 @@ testTokenization('objective-c', [
{ startIndex: 39, type: 'delimiter.objective-c' },
{ startIndex: 40, type: 'white.objective-c' },
{ startIndex: 41, type: 'operator.objective-c' }
]}],
]
}],
[{
line: 'x = /**/;',
@ -153,7 +164,8 @@ testTokenization('objective-c', [
{ startIndex: 3, type: 'white.objective-c' },
{ startIndex: 4, type: 'comment.objective-c' },
{ startIndex: 8, type: 'delimiter.objective-c' }
]}],
]
}],
[{
line: 'x = /*/;',
@ -163,7 +175,8 @@ testTokenization('objective-c', [
{ startIndex: 2, type: 'operator.objective-c' },
{ startIndex: 3, type: 'white.objective-c' },
{ startIndex: 4, type: 'comment.objective-c' }
]}],
]
}],
// Non-Alpha Keywords
[{
@ -176,7 +189,8 @@ testTokenization('objective-c', [
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'identifier.objective-c' },
{ startIndex: 15, type: 'delimiter.angle.objective-c' }
]}],
]
}],
// Numbers
[{
@ -184,84 +198,96 @@ testTokenization('objective-c', [
tokens: [
{ startIndex: 0, type: 'number.objective-c' },
{ startIndex: 1, type: 'white.objective-c' }
]}],
]
}],
[{
line: '0x ',
tokens: [
{ startIndex: 0, type: 'number.hex.objective-c' },
{ startIndex: 2, type: 'white.objective-c' }
]}],
]
}],
[{
line: '0x123 ',
tokens: [
{ startIndex: 0, type: 'number.hex.objective-c' },
{ startIndex: 5, type: 'white.objective-c' }
]}],
]
}],
[{
line: '23.5 ',
tokens: [
{ startIndex: 0, type: 'number.float.objective-c' },
{ startIndex: 4, type: 'white.objective-c' }
]}],
]
}],
[{
line: '23.5e3 ',
tokens: [
{ startIndex: 0, type: 'number.float.objective-c' },
{ startIndex: 6, type: 'white.objective-c' }
]}],
]
}],
[{
line: '23.5E3 ',
tokens: [
{ startIndex: 0, type: 'number.float.objective-c' },
{ startIndex: 6, type: 'white.objective-c' }
]}],
]
}],
[{
line: '23.5F ',
tokens: [
{ startIndex: 0, type: 'number.float.objective-c' },
{ startIndex: 5, type: 'white.objective-c' }
]}],
]
}],
[{
line: '23.5f ',
tokens: [
{ startIndex: 0, type: 'number.float.objective-c' },
{ startIndex: 5, type: 'white.objective-c' }
]}],
]
}],
[{
line: '1.72E3F ',
tokens: [
{ startIndex: 0, type: 'number.float.objective-c' },
{ startIndex: 7, type: 'white.objective-c' }
]}],
]
}],
[{
line: '1.72E3f ',
tokens: [
{ startIndex: 0, type: 'number.float.objective-c' },
{ startIndex: 7, type: 'white.objective-c' }
]}],
]
}],
[{
line: '1.72e3F ',
tokens: [
{ startIndex: 0, type: 'number.float.objective-c' },
{ startIndex: 7, type: 'white.objective-c' }
]}],
]
}],
[{
line: '1.72e3f ',
tokens: [
{ startIndex: 0, type: 'number.float.objective-c' },
{ startIndex: 7, type: 'white.objective-c' }
]}],
]
}],
[{
line: '0+0',
@ -269,7 +295,8 @@ testTokenization('objective-c', [
{ startIndex: 0, type: 'number.objective-c' },
{ startIndex: 1, type: 'operator.objective-c' },
{ startIndex: 2, type: 'number.objective-c' }
]}],
]
}],
[{
line: '100+10',
@ -277,7 +304,8 @@ testTokenization('objective-c', [
{ startIndex: 0, type: 'number.objective-c' },
{ startIndex: 3, type: 'operator.objective-c' },
{ startIndex: 4, type: 'number.objective-c' }
]}],
]
}],
[{
line: '0 + 0',
@ -287,5 +315,6 @@ testTokenization('objective-c', [
{ startIndex: 2, type: 'operator.objective-c' },
{ startIndex: 3, type: 'white.objective-c' },
{ startIndex: 4, type: 'number.objective-c' }
]}]
]
}]
]);

File diff suppressed because it is too large Load diff

View file

@ -23,33 +23,38 @@ testTokenization('postiats', [
{ startIndex: 25, type: 'delimiter.parenthesis.pats' },
{ startIndex: 26, type: '' },
{ startIndex: 27, type: 'keyword.pats' }
]}],
]
}],
// Comments - single line
[{
line: '//',
tokens: [
{ startIndex: 0, type: 'comment.pats' }
]}],
]
}],
[{
line: ' // a comment',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'comment.pats' }
]}],
]
}],
[{
line: '// a comment',
tokens: [
{ startIndex: 0, type: 'comment.pats' }
]}],
]
}],
[{
line: '//sticky comment',
tokens: [
{ startIndex: 0, type: 'comment.pats' }
]}],
]
}],
[{
line: '/almost a comment',
@ -60,7 +65,8 @@ testTokenization('postiats', [
{ startIndex: 8, type: 'identifier.pats' },
{ startIndex: 9, type: '' },
{ startIndex: 10, type: 'identifier.pats' }
]}],
]
}],
[{
line: '/* //*/ a',
@ -68,7 +74,8 @@ testTokenization('postiats', [
{ startIndex: 0, type: 'comment.pats' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'identifier.pats' }
]}],
]
}],
[{
line: '1 / 2; /* comment',
@ -81,7 +88,8 @@ testTokenization('postiats', [
{ startIndex: 5, type: 'delimiter.semicolon.pats' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'comment.pats' }
]}],
]
}],
[{
line: 'val x:int = 1; // my comment // is a nice one',
@ -98,14 +106,16 @@ testTokenization('postiats', [
{ startIndex: 13, type: 'delimiter.semicolon.pats' },
{ startIndex: 14, type: '' },
{ startIndex: 15, type: 'comment.pats' }
]}],
]
}],
// Comments - range comment, single line
[{
line: '/* a simple comment */',
tokens: [
{ startIndex: 0, type: 'comment.pats' }
]}],
]
}],
[{
line: 'var x : int = /* a simple comment */ 1;',
@ -124,7 +134,8 @@ testTokenization('postiats', [
{ startIndex: 36, type: '' },
{ startIndex: 37, type: 'number.decimal.pats' },
{ startIndex: 38, type: 'delimiter.semicolon.pats' }
]}],
]
}],
[{
line: 'val x = /* comment */ 1; */',
@ -141,7 +152,8 @@ testTokenization('postiats', [
{ startIndex: 23, type: 'delimiter.semicolon.pats' },
{ startIndex: 24, type: '' },
{ startIndex: 25, type: 'operator.pats' }
]}],
]
}],
[{
line: 'x = /**/;',
@ -152,7 +164,8 @@ testTokenization('postiats', [
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'comment.pats' },
{ startIndex: 8, type: 'delimiter.semicolon.pats' }
]}],
]
}],
[{
line: 'x = /*/;',
@ -162,26 +175,30 @@ testTokenization('postiats', [
{ startIndex: 2, type: 'keyword.pats' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'comment.pats' }
]}],
]
}],
// block comments, single line
[{
line: '(* a simple comment *)',
tokens: [
{ startIndex: 0, type: 'comment.pats' }
]}],
]
}],
[{
line: '(* a simple (* nested *) comment *)',
tokens: [
{ startIndex: 0, type: 'comment.pats' }
]}],
]
}],
[{
line: '(* ****** ****** *)',
tokens: [
{ startIndex: 0, type: 'comment.pats' }
]}],
]
}],
[{
line: 'var x : int = (* a simple comment *) 1;',
@ -200,7 +217,8 @@ testTokenization('postiats', [
{ startIndex: 36, type: '' },
{ startIndex: 37, type: 'number.decimal.pats' },
{ startIndex: 38, type: 'delimiter.semicolon.pats' }
]}],
]
}],
[{
line: 'val x = (* comment *) 1; *)',
@ -218,7 +236,8 @@ testTokenization('postiats', [
{ startIndex: 24, type: '' },
{ startIndex: 25, type: 'operator.pats' },
{ startIndex: 26, type: 'delimiter.parenthesis.pats' },
]}],
]
}],
[{
line: 'x = (**);',
@ -229,50 +248,58 @@ testTokenization('postiats', [
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'comment.pats' },
{ startIndex: 8, type: 'delimiter.semicolon.pats' }
]}],
]
}],
[{
line: '(*)',
tokens: [
{ startIndex: 0, type: 'invalid.pats' }, // not a comment!
]}],
]
}],
// Numbers
[{
line: '0',
tokens: [
{ startIndex: 0, type: 'number.decimal.pats' }
]}],
]
}],
[{
line: '12l',
tokens: [
{ startIndex: 0, type: 'number.decimal.pats' }
]}],
]
}],
[{
line: '34U',
tokens: [
{ startIndex: 0, type: 'number.decimal.pats' }
]}],
]
}],
[{
line: '55LL',
tokens: [
{ startIndex: 0, type: 'number.decimal.pats' }
]}],
]
}],
[{
line: '34ul',
tokens: [
{ startIndex: 0, type: 'number.decimal.pats' }
]}],
]
}],
[{
line: '55llU',
tokens: [
{ startIndex: 0, type: 'number.decimal.pats' }
]}],
]
}],
/*
[{
@ -291,109 +318,127 @@ testTokenization('postiats', [
line: '0x100aafllU',
tokens: [
{ startIndex: 0, type: 'number.hex.pats' }
]}],
]
}],
[{
line: '0342325',
tokens: [
{ startIndex: 0, type: 'number.octal.pats' }
]}],
]
}],
[{
line: '0x123',
tokens: [
{ startIndex: 0, type: 'number.hex.pats' }
]}],
]
}],
[{
line: '23.5',
tokens: [
{ startIndex: 0, type: 'number.float.pats' }
]}],
]
}],
[{
line: '23.5e3',
tokens: [
{ startIndex: 0, type: 'number.float.pats' }
]}],
]
}],
[{
line: '23.5E3',
tokens: [
{ startIndex: 0, type: 'number.float.pats' }
]}],
]
}],
[{
line: '23.5F',
tokens: [
{ startIndex: 0, type: 'number.float.pats' }
]}],
]
}],
[{
line: '23.5f',
tokens: [
{ startIndex: 0, type: 'number.float.pats' }
]}],
]
}],
[{
line: '1.72E3F',
tokens: [
{ startIndex: 0, type: 'number.float.pats' }
]}],
]
}],
[{
line: '1.72E3f',
tokens: [
{ startIndex: 0, type: 'number.float.pats' }
]}],
]
}],
[{
line: '1.72e3F',
tokens: [
{ startIndex: 0, type: 'number.float.pats' }
]}],
]
}],
[{
line: '1.72e3f',
tokens: [
{ startIndex: 0, type: 'number.float.pats' }
]}],
]
}],
[{
line: '23.5L',
tokens: [
{ startIndex: 0, type: 'number.float.pats' }
]}],
]
}],
[{
line: '23.5l',
tokens: [
{ startIndex: 0, type: 'number.float.pats' }
]}],
]
}],
[{
line: '1.72E3L',
tokens: [
{ startIndex: 0, type: 'number.float.pats' }
]}],
]
}],
[{
line: '1.72E3l',
tokens: [
{ startIndex: 0, type: 'number.float.pats' }
]}],
]
}],
[{
line: '1.72e3L',
tokens: [
{ startIndex: 0, type: 'number.float.pats' }
]}],
]
}],
[{
line: '1.72e3l',
tokens: [
{ startIndex: 0, type: 'number.float.pats' }
]}],
]
}],
[{
line: '0+0',
@ -401,7 +446,8 @@ testTokenization('postiats', [
{ startIndex: 0, type: 'number.decimal.pats' },
{ startIndex: 1, type: 'operator.pats' },
{ startIndex: 2, type: 'number.decimal.pats' }
]}],
]
}],
[{
line: '100+10',
@ -409,7 +455,8 @@ testTokenization('postiats', [
{ startIndex: 0, type: 'number.decimal.pats' },
{ startIndex: 3, type: 'operator.pats' },
{ startIndex: 4, type: 'number.decimal.pats' }
]}],
]
}],
[{
line: '0 + 0',
@ -419,7 +466,8 @@ testTokenization('postiats', [
{ startIndex: 2, type: 'operator.pats' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'number.decimal.pats' }
]}],
]
}],
// hi-lighting of variables in staload/dynload
[{
@ -431,7 +479,8 @@ testTokenization('postiats', [
{ startIndex: 14, type: 'string.escape.pats' },
{ startIndex: 15, type: 'string.pats' },
{ startIndex: 31, type: 'string.quote.pats' }
]}],
]
}],
// Monarch Generated
[{
@ -442,11 +491,13 @@ testTokenization('postiats', [
{ startIndex: 9, type: 'string.quote.pats' },
{ startIndex: 10, type: 'string.pats' },
{ startIndex: 28, type: 'string.quote.pats' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: '#ifdef VAR #then',
tokens: [
{ startIndex: 0, type: 'keyword.srp.pats' },
@ -454,7 +505,8 @@ testTokenization('postiats', [
{ startIndex: 7, type: 'identifier.pats' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'keyword.srp.pats' }
]}, {
]
}, {
line: '#define SUM(A,B) (A) + (B)',
tokens: [
{ startIndex: 0, type: 'keyword.srp.pats' },
@ -475,7 +527,8 @@ testTokenization('postiats', [
{ startIndex: 23, type: 'delimiter.parenthesis.pats' },
{ startIndex: 24, type: 'identifier.pats' },
{ startIndex: 25, type: 'delimiter.parenthesis.pats' }
]}, {
]
}, {
line: 'staload Asdf_CDE = "./myfile.sats"',
tokens: [
{ startIndex: 0, type: 'keyword.pats' },
@ -487,11 +540,13 @@ testTokenization('postiats', [
{ startIndex: 19, type: 'string.quote.pats' },
{ startIndex: 20, type: 'string.pats' },
{ startIndex: 33, type: 'string.quote.pats' },
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'implement main(argc, argv)',
tokens: [
{ startIndex: 0, type: 'keyword.pats' },
@ -503,30 +558,36 @@ testTokenization('postiats', [
{ startIndex: 20, type: '' },
{ startIndex: 21, type: 'identifier.pats' },
{ startIndex: 25, type: 'delimiter.parenthesis.pats' }
]}, {
]
}, {
line: ' = begin',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'keyword.pats' },
{ startIndex: 2, type: '' },
{ startIndex: 3, type: 'keyword.pats' }
]}, {
]
}, {
line: '0',
tokens: [
{ startIndex: 0, type: 'number.decimal.pats' },
]}, {
]
}, {
line: 'end',
tokens: [
{ startIndex: 0, type: 'keyword.pats' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'dataprop FACT (int, int) =',
tokens: [
{ startIndex: 0, type: 'keyword.pats' },
@ -541,7 +602,8 @@ testTokenization('postiats', [
{ startIndex: 23, type: 'delimiter.parenthesis.pats' },
{ startIndex: 24, type: '' },
{ startIndex: 25, type: 'keyword.pats' }
]}, {
]
}, {
line: ' | FACTbas (0, 1) of ()',
tokens: [
{ startIndex: 0, type: '' },
@ -559,7 +621,8 @@ testTokenization('postiats', [
{ startIndex: 18, type: 'keyword.pats' },
{ startIndex: 20, type: '' },
{ startIndex: 21, type: 'delimiter.parenthesis.pats' }
]}, {
]
}, {
line: ' | {n:pos}{r:int} FACTind (n, n*r) of FACT (n-1, r)',
tokens: [
{ startIndex: 0, type: '' },
@ -599,11 +662,13 @@ testTokenization('postiats', [
{ startIndex: 48, type: '' },
{ startIndex: 49, type: 'identifier.pats' },
{ startIndex: 50, type: 'delimiter.parenthesis.pats' },
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'fun fact {n:nat} .<n>. (x: int n) : [r:int] (FACT(n, r) | int(r)) = (',
tokens: [
{ startIndex: 0, type: 'keyword.pats' },
@ -656,7 +721,8 @@ testTokenization('postiats', [
{ startIndex: 66, type: 'keyword.pats' },
{ startIndex: 67, type: '' },
{ startIndex: 68, type: 'delimiter.parenthesis.pats' },
]}, {
]
}, {
line: 'if x > 0 then let',
tokens: [
{ startIndex: 0, type: 'keyword.pats' },
@ -670,7 +736,8 @@ testTokenization('postiats', [
{ startIndex: 9, type: 'keyword.pats' },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'keyword.pats' },
]}, {
]
}, {
line: ' val [r1:int] (pf1 | r1) = fact (x-1)',
tokens: [
{ startIndex: 0, type: '' },
@ -699,7 +766,8 @@ testTokenization('postiats', [
{ startIndex: 35, type: 'operator.pats' },
{ startIndex: 36, type: 'number.decimal.pats' },
{ startIndex: 37, type: 'delimiter.parenthesis.pats' },
]}, {
]
}, {
line: ' prval pf = FACTind {n}{r1} (pf1)',
tokens: [
{ startIndex: 0, type: '' },
@ -721,7 +789,8 @@ testTokenization('postiats', [
{ startIndex: 29, type: 'delimiter.parenthesis.pats' },
{ startIndex: 30, type: 'identifier.pats' },
{ startIndex: 33, type: 'delimiter.parenthesis.pats' }
]}, {
]
}, {
line: ' val r = x * r1',
tokens: [
{ startIndex: 0, type: '' },
@ -736,11 +805,13 @@ testTokenization('postiats', [
{ startIndex: 12, type: 'operator.pats' },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'identifier.pats' }
]}, {
]
}, {
line: 'in',
tokens: [
{ startIndex: 0, type: 'keyword.pats' }
]}, {
]
}, {
line: ' (pf | r)',
tokens: [
{ startIndex: 0, type: '' },
@ -751,13 +822,15 @@ testTokenization('postiats', [
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'identifier.pats' },
{ startIndex: 9, type: 'delimiter.parenthesis.pats' }
]}, {
]
}, {
line: 'end // end of [then]',
tokens: [
{ startIndex: 0, type: 'keyword.pats' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'comment.pats' }
]}, {
]
}, {
line: 'else (FACTbas () | 1)',
tokens: [
{ startIndex: 0, type: 'keyword.pats' },
@ -771,21 +844,25 @@ testTokenization('postiats', [
{ startIndex: 18, type: '' },
{ startIndex: 19, type: 'number.decimal.pats' },
{ startIndex: 20, type: 'delimiter.parenthesis.pats' }
]}, {
]
}, {
line: ') (* end of [fact] *)',
tokens: [
{ startIndex: 0, type: 'delimiter.parenthesis.pats' },
{ startIndex: 1, type: '' },
{ startIndex: 2, type: 'comment.pats' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'local',
tokens: [
{ startIndex: 0, type: 'keyword.pats' }
]}, {
]
}, {
line: 'var __count: int = 0 // it is statically allocated',
tokens: [
{ startIndex: 0, type: 'keyword.pats' },
@ -800,10 +877,12 @@ testTokenization('postiats', [
{ startIndex: 19, type: 'number.decimal.pats' },
{ startIndex: 20, type: '' },
{ startIndex: 21, type: 'comment.pats' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'val theCount =',
tokens: [
{ startIndex: 0, type: 'keyword.pats' },
@ -811,7 +890,8 @@ testTokenization('postiats', [
{ startIndex: 4, type: 'identifier.pats' },
{ startIndex: 12, type: '' },
{ startIndex: 13, type: 'keyword.pats' }
]}, {
]
}, {
line: ' ref_make_viewptr{int}(view@(__count) | addr@(__count))',
tokens: [
{ startIndex: 0, type: '' },
@ -830,25 +910,30 @@ testTokenization('postiats', [
{ startIndex: 46, type: 'delimiter.parenthesis.pats' },
{ startIndex: 47, type: 'identifier.pats' },
{ startIndex: 54, type: 'delimiter.parenthesis.pats' },
]}, {
]
}, {
line: '// end of [val]',
tokens: [
{ startIndex: 0, type: 'comment.pats' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'in (* in of [local] *)',
tokens: [
{ startIndex: 0, type: 'keyword.pats' },
{ startIndex: 2, type: '' },
{ startIndex: 3, type: 'comment.pats' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'fun theCount_get (): int = !theCount',
tokens: [
{ startIndex: 0, type: 'keyword.pats' },
@ -864,11 +949,13 @@ testTokenization('postiats', [
{ startIndex: 26, type: '' },
{ startIndex: 27, type: 'keyword.pats' },
{ startIndex: 28, type: 'identifier.pats' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'fun theCount_inc (): void = !theCount := !theCount + 1',
tokens: [
{ startIndex: 0, type: 'keyword.pats' },
@ -893,23 +980,28 @@ testTokenization('postiats', [
{ startIndex: 51, type: 'operator.pats' },
{ startIndex: 52, type: '' },
{ startIndex: 53, type: 'number.decimal.pats' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: 'end // end of [local]',
tokens: [
{ startIndex: 0, type: 'keyword.pats' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'comment.pats' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: '#endif',
tokens: [
{ startIndex: 0, type: 'keyword.srp.pats' }
]}]
]
}]
]);

View file

@ -13,32 +13,37 @@ testTokenization('powershell', [
line: '#',
tokens: [
{ startIndex: 0, type: 'comment.ps1' }
]}],
]
}],
[{
line: ' # a comment',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'comment.ps1' }
]}],
]
}],
[{
line: '# a comment',
tokens: [
{ startIndex: 0, type: 'comment.ps1' }
]}],
]
}],
[{
line: '#sticky comment',
tokens: [
{ startIndex: 0, type: 'comment.ps1' }
]}],
]
}],
[{
line: '##still a comment',
tokens: [
{ startIndex: 0, type: 'comment.ps1' }
]}],
]
}],
[{
line: '1 / 2 /# comment',
@ -51,7 +56,8 @@ testTokenization('powershell', [
{ startIndex: 5, type: '' },
{ startIndex: 6, type: 'delimiter.ps1' },
{ startIndex: 7, type: 'comment.ps1' }
]}],
]
}],
[{
line: '$x = 1 # my comment # is a nice one',
@ -63,14 +69,16 @@ testTokenization('powershell', [
{ startIndex: 5, type: 'number.ps1' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'comment.ps1' }
]}],
]
}],
// Comments - range comment, single line
[{
line: '<# a simple comment #>',
tokens: [
{ startIndex: 0, type: 'comment.ps1' }
]}],
]
}],
[{
line: '$x = <# a simple comment #> 1',
@ -82,7 +90,8 @@ testTokenization('powershell', [
{ startIndex: 5, type: 'comment.ps1' },
{ startIndex: 27, type: '' },
{ startIndex: 28, type: 'number.ps1' }
]}],
]
}],
[{
line: '$yy = <# comment #> 14',
@ -94,7 +103,8 @@ testTokenization('powershell', [
{ startIndex: 6, type: 'comment.ps1' },
{ startIndex: 19, type: '' },
{ startIndex: 20, type: 'number.ps1' }
]}],
]
}],
[{
line: '$x = <##>7',
@ -105,7 +115,8 @@ testTokenization('powershell', [
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'comment.ps1' },
{ startIndex: 9, type: 'number.ps1' }
]}],
]
}],
[{
line: '$x = <#<85',
@ -115,22 +126,26 @@ testTokenization('powershell', [
{ startIndex: 3, type: 'delimiter.ps1' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'comment.ps1' }
]}],
]
}],
// Comments - range comment, multiple lines
[{
line: '<# start of multiline comment',
tokens: [
{ startIndex: 0, type: 'comment.ps1' }
]}, {
]
}, {
line: 'a comment between',
tokens: [
{ startIndex: 0, type: 'comment.ps1' }
]}, {
]
}, {
line: 'end of multiline comment#>',
tokens: [
{ startIndex: 0, type: 'comment.ps1' }
]}],
]
}],
[{
line: '$x = <# start a comment',
@ -140,17 +155,20 @@ testTokenization('powershell', [
{ startIndex: 3, type: 'delimiter.ps1' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'comment.ps1' }
]}, {
]
}, {
line: ' a ',
tokens: [
{ startIndex: 0, type: 'comment.ps1' }
]}, {
]
}, {
line: 'and end it #> 2',
tokens: [
{ startIndex: 0, type: 'comment.ps1' },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'number.ps1' }
]}],
]
}],
// Keywords
[{
@ -174,7 +192,8 @@ testTokenization('powershell', [
{ startIndex: 25, type: '' },
{ startIndex: 26, type: 'keyword.continue.ps1' },
{ startIndex: 34, type: 'delimiter.curly.ps1' }
]}],
]
}],
// Redirect operand
[{
@ -186,62 +205,72 @@ testTokenization('powershell', [
{ startIndex: 4, type: '' },
{ startIndex: 12, type: 'delimiter.ps1' },
{ startIndex: 13, type: '' }
]}],
]
}],
// Numbers
[{
line: '0',
tokens: [
{ startIndex: 0, type: 'number.ps1' }
]}],
]
}],
[{
line: '0.10',
tokens: [
{ startIndex: 0, type: 'number.float.ps1' }
]}],
]
}],
[{
line: '0X123',
tokens: [
{ startIndex: 0, type: 'number.hex.ps1' }
]}],
]
}],
[{
line: '0x123',
tokens: [
{ startIndex: 0, type: 'number.hex.ps1' }
]}],
]
}],
[{
line: '23.5e3',
tokens: [
{ startIndex: 0, type: 'number.float.ps1' }
]}],
]
}],
[{
line: '23.5e-3',
tokens: [
{ startIndex: 0, type: 'number.float.ps1' }
]}],
]
}],
[{
line: '23.5E3',
tokens: [
{ startIndex: 0, type: 'number.float.ps1' }
]}],
]
}],
[{
line: '23.5E-3',
tokens: [
{ startIndex: 0, type: 'number.float.ps1' }
]}],
]
}],
[{
line: '23.5',
tokens: [
{ startIndex: 0, type: 'number.float.ps1' }
]}],
]
}],
[{
line: '0+0',
@ -249,7 +278,8 @@ testTokenization('powershell', [
{ startIndex: 0, type: 'number.ps1' },
{ startIndex: 1, type: 'delimiter.ps1' },
{ startIndex: 2, type: 'number.ps1' }
]}],
]
}],
[{
line: '100+10',
@ -257,7 +287,8 @@ testTokenization('powershell', [
{ startIndex: 0, type: 'number.ps1' },
{ startIndex: 3, type: 'delimiter.ps1' },
{ startIndex: 4, type: 'number.ps1' }
]}],
]
}],
[{
line: '10 + 0',
@ -267,7 +298,8 @@ testTokenization('powershell', [
{ startIndex: 3, type: 'delimiter.ps1' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'number.ps1' }
]}],
]
}],
// Strings
[{
@ -278,13 +310,15 @@ testTokenization('powershell', [
{ startIndex: 3, type: 'delimiter.ps1' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'string.ps1' }
]}],
]
}],
[{
line: '\'I am also a ( String\'',
tokens: [
{ startIndex: 0, type: 'string.ps1' }
]}],
]
}],
[{
line: '$s = "concatenated" + " String"',
@ -298,7 +332,8 @@ testTokenization('powershell', [
{ startIndex: 20, type: 'delimiter.ps1' },
{ startIndex: 21, type: '' },
{ startIndex: 22, type: 'string.ps1' }
]}],
]
}],
[{
line: '"escaping `"quotes`" is cool"',
@ -308,7 +343,8 @@ testTokenization('powershell', [
{ startIndex: 12, type: 'string.ps1' },
{ startIndex: 18, type: 'string.escape.ps1' },
{ startIndex: 20, type: 'string.ps1' }
]}],
]
}],
[{
line: '\'`\'end of the string',
@ -316,19 +352,22 @@ testTokenization('powershell', [
{ startIndex: 0, type: 'string.ps1' },
{ startIndex: 1, type: 'string.escape.ps1' },
{ startIndex: 3, type: 'string.ps1' }
]}],
]
}],
[{
line: '@"I am an expandable String"@',
tokens: [
{ startIndex: 0, type: 'string.ps1' }
]}],
]
}],
[{
line: '@\'I am also an expandable String\'@',
tokens: [
{ startIndex: 0, type: 'string.ps1' }
]}],
]
}],
[{
line: '$s = @\'I am also an expandable String\'@',
@ -338,7 +377,8 @@ testTokenization('powershell', [
{ startIndex: 3, type: 'delimiter.ps1' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'string.ps1' }
]}],
]
}],
[{
line: '$s = @\'I am also an expandable String\'@+7',
@ -348,35 +388,42 @@ testTokenization('powershell', [
{ startIndex: 3, type: 'delimiter.ps1' },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'string.ps1' }
]}],
]
}],
[{
line: '@\'I am a multiline string,',
tokens: [
{ startIndex: 0, type: 'string.ps1' }
]}, {
]
}, {
line: 'and this is the middle line,',
tokens: [
{ startIndex: 0, type: 'string.ps1' }
]}, {
]
}, {
line: 'and this is NOT the end of the string\'@foreach $i',
tokens: [
{ startIndex: 0, type: 'string.ps1' }
]}, {
]
}, {
line: '\'@',
tokens: [
{ startIndex: 0, type: 'string.ps1' }
]}, {
]
}, {
line: '${script:foo}',
tokens: [
{ startIndex: 0, type: 'variable.ps1' }
]}, {
]
}, {
line: 'foreach $i',
tokens: [
{ startIndex: 0, type: 'keyword.foreach.ps1' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'variable.ps1' }
]}],
]
}],
// Generated from sample
[{
@ -387,7 +434,8 @@ testTokenization('powershell', [
{ startIndex: 21, type: '' },
{ startIndex: 22, type: 'delimiter.parenthesis.ps1' },
{ startIndex: 24, type: 'delimiter.ps1' }
]}, {
]
}, {
line: '$XenCenterNodeSelected = 0;',
tokens: [
{ startIndex: 0, type: 'variable.ps1' },
@ -396,11 +444,13 @@ testTokenization('powershell', [
{ startIndex: 24, type: '' },
{ startIndex: 25, type: 'number.ps1' },
{ startIndex: 26, type: 'delimiter.ps1' }
]}, {
]
}, {
line: '#the object info array contains hashmaps, each of which represent a parameter set and describe a target in the XenCenter resource list',
tokens: [
{ startIndex: 0, type: 'comment.ps1' }
]}, {
]
}, {
line: 'foreach($parameterSet in $ObjInfoArray)',
tokens: [
{ startIndex: 0, type: 'keyword.foreach.ps1' },
@ -411,11 +461,13 @@ testTokenization('powershell', [
{ startIndex: 24, type: '' },
{ startIndex: 25, type: 'variable.ps1' },
{ startIndex: 38, type: 'delimiter.parenthesis.ps1' }
]}, {
]
}, {
line: '{',
tokens: [
{ startIndex: 0, type: 'delimiter.curly.ps1' }
]}, {
]
}, {
line: ' if ($parameterSet["class"] -eq "blank")',
tokens: [
{ startIndex: 0, type: '' },
@ -431,17 +483,20 @@ testTokenization('powershell', [
{ startIndex: 29, type: '' },
{ startIndex: 32, type: 'string.ps1' },
{ startIndex: 39, type: 'delimiter.parenthesis.ps1' }
]}, {
]
}, {
line: ' {',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'delimiter.curly.ps1' }
]}, {
]
}, {
line: ' #When the XenCenter node is selected a parameter set is created for each of your connected servers with the class and objUuid keys marked as blank',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'comment.ps1' }
]}, {
]
}, {
line: ' if ($XenCenterNodeSelected)',
tokens: [
{ startIndex: 0, type: '' },
@ -450,22 +505,26 @@ testTokenization('powershell', [
{ startIndex: 5, type: 'delimiter.parenthesis.ps1' },
{ startIndex: 6, type: 'variable.ps1' },
{ startIndex: 28, type: 'delimiter.parenthesis.ps1' }
]}, {
]
}, {
line: ' {',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'delimiter.curly.ps1' }
]}, {
]
}, {
line: ' continue',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 3, type: 'keyword.continue.ps1' }
]}, {
]
}, {
line: ' }',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'delimiter.curly.ps1' }
]}, {
]
}, {
line: ' $XenCenterNodeSelected = 1;',
tokens: [
{ startIndex: 0, type: '' },
@ -475,7 +534,8 @@ testTokenization('powershell', [
{ startIndex: 26, type: '' },
{ startIndex: 27, type: 'number.ps1' },
{ startIndex: 28, type: 'delimiter.ps1' }
]}, {
]
}, {
line: ' $SelectedObjectNames += "XenCenter"',
tokens: [
{ startIndex: 0, type: '' },
@ -484,12 +544,14 @@ testTokenization('powershell', [
{ startIndex: 23, type: 'delimiter.ps1' },
{ startIndex: 25, type: '' },
{ startIndex: 26, type: 'string.ps1' }
]}, {
]
}, {
line: ' }',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'delimiter.curly.ps1' }
]}, {
]
}, {
line: ' elseif ($parameterSet["sessionRef"] -eq "null")',
tokens: [
{ startIndex: 0, type: '' },
@ -505,22 +567,26 @@ testTokenization('powershell', [
{ startIndex: 38, type: '' },
{ startIndex: 41, type: 'string.ps1' },
{ startIndex: 47, type: 'delimiter.parenthesis.ps1' }
]}, {
]
}, {
line: ' {',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'delimiter.curly.ps1' }
]}, {
]
}, {
line: ' #When a disconnected server is selected there is no session information, we get null for everything except class',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'comment.ps1' }
]}, {
]
}, {
line: ' }',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'delimiter.curly.ps1' }
]}, {
]
}, {
line: ' $SelectedObjectNames += "a disconnected server"',
tokens: [
{ startIndex: 0, type: '' },
@ -529,17 +595,20 @@ testTokenization('powershell', [
{ startIndex: 23, type: 'delimiter.ps1' },
{ startIndex: 25, type: '' },
{ startIndex: 26, type: 'string.ps1' }
]}, {
]
}, {
line: ' else',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'keyword.else.ps1' }
]}, {
]
}, {
line: ' {',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'delimiter.curly.ps1' }
]}, {
]
}, {
line: ' Connect-XenServer -url $parameterSet["url"] -opaqueref $parameterSet["sessionRef"]',
tokens: [
{ startIndex: 0, type: '' },
@ -556,17 +625,20 @@ testTokenization('powershell', [
{ startIndex: 70, type: 'delimiter.square.ps1' },
{ startIndex: 71, type: 'string.ps1' },
{ startIndex: 83, type: 'delimiter.square.ps1' }
]}, {
]
}, {
line: ' #Use $class to determine which server objects to get',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'comment.ps1' }
]}, {
]
}, {
line: ' #-properties allows us to filter the results to just include the selected object',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'comment.ps1' }
]}, {
]
}, {
line: ' $exp = "Get-XenServer:{0} -properties @{{uuid=\'{1}\'}}" -f $parameterSet["class"], $parameterSet["objUuid"]',
tokens: [
{ startIndex: 0, type: '' },
@ -588,7 +660,8 @@ testTokenization('powershell', [
{ startIndex: 97, type: 'delimiter.square.ps1' },
{ startIndex: 98, type: 'string.ps1' },
{ startIndex: 107, type: 'delimiter.square.ps1' }
]}, {
]
}, {
line: ' $obj = Invoke-Expression $exp',
tokens: [
{ startIndex: 0, type: '' },
@ -597,7 +670,8 @@ testTokenization('powershell', [
{ startIndex: 7, type: 'delimiter.ps1' },
{ startIndex: 8, type: '' },
{ startIndex: 27, type: 'variable.ps1' }
]}, {
]
}, {
line: ' $SelectedObjectNames += $obj.name_label;',
tokens: [
{ startIndex: 0, type: '' },
@ -609,21 +683,25 @@ testTokenization('powershell', [
{ startIndex: 30, type: 'delimiter.ps1' },
{ startIndex: 31, type: '' },
{ startIndex: 41, type: 'delimiter.ps1' }
]}, {
]
}, {
line: ' } ',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'delimiter.curly.ps1' },
{ startIndex: 2, type: '' }
]}, {
]
}, {
line: '}',
tokens: [
{ startIndex: 0, type: 'delimiter.curly.ps1' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: '$test = "in string var$test"',
tokens: [
{ startIndex: 0, type: 'variable.ps1' },
@ -633,7 +711,8 @@ testTokenization('powershell', [
{ startIndex: 8, type: 'string.ps1' },
{ startIndex: 22, type: 'variable.ps1' },
{ startIndex: 27, type: 'string.ps1' }
]}, {
]
}, {
line: '$another = \'not a $var\'',
tokens: [
{ startIndex: 0, type: 'variable.ps1' },
@ -641,7 +720,8 @@ testTokenization('powershell', [
{ startIndex: 9, type: 'delimiter.ps1' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'string.ps1' }
]}, {
]
}, {
line: '$third = "a $var and not `$var string"',
tokens: [
{ startIndex: 0, type: 'variable.ps1' },
@ -653,55 +733,68 @@ testTokenization('powershell', [
{ startIndex: 16, type: 'string.ps1' },
{ startIndex: 25, type: 'string.escape.ps1' },
{ startIndex: 27, type: 'string.ps1' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: ':aLabel',
tokens: [
{ startIndex: 0, type: 'metatag.ps1' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: '<#',
tokens: [
{ startIndex: 0, type: 'comment.ps1' }
]}, {
]
}, {
line: '.SYNOPSIS',
tokens: [
{ startIndex: 0, type: 'comment.keyword.synopsis.ps1' }
]}, {
]
}, {
line: ' some text',
tokens: [
{ startIndex: 0, type: 'comment.ps1' }
]}, {
]
}, {
line: ' ',
tokens: [
{ startIndex: 0, type: 'comment.ps1' }
]}, {
]
}, {
line: '.LINK',
tokens: [
{ startIndex: 0, type: 'comment.keyword.link.ps1' }
]}, {
]
}, {
line: ' some more text',
tokens: [
{ startIndex: 0, type: 'comment.ps1' }
]}, {
]
}, {
line: '#>',
tokens: [
{ startIndex: 0, type: 'comment.ps1' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: '$hereString = @"',
tokens: [
{ startIndex: 0, type: 'variable.ps1' },
@ -709,29 +802,35 @@ testTokenization('powershell', [
{ startIndex: 12, type: 'delimiter.ps1' },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'string.ps1' }
]}, {
]
}, {
line: ' a string',
tokens: [
{ startIndex: 0, type: 'string.ps1' }
]}, {
]
}, {
line: ' still "@ a string $withVar',
tokens: [
{ startIndex: 0, type: 'string.ps1' },
{ startIndex: 20, type: 'variable.ps1' }
]}, {
]
}, {
line: ' still a string `$noVar',
tokens: [
{ startIndex: 0, type: 'string.ps1' },
{ startIndex: 17, type: 'string.escape.ps1' },
{ startIndex: 19, type: 'string.ps1' }
]}, {
]
}, {
line: '',
tokens: [
]}, {
]
}, {
line: '"@ still a string',
tokens: [
{ startIndex: 0, type: 'string.ps1' },
{ startIndex: 2, type: '' }
]}]
]
}]
]);

View file

@ -17,7 +17,8 @@ testTokenization('python', [
{ startIndex: 4, type: 'identifier.python' },
{ startIndex: 8, type: 'delimiter.parenthesis.python' },
{ startIndex: 10, type: 'delimiter.python' }
]}],
]
}],
[{
line: 'func(str Y3)',
@ -28,14 +29,16 @@ testTokenization('python', [
{ startIndex: 8, type: 'white.python' },
{ startIndex: 9, type: 'identifier.python' },
{ startIndex: 11, type: 'delimiter.parenthesis.python' }
]}],
]
}],
[{
line: '@Dec0_rator:',
tokens: [
{ startIndex: 0, type: 'tag.python' },
{ startIndex: 11, type: 'delimiter.python' }
]}],
]
}],
// Comments
[{
@ -43,7 +46,8 @@ testTokenization('python', [
tokens: [
{ startIndex: 0, type: 'white.python' },
{ startIndex: 1, type: 'comment.python' }
]}],
]
}],
// Strings
[{
@ -52,7 +56,8 @@ testTokenization('python', [
{ startIndex: 0, type: 'string.escape.python' },
{ startIndex: 1, type: 'string.python' },
{ startIndex: 3, type: 'string.escape.python' }
]}],
]
}],
[{
line: '"\' " "',
@ -62,44 +67,51 @@ testTokenization('python', [
{ startIndex: 3, type: 'string.escape.python' },
{ startIndex: 4, type: 'white.python' },
{ startIndex: 5, type: 'string.escape.python' }
]}],
]
}],
[{
line: '\'\'\'Lots of string\'\'\'',
tokens: [
{ startIndex: 0, type: 'string.python' }
]}],
]
}],
[{
line: '"""Lots \'\'\' \'\'\'"""',
tokens: [
{ startIndex: 0, type: 'string.python' }
]}],
]
}],
[{
line: '\'\'\'Lots \'\'\'0.3e-5',
tokens: [
{ startIndex: 0, type: 'string.python' },
{ startIndex: 11, type: 'number.python' }
]}],
]
}],
// Numbers
[{
line: '0xAcBFd',
tokens: [
{ startIndex: 0, type: 'number.hex.python' }
]}],
]
}],
[{
line: '0x0cH',
tokens: [
{ startIndex: 0, type: 'number.hex.python' },
{ startIndex: 4, type: 'identifier.python' }
]}],
]
}],
[{
line: '456.7e-7j',
tokens: [
{ startIndex: 0, type: 'number.python' }
]}]
]
}]
]);

View file

@ -22,7 +22,8 @@ testTokenization('r', [
{ startIndex: 14, type: 'identifier.r' },
{ startIndex: 15, type: 'white.r' },
{ startIndex: 16, type: 'delimiter.curly.r' }
]}],
]
}],
[{
line: 'while(FALSE) { break }',
@ -37,7 +38,8 @@ testTokenization('r', [
{ startIndex: 15, type: 'keyword.r' },
{ startIndex: 20, type: 'white.r' },
{ startIndex: 21, type: 'delimiter.curly.r' }
]}],
]
}],
[{
line: 'if (a) { b } else { d }',
@ -61,14 +63,16 @@ testTokenization('r', [
{ startIndex: 20, type: 'identifier.r' },
{ startIndex: 21, type: 'white.r' },
{ startIndex: 22, type: 'delimiter.curly.r' }
]}],
]
}],
// Identifiers
[{
line: 'a',
tokens: [
{ startIndex: 0, type: 'identifier.r' }
]}],
]
}],
// Comments
[{
@ -76,7 +80,8 @@ testTokenization('r', [
tokens: [
{ startIndex: 0, type: 'white.r' },
{ startIndex: 1, type: 'comment.r' }
]}],
]
}],
// Roxygen comments
[{
@ -86,7 +91,8 @@ testTokenization('r', [
{ startIndex: 1, type: 'comment.doc.r' },
{ startIndex: 4, type: 'tag.r' },
{ startIndex: 11, type: 'comment.doc.r' }
]}],
]
}],
// Strings
[{
@ -95,7 +101,8 @@ testTokenization('r', [
{ startIndex: 0, type: 'string.escape.r' },
{ startIndex: 1, type: 'string.r' },
{ startIndex: 4, type: 'string.escape.r' }
]}],
]
}],
// '\\s' is not a special character
[{
@ -105,98 +112,114 @@ testTokenization('r', [
{ startIndex: 1, type: 'string.r' },
{ startIndex: 2, type: 'error-token.r' },
{ startIndex: 4, type: 'string.escape.r' }
]}],
]
}],
// Numbers
[{
line: '0',
tokens: [
{ startIndex: 0, type: 'number.r' }
]}],
]
}],
[{
line: '1',
tokens: [
{ startIndex: 0, type: 'number.r' }
]}],
]
}],
[{
line: '-1',
tokens: [
{ startIndex: 0, type: 'number.r' }
]}],
]
}],
[{
line: '1.1',
tokens: [
{ startIndex: 0, type: 'number.r' }
]}],
]
}],
[{
line: '-1.1',
tokens: [
{ startIndex: 0, type: 'number.r' }
]}],
]
}],
[{
line: '.1',
tokens: [
{ startIndex: 0, type: 'number.r' }
]}],
]
}],
[{
line: '-.1',
tokens: [
{ startIndex: 0, type: 'number.r' }
]}],
]
}],
[{
line: '1e10',
tokens: [
{ startIndex: 0, type: 'number.r' }
]}],
]
}],
[{
line: '1e-10',
tokens: [
{ startIndex: 0, type: 'number.r' }
]}],
]
}],
[{
line: '-1e10',
tokens: [
{ startIndex: 0, type: 'number.r' }
]}],
]
}],
[{
line: '-1e-10',
tokens: [
{ startIndex: 0, type: 'number.r' }
]}],
]
}],
[{
line: '1E10',
tokens: [
{ startIndex: 0, type: 'number.r' }
]}],
]
}],
[{
line: '1E-10',
tokens: [
{ startIndex: 0, type: 'number.r' }
]}],
]
}],
[{
line: '-1E10',
tokens: [
{ startIndex: 0, type: 'number.r' }
]}],
]
}],
[{
line: '-1E-10',
tokens: [
{ startIndex: 0, type: 'number.r' }
]}],
]
}],
// Operators
[{
@ -207,7 +230,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 3, type: 'white.r' },
{ startIndex: 4, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a - b',
@ -217,7 +241,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 3, type: 'white.r' },
{ startIndex: 4, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a * b',
@ -227,7 +252,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 3, type: 'white.r' },
{ startIndex: 4, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a + b',
@ -237,7 +263,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 3, type: 'white.r' },
{ startIndex: 4, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a = b',
@ -247,7 +274,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 3, type: 'white.r' },
{ startIndex: 4, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a | b',
@ -257,7 +285,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 3, type: 'white.r' },
{ startIndex: 4, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a ! b',
@ -267,7 +296,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 3, type: 'white.r' },
{ startIndex: 4, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a < b',
@ -277,7 +307,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 3, type: 'white.r' },
{ startIndex: 4, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a > b',
@ -287,7 +318,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 3, type: 'white.r' },
{ startIndex: 4, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a ^ b',
@ -297,7 +329,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 3, type: 'white.r' },
{ startIndex: 4, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a ~ b',
@ -307,7 +340,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 3, type: 'white.r' },
{ startIndex: 4, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a / b',
@ -317,7 +351,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 3, type: 'white.r' },
{ startIndex: 4, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a : b',
@ -327,7 +362,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 3, type: 'white.r' },
{ startIndex: 4, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a %in% b',
@ -337,7 +373,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 6, type: 'white.r' },
{ startIndex: 7, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a %->% b',
@ -347,7 +384,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 6, type: 'white.r' },
{ startIndex: 7, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a == b',
@ -357,7 +395,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 4, type: 'white.r' },
{ startIndex: 5, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a != b',
@ -367,7 +406,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 4, type: 'white.r' },
{ startIndex: 5, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a %% b',
@ -377,7 +417,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 4, type: 'white.r' },
{ startIndex: 5, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a && b',
@ -387,7 +428,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 4, type: 'white.r' },
{ startIndex: 5, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a || b',
@ -397,7 +439,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 4, type: 'white.r' },
{ startIndex: 5, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a <- b',
@ -407,7 +450,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 4, type: 'white.r' },
{ startIndex: 5, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a <<- b',
@ -417,7 +461,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 5, type: 'white.r' },
{ startIndex: 6, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a -> b',
@ -427,7 +472,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 4, type: 'white.r' },
{ startIndex: 5, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a ->> b',
@ -437,7 +483,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 5, type: 'white.r' },
{ startIndex: 6, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a $ b',
@ -447,7 +494,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 3, type: 'white.r' },
{ startIndex: 4, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a << b',
@ -457,7 +505,8 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 4, type: 'white.r' },
{ startIndex: 5, type: 'identifier.r' }
]}],
]
}],
[{
line: 'a >> b',
@ -467,5 +516,6 @@ testTokenization('r', [
{ startIndex: 2, type: 'operator.r' },
{ startIndex: 4, type: 'white.r' },
{ startIndex: 5, type: 'identifier.r' }
]}]
]
}]
]);

View file

@ -32,7 +32,8 @@ testTokenization('razor', [
{ startIndex: 17, type: htmlTokenTypes.DELIM_END },
{ startIndex: 18, type: '' },
{ startIndex: 19, type: EMBED_CS }
]}],
]
}],
// Comments - razor comment inside csharp
[{
@ -54,7 +55,8 @@ testTokenization('razor', [
{ startIndex: 28, type: 'delimiter.cs' },
{ startIndex: 29, type: '' },
{ startIndex: 30, type: EMBED_CS }
]}],
]
}],
// Blocks - simple
[{
@ -72,7 +74,8 @@ testTokenization('razor', [
{ startIndex: 16, type: 'delimiter.cs' },
{ startIndex: 17, type: '' },
{ startIndex: 18, type: EMBED_CS }
]}],
]
}],
// [{
// line: '@if(true){ var total = 0; }',
@ -106,7 +109,8 @@ testTokenization('razor', [
{ startIndex: 8, type: htmlTokenTypes.DELIM_START },
{ startIndex: 9, type: htmlTokenTypes.getTag('br') },
{ startIndex: 11, type: htmlTokenTypes.DELIM_END }
]}],
]
}],
[{
line: 'test@xyz',
@ -114,7 +118,8 @@ testTokenization('razor', [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: EMBED_CS },
{ startIndex: 5, type: 'identifier.cs' }
]}],
]
}],
[{
line: 'test @ xyz',
@ -122,7 +127,8 @@ testTokenization('razor', [
{ startIndex: 0, type: '' },
{ startIndex: 5, type: EMBED_CS },
{ startIndex: 6, type: 'identifier.cs' }
]}],
]
}],
[{
line: 'test @(foo) xyz',
@ -132,7 +138,8 @@ testTokenization('razor', [
{ startIndex: 7, type: 'identifier.cs' },
{ startIndex: 10, type: EMBED_CS },
{ startIndex: 11, type: '' }
]}],
]
}],
[{
line: 'test @(foo(\")\")) xyz',
@ -145,12 +152,14 @@ testTokenization('razor', [
{ startIndex: 14, type: 'delimiter.parenthesis.cs' },
{ startIndex: 15, type: EMBED_CS },
{ startIndex: 16, type: '' }
]}],
]
}],
// Escaping - escaped at character
[{
line: 'test@@xyz',
tokens: [
{ startIndex: 0, type: '' }
]}]
]
}]
]);

View file

@ -22,7 +22,8 @@ testTokenization('ruby', [
{ startIndex: 20, type: 'delimiter.parenthesis.ruby' },
{ startIndex: 22, type: '' },
{ startIndex: 23, type: 'keyword.def.ruby' }
]}],
]
}],
// Single digit
[{
@ -34,7 +35,8 @@ testTokenization('ruby', [
{ startIndex: 4, type: '' },
{ startIndex: 5, type: 'number.ruby' },
{ startIndex: 6, type: '' }
]}],
]
}],
// Regex
[{
@ -47,7 +49,8 @@ testTokenization('ruby', [
{ startIndex: 8, type: 'regexp.delim.ruby' },
{ startIndex: 9, type: 'regexp.ruby' },
{ startIndex: 13, type: 'regexp.delim.ruby' }
]}],
]
}],
[{
line: 'text.sub!(/Rbuy/, "Ruby")',
@ -65,7 +68,8 @@ testTokenization('ruby', [
{ startIndex: 19, type: 'string.$S2.ruby' },
{ startIndex: 23, type: 'string.d.delim.ruby' },
{ startIndex: 24, type: 'delimiter.parenthesis.ruby' }
]}],
]
}],
// make sure that division does not match regex
[{
@ -76,37 +80,44 @@ testTokenization('ruby', [
{ startIndex: 2, type: 'operator.ruby' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'identifier.ruby' }
]}],
]
}],
// Heredoc
[{
line: '<<HERE',
tokens: [
{ startIndex: 0, type: 'string.heredoc.delimiter.ruby' }
]}, {
]
}, {
line: 'do some string',
tokens: [
{ startIndex: 0, type: 'string.heredoc.ruby' }
]}, {
]
}, {
line: 'HERE',
tokens: [
{ startIndex: 0, type: 'string.heredoc.delimiter.ruby' }
]}],
]
}],
[{
line: 'x <<HERE',
tokens: [
{ startIndex: 0, type: 'identifier.ruby' },
{ startIndex: 1, type: 'string.heredoc.delimiter.ruby' }
]}, {
]
}, {
line: 'do some string',
tokens: [
{ startIndex: 0, type: 'string.heredoc.ruby' }
]}, {
]
}, {
line: 'HERE',
tokens: [
{ startIndex: 0, type: 'string.heredoc.delimiter.ruby' }
]}],
]
}],
[{
line: 'x<<HERE',
@ -114,12 +125,14 @@ testTokenization('ruby', [
{ startIndex: 0, type: 'identifier.ruby' },
{ startIndex: 1, type: 'operator.ruby' },
{ startIndex: 3, type: 'constructor.identifier.ruby' }
]}],
]
}],
[{
line: 'x<<-HERE',
tokens: [
{ startIndex: 0, type: 'identifier.ruby' },
{ startIndex: 1, type: 'string.heredoc.delimiter.ruby' }
]}]
]
}]
]);

View file

@ -77,7 +77,8 @@ testTokenization('scss', [
{ startIndex: 110, type: 'delimiter.curly.scss' } /* '}' */,
{ startIndex: 111, type: '' },
{ startIndex: 112, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// Parent selector
[{
@ -122,7 +123,8 @@ testTokenization('scss', [
{ startIndex: 83, type: 'delimiter.curly.scss' } /* '}' */,
{ startIndex: 84, type: '' },
{ startIndex: 85, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// Nested Properties
[{
@ -171,7 +173,8 @@ testTokenization('scss', [
{ startIndex: 100, type: 'delimiter.scss' } /* ';' */,
{ startIndex: 101, type: '' },
{ startIndex: 102, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// Nesting name conflicts
[{
@ -248,7 +251,8 @@ testTokenization('scss', [
{ startIndex: 167, type: 'comment.scss' } /* '// rule' */,
{ startIndex: 174, type: '' },
{ startIndex: 175, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// Missing semicolons
[{
@ -320,7 +324,8 @@ testTokenization('scss', [
{ startIndex: 158, type: 'attribute.value.scss' } /* 'black' */,
{ startIndex: 163, type: '' },
{ startIndex: 164, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// Rules without whitespaces
[{
@ -346,7 +351,8 @@ testTokenization('scss', [
{ startIndex: 61, type: 'number.scss' } /* '1' */,
{ startIndex: 62, type: 'meta.scss' } /* ')' */,
{ startIndex: 63, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// Extended commentswhitespaces
[{
@ -394,7 +400,8 @@ testTokenization('scss', [
{ startIndex: 330, type: 'delimiter.scss' } /* ';' */,
{ startIndex: 331, type: '' },
{ startIndex: 332, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// Variable declarations and referenceswhitespaces
[{
@ -492,7 +499,8 @@ testTokenization('scss', [
{ startIndex: 236, type: 'delimiter.scss' } /* ';' */,
{ startIndex: 237, type: '' },
{ startIndex: 238, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// Variable declaration with whitespaces
[{
@ -519,7 +527,8 @@ testTokenization('scss', [
{ startIndex: 94, type: '' },
{ startIndex: 97, type: 'literal.scss' } /* '!default' */,
{ startIndex: 105, type: 'delimiter.scss' } /* ';' */
]}],
]
}],
// Operationswhitespaces
[{
@ -624,7 +633,8 @@ testTokenization('scss', [
{ startIndex: 237, type: 'delimiter.scss' } /* ';' */,
{ startIndex: 238, type: '' },
{ startIndex: 239, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// Functionwhitespaces
[{
@ -691,7 +701,8 @@ testTokenization('scss', [
{ startIndex: 155, type: 'delimiter.scss' } /* ';' */,
{ startIndex: 156, type: '' },
{ startIndex: 157, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// Importswhitespaces
[{
@ -744,7 +755,8 @@ testTokenization('scss', [
{ startIndex: 163, type: 'delimiter.scss' } /* ';' */,
{ startIndex: 164, type: '' },
{ startIndex: 165, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// Mediawhitespaces
[{
@ -787,7 +799,8 @@ testTokenization('scss', [
{ startIndex: 94, type: 'delimiter.curly.scss' } /* '}' */,
{ startIndex: 95, type: '' },
{ startIndex: 96, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// Extendwhitespaces
[{
@ -878,7 +891,8 @@ testTokenization('scss', [
{ startIndex: 229, type: 'delimiter.scss' } /* ';' */,
{ startIndex: 230, type: '' },
{ startIndex: 231, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// @debug and @warnwhitespaces
[{
@ -984,7 +998,8 @@ testTokenization('scss', [
{ startIndex: 266, type: 'delimiter.scss' } /* ';' */,
{ startIndex: 267, type: '' },
{ startIndex: 268, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// if statementwhitespaces
[{
@ -1057,7 +1072,8 @@ testTokenization('scss', [
{ startIndex: 125, type: 'delimiter.curly.scss' } /* '}' */,
{ startIndex: 126, type: '' },
{ startIndex: 127, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// if-else statementwhitespaces
[{
@ -1130,7 +1146,8 @@ testTokenization('scss', [
{ startIndex: 140, type: 'delimiter.curly.scss' } /* '}' */,
{ startIndex: 141, type: '' },
{ startIndex: 142, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// for statementwhitespaces
[{
@ -1172,7 +1189,8 @@ testTokenization('scss', [
{ startIndex: 60, type: 'delimiter.curly.scss' } /* '}' */,
{ startIndex: 61, type: '' },
{ startIndex: 62, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// each statementwhitespaces
[{
@ -1222,7 +1240,8 @@ testTokenization('scss', [
{ startIndex: 129, type: 'delimiter.curly.scss' } /* '}' */,
{ startIndex: 130, type: '' },
{ startIndex: 131, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// while statementwhitespaces
[{
@ -1276,7 +1295,8 @@ testTokenization('scss', [
{ startIndex: 70, type: 'delimiter.scss' } /* ';' */,
{ startIndex: 71, type: '' },
{ startIndex: 72, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// Function with control statements nestedwhitespaces
[{
@ -1369,7 +1389,8 @@ testTokenization('scss', [
{ startIndex: 170, type: 'delimiter.scss' } /* ';' */,
{ startIndex: 171, type: '' },
{ startIndex: 172, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
@ -1438,7 +1459,8 @@ testTokenization('scss', [
{ startIndex: 158, type: 'delimiter.scss' } /* ';' */,
{ startIndex: 159, type: '' },
{ startIndex: 160, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// @mixin with parameterswhitespaces
[{
@ -1500,7 +1522,8 @@ testTokenization('scss', [
{ startIndex: 147, type: 'delimiter.scss' } /* ';' */,
{ startIndex: 148, type: '' },
{ startIndex: 149, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// @mixin with varargswhitespaces
[{
@ -1567,7 +1590,8 @@ testTokenization('scss', [
{ startIndex: 189, type: 'delimiter.scss' } /* ';' */,
{ startIndex: 190, type: '' },
{ startIndex: 191, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// @include with varargswhitespaces
[{
@ -1637,7 +1661,8 @@ testTokenization('scss', [
{ startIndex: 197, type: 'delimiter.scss' } /* ';' */,
{ startIndex: 198, type: '' },
{ startIndex: 199, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// @include with bodywhitespaces
[{
line:
@ -1690,7 +1715,8 @@ testTokenization('scss', [
{ startIndex: 137, type: 'delimiter.curly.scss' } /* '}' */,
{ startIndex: 138, type: '' },
{ startIndex: 139, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// CSS charsetwhitespaces
[{
@ -1703,7 +1729,8 @@ testTokenization('scss', [
{ startIndex: 10, type: 'string.scss' } /* 'UTF-8' */,
{ startIndex: 15, type: 'string.delimiter.scss' } /* '"' */,
{ startIndex: 16, type: 'delimiter.scss' } /* ';' */
]}],
]
}],
// CSS attributeswhitespaces
[{
@ -1731,7 +1758,8 @@ testTokenization('scss', [
{ startIndex: 42, type: 'delimiter.scss' } /* ';' */,
{ startIndex: 43, type: '' },
{ startIndex: 44, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// CSS @pagewhitespaces
[{
@ -1758,7 +1786,8 @@ testTokenization('scss', [
{ startIndex: 53, type: 'delimiter.scss' } /* ';' */,
{ startIndex: 54, type: '' },
{ startIndex: 55, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// Extend with interpolation variablewhitespaces
[{
@ -1833,7 +1862,8 @@ testTokenization('scss', [
{ startIndex: 123, type: 'delimiter.scss' } /* ';' */,
{ startIndex: 124, type: '' },
{ startIndex: 128, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// @font-facewhitespaces
[{
@ -1860,7 +1890,8 @@ testTokenization('scss', [
{ startIndex: 69, type: '' },
{ startIndex: 70, type: 'delimiter.curly.scss' } /* '}' */,
{ startIndex: 71, type: '' }
]}],
]
}],
// Keyframeswhitespaces
[{
@ -2001,7 +2032,8 @@ testTokenization('scss', [
{ startIndex: 336, type: 'delimiter.curly.scss' } /* '}' */,
{ startIndex: 337, type: '' },
{ startIndex: 338, type: 'delimiter.curly.scss' } /* '}' */
]}],
]
}],
// String escapingwhitespaces
[{
@ -2050,5 +2082,6 @@ testTokenization('scss', [
{ startIndex: 88, type: 'delimiter.scss' } /* ';' */,
{ startIndex: 89, type: '' },
{ startIndex: 90, type: 'comment.scss' } /* '/* another comment * /' */
]}],
]
}],
]);

View file

@ -14,7 +14,8 @@ testTokenization('sol', [
{ startIndex: 16, type: 'delimiter.sol' },
{ startIndex: 17, type: 'number.float.sol' },
{ startIndex: 22, type: 'delimiter.sol' },
]}],
]
}],
[{
line: 'contract Ballot {',
@ -24,7 +25,8 @@ testTokenization('sol', [
{ startIndex: 9, type: 'identifier.sol' },
{ startIndex: 15, type: '' },
{ startIndex: 16, type: 'delimiter.curly.sol' }
]}],
]
}],
[{
line: 'struct Voter {',
@ -34,7 +36,8 @@ testTokenization('sol', [
{ startIndex: 7, type: 'identifier.sol' },
{ startIndex: 12, type: '' },
{ startIndex: 13, type: 'delimiter.curly.sol' }
]}],
]
}],
[{
line: 'address chairperson;',
@ -43,7 +46,8 @@ testTokenization('sol', [
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'identifier.sol' },
{ startIndex: 19, type: 'delimiter.sol' }
]}],
]
}],
[{
line: 'int weight;',
@ -52,7 +56,8 @@ testTokenization('sol', [
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'identifier.sol' },
{ startIndex: 10, type: 'delimiter.sol' },
]}],
]
}],
[{
line: 'mapping(address => Voter) voters;',
@ -66,7 +71,8 @@ testTokenization('sol', [
{ startIndex: 25, type: '' },
{ startIndex: 26, type: 'identifier.sol' },
{ startIndex: 32, type: 'delimiter.sol' },
]}],
]
}],
[{
line: 'function Ballot(uint8 _numProposals) {',
@ -81,33 +87,38 @@ testTokenization('sol', [
{ startIndex: 35, type: 'delimiter.parenthesis.sol' },
{ startIndex: 36, type: '' },
{ startIndex: 37, type: 'delimiter.curly.sol' },
]}],
]
}],
// Comments - single line
[{
line: '//',
tokens: [
{ startIndex: 0, type: 'comment.sol' }
]}],
]
}],
[{
line: ' // a comment',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'comment.sol' }
]}],
]
}],
[{
line: '// a comment',
tokens: [
{ startIndex: 0, type: 'comment.sol' }
]}],
]
}],
[{
line: '//sticky comment',
tokens: [
{ startIndex: 0, type: 'comment.sol' }
]}],
]
}],
[{
line: '/almost a comment',
@ -118,7 +129,8 @@ testTokenization('sol', [
{ startIndex: 8, type: 'identifier.sol' },
{ startIndex: 9, type: '' },
{ startIndex: 10, type: 'identifier.sol' }
]}],
]
}],
[{
line: '/* //*/ a',
@ -126,7 +138,8 @@ testTokenization('sol', [
{ startIndex: 0, type: 'comment.sol' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'identifier.sol' }
]}],
]
}],
[{
line: '1 / 2; /* comment',
@ -139,7 +152,8 @@ testTokenization('sol', [
{ startIndex: 5, type: 'delimiter.sol' },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: 'comment.sol' }
]}],
]
}],
[{
line: 'int x = 1; // my comment // is a nice one',
@ -154,14 +168,16 @@ testTokenization('sol', [
{ startIndex: 9, type: 'delimiter.sol' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'comment.sol' }
]}],
]
}],
// Comments - range comment, single line
[{
line: '/* a simple comment */',
tokens: [
{ startIndex: 0, type: 'comment.sol' }
]}],
]
}],
[{
line: 'int x = /* a simple comment */ 1;',
@ -176,7 +192,8 @@ testTokenization('sol', [
{ startIndex: 30, type: '' },
{ startIndex: 31, type: 'number.sol' },
{ startIndex: 32, type: 'delimiter.sol' }
]}],
]
}],
[{
line: 'int x = /* comment */ 1; */',
@ -192,7 +209,8 @@ testTokenization('sol', [
{ startIndex: 22, type: 'number.sol' },
{ startIndex: 23, type: 'delimiter.sol' },
{ startIndex: 24, type: '' }
]}],
]
}],
[{
line: 'x = /**/;',
@ -203,7 +221,8 @@ testTokenization('sol', [
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'comment.sol' },
{ startIndex: 8, type: 'delimiter.sol' }
]}],
]
}],
[{
line: 'x = /*/;',
@ -213,6 +232,7 @@ testTokenization('sol', [
{ startIndex: 2, type: 'delimiter.sol' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'comment.sol' }
]}],
]
}],
]);

View file

@ -13,13 +13,15 @@ testTokenization('sql', [
line: '-- a comment',
tokens: [
{ startIndex: 0, type: 'comment.sql' }
]}],
]
}],
[{
line: '---sticky -- comment',
tokens: [
{ startIndex: 0, type: 'comment.sql' }
]}],
]
}],
[{
line: '-almost a comment',
@ -30,7 +32,8 @@ testTokenization('sql', [
{ startIndex: 8, type: 'identifier.sql' },
{ startIndex: 9, type: 'white.sql' },
{ startIndex: 10, type: 'identifier.sql' }
]}],
]
}],
[{
line: '/* a full line comment */',
@ -38,7 +41,8 @@ testTokenization('sql', [
{ startIndex: 0, type: 'comment.quote.sql' },
{ startIndex: 2, type: 'comment.sql' },
{ startIndex: 23, type: 'comment.quote.sql' }
]}],
]
}],
[{
line: '/* /// *** /// */',
@ -46,7 +50,8 @@ testTokenization('sql', [
{ startIndex: 0, type: 'comment.quote.sql' },
{ startIndex: 2, type: 'comment.sql' },
{ startIndex: 15, type: 'comment.quote.sql' }
]}],
]
}],
[{
line: 'declare @x int = /* a simple comment */ 1;',
@ -65,7 +70,8 @@ testTokenization('sql', [
{ startIndex: 39, type: 'white.sql' },
{ startIndex: 40, type: 'number.sql' },
{ startIndex: 41, type: 'delimiter.sql' }
]}],
]
}],
// Not supporting nested comments, as nested comments seem to not be standard?
// i.e. http://stackoverflow.com/questions/728172/are-there-multiline-comment-delimiters-in-sql-that-are-vendor-agnostic
@ -78,7 +84,8 @@ testTokenization('sql', [
{ startIndex: 5, type: 'comment.sql' },
{ startIndex: 28, type: 'comment.quote.sql' },
{ startIndex: 30, type: 'delimiter.sql' }
]}],
]
}],
[{
line: '@x=/* another comment */ 1*/;',
@ -92,7 +99,8 @@ testTokenization('sql', [
{ startIndex: 25, type: 'number.sql' },
{ startIndex: 26, type: 'operator.sql' },
{ startIndex: 28, type: 'delimiter.sql' }
]}],
]
}],
[{
line: '@x=/*/;',
@ -101,251 +109,292 @@ testTokenization('sql', [
{ startIndex: 2, type: 'operator.sql' },
{ startIndex: 3, type: 'comment.quote.sql' },
{ startIndex: 5, type: 'comment.sql' }
]}],
]
}],
// Numbers
[{
line: '123',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '-123',
tokens: [
{ startIndex: 0, type: 'operator.sql' },
{ startIndex: 1, type: 'number.sql' }
]}],
]
}],
[{
line: '0xaBc123',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '0XaBc123',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '0x',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '0x0',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '0xAB_CD',
tokens: [
{ startIndex: 0, type: 'number.sql' },
{ startIndex: 4, type: 'identifier.sql' }
]}],
]
}],
[{
line: '$',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '$-123',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '$-+-123',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '$123.5678',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '$0.99',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '$.99',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '$99.',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '$0.',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '$.0',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '.',
tokens: [
{ startIndex: 0, type: 'delimiter.sql' }
]}],
]
}],
[{
line: '123',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '123.5678',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '0.99',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '.99',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '99.',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '0.',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '.0',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '1E-2',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '1E+2',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '1E2',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '0.1E2',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '1.E2',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
[{
line: '.1E2',
tokens: [
{ startIndex: 0, type: 'number.sql' }
]}],
]
}],
// Identifiers
[{
line: '_abc$01',
tokens: [
{ startIndex: 0, type: 'identifier.sql' }
]}],
]
}],
[{
line: '#abc$01',
tokens: [
{ startIndex: 0, type: 'identifier.sql' }
]}],
]
}],
[{
line: '##abc$01',
tokens: [
{ startIndex: 0, type: 'identifier.sql' }
]}],
]
}],
[{
line: '@abc$01',
tokens: [
{ startIndex: 0, type: 'identifier.sql' }
]}],
]
}],
[{
line: '@@abc$01',
tokens: [
{ startIndex: 0, type: 'identifier.sql' }
]}],
]
}],
[{
line: '$abc',
tokens: [
{ startIndex: 0, type: 'identifier.sql' }
]}],
]
}],
[{
line: '$action',
tokens: [
{ startIndex: 0, type: 'predefined.sql' }
]}],
]
}],
[{
line: '$nonexistent',
tokens: [
{ startIndex: 0, type: 'identifier.sql' }
]}],
]
}],
[{
line: '@@DBTS',
tokens: [
{ startIndex: 0, type: 'predefined.sql' }
]}],
]
}],
[{
line: '@@nonexistent',
tokens: [
{ startIndex: 0, type: 'identifier.sql' }
]}],
]
}],
[{
line: 'declare [abc 321];',
@ -356,7 +405,8 @@ testTokenization('sql', [
{ startIndex: 9, type: 'identifier.sql' },
{ startIndex: 16, type: 'identifier.quote.sql' },
{ startIndex: 17, type: 'delimiter.sql' }
]}],
]
}],
[{
line: '[abc[[ 321 ]] xyz]',
@ -364,14 +414,16 @@ testTokenization('sql', [
{ startIndex: 0, type: 'identifier.quote.sql' },
{ startIndex: 1, type: 'identifier.sql' },
{ startIndex: 17, type: 'identifier.quote.sql' }
]}],
]
}],
[{
line: '[abc',
tokens: [
{ startIndex: 0, type: 'identifier.quote.sql' },
{ startIndex: 1, type: 'identifier.sql' }
]}],
]
}],
[{
line: 'declare "abc 321";',
@ -382,7 +434,8 @@ testTokenization('sql', [
{ startIndex: 9, type: 'identifier.sql' },
{ startIndex: 16, type: 'identifier.quote.sql' },
{ startIndex: 17, type: 'delimiter.sql' }
]}],
]
}],
[{
line: '"abc"" 321 "" xyz"',
@ -390,20 +443,23 @@ testTokenization('sql', [
{ startIndex: 0, type: 'identifier.quote.sql' },
{ startIndex: 1, type: 'identifier.sql' },
{ startIndex: 17, type: 'identifier.quote.sql' }
]}],
]
}],
[{
line: '"abc',
tokens: [
{ startIndex: 0, type: 'identifier.quote.sql' },
{ startIndex: 1, type: 'identifier.sql' }
]}],
]
}],
[{
line: 'int',
tokens: [
{ startIndex: 0, type: 'keyword.sql' }
]}],
]
}],
[{
line: '[int]',
@ -411,7 +467,8 @@ testTokenization('sql', [
{ startIndex: 0, type: 'identifier.quote.sql' },
{ startIndex: 1, type: 'identifier.sql' },
{ startIndex: 4, type: 'identifier.quote.sql' }
]}],
]
}],
// Strings
[{
@ -423,37 +480,43 @@ testTokenization('sql', [
{ startIndex: 10, type: 'operator.sql' },
{ startIndex: 11, type: 'string.sql' },
{ startIndex: 21, type: 'delimiter.sql' }
]}],
]
}],
[{
line: '\'a \'\' string with quotes\'',
tokens: [
{ startIndex: 0, type: 'string.sql' },
]}],
]
}],
[{
line: '\'a " string with quotes\'',
tokens: [
{ startIndex: 0, type: 'string.sql' },
]}],
]
}],
[{
line: '\'a -- string with comment\'',
tokens: [
{ startIndex: 0, type: 'string.sql' },
]}],
]
}],
[{
line: 'N\'a unicode string\'',
tokens: [
{ startIndex: 0, type: 'string.sql' },
]}],
]
}],
[{
line: '\'a endless string',
tokens: [
{ startIndex: 0, type: 'string.sql' },
]}],
]
}],
// Operators
[{
@ -466,7 +529,8 @@ testTokenization('sql', [
{ startIndex: 7, type: 'identifier.sql' },
{ startIndex: 9, type: 'operator.sql' },
{ startIndex: 10, type: 'number.sql' }
]}],
]
}],
[{
line: '@x^=@x',
@ -474,7 +538,8 @@ testTokenization('sql', [
{ startIndex: 0, type: 'identifier.sql' },
{ startIndex: 2, type: 'operator.sql' },
{ startIndex: 4, type: 'identifier.sql' }
]}],
]
}],
[{
line: 'WHERE x IS NOT NULL',
@ -488,7 +553,8 @@ testTokenization('sql', [
{ startIndex: 11, type: 'operator.sql' },
{ startIndex: 14, type: 'white.sql' },
{ startIndex: 15, type: 'operator.sql' }
]}],
]
}],
[{
line: 'SELECT * FROM dbo.MyTable WHERE MyColumn IN (1,2)',
@ -514,7 +580,8 @@ testTokenization('sql', [
{ startIndex: 46, type: 'delimiter.sql' },
{ startIndex: 47, type: 'number.sql' },
{ startIndex: 48, type: 'delimiter.parenthesis.sql' }
]}],
]
}],
// Scopes
[{
@ -526,7 +593,8 @@ testTokenization('sql', [
{ startIndex: 8, type: 'keyword.block.sql' },
{ startIndex: 13, type: 'white.sql' },
{ startIndex: 14, type: 'keyword.block.sql' }
]}],
]
}],
[{
line: 'BEGIN TRAN BEGIN TRY SELECT $ COMMIT END TRY BEGIN CATCH ROLLBACK END CATCH',
@ -548,7 +616,8 @@ testTokenization('sql', [
{ startIndex: 57, type: 'keyword.sql' },
{ startIndex: 65, type: 'white.sql' },
{ startIndex: 66, type: 'keyword.catch.sql' }
]}],
]
}],
[{
line: 'SELECT CASE $ WHEN 3 THEN 4 ELSE 5 END',
@ -572,5 +641,6 @@ testTokenization('sql', [
{ startIndex: 33, type: 'number.sql' },
{ startIndex: 34, type: 'white.sql' },
{ startIndex: 35, type: 'keyword.block.sql' }
]}]
]
}]
]);

View file

@ -14,7 +14,8 @@ testTokenization('swift', [
line: '@noescape',
tokens: [
{ startIndex: 0, type: 'keyword.control.swift' } /* '@noescape' */
]}],
]
}],
//Keyword and Type Identifier
[{
line: 'class App: UI, UIApp, UIView {',
@ -33,7 +34,8 @@ testTokenization('swift', [
{ startIndex: 22, type: 'type.identifier.swift' } /* 'UIView' */,
{ startIndex: 28, type: '' },
{ startIndex: 29, type: 'delimiter.curly.swift' } /* '{' */
]}],
]
}],
// Keyword, Identifier, and Type Identifier
[{
line: ' var window: UIWindow?',
@ -46,14 +48,16 @@ testTokenization('swift', [
{ startIndex: 15, type: '' },
{ startIndex: 16, type: 'type.identifier.swift' } /* 'UIWindow' */,
{ startIndex: 24, type: 'operator.swift' } /* '?' */
]}],
]
}],
//Comment
[{
line: ' // Comment',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'comment.swift' } /* '// Comment' */
]}],
]
}],
//Block Comment with Embedded Comment followed by code
[{
line: ' /* Comment //Embedded */ var y = 0b10',
@ -68,7 +72,8 @@ testTokenization('swift', [
{ startIndex: 35, type: 'operator.swift' } /* '=' */,
{ startIndex: 36, type: '' },
{ startIndex: 37, type: 'number.binary.swift' } /* '0b10' */
]}],
]
}],
// Method signature (broken on two lines)
[{
line: ' public func app(app: App, opts:',
@ -88,7 +93,8 @@ testTokenization('swift', [
{ startIndex: 29, type: '' },
{ startIndex: 30, type: 'identifier.swift' } /* 'opts' */,
{ startIndex: 34, type: 'operator.swift' } /* ':' */,
]}],
]
}],
// Method signature Continued
[{
line: ' [NSObject: AnyObject]?) -> Bool {',
@ -108,7 +114,8 @@ testTokenization('swift', [
{ startIndex: 35, type: 'type.identifier.swift' } /* 'Bool' */,
{ startIndex: 39, type: '' },
{ startIndex: 40, type: 'delimiter.curly.swift' } /* '{' */
]}],
]
}],
// String with escapes
[{
line: ' var `String` = "String w/ \\"escape\\""',
@ -125,7 +132,8 @@ testTokenization('swift', [
{ startIndex: 23, type: 'string.quote.swift' } /* '"' */,
{ startIndex: 24, type: 'string.swift' } /* 'String w/ \\"escape\\""' */,
{ startIndex: 44, type: 'string.quote.swift' } /* '"' */,
]}],
]
}],
// String with interpolated expression
[{
line: ' let message = "\\(y) times 2.5 is \\(Double(25) * 2.5)"',
@ -153,7 +161,8 @@ testTokenization('swift', [
{ startIndex: 56, type: 'number.float.swift' } /* '2.5' */,
{ startIndex: 59, type: 'operator.swift' } /* ')' */,
{ startIndex: 60, type: 'string.quote.swift' } /* '"' */
]}],
]
}],
// Method invocation/property accessor.
[{
line: ' let view = self.window!.contr as! UIView',
@ -176,6 +185,7 @@ testTokenization('swift', [
{ startIndex: 40, type: 'operator.swift' } /* '!' */,
{ startIndex: 41, type: '' },
{ startIndex: 42, type: 'type.identifier.swift' } /* 'UIView' */
]}]
]
}]
]);

View file

@ -14,26 +14,30 @@ testTokenization('vb', [
line: '\'',
tokens: [
{ startIndex: 0, type: 'comment.vb' }
]}],
]
}],
[{
line: ' \' a comment',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'comment.vb' }
]}],
]
}],
[{
line: '\' a comment',
tokens: [
{ startIndex: 0, type: 'comment.vb' }
]}],
]
}],
[{
line: '\'sticky comment',
tokens: [
{ startIndex: 0, type: 'comment.vb' }
]}],
]
}],
[{
line: '1 \' 2; \' comment',
@ -41,7 +45,8 @@ testTokenization('vb', [
{ startIndex: 0, type: 'number.vb' },
{ startIndex: 1, type: '' },
{ startIndex: 2, type: 'comment.vb' }
]}],
]
}],
[{
line: 'Dim x = 1; \' my comment \'\' is a nice one',
@ -56,13 +61,15 @@ testTokenization('vb', [
{ startIndex: 9, type: 'delimiter.vb' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'comment.vb' }
]}],
]
}],
[{
line: 'REM this is a comment',
tokens: [
{ startIndex: 0, type: 'comment.vb' }
]}],
]
}],
[{
line: '2 + 5 REM comment starts',
@ -74,122 +81,142 @@ testTokenization('vb', [
{ startIndex: 4, type: 'number.vb' },
{ startIndex: 5, type: '' },
{ startIndex: 6, type: 'comment.vb' }
]}],
]
}],
// Numbers
[{
line: '0',
tokens: [
{ startIndex: 0, type: 'number.vb' }
]}],
]
}],
[{
line: '0.0',
tokens: [
{ startIndex: 0, type: 'number.float.vb' }
]}],
]
}],
[{
line: '&h123',
tokens: [
{ startIndex: 0, type: 'number.hex.vb' }
]}],
]
}],
[{
line: '23.5',
tokens: [
{ startIndex: 0, type: 'number.float.vb' }
]}],
]
}],
[{
line: '23.5e3',
tokens: [
{ startIndex: 0, type: 'number.float.vb' }
]}],
]
}],
[{
line: '23.5E3',
tokens: [
{ startIndex: 0, type: 'number.float.vb' }
]}],
]
}],
[{
line: '23.5r',
tokens: [
{ startIndex: 0, type: 'number.float.vb' }
]}],
]
}],
[{
line: '23.5f',
tokens: [
{ startIndex: 0, type: 'number.float.vb' }
]}],
]
}],
[{
line: '1.72E3r',
tokens: [
{ startIndex: 0, type: 'number.float.vb' }
]}],
]
}],
[{
line: '1.72E3r',
tokens: [
{ startIndex: 0, type: 'number.float.vb' }
]}],
]
}],
[{
line: '1.72e3f',
tokens: [
{ startIndex: 0, type: 'number.float.vb' }
]}],
]
}],
[{
line: '1.72e3r',
tokens: [
{ startIndex: 0, type: 'number.float.vb' }
]}],
]
}],
[{
line: '23.5R',
tokens: [
{ startIndex: 0, type: 'number.float.vb' }
]}],
]
}],
[{
line: '23.5r',
tokens: [
{ startIndex: 0, type: 'number.float.vb' }
]}],
]
}],
[{
line: '1.72E3#',
tokens: [
{ startIndex: 0, type: 'number.float.vb' }
]}],
]
}],
[{
line: '1.72E3F',
tokens: [
{ startIndex: 0, type: 'number.float.vb' }
]}],
]
}],
[{
line: '1.72e3!',
tokens: [
{ startIndex: 0, type: 'number.float.vb' }
]}],
]
}],
[{
line: '1.72e3f',
tokens: [
{ startIndex: 0, type: 'number.float.vb' }
]}],
]
}],
[{
line: '1.72e-3',
tokens: [
{ startIndex: 0, type: 'number.float.vb' }
]}],
]
}],
[{
line: '0+0',
@ -197,7 +224,8 @@ testTokenization('vb', [
{ startIndex: 0, type: 'number.vb' },
{ startIndex: 1, type: 'delimiter.vb' },
{ startIndex: 2, type: 'number.vb' }
]}],
]
}],
[{
line: '100+10',
@ -205,7 +233,8 @@ testTokenization('vb', [
{ startIndex: 0, type: 'number.vb' },
{ startIndex: 3, type: 'delimiter.vb' },
{ startIndex: 4, type: 'number.vb' }
]}],
]
}],
[{
line: '0 + 0',
@ -215,7 +244,8 @@ testTokenization('vb', [
{ startIndex: 2, type: 'delimiter.vb' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'number.vb' }
]}],
]
}],
// Keywords
[{
@ -226,7 +256,8 @@ testTokenization('vb', [
{ startIndex: 8, type: 'identifier.vb' },
{ startIndex: 17, type: 'delimiter.vb' },
{ startIndex: 18, type: 'identifier.vb' }
]}],
]
}],
[{
line: 'Private Sub Foo(ByVal sender As String)',
@ -245,7 +276,8 @@ testTokenization('vb', [
{ startIndex: 31, type: '' },
{ startIndex: 32, type: 'keyword.string.vb' },
{ startIndex: 38, type: 'delimiter.parenthesis.vb' }
]}],
]
}],
// Strings
[{
@ -258,14 +290,16 @@ testTokenization('vb', [
{ startIndex: 9, type: 'delimiter.vb' },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'string.vb' }
]}],
]
}],
[{
line: '"use strict";',
tokens: [
{ startIndex: 0, type: 'string.vb' },
{ startIndex: 12, type: 'delimiter.vb' }
]}],
]
}],
// Tags
[{
@ -277,7 +311,8 @@ testTokenization('vb', [
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'identifier.vb' },
{ startIndex: 19, type: 'delimiter.parenthesis.vb' }
]}],
]
}],
[{
line: 'public sub ToString()',
@ -288,7 +323,8 @@ testTokenization('vb', [
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'identifier.vb' },
{ startIndex: 19, type: 'delimiter.parenthesis.vb' }
]}],
]
}],
[{
line: 'While Do Continue While End While',
@ -302,7 +338,8 @@ testTokenization('vb', [
{ startIndex: 18, type: 'keyword.tag-while.vb' },
{ startIndex: 23, type: '' },
{ startIndex: 24, type: 'keyword.tag-while.vb' }
]}],
]
}],
[{
line: 'While while WHILE WHile whiLe',
@ -316,7 +353,8 @@ testTokenization('vb', [
{ startIndex: 18, type: 'keyword.tag-while.vb' },
{ startIndex: 23, type: '' },
{ startIndex: 24, type: 'keyword.tag-while.vb' }
]}],
]
}],
[{
line: 'If b(i) = col Then',
@ -333,7 +371,8 @@ testTokenization('vb', [
{ startIndex: 10, type: 'identifier.vb' },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'keyword.then.vb' }
]}],
]
}],
[{
line: 'Do stuff While True Loop',
@ -347,7 +386,8 @@ testTokenization('vb', [
{ startIndex: 15, type: 'keyword.true.vb' },
{ startIndex: 19, type: '' },
{ startIndex: 20, type: 'keyword.tag-do.vb' }
]}],
]
}],
[{
line: 'For i = 0 To 10 DoStuff Next',
@ -367,7 +407,8 @@ testTokenization('vb', [
{ startIndex: 16, type: 'identifier.vb' },
{ startIndex: 23, type: '' },
{ startIndex: 24, type: 'keyword.tag-for.vb' }
]}],
]
}],
[{
line: 'For stuff End For',
@ -379,7 +420,8 @@ testTokenization('vb', [
{ startIndex: 10, type: 'keyword.end.vb' },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'keyword.tag-for.vb' }
]}],
]
}],
[{
line: 'For stuff end for',
@ -391,5 +433,6 @@ testTokenization('vb', [
{ startIndex: 10, type: 'keyword.end.vb' },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'keyword.tag-for.vb' }
]}]
]
}]
]);

View file

@ -15,7 +15,8 @@ testTokenization('xml', [
{ startIndex: 0, type: 'delimiter.xml' },
{ startIndex: 1, type: 'tag.xml' },
{ startIndex: 7, type: 'delimiter.xml' }
]}],
]
}],
[{
line: '<person/>',
@ -23,7 +24,8 @@ testTokenization('xml', [
{ startIndex: 0, type: 'delimiter.xml' },
{ startIndex: 1, type: 'tag.xml' },
{ startIndex: 8, type: 'delimiter.xml' }
]}],
]
}],
[{
line: '<person >',
@ -32,7 +34,8 @@ testTokenization('xml', [
{ startIndex: 1, type: 'tag.xml' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'delimiter.xml' }
]}],
]
}],
[{
line: '<person />',
@ -42,41 +45,47 @@ testTokenization('xml', [
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'tag.xml' },
{ startIndex: 9, type: 'delimiter.xml' }
]}],
]
}],
// Incomplete Start Tag
[{
line: '<',
tokens: [
{ startIndex: 0, type: '' }
]}],
]
}],
[{
line: '<person',
tokens: [
{ startIndex: 0, type: 'delimiter.xml' },
{ startIndex: 1, type: 'tag.xml' }
]}],
]
}],
[{
line: '<input',
tokens: [
{ startIndex: 0, type: 'delimiter.xml' },
{ startIndex: 1, type: 'tag.xml' }
]}],
]
}],
// Invalid Open Start Tag
[{
line: '< person',
tokens: [
{ startIndex: 0, type: '' }
]}],
]
}],
[{
line: '< person>',
tokens: [
{ startIndex: 0, type: '' }
]}],
]
}],
[{
line: 'i <person;',
@ -85,7 +94,8 @@ testTokenization('xml', [
{ startIndex: 2, type: 'delimiter.xml' },
{ startIndex: 3, type: 'tag.xml' },
{ startIndex: 9, type: '' }
]}],
]
}],
// Tag with Attribute
[{
@ -98,7 +108,8 @@ testTokenization('xml', [
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'attribute.value.xml' },
{ startIndex: 13, type: 'delimiter.xml' }
]}],
]
}],
[{
line: '<tool name="Monaco">',
@ -110,7 +121,8 @@ testTokenization('xml', [
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'attribute.value.xml' },
{ startIndex: 19, type: 'delimiter.xml' }
]}],
]
}],
[{
line: '<tool name=\'Monaco\'>',
@ -122,7 +134,8 @@ testTokenization('xml', [
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'attribute.value.xml' },
{ startIndex: 19, type: 'delimiter.xml' }
]}],
]
}],
// Tag with Attributes
[{
@ -139,7 +152,8 @@ testTokenization('xml', [
{ startIndex: 27, type: '' },
{ startIndex: 28, type: 'attribute.value.xml' },
{ startIndex: 33, type: 'delimiter.xml' }
]}],
]
}],
// Tag with Name-Only-Attribute
[{
@ -150,7 +164,8 @@ testTokenization('xml', [
{ startIndex: 5, type: '' },
{ startIndex: 6, type: 'attribute.name.xml' },
{ startIndex: 10, type: 'delimiter.xml' }
]}],
]
}],
[{
line: '<tool name version>',
@ -162,7 +177,8 @@ testTokenization('xml', [
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'attribute.name.xml' },
{ startIndex: 18, type: 'delimiter.xml' }
]}],
]
}],
// Tag with Attribute And Whitespace
[{
@ -175,7 +191,8 @@ testTokenization('xml', [
{ startIndex: 10, type: '' },
{ startIndex: 13, type: 'attribute.value.xml' },
{ startIndex: 21, type: 'delimiter.xml' }
]}],
]
}],
[{
line: '<tool name = "monaco">',
@ -187,7 +204,8 @@ testTokenization('xml', [
{ startIndex: 10, type: '' },
{ startIndex: 13, type: 'attribute.value.xml' },
{ startIndex: 21, type: 'delimiter.xml' }
]}],
]
}],
// Tag with Invalid Attribute Name
[{
@ -201,7 +219,8 @@ testTokenization('xml', [
{ startIndex: 15, type: 'attribute.name.xml' },
{ startIndex: 18, type: '' },
{ startIndex: 19, type: 'delimiter.xml' }
]}],
]
}],
// Tag with Invalid Attribute Value
[{
@ -214,7 +233,8 @@ testTokenization('xml', [
{ startIndex: 10, type: '' },
{ startIndex: 11, type: 'attribute.value.xml' },
{ startIndex: 12, type: 'delimiter.xml' }
]}],
]
}],
// Complete End Tag
[{
@ -223,7 +243,8 @@ testTokenization('xml', [
{ startIndex: 0, type: 'delimiter.xml' },
{ startIndex: 2, type: 'tag.xml' },
{ startIndex: 8, type: 'delimiter.xml' }
]}],
]
}],
// Complete End Tag with Whitespace
[{
@ -233,14 +254,16 @@ testTokenization('xml', [
{ startIndex: 2, type: 'tag.xml' },
{ startIndex: 8, type: '' },
{ startIndex: 10, type: 'delimiter.xml' }
]}],
]
}],
// Incomplete End Tag
[{
line: '</person',
tokens: [
{ startIndex: 0, type: '' }
]}],
]
}],
// Comments
[{
@ -249,7 +272,8 @@ testTokenization('xml', [
{ startIndex: 0, type: 'comment.xml' },
{ startIndex: 4, type: 'comment.content.xml' },
{ startIndex: 5, type: 'comment.xml' }
]}],
]
}],
[{
line: '<!--a>monaco</a -->',
@ -257,23 +281,27 @@ testTokenization('xml', [
{ startIndex: 0, type: 'comment.xml' },
{ startIndex: 4, type: 'comment.content.xml' },
{ startIndex: 16, type: 'comment.xml' }
]}],
]
}],
[{
line: '<!--a>',
tokens: [
{ startIndex: 0, type: 'comment.xml' },
{ startIndex: 4, type: 'comment.content.xml' }
]},{
]
}, {
line: 'monaco ',
tokens: [
{ startIndex: 0, type: 'comment.content.xml' }
]},{
]
}, {
line: 'tools</a -->',
tokens: [
{ startIndex: 0, type: 'comment.content.xml' },
{ startIndex: 9, type: 'comment.xml' }
]}],
]
}],
// CDATA
[{
@ -288,7 +316,8 @@ testTokenization('xml', [
{ startIndex: 28, type: 'delimiter.xml' },
{ startIndex: 30, type: 'tag.xml' },
{ startIndex: 35, type: 'delimiter.xml' }
]}],
]
}],
[{
line: '<tools>',
@ -296,27 +325,32 @@ testTokenization('xml', [
{ startIndex: 0, type: 'delimiter.xml' },
{ startIndex: 1, type: 'tag.xml' },
{ startIndex: 6, type: 'delimiter.xml' }
]},{
]
}, {
line: '\t<![CDATA[',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'delimiter.cdata.xml' }
]},{
]
}, {
line: '\t\t<person/>',
tokens: [
{ startIndex: 0, type: '' }
]},{
]
}, {
line: '\t]]>',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'delimiter.cdata.xml' },
]},{
]
}, {
line: '</tools>',
tokens: [
{ startIndex: 0, type: 'delimiter.xml' },
{ startIndex: 2, type: 'tag.xml' },
{ startIndex: 7, type: 'delimiter.xml' }
]}],
]
}],
// Generated from sample
[{
@ -329,7 +363,8 @@ testTokenization('xml', [
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'attribute.value.xml' },
{ startIndex: 19, type: 'delimiter.xml' }
]}, {
]
}, {
line: '<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">',
tokens: [
{ startIndex: 0, type: 'delimiter.xml' },
@ -339,14 +374,16 @@ testTokenization('xml', [
{ startIndex: 24, type: '' },
{ startIndex: 25, type: 'attribute.value.xml' },
{ startIndex: 78, type: 'delimiter.xml' }
]}, {
]
}, {
line: ' <connectionStrings>',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'delimiter.xml' },
{ startIndex: 3, type: 'tag.xml' },
{ startIndex: 20, type: 'delimiter.xml' }
]}, {
]
}, {
line: ' <add name="MyDB" ',
tokens: [
{ startIndex: 0, type: '' },
@ -357,7 +394,8 @@ testTokenization('xml', [
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'attribute.value.xml' },
{ startIndex: 20, type: '' }
]}, {
]
}, {
line: ' connectionString="value for the deployed Web.config file" ',
tokens: [
{ startIndex: 0, type: '' },
@ -365,7 +403,8 @@ testTokenization('xml', [
{ startIndex: 22, type: '' },
{ startIndex: 23, type: 'attribute.value.xml' },
{ startIndex: 63, type: '' }
]}, {
]
}, {
line: ' xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>',
tokens: [
{ startIndex: 0, type: '' },
@ -378,21 +417,24 @@ testTokenization('xml', [
{ startIndex: 48, type: 'attribute.value.xml' },
{ startIndex: 61, type: 'tag.xml' },
{ startIndex: 62, type: 'delimiter.xml' }
]}, {
]
}, {
line: ' </connectionStrings>',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'delimiter.xml' },
{ startIndex: 4, type: 'tag.xml' },
{ startIndex: 21, type: 'delimiter.xml' }
]}, {
]
}, {
line: ' <system.web>',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'delimiter.xml' },
{ startIndex: 3, type: 'tag.xml' },
{ startIndex: 13, type: 'delimiter.xml' }
]}, {
]
}, {
line: ' <customErrors defaultRedirect="GenericError.htm"',
tokens: [
{ startIndex: 0, type: '' },
@ -402,7 +444,8 @@ testTokenization('xml', [
{ startIndex: 18, type: 'attribute.name.xml' },
{ startIndex: 33, type: '' },
{ startIndex: 34, type: 'attribute.value.xml' }
]}, {
]
}, {
line: ' mode="RemoteOnly" xdt:Transform="Replace">',
tokens: [
{ startIndex: 0, type: '' },
@ -414,7 +457,8 @@ testTokenization('xml', [
{ startIndex: 37, type: '' },
{ startIndex: 38, type: 'attribute.value.xml' },
{ startIndex: 47, type: 'delimiter.xml' }
]}, {
]
}, {
line: ' <error statusCode="500" redirect="InternalError.htm"/>',
tokens: [
{ startIndex: 0, type: '' },
@ -430,47 +474,55 @@ testTokenization('xml', [
{ startIndex: 39, type: 'attribute.value.xml' },
{ startIndex: 58, type: 'tag.xml' },
{ startIndex: 59, type: 'delimiter.xml' }
]}, {
]
}, {
line: ' </customErrors>',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'delimiter.xml' },
{ startIndex: 6, type: 'tag.xml' },
{ startIndex: 18, type: 'delimiter.xml' }
]}, {
]
}, {
line: ' </system.web>',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'delimiter.xml' },
{ startIndex: 4, type: 'tag.xml' },
{ startIndex: 14, type: 'delimiter.xml' }
]}, {
]
}, {
line: ' ',
tokens: [
{ startIndex: 0, type: '' }
]}, {
]
}, {
line: ' <!-- The stuff below was added for extra tokenizer testing -->',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'comment.xml' },
{ startIndex: 5, type: 'comment.content.xml' },
{ startIndex: 60, type: 'comment.xml' }
]}, {
]
}, {
line: ' <!-- A multi-line comment <with> </with>',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'comment.xml' },
{ startIndex: 5, type: 'comment.content.xml' }
]}, {
]
}, {
line: ' <tags>',
tokens: [
{ startIndex: 0, type: 'comment.content.xml' }
]}, {
]
}, {
line: ' -->',
tokens: [
{ startIndex: 0, type: 'comment.content.xml' },
{ startIndex: 5, type: 'comment.xml' }
]}, {
]
}, {
line: ' <!DOCTYPE another meta tag>',
tokens: [
{ startIndex: 0, type: '' },
@ -483,7 +535,8 @@ testTokenization('xml', [
{ startIndex: 23, type: '' },
{ startIndex: 24, type: 'attribute.name.xml' },
{ startIndex: 27, type: 'delimiter.xml' }
]}, {
]
}, {
line: ' <tools><![CDATA[Some text and tags <person/>]]></tools>',
tokens: [
{ startIndex: 0, type: '' },
@ -496,7 +549,8 @@ testTokenization('xml', [
{ startIndex: 48, type: 'delimiter.xml' },
{ startIndex: 50, type: 'tag.xml' },
{ startIndex: 55, type: 'delimiter.xml' }
]}, {
]
}, {
line: ' <aSelfClosingTag with="attribute" />',
tokens: [
{ startIndex: 0, type: '' },
@ -509,7 +563,8 @@ testTokenization('xml', [
{ startIndex: 34, type: '' },
{ startIndex: 35, type: 'tag.xml' },
{ startIndex: 36, type: 'delimiter.xml' }
]}, {
]
}, {
line: ' <aSelfClosingTag with="attribute"/>',
tokens: [
{ startIndex: 0, type: '' },
@ -521,7 +576,8 @@ testTokenization('xml', [
{ startIndex: 23, type: 'attribute.value.xml' },
{ startIndex: 34, type: 'tag.xml' },
{ startIndex: 35, type: 'delimiter.xml' }
]}, {
]
}, {
line: ' <namespace:aSelfClosingTag otherspace:with="attribute"/>',
tokens: [
{ startIndex: 0, type: '' },
@ -533,7 +589,8 @@ testTokenization('xml', [
{ startIndex: 44, type: 'attribute.value.xml' },
{ startIndex: 55, type: 'tag.xml' },
{ startIndex: 56, type: 'delimiter.xml' }
]}, {
]
}, {
line: ' <valid-name also_valid this.one=\'too is valid\'/>',
tokens: [
{ startIndex: 0, type: '' },
@ -547,7 +604,8 @@ testTokenization('xml', [
{ startIndex: 33, type: 'attribute.value.xml' },
{ startIndex: 47, type: 'tag.xml' },
{ startIndex: 48, type: 'delimiter.xml' }
]}, {
]
}, {
line: ' <aSimpleSelfClosingTag />',
tokens: [
{ startIndex: 0, type: '' },
@ -556,18 +614,21 @@ testTokenization('xml', [
{ startIndex: 23, type: '' },
{ startIndex: 24, type: 'tag.xml' },
{ startIndex: 25, type: 'delimiter.xml' }
]}, {
]
}, {
line: ' <aSimpleSelfClosingTag/>',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 1, type: 'delimiter.xml' },
{ startIndex: 2, type: 'tag.xml' },
{ startIndex: 24, type: 'delimiter.xml' }
]}, {
]
}, {
line: '</configuration>',
tokens: [
{ startIndex: 0, type: 'delimiter.xml' },
{ startIndex: 2, type: 'tag.xml' },
{ startIndex: 15, type: 'delimiter.xml' }
]}]
]
}]
]);