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

@ -8,14 +8,14 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
comments: {
lineComment: 'REM'
},
brackets: [
['{','}'],
['[',']'],
['(',')']
['{', '}'],
['[', ']'],
['(', ')']
],
autoClosingPairs: [
{ open: '{', close: '}' },
@ -30,7 +30,7 @@ export var conf:IRichLanguageConfiguration = {
]
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
ignoreCase: true,
tokenPostfix: '.bat',
@ -51,16 +51,16 @@ export var language = <ILanguage> {
tokenizer: {
root: [
[/^(\s*)(rem(?:\s.*|))$/, ['','comment']],
[/^(\s*)(rem(?:\s.*|))$/, ['', 'comment']],
[/(\@?)(@keywords)(?!\w)/, [{token:'keyword'}, {token:'keyword.$2'}]],
[/(\@?)(@keywords)(?!\w)/, [{ token: 'keyword' }, { token: 'keyword.$2' }]],
// whitespace
[/[ \t\r\n]+/, ''],
// blocks
[/setlocal(?!\w)/, 'keyword.tag-setlocal' ],
[/endlocal(?!\w)/, 'keyword.tag-setlocal' ],
[/setlocal(?!\w)/, 'keyword.tag-setlocal'],
[/endlocal(?!\w)/, 'keyword.tag-setlocal'],
// words
[/[a-zA-Z_]\w*/, ''],
@ -85,18 +85,27 @@ export var language = <ILanguage> {
[/[;,.]/, 'delimiter'],
// strings:
[/"/, 'string', '@string."' ],
[/"/, 'string', '@string."'],
[/'/, 'string', '@string.\''],
],
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

@ -8,16 +8,16 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#%\^\&\*\(\)\=\$\-\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
comments: {
blockComment: ['###', '###'],
lineComment: '#'
},
brackets: [
['{','}'],
['[',']'],
['(',')']
['{', '}'],
['[', ']'],
['(', ')']
],
autoClosingPairs: [
{ open: '{', close: '}' },
@ -33,22 +33,17 @@ 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> {
export var language = <ILanguage>{
defaultToken: '',
ignoreCase: true,
tokenPostfix: '.coffee',
brackets: [
{ open:'{', close:'}', token:'delimiter.curly'},
{ open:'[', close:']', token:'delimiter.square'},
{ open:'(', close:')', token:'delimiter.parenthesis'}
{ open: '{', close: '}', token: 'delimiter.curly' },
{ open: '[', close: ']', token: 'delimiter.square' },
{ open: '(', close: ')', token: 'delimiter.parenthesis' }
],
regEx: /\/(?!\/\/)(?:[^\/\\]|\\.)*\/[igm]*/,
@ -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,27 +143,42 @@ 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' } }],
[/[^#\\'"]+/,'string' ],
[/['"]+/,'string' ],
[/("""|''')/, {
cases: {
'$1==$S2': { token: 'string', next: '@pop' },
'@default': 'string'
}
}],
[/[^#\\'"]+/, 'string'],
[/['"]+/, 'string'],
[/@escapes/, 'string.escape'],
[/\./, 'string.escape.invalid'],
[/#{/, { token: 'string.quote', next: 'root.interpolatedstring' } ],
[/#{/, { token: 'string.quote', next: 'root.interpolatedstring' }],
[/#/, 'string']
],
comment: [
[/[^#]+/, 'comment', ],
[/[^#]+/, 'comment',],
[/###/, 'comment', '@pop'],
[/#/, 'comment' ],
[/#/, 'comment'],
],
hereregexp: [

View file

@ -8,15 +8,15 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
comments: {
lineComment: '//',
blockComment: ['/*', '*/'],
},
brackets: [
['{','}'],
['[',']'],
['(',')']
['{', '}'],
['[', ']'],
['(', ')']
],
autoClosingPairs: [
{ open: '[', close: ']' },
@ -34,7 +34,7 @@ export var conf:IRichLanguageConfiguration = {
]
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '.cpp',
@ -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'],
@ -276,39 +284,39 @@ export var language = <ILanguage> {
[/[;,.]/, 'delimiter'],
// strings
[/"([^"\\]|\\.)*$/, 'string.invalid' ], // non-teminated string
[/"/, 'string', '@string' ],
[/"([^"\\]|\\.)*$/, 'string.invalid'], // non-teminated string
[/"/, 'string', '@string'],
// characters
[/'[^\\']'/, 'string'],
[/(')(@escapes)(')/, ['string','string.escape','string']],
[/(')(@escapes)(')/, ['string', 'string.escape', 'string']],
[/'/, 'string.invalid']
],
whitespace: [
[/[ \t\r\n]+/, ''],
[/\/\*\*(?!\/)/, 'comment.doc', '@doccomment' ],
[/\/\*/, 'comment', '@comment' ],
[/\/\*\*(?!\/)/, 'comment.doc', '@doccomment'],
[/\/\*/, 'comment', '@comment'],
[/\/\/.*$/, 'comment'],
],
comment: [
[/[^\/*]+/, 'comment' ],
[/\*\//, 'comment', '@pop' ],
[/[\/*]/, 'comment' ]
[/[^\/*]+/, 'comment'],
[/\*\//, 'comment', '@pop'],
[/[\/*]/, 'comment']
],
//Identical copy of comment above, except for the addition of .doc
doccomment: [
[/[^\/*]+/, 'comment.doc' ],
[/\*\//, 'comment.doc', '@pop' ],
[/[\/*]/, 'comment.doc' ]
[/[^\/*]+/, 'comment.doc'],
[/\*\//, 'comment.doc', '@pop'],
[/[\/*]/, 'comment.doc']
],
string: [
[/[^\\"]+/, 'string'],
[/@escapes/, 'string.escape'],
[/\\./, 'string.escape.invalid'],
[/"/, 'string', '@pop' ]
[/"/, 'string', '@pop']
],
},
};

View file

@ -8,16 +8,16 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\#\$\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
comments: {
lineComment: '//',
blockComment: ['/*', '*/'],
},
brackets: [
['{','}'],
['[',']'],
['(',')'],
['{', '}'],
['[', ']'],
['(', ')'],
],
autoClosingPairs: [
{ open: '{', close: '}' },
@ -36,7 +36,7 @@ export var conf:IRichLanguageConfiguration = {
]
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '.cs',
@ -61,7 +61,7 @@ export var language = <ILanguage> {
'internal', 'private', 'abstract', 'sealed', 'static', 'struct', 'readonly',
'volatile', 'virtual', 'override', 'params', 'get', 'set', 'add', 'remove',
'operator', 'true', 'false', 'implicit', 'explicit', 'interface', 'enum',
'null', 'async', 'await','fixed','sizeof','stackalloc','unsafe', 'nameof',
'null', 'async', 'await', 'fixed', 'sizeof', 'stackalloc', 'unsafe', 'nameof',
'when'
],
@ -75,7 +75,7 @@ export var language = <ILanguage> {
operators: [
'=', '??', '||', '&&', '|', '^', '&', '==', '!=', '<=', '>=', '<<',
'+', '-', '*', '/', '%', '!', '~', '++', '--','+=',
'+', '-', '*', '/', '%', '!', '~', '++', '--', '+=',
'-=', '*=', '/=', '%=', '&=', '|=', '^=', '<<=', '>>=', '>>', '=>'
],
@ -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
@ -119,52 +128,54 @@ export var language = <ILanguage> {
[/[;,.]/, 'delimiter'],
// strings
[/"([^"\\]|\\.)*$/, 'string.invalid' ], // non-teminated string
[/"/, { token: 'string.quote', next: '@string' } ],
[/\$\@"/, { token: 'string.quote', next: '@litinterpstring' } ],
[/\@"/, { token: 'string.quote', next: '@litstring' } ],
[/\$"/, { token: 'string.quote', next: '@interpolatedstring' } ],
[/"([^"\\]|\\.)*$/, 'string.invalid'], // non-teminated string
[/"/, { token: 'string.quote', next: '@string' }],
[/\$\@"/, { token: 'string.quote', next: '@litinterpstring' }],
[/\@"/, { token: 'string.quote', next: '@litstring' }],
[/\$"/, { token: 'string.quote', next: '@interpolatedstring' }],
// characters
[/'[^\\']'/, 'string'],
[/(')(@escapes)(')/, ['string','string.escape','string']],
[/(')(@escapes)(')/, ['string', 'string.escape', 'string']],
[/'/, 'string.invalid']
],
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'],
['', '', '@pop'],
],
namespace: [
{ include: '@whitespace' },
[/[A-Z]\w*/, 'namespace'],
[/[\.=]/, 'delimiter'],
['','','@pop'],
['', '', '@pop'],
],
comment: [
[/[^\/*]+/, 'comment' ],
[/[^\/*]+/, 'comment'],
// [/\/\*/, 'comment', '@push' ], // no nested comments :-(
['\\*/', 'comment', '@pop' ],
[/[\/*]/, 'comment' ]
['\\*/', 'comment', '@pop'],
[/[\/*]/, 'comment']
],
string: [
[/[^\\"]+/, 'string'],
[/@escapes/, 'string.escape'],
[/\\./, 'string.escape.invalid'],
[/"/, { token: 'string.quote', next: '@pop' } ]
[/"/, { token: 'string.quote', next: '@pop' }]
],
litstring: [
[/[^"]+/, 'string'],
[/""/, 'string.escape'],
[/"/, { token: 'string.quote', next: '@pop' } ]
[/"/, { token: 'string.quote', next: '@pop' }]
],
litinterpstring: [
@ -172,8 +183,8 @@ export var language = <ILanguage> {
[/""/, 'string.escape'],
[/{{/, 'string.escape'],
[/}}/, 'string.escape'],
[/{/, { token: 'string.quote', next: 'root.litinterpstring' } ],
[/"/, { token: 'string.quote', next: '@pop' } ]
[/{/, { token: 'string.quote', next: 'root.litinterpstring' }],
[/"/, { token: 'string.quote', next: '@pop' }]
],
interpolatedstring: [
@ -182,15 +193,15 @@ export var language = <ILanguage> {
[/\\./, 'string.escape.invalid'],
[/{{/, 'string.escape'],
[/}}/, 'string.escape'],
[/{/, { token: 'string.quote', next: 'root.interpolatedstring' } ],
[/"/, { token: 'string.quote', next: '@pop' } ]
[/{/, { token: 'string.quote', next: 'root.interpolatedstring' }],
[/"/, { token: 'string.quote', next: '@pop' }]
],
whitespace: [
[/^[ \t\v\f]*#((r)|(load))(?=\s)/, 'directive.csx' ],
[/^[ \t\v\f]*#\w.*$/, 'namespace.cpp' ],
[/^[ \t\v\f]*#((r)|(load))(?=\s)/, 'directive.csx'],
[/^[ \t\v\f]*#\w.*$/, 'namespace.cpp'],
[/[ \t\v\f\r\n]+/, ''],
[/\/\*/, 'comment', '@comment' ],
[/\/\*/, 'comment', '@comment'],
[/\/\/.*$/, 'comment'],
],
},

View file

@ -8,7 +8,7 @@
import LanguageConfiguration = monaco.languages.LanguageConfiguration;
import IMonarchLanguage = monaco.languages.IMonarchLanguage;
export var conf:LanguageConfiguration = {
export var conf: LanguageConfiguration = {
wordPattern: /(#?-?\d*\.\d\w*%?)|((::|[@#.!:])?[\w-?]+%?)|::|[@#.!:]/g,
comments: {
@ -44,7 +44,7 @@ const TOKEN_PROPERTY = 'attribute.name';
const TOKEN_VALUE = 'attribute.value';
const TOKEN_AT_KEYWORD = 'keyword';
export var language = <IMonarchLanguage> {
export var language = <IMonarchLanguage>{
defaultToken: '',
tokenPostfix: '.css',
@ -70,8 +70,8 @@ export var language = <IMonarchLanguage> {
['[@](keyframes|-webkit-keyframes|-moz-keyframes|-o-keyframes)', { token: TOKEN_AT_KEYWORD, next: '@keyframedeclaration' }],
['[@](page|content|font-face|-moz-document)', { token: TOKEN_AT_KEYWORD }],
['[@](charset|namespace)', { token: TOKEN_AT_KEYWORD, next: '@declarationbody' }],
['(url-prefix)(\\()', ['attribute.value', { token: 'delimiter.parenthesis', next: '@urldeclaration' }] ],
['(url)(\\()', ['attribute.value', { token: 'delimiter.parenthesis', next: '@urldeclaration' }] ],
['(url-prefix)(\\()', ['attribute.value', { token: 'delimiter.parenthesis', next: '@urldeclaration' }]],
['(url)(\\()', ['attribute.value', { token: 'delimiter.parenthesis', next: '@urldeclaration' }]],
{ include: '@selectorname' },
['[\\*]', TOKEN_SELECTOR_TAG], // selector symbols
['[>\\+,]', 'delimiter'], // selector operators
@ -96,8 +96,8 @@ export var language = <IMonarchLanguage> {
term: [
{ include: '@comments' },
['(url-prefix)(\\()', ['attribute.value', { token: 'delimiter.parenthesis', next: '@urldeclaration' }] ],
['(url)(\\()', ['attribute.value', { token: 'delimiter.parenthesis', next: '@urldeclaration' }] ],
['(url-prefix)(\\()', ['attribute.value', { token: 'delimiter.parenthesis', next: '@urldeclaration' }]],
['(url)(\\()', ['attribute.value', { token: 'delimiter.parenthesis', next: '@urldeclaration' }]],
{ include: '@functioninvocation' },
{ include: '@numbers' },
{ include: '@name' },

View file

@ -8,11 +8,11 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
brackets: [
['{','}'],
['[',']'],
['(',')']
['{', '}'],
['[', ']'],
['(', ')']
],
autoClosingPairs: [
{ open: '{', close: '}' },
@ -40,7 +40,7 @@ export var language = <ILanguage>{
variableAfter: /ENV/,
variable:/\${?[\w]+}?/,
variable: /\${?[\w]+}?/,
tokenizer: {
root: [
@ -52,7 +52,7 @@ export var language = <ILanguage>{
],
instructions: [
[/(@variableAfter)(\s+)([\w]+)/, ['keyword', '',{token:'variable', next:'@arguments'}]],
[/(@variableAfter)(\s+)([\w]+)/, ['keyword', '', { token: 'variable', next: '@arguments' }]],
[/(@instructions)/, 'keyword', '@arguments']
],
@ -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,23 +102,33 @@ 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'],
[/'/, 'string', '@pop'],
[/(@variable)/, 'variable' ],
[/(@variable)/, 'variable'],
[/\\$/, 'string'],
[/$/, 'string', '@popall']
],
dblStringBody: [
[/[^\\\$"]/, { cases: { '@eos': {token:'string', next:'@popall'}, '@default': 'string' }}],
[/[^\\\$"]/, {
cases: {
'@eos': { token: 'string', next: '@popall' },
'@default': 'string'
}
}],
[/\\./, 'string.escape'],
[/"$/, 'string', '@popall'],
[/"/, 'string', '@pop'],
[/(@variable)/, 'variable' ],
[/(@variable)/, 'variable'],
[/\\$/, 'string'],
[/$/, 'string', '@popall']

View file

@ -8,15 +8,15 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
comments: {
lineComment: '//',
blockComment: ['(*', '*)'],
},
brackets: [
['{','}'],
['[',']'],
['(',')']
['{', '}'],
['[', ']'],
['(', ')']
],
autoClosingPairs: [
{ open: '{', close: '}' },
@ -33,7 +33,7 @@ export var conf:IRichLanguageConfiguration = {
]
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '.fs',
@ -43,15 +43,15 @@ export var language = <ILanguage> {
'break', 'checked', 'component',
'const', 'constraint', 'constructor',
'continue', 'class', 'default',
'delegate','do', 'done', 'downcast',
'delegate', 'do', 'done', 'downcast',
'downto', 'elif', 'else', 'end',
'exception', 'eager', 'event', 'external',
'extern', 'false', 'finally', 'for',
'fun', 'function', 'fixed', 'functor',
'global', 'if', 'in', 'include', 'inherit',
'inline', 'interface', 'internal', 'land',
'lor', 'lsl','lsr', 'lxor', 'lazy', 'let',
'match', 'member','mod','module', 'mutable',
'lor', 'lsl', 'lsr', 'lxor', 'lazy', 'let',
'match', 'member', 'mod', 'module', 'mutable',
'namespace', 'method', 'mixin', 'new', 'not',
'null', 'of', 'open', 'or', 'object',
'override', 'private', 'parallel', 'process',
@ -60,7 +60,7 @@ export var language = <ILanguage> {
'to', 'true', 'tailcall', 'trait',
'try', 'type', 'upcast', 'use',
'val', 'void', 'virtual', 'volatile',
'when', 'while','with', 'yield'
'when', 'while', 'with', 'yield'
],
// we include these common regular expressions
@ -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' },
@ -88,7 +92,7 @@ export var language = <ILanguage> {
// delimiters and operators
[/[{}()\[\]]/, '@brackets'],
[/[<>](?!@symbols)/, '@brackets'],
[/@symbols/, 'delimiter' ],
[/@symbols/, 'delimiter'],
// numbers
[/\d*\d+[eE]([\-+]?\d+)?(@floatsuffix)/, 'number.float'],
@ -102,43 +106,47 @@ export var language = <ILanguage> {
[/[;,.]/, 'delimiter'],
// strings
[/"([^"\\]|\\.)*$/, 'string.invalid' ], // non-teminated string
[/"([^"\\]|\\.)*$/, 'string.invalid'], // non-teminated string
[/"""/, 'string', '@string."""'],
[/"/, 'string', '@string."' ],
[/"/, 'string', '@string."'],
// literal string
[/\@"/, { token: 'string.quote', next: '@litstring' }],
// characters
[/'[^\\']'B?/, 'string'],
[/(')(@escapes)(')/, ['string','string.escape','string']],
[/(')(@escapes)(')/, ['string', 'string.escape', 'string']],
[/'/, 'string.invalid']
],
whitespace: [
[/[ \t\r\n]+/, ''],
[/\(\*/, 'comment', '@comment' ],
[/\(\*/, 'comment', '@comment'],
[/\/\/.*$/, 'comment'],
],
comment: [
[/[^\*]+/, 'comment' ],
[/\*\)/, 'comment', '@pop' ],
[/\*/, 'comment' ]
[/[^\*]+/, 'comment'],
[/\*\)/, 'comment', '@pop'],
[/\*/, 'comment']
],
string: [
[/[^\\"]+/, '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: [
[/[^"]+/, 'string'],
[/""/, 'string.escape'],
[/"/, { token: 'string.quote', next: '@pop' } ]
[/"/, { token: 'string.quote', next: '@pop' }]
],
},
};

View file

@ -8,15 +8,15 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
comments: {
lineComment: '//',
blockComment: ['/*', '*/'],
},
brackets: [
['{','}'],
['[',']'],
['(',')']
['{', '}'],
['[', ']'],
['(', ')']
],
autoClosingPairs: [
{ open: '{', close: '}' },
@ -36,7 +36,7 @@ export var conf:IRichLanguageConfiguration = {
]
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '.go',
@ -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'],
@ -138,44 +146,44 @@ export var language = <ILanguage> {
[/[;,.]/, 'delimiter'],
// strings
[/"([^"\\]|\\.)*$/, 'string.invalid' ], // non-teminated string
[/"/, 'string', '@string' ],
[/"([^"\\]|\\.)*$/, 'string.invalid'], // non-teminated string
[/"/, 'string', '@string'],
[/`/, "string", "@rawstring"],
// characters
[/'[^\\']'/, 'string'],
[/(')(@escapes)(')/, ['string','string.escape','string']],
[/(')(@escapes)(')/, ['string', 'string.escape', 'string']],
[/'/, 'string.invalid']
],
whitespace: [
[/[ \t\r\n]+/, ''],
[/\/\*\*(?!\/)/, 'comment.doc', '@doccomment' ],
[/\/\*/, 'comment', '@comment' ],
[/\/\*\*(?!\/)/, 'comment.doc', '@doccomment'],
[/\/\*/, 'comment', '@comment'],
[/\/\/.*$/, 'comment'],
],
comment: [
[/[^\/*]+/, 'comment' ],
[/[^\/*]+/, 'comment'],
// [/\/\*/, 'comment', '@push' ], // nested comment not allowed :-(
// [/\/\*/, 'comment.invalid' ], // this breaks block comments in the shape of /* //*/
[/\*\//, 'comment', '@pop' ],
[/[\/*]/, 'comment' ]
[/\*\//, 'comment', '@pop'],
[/[\/*]/, 'comment']
],
//Identical copy of comment above, except for the addition of .doc
doccomment: [
[/[^\/*]+/, 'comment.doc' ],
[/[^\/*]+/, 'comment.doc'],
// [/\/\*/, 'comment.doc', '@push' ], // nested comment not allowed :-(
[/\/\*/, 'comment.doc.invalid' ],
[/\*\//, 'comment.doc', '@pop' ],
[/[\/*]/, 'comment.doc' ]
[/\/\*/, 'comment.doc.invalid'],
[/\*\//, 'comment.doc', '@pop'],
[/[\/*]/, 'comment.doc']
],
string: [
[/[^\\"]+/, 'string'],
[/@escapes/, 'string.escape'],
[/\\./, 'string.escape.invalid'],
[/"/, 'string', '@pop' ]
[/"/, 'string', '@pop']
],
rawstring: [

View file

@ -11,9 +11,9 @@ import ILanguage = monaco.languages.IMonarchLanguage;
// Allow for running under nodejs/requirejs in tests
var _monaco: typeof monaco = (typeof monaco === 'undefined' ? (<any>self).monaco : monaco);
const EMPTY_ELEMENTS:string[] = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'];
const EMPTY_ELEMENTS: string[] = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'];
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
comments: {
@ -65,7 +65,7 @@ export const htmlTokenTypes = {
}
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '',
// ignoreCase: true,
@ -77,9 +77,9 @@ export var language = <ILanguage> {
[/<!DOCTYPE/, 'metatag.html', '@doctype'],
[/<!--/, 'comment.html', '@comment'],
[/(<)(\w+)(\/>)/, [htmlTokenTypes.DELIM_START, 'tag.html', htmlTokenTypes.DELIM_END]],
[/(<)(script)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@script'} ]],
[/(<)(style)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@style'} ]],
[/(<)([:\w]+)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@otherTag'} ]],
[/(<)(script)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@script' }]],
[/(<)(style)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@style' }]],
[/(<)([:\w]+)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@otherTag' }]],
[/(<\/)(\w+)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@otherTag' }]],
[/</, htmlTokenTypes.DELIM_START],
[/\{/, htmlTokenTypes.DELIM_START],
@ -88,8 +88,8 @@ export var language = <ILanguage> {
doctype: [
[/\{\{/, { token: '@rematch', switchTo: '@handlebarsInSimpleState.comment' }],
[/[^>]+/, 'metatag.content.html' ],
[/>/, 'metatag.html', '@pop' ],
[/[^>]+/, 'metatag.content.html'],
[/>/, 'metatag.html', '@pop'],
],
comment: [
@ -119,15 +119,15 @@ export var language = <ILanguage> {
[/'([^']*)'/, 'attribute.value'],
[/[\w\-]+/, 'attribute.name'],
[/=/, 'delimiter'],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.text/javascript', nextEmbedded: 'text/javascript'} ],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.text/javascript', nextEmbedded: 'text/javascript' }],
[/[ \t\r\n]+/], // whitespace
[/(<\/)(script\s*)(>)/, [ htmlTokenTypes.DELIM_START, 'tag.html', { token: htmlTokenTypes.DELIM_END, next: '@pop' } ]]
[/(<\/)(script\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag.html', { token: htmlTokenTypes.DELIM_END, next: '@pop' }]]
],
// After <script ... type
scriptAfterType: [
[/\{\{/, { token: '@rematch', switchTo: '@handlebarsInSimpleState.scriptAfterType' }],
[/=/,'delimiter', '@scriptAfterTypeEquals'],
[/=/, 'delimiter', '@scriptAfterTypeEquals'],
[/[ \t\r\n]+/], // whitespace
[/<\/script\s*>/, { token: '@rematch', next: '@pop' }]
],
@ -135,8 +135,8 @@ export var language = <ILanguage> {
// After <script ... type =
scriptAfterTypeEquals: [
[/\{\{/, { token: '@rematch', switchTo: '@handlebarsInSimpleState.scriptAfterTypeEquals' }],
[/"([^"]*)"/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' } ],
[/'([^']*)'/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' } ],
[/"([^"]*)"/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' }],
[/'([^']*)'/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' }],
[/[ \t\r\n]+/], // whitespace
[/<\/script\s*>/, { token: '@rematch', next: '@pop' }]
],
@ -144,7 +144,7 @@ export var language = <ILanguage> {
// After <script ... type = $S2
scriptWithCustomType: [
[/\{\{/, { token: '@rematch', switchTo: '@handlebarsInSimpleState.scriptWithCustomType.$S2' }],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.$S2', nextEmbedded: '$S2'}],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.$S2', nextEmbedded: '$S2' }],
[/"([^"]*)"/, 'attribute.value'],
[/'([^']*)'/, 'attribute.value'],
[/[\w\-]+/, 'attribute.name'],
@ -171,15 +171,15 @@ export var language = <ILanguage> {
[/'([^']*)'/, 'attribute.value'],
[/[\w\-]+/, 'attribute.name'],
[/=/, 'delimiter'],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.text/css', nextEmbedded: 'text/css'} ],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.text/css', nextEmbedded: 'text/css' }],
[/[ \t\r\n]+/], // whitespace
[/(<\/)(style\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag.html', { token: htmlTokenTypes.DELIM_END, next: '@pop' } ]]
[/(<\/)(style\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag.html', { token: htmlTokenTypes.DELIM_END, next: '@pop' }]]
],
// After <style ... type
styleAfterType: [
[/\{\{/, { token: '@rematch', switchTo: '@handlebarsInSimpleState.styleAfterType' }],
[/=/,'delimiter', '@styleAfterTypeEquals'],
[/=/, 'delimiter', '@styleAfterTypeEquals'],
[/[ \t\r\n]+/], // whitespace
[/<\/style\s*>/, { token: '@rematch', next: '@pop' }]
],
@ -187,8 +187,8 @@ export var language = <ILanguage> {
// After <style ... type =
styleAfterTypeEquals: [
[/\{\{/, { token: '@rematch', switchTo: '@handlebarsInSimpleState.styleAfterTypeEquals' }],
[/"([^"]*)"/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' } ],
[/'([^']*)'/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' } ],
[/"([^"]*)"/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' }],
[/'([^']*)'/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' }],
[/[ \t\r\n]+/], // whitespace
[/<\/style\s*>/, { token: '@rematch', next: '@pop' }]
],
@ -196,7 +196,7 @@ export var language = <ILanguage> {
// After <style ... type = $S2
styleWithCustomType: [
[/\{\{/, { token: '@rematch', switchTo: '@handlebarsInSimpleState.styleWithCustomType.$S2' }],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.$S2', nextEmbedded: '$S2'}],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.$S2', nextEmbedded: '$S2' }],
[/"([^"]*)"/, 'attribute.value'],
[/'([^']*)'/, 'attribute.value'],
[/[\w\-]+/, 'attribute.name'],

View file

@ -11,9 +11,9 @@ import ILanguage = monaco.languages.IMonarchLanguage;
// Allow for running under nodejs/requirejs in tests
var _monaco: typeof monaco = (typeof monaco === 'undefined' ? (<any>self).monaco : monaco);
const EMPTY_ELEMENTS:string[] = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'];
const EMPTY_ELEMENTS: string[] = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'];
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
comments: {
@ -66,7 +66,7 @@ export const htmlTokenTypes = {
}
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '.html',
ignoreCase: true,
@ -77,8 +77,8 @@ export var language = <ILanguage> {
[/<!DOCTYPE/, 'metatag', '@doctype'],
[/<!--/, 'comment', '@comment'],
[/(<)((?:[\w\-]+:)?[\w\-]+)(\s*)(\/>)/, [htmlTokenTypes.DELIM_START, 'tag', '', htmlTokenTypes.DELIM_END]],
[/(<)(script)/, [htmlTokenTypes.DELIM_START, { token: 'tag', next: '@script'} ]],
[/(<)(style)/, [htmlTokenTypes.DELIM_START, { token: 'tag', next: '@style'} ]],
[/(<)(script)/, [htmlTokenTypes.DELIM_START, { token: 'tag', next: '@script' }]],
[/(<)(style)/, [htmlTokenTypes.DELIM_START, { token: 'tag', next: '@style' }]],
[/(<)((?:[\w\-]+:)?[\w\-]+)/, [htmlTokenTypes.DELIM_START, { token: 'tag', next: '@otherTag' }]],
[/(<\/)((?:[\w\-]+:)?[\w\-]+)/, [htmlTokenTypes.DELIM_START, { token: 'tag', next: '@otherTag' }]],
[/</, htmlTokenTypes.DELIM_START],
@ -86,8 +86,8 @@ export var language = <ILanguage> {
],
doctype: [
[/[^>]+/, 'metatag.content' ],
[/>/, 'metatag', '@pop' ],
[/[^>]+/, 'metatag.content'],
[/>/, 'metatag', '@pop'],
],
comment: [
@ -114,29 +114,29 @@ export var language = <ILanguage> {
[/'([^']*)'/, 'attribute.value'],
[/[\w\-]+/, 'attribute.name'],
[/=/, 'delimiter'],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded', nextEmbedded: 'text/javascript'} ],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded', nextEmbedded: 'text/javascript' }],
[/[ \t\r\n]+/], // whitespace
[/(<\/)(script\s*)(>)/, [ htmlTokenTypes.DELIM_START, 'tag', { token: htmlTokenTypes.DELIM_END, next: '@pop' } ]]
[/(<\/)(script\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag', { token: htmlTokenTypes.DELIM_END, next: '@pop' }]]
],
// After <script ... type
scriptAfterType: [
[/=/,'delimiter', '@scriptAfterTypeEquals'],
[/=/, 'delimiter', '@scriptAfterTypeEquals'],
[/[ \t\r\n]+/], // whitespace
[/<\/script\s*>/, { token: '@rematch', next: '@pop' }]
],
// After <script ... type =
scriptAfterTypeEquals: [
[/"([^"]*)"/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' } ],
[/'([^']*)'/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' } ],
[/"([^"]*)"/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' }],
[/'([^']*)'/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' }],
[/[ \t\r\n]+/], // whitespace
[/<\/script\s*>/, { token: '@rematch', next: '@pop' }]
],
// After <script ... type = $S2
scriptWithCustomType: [
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.$S2', nextEmbedded: '$S2'}],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.$S2', nextEmbedded: '$S2' }],
[/"([^"]*)"/, 'attribute.value'],
[/'([^']*)'/, 'attribute.value'],
[/[\w\-]+/, 'attribute.name'],
@ -162,29 +162,29 @@ export var language = <ILanguage> {
[/'([^']*)'/, 'attribute.value'],
[/[\w\-]+/, 'attribute.name'],
[/=/, 'delimiter'],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded', nextEmbedded: 'text/css'} ],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded', nextEmbedded: 'text/css' }],
[/[ \t\r\n]+/], // whitespace
[/(<\/)(style\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag', { token: htmlTokenTypes.DELIM_END, next: '@pop' } ]]
[/(<\/)(style\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag', { token: htmlTokenTypes.DELIM_END, next: '@pop' }]]
],
// After <style ... type
styleAfterType: [
[/=/,'delimiter', '@styleAfterTypeEquals'],
[/=/, 'delimiter', '@styleAfterTypeEquals'],
[/[ \t\r\n]+/], // whitespace
[/<\/style\s*>/, { token: '@rematch', next: '@pop' }]
],
// After <style ... type =
styleAfterTypeEquals: [
[/"([^"]*)"/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' } ],
[/'([^']*)'/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' } ],
[/"([^"]*)"/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' }],
[/'([^']*)'/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' }],
[/[ \t\r\n]+/], // whitespace
[/<\/style\s*>/, { token: '@rematch', next: '@pop' }]
],
// After <style ... type = $S2
styleWithCustomType: [
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.$S2', nextEmbedded: '$S2'}],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.$S2', nextEmbedded: '$S2' }],
[/"([^"]*)"/, 'attribute.value'],
[/'([^']*)'/, 'attribute.value'],
[/[\w\-]+/, 'attribute.name'],

View file

@ -8,14 +8,14 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
comments: {
lineComment: '#'
},
brackets: [
['{','}'],
['[',']'],
['(',')'],
['{', '}'],
['[', ']'],
['(', ')'],
],
autoClosingPairs: [
{ open: '{', close: '}' },
@ -33,7 +33,7 @@ export var conf:IRichLanguageConfiguration = {
]
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '.ini',
@ -57,9 +57,9 @@ export var language = <ILanguage> {
[/\d+/, 'number'],
// strings: recover on non-terminated strings
[/"([^"\\]|\\.)*$/, 'string.invalid' ], // non-teminated string
[/'([^'\\]|\\.)*$/, 'string.invalid' ], // non-teminated string
[/"/, 'string', '@string."' ],
[/"([^"\\]|\\.)*$/, 'string.invalid'], // non-teminated string
[/'([^'\\]|\\.)*$/, 'string.invalid'], // non-teminated string
[/"/, 'string', '@string."'],
[/'/, 'string', '@string.\''],
],
@ -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

@ -8,11 +8,11 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
comments: {
lineComment: '//'
},
brackets: [['{','}'], ['[',']'], ['(',')']],
brackets: [['{', '}'], ['[', ']'], ['(', ')']],
autoClosingPairs: [
{ open: '"', close: '"', notIn: ['string', 'comment'] },
{ open: '\'', close: '\'', notIn: ['string', 'comment'] },
@ -22,19 +22,19 @@ export var conf:IRichLanguageConfiguration = {
]
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '.jade',
ignoreCase: true,
brackets: [
{ token:'delimiter.curly', open: '{', close: '}' },
{ token:'delimiter.array', open: '[', close: ']' },
{ token:'delimiter.parenthesis', open: '(', close: ')' }
{ token: 'delimiter.curly', open: '{', close: '}' },
{ token: 'delimiter.array', open: '[', close: ']' },
{ token: 'delimiter.parenthesis', open: '(', close: ')' }
],
keywords: [ 'append', 'block', 'case', 'default', 'doctype', 'each', 'else', 'extends',
keywords: ['append', 'block', 'case', 'default', 'doctype', 'each', 'else', 'extends',
'for', 'if', 'in', 'include', 'mixin', 'typeof', 'unless', 'var', 'when'],
tags: [
@ -70,26 +70,48 @@ 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' }, ] } },
'$2@keywords': [ '', { token: 'keyword.$2'}, ],
'@default': [ '', '', ]}}
{
cases: {
'$2@tags': {
cases: {
'@eos': ['', 'tag'],
'@default': ['', { token: 'tag', next: '@tag.$1' },]
}
},
'$2@keywords': ['', { token: 'keyword.$2' },],
'@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*)(\|.*)$/, '' ],
[/^(\s*)(\|.*)$/, ''],
{ 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'],
@ -100,80 +122,138 @@ export var language = <ILanguage> {
[/\d+/, 'number'],
// strings:
[/"/, 'string', '@string."' ],
[/"/, 'string', '@string."'],
[/'/, 'string', '@string.\''],
],
tag: [
[/(\.)(\s*$)/, [ {token: 'delimiter', next:'@blockText.$S2.'}, '']],
[/(\.)(\s*$)/, [{ token: 'delimiter', next: '@blockText.$S2.' }, '']],
[/\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' }],
],
simpleText: [
[/[^#]+$/, {token: '', next: '@popall'}],
[/[^#]+/, {token: ''}],
[/[^#]+$/, { token: '', next: '@popall' }],
[/[^#]+/, { 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' }],
[/#/, '']
],
attributeList: [
[/\s+/, '' ],
[/(\w+)(\s*=\s*)("|')/, ['attribute.name', 'delimiter', { token: 'attribute.value', next:'@value.$3'}]],
[/\s+/, ''],
[/(\w+)(\s*=\s*)("|')/, ['attribute.name', 'delimiter', { token: 'attribute.value', next: '@value.$3' }]],
[/\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' }],
],
whitespace: [
[/^(\s*)(\/\/.*)$/, { token: 'comment', next: '@blockText.$1.comment' } ],
[/^(\s*)(\/\/.*)$/, { token: 'comment', next: '@blockText.$1.comment' }],
[/[ \t\r\n]+/, ''],
[/<!--/, { token: 'comment', next: '@comment' }],
],
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' }]
],
comment: [
[/[^<\-]+/, 'comment.content' ],
[/-->/, { token: 'comment', next: '@pop' } ],
[/[^<\-]+/, 'comment.content'],
[/-->/, { token: 'comment', next: '@pop' }],
[/<!--/, 'comment.content.invalid'],
[/[<\-]/, 'comment.content' ]
[/[<\-]/, 'comment.content']
],
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

@ -8,7 +8,7 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
// the default separators except `@$`
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
comments: {
@ -16,9 +16,9 @@ export var conf:IRichLanguageConfiguration = {
blockComment: ['/*', '*/'],
},
brackets: [
['{','}'],
['[',']'],
['(',')'],
['{', '}'],
['[', ']'],
['(', ')'],
],
autoClosingPairs: [
{ open: '{', close: '}' },
@ -37,7 +37,7 @@ export var conf:IRichLanguageConfiguration = {
]
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '.java',
@ -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'],
@ -99,43 +107,43 @@ export var language = <ILanguage> {
[/[;,.]/, 'delimiter'],
// strings
[/"([^"\\]|\\.)*$/, 'string.invalid' ], // non-teminated string
[/"/, 'string', '@string' ],
[/"([^"\\]|\\.)*$/, 'string.invalid'], // non-teminated string
[/"/, 'string', '@string'],
// characters
[/'[^\\']'/, 'string'],
[/(')(@escapes)(')/, ['string','string.escape','string']],
[/(')(@escapes)(')/, ['string', 'string.escape', 'string']],
[/'/, 'string.invalid']
],
whitespace: [
[/[ \t\r\n]+/, ''],
[/\/\*\*(?!\/)/, 'comment.doc', '@javadoc' ],
[/\/\*/, 'comment', '@comment' ],
[/\/\*\*(?!\/)/, 'comment.doc', '@javadoc'],
[/\/\*/, 'comment', '@comment'],
[/\/\/.*$/, 'comment'],
],
comment: [
[/[^\/*]+/, 'comment' ],
[/[^\/*]+/, 'comment'],
// [/\/\*/, 'comment', '@push' ], // nested comment not allowed :-(
// [/\/\*/, 'comment.invalid' ], // this breaks block comments in the shape of /* //*/
[/\*\//, 'comment', '@pop' ],
[/[\/*]/, 'comment' ]
[/\*\//, 'comment', '@pop'],
[/[\/*]/, 'comment']
],
//Identical copy of comment above, except for the addition of .doc
javadoc: [
[/[^\/*]+/, 'comment.doc' ],
[/[^\/*]+/, 'comment.doc'],
// [/\/\*/, 'comment.doc', '@push' ], // nested comment not allowed :-(
[/\/\*/, 'comment.doc.invalid' ],
[/\*\//, 'comment.doc', '@pop' ],
[/[\/*]/, 'comment.doc' ]
[/\/\*/, 'comment.doc.invalid'],
[/\*\//, 'comment.doc', '@pop'],
[/[\/*]/, 'comment.doc']
],
string: [
[/[^\\"]+/, 'string'],
[/@escapes/, 'string.escape'],
[/\\./, 'string.escape.invalid'],
[/"/, 'string', '@pop' ]
[/"/, 'string', '@pop']
],
},
};

View file

@ -41,7 +41,7 @@ const TOKEN_PROPERTY = 'attribute.name';
const TOKEN_VALUE = 'attribute.value';
const TOKEN_AT_KEYWORD = 'keyword.control.at-rule';
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '.less',
@ -67,7 +67,7 @@ export var language = <ILanguage> {
{ include: '@numbers' },
['[*_]?[a-zA-Z\\-\\s]+(?=:.*(;|(\\\\$)))', TOKEN_PROPERTY, '@attribute'],
['url(\\-prefix)?\\(', { token: 'tag', next: '@urldeclaration'}],
['url(\\-prefix)?\\(', { token: 'tag', next: '@urldeclaration' }],
['[{}()\\[\\]]', '@brackets'],
['[,:;]', 'delimiter'],
@ -104,9 +104,9 @@ export var language = <ILanguage> {
],
urldeclaration: [
{ include: '@strings'},
[ '[^)\r\n]+', 'string' ],
['\\)', { token: 'tag', next: '@pop'}],
{ include: '@strings' },
['[^)\r\n]+', 'string'],
['\\)', { token: 'tag', next: '@pop' }],
],
attribute: <any[]>[

View file

@ -8,15 +8,15 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
comments: {
lineComment: '--',
blockComment: ['--[[', ']]'],
},
brackets: [
['{','}'],
['[',']'],
['(',')']
['{', '}'],
['[', ']'],
['(', ')']
],
autoClosingPairs: [
{ open: '{', close: '}' },
@ -34,7 +34,7 @@ export var conf:IRichLanguageConfiguration = {
]
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '.lua',
@ -47,9 +47,9 @@ export var language = <ILanguage> {
],
brackets: [
{ token: 'delimiter.bracket', open: '{', close: '}'},
{ token: 'delimiter.array', open: '[', close: ']'},
{ token: 'delimiter.parenthesis', open: '(', close: ')'}
{ token: 'delimiter.bracket', open: '{', close: '}' },
{ token: 'delimiter.array', open: '[', close: ']' },
{ token: 'delimiter.parenthesis', open: '(', close: ')' }
],
operators: [
@ -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'],
@ -88,30 +96,39 @@ export var language = <ILanguage> {
[/[;,.]/, 'delimiter'],
// strings: recover on non-terminated strings
[/"([^"\\]|\\.)*$/, 'string.invalid' ], // non-teminated string
[/'([^'\\]|\\.)*$/, 'string.invalid' ], // non-teminated string
[/"/, 'string', '@string."' ],
[/"([^"\\]|\\.)*$/, 'string.invalid'], // non-teminated string
[/'([^'\\]|\\.)*$/, 'string.invalid'], // non-teminated string
[/"/, 'string', '@string."'],
[/'/, 'string', '@string.\''],
],
whitespace: [
[/[ \t\r\n]+/, ''],
[/--\[([=]*)\[/, 'comment', '@comment.$1' ],
[/--\[([=]*)\[/, 'comment', '@comment.$1'],
[/--.*$/, 'comment'],
],
comment: [
[/[^\]]+/, 'comment'],
[/\]([=]*)\]/, { cases: { '$1==$S2': { token: 'comment', next: '@pop' }, '@default' : 'comment' } } ],
[/./, 'comment' ]
[/\]([=]*)\]/, {
cases: {
'$1==$S2': { token: 'comment', next: '@pop' },
'@default': 'comment'
}
}],
[/./, 'comment']
],
string: [
[/[^\\"']+/, '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

@ -38,7 +38,7 @@ export var conf: IRichLanguageConfiguration = {
{ open: '{', close: '}' },
{ open: '[', close: ']' },
{ open: '(', close: ')' },
{ open: '<', close: '>', notIn: [ 'string' ] }
{ open: '<', close: '>', notIn: ['string'] }
],
surroundingPairs: [
{ open: '(', close: ')' },

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
declare var require:<T>(moduleId:[string], callback:(module:T)=>void, error:(err:any)=>void)=>void;
declare var require: <T>(moduleId: [string], callback: (module: T) => void, error: (err: any) => void) => void;
// Allow for running under nodejs/requirejs in tests
var _monaco: typeof monaco = (typeof monaco === 'undefined' ? (<any>self).monaco : monaco);
@ -18,9 +18,9 @@ interface ILangImpl {
language: monaco.languages.IMonarchLanguage;
}
let languageDefinitions:{[languageId:string]:ILang} = {};
let languageDefinitions: { [languageId: string]: ILang } = {};
function _loadLanguage(languageId:string): monaco.Promise<void> {
function _loadLanguage(languageId: string): monaco.Promise<void> {
let module = languageDefinitions[languageId].module;
return new _monaco.Promise<void>((c, e, p) => {
require<ILangImpl>([module], (mod) => {
@ -31,16 +31,16 @@ function _loadLanguage(languageId:string): monaco.Promise<void> {
});
}
let languagePromises:{[languageId:string]: monaco.Promise<void>} = {};
let languagePromises: { [languageId: string]: monaco.Promise<void> } = {};
export function loadLanguage(languageId:string): monaco.Promise<void> {
export function loadLanguage(languageId: string): monaco.Promise<void> {
if (!languagePromises[languageId]) {
languagePromises[languageId] = _loadLanguage(languageId);
}
return languagePromises[languageId];
}
function registerLanguage(def:ILang): void {
function registerLanguage(def: ILang): void {
let languageId = def.id;
languageDefinitions[languageId] = def;
@ -53,52 +53,52 @@ function registerLanguage(def:ILang): void {
registerLanguage({
id: 'bat',
extensions: [ '.bat', '.cmd'],
aliases: [ 'Batch', 'bat' ],
extensions: ['.bat', '.cmd'],
aliases: ['Batch', 'bat'],
module: './bat'
});
registerLanguage({
id: 'coffeescript',
extensions: [ '.coffee' ],
aliases: [ 'CoffeeScript', 'coffeescript', 'coffee' ],
extensions: ['.coffee'],
aliases: ['CoffeeScript', 'coffeescript', 'coffee'],
mimetypes: ['text/x-coffeescript', 'text/coffeescript'],
module: './coffee'
});
registerLanguage({
id: 'c',
extensions: [ '.c', '.h' ],
aliases: [ 'C', 'c' ],
extensions: ['.c', '.h'],
aliases: ['C', 'c'],
module: './cpp'
});
registerLanguage({
id: 'cpp',
extensions: [ '.cpp', '.cc', '.cxx', '.hpp', '.hh', '.hxx' ],
aliases: [ 'C++', 'Cpp', 'cpp'],
extensions: ['.cpp', '.cc', '.cxx', '.hpp', '.hh', '.hxx'],
aliases: ['C++', 'Cpp', 'cpp'],
module: './cpp'
});
registerLanguage({
id: 'csharp',
extensions: [ '.cs', '.csx' ],
aliases: [ 'C#', 'csharp' ],
extensions: ['.cs', '.csx'],
aliases: ['C#', 'csharp'],
module: './csharp'
});
registerLanguage({
id: 'dockerfile',
extensions: [ '.dockerfile' ],
filenames: [ 'Dockerfile' ],
aliases: [ 'Dockerfile' ],
extensions: ['.dockerfile'],
filenames: ['Dockerfile'],
aliases: ['Dockerfile'],
module: './dockerfile'
});
registerLanguage({
id: 'fsharp',
extensions: [ '.fs', '.fsi', '.ml', '.mli', '.fsx', '.fsscript' ],
aliases: [ 'F#', 'FSharp', 'fsharp' ],
extensions: ['.fs', '.fsi', '.ml', '.mli', '.fsx', '.fsscript'],
aliases: ['F#', 'FSharp', 'fsharp'],
module: './fsharp'
});
registerLanguage({
id: 'go',
extensions: [ '.go' ],
aliases: [ 'Go' ],
extensions: ['.go'],
aliases: ['Go'],
module: './go'
});
registerLanguage({
@ -117,28 +117,28 @@ registerLanguage({
});
registerLanguage({
id: 'ini',
extensions: [ '.ini', '.properties', '.gitconfig' ],
extensions: ['.ini', '.properties', '.gitconfig'],
filenames: ['config', '.gitattributes', '.gitconfig', '.editorconfig'],
aliases: [ 'Ini', 'ini' ],
aliases: ['Ini', 'ini'],
module: './ini'
});
registerLanguage({
id: 'jade',
extensions: [ '.jade', '.pug' ],
aliases: [ 'Jade', 'jade' ],
extensions: ['.jade', '.pug'],
aliases: ['Jade', 'jade'],
module: './jade'
});
registerLanguage({
id: 'java',
extensions: [ '.java', '.jav' ],
aliases: [ 'Java', 'java' ],
extensions: ['.java', '.jav'],
aliases: ['Java', 'java'],
mimetypes: ['text/x-java-source', 'text/x-java'],
module: './java'
});
registerLanguage({
id: 'lua',
extensions: [ '.lua' ],
aliases: [ 'Lua', 'lua' ],
extensions: ['.lua'],
aliases: ['Lua', 'lua'],
module: './lua'
});
registerLanguage({
@ -155,14 +155,14 @@ registerLanguage({
});
registerLanguage({
id: 'objective-c',
extensions: [ '.m' ],
aliases: [ 'Objective-C'],
extensions: ['.m'],
aliases: ['Objective-C'],
module: './objective-c'
});
registerLanguage({
registerLanguage({
id: 'postiats',
extensions: [ '.dats', '.sats', '.hats' ],
aliases: [ 'ATS', 'ATS/Postiats' ],
extensions: ['.dats', '.sats', '.hats'],
aliases: ['ATS', 'ATS/Postiats'],
module: './postiats'
});
registerLanguage({
@ -174,21 +174,21 @@ registerLanguage({
});
registerLanguage({
id: 'powershell',
extensions: [ '.ps1', '.psm1', '.psd1' ],
aliases: [ 'PowerShell', 'powershell', 'ps', 'ps1' ],
extensions: ['.ps1', '.psm1', '.psd1'],
aliases: ['PowerShell', 'powershell', 'ps', 'ps1'],
module: './powershell'
});
registerLanguage({
id: 'python',
extensions: [ '.py', '.rpy', '.pyw', '.cpy', '.gyp', '.gypi' ],
aliases: [ 'Python', 'py' ],
extensions: ['.py', '.rpy', '.pyw', '.cpy', '.gyp', '.gypi'],
aliases: ['Python', 'py'],
firstLine: '^#!/.*\\bpython[0-9.-]*\\b',
module: './python'
});
registerLanguage({
id: 'r',
extensions: [ '.r', '.rhistory', '.rprofile', '.rt' ],
aliases: [ 'R', 'r' ],
extensions: ['.r', '.rhistory', '.rprofile', '.rt'],
aliases: ['R', 'r'],
module: './r'
});
registerLanguage({
@ -200,35 +200,35 @@ registerLanguage({
});
registerLanguage({
id: 'ruby',
extensions: [ '.rb', '.rbx', '.rjs', '.gemspec', '.pp' ],
filenames: [ 'rakefile' ],
aliases: [ 'Ruby', 'rb' ],
extensions: ['.rb', '.rbx', '.rjs', '.gemspec', '.pp'],
filenames: ['rakefile'],
aliases: ['Ruby', 'rb'],
module: './ruby'
});
registerLanguage({
id: 'swift',
aliases: ['Swift','swift'],
aliases: ['Swift', 'swift'],
extensions: ['.swift'],
mimetypes: ['text/swift'],
module: './swift'
});
registerLanguage({
id: 'sql',
extensions: [ '.sql' ],
aliases: [ 'SQL' ],
extensions: ['.sql'],
aliases: ['SQL'],
module: './sql'
});
registerLanguage({
id: 'vb',
extensions: [ '.vb' ],
aliases: [ 'Visual Basic', 'vb' ],
extensions: ['.vb'],
aliases: ['Visual Basic', 'vb'],
module: './vb'
});
registerLanguage({
id: 'xml',
extensions: [ '.xml', '.dtd', '.ascx', '.csproj', '.config', '.wxi', '.wxl', '.wxs', '.xaml', '.svg', '.svgz' ],
firstLine : '(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)',
aliases: [ 'XML', 'xml' ],
extensions: ['.xml', '.dtd', '.ascx', '.csproj', '.config', '.wxi', '.wxl', '.wxs', '.xaml', '.svg', '.svgz'],
firstLine: '(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)',
aliases: ['XML', 'xml'],
mimetypes: ['text/xml', 'application/xml', 'application/xaml+xml', 'application/xml-dtd'],
module: './xml'
});
@ -262,7 +262,7 @@ registerLanguage({
});
registerLanguage({
id: 'sol',
extensions: [ '.sol' ],
aliases: [ 'sol','solidity','Solidity' ],
extensions: ['.sol'],
aliases: ['sol', 'solidity', 'Solidity'],
module: './solidity'
});

View file

@ -8,12 +8,12 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
comments: {
lineComment: '//',
blockComment: ['/*', '*/'],
},
brackets: [['[',']'],['(',')'],['{','}']],
brackets: [['[', ']'], ['(', ')'], ['{', '}']],
autoClosingPairs: [
{ open: '"', close: '"', notIn: ['string', 'comment'] },
{ open: '\'', close: '\'', notIn: ['string', 'comment'] },
@ -23,7 +23,7 @@ export var conf:IRichLanguageConfiguration = {
]
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '.msdax',
ignoreCase: true,
@ -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

@ -8,15 +8,15 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
comments: {
lineComment: '//',
blockComment: ['/*', '*/'],
},
brackets: [
['{','}'],
['[',']'],
['(',')']
['{', '}'],
['[', ']'],
['(', ')']
],
autoClosingPairs: [
{ open: '{', close: '}' },
@ -34,7 +34,7 @@ export var conf:IRichLanguageConfiguration = {
]
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '.objective-c',
@ -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'],
],
@ -170,20 +174,23 @@ export var language = <ILanguage> {
],
comments: [
['\\/\\*','comment','@comment' ],
['\\/\\/+.*','comment' ],
['\\/\\*', 'comment', '@comment'],
['\\/\\/+.*', 'comment'],
],
comment: [
['\\*\\/','comment','@pop' ],
['.', 'comment', ],
['\\*\\/', 'comment', '@pop'],
['.', 'comment',],
],
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

@ -8,7 +8,7 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
comments: {
@ -41,7 +41,7 @@ export const htmlTokenTypes = {
}
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '',
// ignoreCase: true,
@ -53,9 +53,9 @@ export var language = <ILanguage> {
[/<!DOCTYPE/, 'metatag.html', '@doctype'],
[/<!--/, 'comment.html', '@comment'],
[/(<)(\w+)(\/>)/, [htmlTokenTypes.DELIM_START, 'tag.html', htmlTokenTypes.DELIM_END]],
[/(<)(script)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@script'} ]],
[/(<)(style)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@style'} ]],
[/(<)([:\w]+)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@otherTag'} ]],
[/(<)(script)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@script' }]],
[/(<)(style)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@style' }]],
[/(<)([:\w]+)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@otherTag' }]],
[/(<\/)(\w+)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@otherTag' }]],
[/</, htmlTokenTypes.DELIM_START],
[/[^<]+/] // text
@ -63,8 +63,8 @@ export var language = <ILanguage> {
doctype: [
[/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.comment' }],
[/[^>]+/, 'metatag.content.html' ],
[/>/, 'metatag.html', '@pop' ],
[/[^>]+/, 'metatag.content.html'],
[/>/, 'metatag.html', '@pop'],
],
comment: [
@ -94,15 +94,15 @@ export var language = <ILanguage> {
[/'([^']*)'/, 'attribute.value'],
[/[\w\-]+/, 'attribute.name'],
[/=/, 'delimiter'],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.text/javascript', nextEmbedded: 'text/javascript'} ],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.text/javascript', nextEmbedded: 'text/javascript' }],
[/[ \t\r\n]+/], // whitespace
[/(<\/)(script\s*)(>)/, [ htmlTokenTypes.DELIM_START, 'tag.html', { token: htmlTokenTypes.DELIM_END, next: '@pop' } ]]
[/(<\/)(script\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag.html', { token: htmlTokenTypes.DELIM_END, next: '@pop' }]]
],
// After <script ... type
scriptAfterType: [
[/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.scriptAfterType' }],
[/=/,'delimiter', '@scriptAfterTypeEquals'],
[/=/, 'delimiter', '@scriptAfterTypeEquals'],
[/[ \t\r\n]+/], // whitespace
[/<\/script\s*>/, { token: '@rematch', next: '@pop' }]
],
@ -110,8 +110,8 @@ export var language = <ILanguage> {
// After <script ... type =
scriptAfterTypeEquals: [
[/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.scriptAfterTypeEquals' }],
[/"([^"]*)"/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' } ],
[/'([^']*)'/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' } ],
[/"([^"]*)"/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' }],
[/'([^']*)'/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' }],
[/[ \t\r\n]+/], // whitespace
[/<\/script\s*>/, { token: '@rematch', next: '@pop' }]
],
@ -119,7 +119,7 @@ export var language = <ILanguage> {
// After <script ... type = $S2
scriptWithCustomType: [
[/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.scriptWithCustomType.$S2' }],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.$S2', nextEmbedded: '$S2'}],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.$S2', nextEmbedded: '$S2' }],
[/"([^"]*)"/, 'attribute.value'],
[/'([^']*)'/, 'attribute.value'],
[/[\w\-]+/, 'attribute.name'],
@ -146,15 +146,15 @@ export var language = <ILanguage> {
[/'([^']*)'/, 'attribute.value'],
[/[\w\-]+/, 'attribute.name'],
[/=/, 'delimiter'],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.text/css', nextEmbedded: 'text/css'} ],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.text/css', nextEmbedded: 'text/css' }],
[/[ \t\r\n]+/], // whitespace
[/(<\/)(style\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag.html', { token: htmlTokenTypes.DELIM_END, next: '@pop' } ]]
[/(<\/)(style\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag.html', { token: htmlTokenTypes.DELIM_END, next: '@pop' }]]
],
// After <style ... type
styleAfterType: [
[/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.styleAfterType' }],
[/=/,'delimiter', '@styleAfterTypeEquals'],
[/=/, 'delimiter', '@styleAfterTypeEquals'],
[/[ \t\r\n]+/], // whitespace
[/<\/style\s*>/, { token: '@rematch', next: '@pop' }]
],
@ -162,8 +162,8 @@ export var language = <ILanguage> {
// After <style ... type =
styleAfterTypeEquals: [
[/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.styleAfterTypeEquals' }],
[/"([^"]*)"/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' } ],
[/'([^']*)'/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' } ],
[/"([^"]*)"/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' }],
[/'([^']*)'/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' }],
[/[ \t\r\n]+/], // whitespace
[/<\/style\s*>/, { token: '@rematch', next: '@pop' }]
],
@ -171,7 +171,7 @@ export var language = <ILanguage> {
// After <style ... type = $S2
styleWithCustomType: [
[/<\?((php)|=)?/, { token: '@rematch', switchTo: '@phpInSimpleState.styleWithCustomType.$S2' }],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.$S2', nextEmbedded: '$S2'}],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.$S2', nextEmbedded: '$S2' }],
[/"([^"]*)"/, 'attribute.value'],
[/'([^']*)'/, 'attribute.value'],
[/[\w\-]+/, 'attribute.name'],
@ -203,22 +203,22 @@ export var language = <ILanguage> {
phpRoot: [
[/[a-zA-Z_]\w*/, {
cases: {
'@phpKeywords': { token:'keyword.php' },
'@phpCompileTimeConstants': { token: 'constant.php'},
'@phpKeywords': { token: 'keyword.php' },
'@phpCompileTimeConstants': { token: 'constant.php' },
'@default': 'identifier.php'
}
}],
[/[$a-zA-Z_]\w*/, {
cases: {
'@phpPreDefinedVariables': { token:'variable.predefined.php' },
'@phpPreDefinedVariables': { token: 'variable.predefined.php' },
'@default': 'variable.php'
}
}],
// brackets
[/[{}]/, 'delimiter.bracket.php' ],
[/[\[\]]/, 'delimiter.array.php' ],
[/[()]/, 'delimiter.parenthesis.php' ],
[/[{}]/, 'delimiter.bracket.php'],
[/[\[\]]/, 'delimiter.array.php'],
[/[()]/, 'delimiter.parenthesis.php'],
// whitespace
[/[ \t\r\n]+/],
@ -228,14 +228,14 @@ export var language = <ILanguage> {
[/\/\//, 'comment.php', '@phpLineComment'],
// block comments
[/\/\*/, 'comment.php', '@phpComment' ],
[/\/\*/, 'comment.php', '@phpComment'],
// strings
[/"/, 'string.php', '@phpDoubleQuoteString' ],
[/'/, 'string.php', '@phpSingleQuoteString' ],
[/"/, 'string.php', '@phpDoubleQuoteString'],
[/'/, 'string.php', '@phpSingleQuoteString'],
// delimiters
[/[\+\-\*\%\&\|\^\~\!\=\<\>\/\?\;\:\.\,\@]/, 'delimiter.php' ],
[/[\+\-\*\%\&\|\^\~\!\=\<\>\/\?\;\:\.\,\@]/, 'delimiter.php'],
// numbers
[/\d*\d+[eE]([\-+]?\d+)?/, 'number.float.php'],
@ -265,14 +265,14 @@ export var language = <ILanguage> {
[/[^\\"]+/, 'string.php'],
[/@escapes/, 'string.escape.php'],
[/\\./, 'string.escape.invalid.php'],
[/"/, 'string.php', '@pop' ]
[/"/, 'string.php', '@pop']
],
phpSingleQuoteString: [
[/[^\\']+/, 'string.php'],
[/@escapes/, 'string.escape.php'],
[/\\./, 'string.escape.invalid.php'],
[/'/, 'string.php', '@pop' ]
[/'/, 'string.php', '@pop']
],
},

View file

@ -10,12 +10,12 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
comments: {
lineComment: '//',
blockComment: ['(*', '*)'],
},
brackets: [['{','}'], ['[',']'], ['(',')'], ['<','>']],
brackets: [['{', '}'], ['[', ']'], ['(', ')'], ['<', '>']],
autoClosingPairs: [
{ open: '"', close: '"', notIn: ['string', 'comment'] },
{ open: '{', close: '}', notIn: ['string', 'comment'] },
@ -24,7 +24,7 @@ export var conf:IRichLanguageConfiguration = {
]
};
export var language = <ILanguage> {
export var language = <ILanguage>{
tokenPostfix: '.pats',
// TODO: staload and dynload are followed by a special kind of string literals
@ -37,7 +37,7 @@ export var language = <ILanguage> {
// keyword reference: https://github.com/githwxi/ATS-Postiats/blob/master/src/pats_lexing_token.dats
keywords: [
//
//
"abstype", // ABSTYPE
"abst0ype", // ABST0YPE
"absprop", // ABSPROP
@ -46,252 +46,252 @@ export var language = <ILanguage> {
"absviewtype", // ABSVIEWTYPE
"absvt0ype", // ABSVIEWT0YPE
"absviewt0ype", // ABSVIEWT0YPE
//
//
"as", // T_AS
//
//
"and", // T_AND
//
//
"assume", // T_ASSUME
//
//
"begin", // T_BEGIN
//
/*
//
/*
"case", // CASE
*/
//
*/
//
"classdec", // T_CLASSDEC
//
//
"datasort", // T_DATASORT
//
//
"datatype", // DATATYPE
"dataprop", // DATAPROP
"dataview", // DATAVIEW
"datavtype", // DATAVIEWTYPE
"dataviewtype", // DATAVIEWTYPE
//
//
"do", // T_DO
//
//
"end", // T_END
//
//
"extern", // T_EXTERN
"extype", // T_EXTYPE
"extvar", // T_EXTVAR
//
//
"exception", // T_EXCEPTION
//
//
"fn", // FN // non-recursive
"fnx", // FNX // mutual tail-rec.
"fun", // FUN // general-recursive
//
//
"prfn", // PRFN
"prfun", // PRFUN
//
//
"praxi", // PRAXI
"castfn", // CASTFN
//
//
"if", // T_IF
"then", // T_THEN
"else", // T_ELSE
//
//
"ifcase", // T_IFCASE
//
//
"in", // T_IN
//
//
"infix", // INFIX
"infixl", // INFIXL
"infixr", // INFIXR
"prefix", // PREFIX
"postfix", // POSTFIX
//
//
"implmnt", // IMPLMNT // 0
"implement", // IMPLEMENT // 1
//
//
"primplmnt", // PRIMPLMNT // ~1
"primplement", // PRIMPLMNT // ~1
//
//
"import", // T_IMPORT // for importing packages
//
/*
//
/*
"lam", // LAM
"llam", // LLAM
"fix", // FIX
*/
//
*/
//
"let", // T_LET
//
//
"local", // T_LOCAL
//
//
"macdef", // MACDEF
"macrodef", // MACRODEF
//
//
"nonfix", // T_NONFIX
//
//
"symelim", // T_SYMELIM
"symintr", // T_SYMINTR
"overload", // T_OVERLOAD
//
//
"of", // T_OF
"op", // T_OP
//
//
"rec", // T_REC
//
//
"sif", // T_SIF
"scase", // T_SCASE
//
//
"sortdef", // T_SORTDEF
/*
// HX: [sta] is now deprecated
*/
/*
// HX: [sta] is now deprecated
*/
"sta", // T_STACST
"stacst", // T_STACST
"stadef", // T_STADEF
"static", // T_STATIC
/*
/*
"stavar", // T_STAVAR
*/
//
*/
//
"staload", // T_STALOAD
"dynload", // T_DYNLOAD
//
//
"try", // T_TRY
//
//
"tkindef", // T_TKINDEF // HX-2012-05-23
//
/*
//
/*
"type", // TYPE
*/
*/
"typedef", // TYPEDEF
"propdef", // PROPDEF
"viewdef", // VIEWDEF
"vtypedef", // VIEWTYPEDEF
"viewtypedef", // VIEWTYPEDEF
//
/*
//
/*
"val", // VAL
*/
*/
"prval", // PRVAL
//
//
"var", // VAR
"prvar", // PRVAR
//
//
"when", // T_WHEN
"where", // T_WHERE
//
/*
//
/*
"for", // T_FOR
"while", // T_WHILE
*/
//
*/
//
"with", // T_WITH
//
//
"withtype", // WITHTYPE
"withprop", // WITHPROP
"withview", // WITHVIEW
"withvtype", // WITHVIEWTYPE
"withviewtype", // WITHVIEWTYPE
//
//
],
keywords_dlr: [
"$delay", // DLRDELAY
"$ldelay", // DLRLDELAY
//
//
"$arrpsz", // T_DLRARRPSZ
"$arrptrsize", // T_DLRARRPSZ
//
//
"$d2ctype", // T_DLRD2CTYPE
//
//
"$effmask", // DLREFFMASK
"$effmask_ntm", // DLREFFMASK_NTM
"$effmask_exn", // DLREFFMASK_EXN
"$effmask_ref", // DLREFFMASK_REF
"$effmask_wrt", // DLREFFMASK_WRT
"$effmask_all", // DLREFFMASK_ALL
//
//
"$extern", // T_DLREXTERN
"$extkind", // T_DLREXTKIND
"$extype", // T_DLREXTYPE
"$extype_struct", // T_DLREXTYPE_STRUCT
//
//
"$extval", // T_DLREXTVAL
"$extfcall", // T_DLREXTFCALL
"$extmcall", // T_DLREXTMCALL
//
//
"$literal", // T_DLRLITERAL
//
//
"$myfilename", // T_DLRMYFILENAME
"$mylocation", // T_DLRMYLOCATION
"$myfunction", // T_DLRMYFUNCTION
//
//
"$lst", // DLRLST
"$lst_t", // DLRLST_T
"$lst_vt", // DLRLST_VT
"$list", // DLRLST
"$list_t", // DLRLST_T
"$list_vt", // DLRLST_VT
//
//
"$rec", // DLRREC
"$rec_t", // DLRREC_T
"$rec_vt", // DLRREC_VT
"$record", // DLRREC
"$record_t", // DLRREC_T
"$record_vt", // DLRREC_VT
//
//
"$tup", // DLRTUP
"$tup_t", // DLRTUP_T
"$tup_vt", // DLRTUP_VT
"$tuple", // DLRTUP
"$tuple_t", // DLRTUP_T
"$tuple_vt", // DLRTUP_VT
//
//
"$break", // T_DLRBREAK
"$continue", // T_DLRCONTINUE
//
//
"$raise", // T_DLRRAISE
//
//
"$showtype", // T_DLRSHOWTYPE
//
//
"$vcopyenv_v", // DLRVCOPYENV_V
"$vcopyenv_vt", // DLRVCOPYENV_VT
//
//
"$tempenver", // T_DLRTEMPENVER
//
//
"$solver_assert", // T_DLRSOLASSERT
"$solver_verify", // T_DLRSOLVERIFY
],
keywords_srp: [
//
//
"#if", // T_SRPIF
"#ifdef", // T_SRPIFDEF
"#ifndef", // T_SRPIFNDEF
//
//
"#then", // T_SRPTHEN
//
//
"#elif", // T_SRPELIF
"#elifdef", // T_SRPELIFDEF
"#elifndef", // T_SRPELIFNDEF
//
//
"#else", // T_SRPELSE
"#endif", // T_SRPENDIF
//
//
"#error", // T_SRPERROR
//
//
"#prerr", // T_SRPPRERR // outpui to stderr
"#print", // T_SRPPRINT // output to stdout
//
//
"#assert", // T_SRPASSERT
//
//
"#undef", // T_SRPUNDEF
"#define", // T_SRPDEFINE
//
//
"#include", // T_SRPINCLUDE
"#require", // T_SRPREQUIRE
//
//
"#pragma", // T_SRPPRAGMA // HX: general pragma
"#codegen2", // T_SRPCODEGEN2 // for level-2 codegen
"#codegen3", // T_SRPCODEGEN3 // for level-3 codegen
//
// HX: end of special tokens
//
//
// HX: end of special tokens
//
],
irregular_keyword_list: [
@ -398,47 +398,47 @@ export var language = <ILanguage> {
//
"..", // T_DOTDOT
"...", // T_DOTDOTDOT
//
//
"=>", // T_EQGT
// "=<", // T_EQLT
"=<>", // T_EQLTGT
"=/=>", // T_EQSLASHEQGT
"=>>", // T_EQGTGT
"=/=>>", // T_EQSLASHEQGTGT
//
//
"<", // T_LT // opening a tmparg
">", // T_GT // closing a tmparg
//
//
"><", // T_GTLT
//
//
".<", // T_DOTLT
">.", // T_GTDOT
//
//
".<>.", // T_DOTLTGTDOT
//
//
"->", // T_MINUSGT
//"-<", // T_MINUSLT
"-<>", // T_MINUSLTGT
//
/*
//
/*
":<", // T_COLONLT
*/
*/
],
brackets: [
{open: ',(', close: ')', token: 'delimiter.parenthesis'}, // meta-programming syntax
{open: '`(', close: ')', token: 'delimiter.parenthesis'},
{open: '%(', close: ')', token: 'delimiter.parenthesis'},
{open: '\'(', close: ')', token: 'delimiter.parenthesis'},
{open: '\'{', close: '}', token: 'delimiter.parenthesis'},
{open: '@(', close: ')', token: 'delimiter.parenthesis'},
{open: '@{', close: '}', token: 'delimiter.brace'},
{open: '@[', close: ']', token: 'delimiter.square'},
{open: '#[', close: ']', token: 'delimiter.square'},
{open: '{', close: '}', token: 'delimiter.curly'},
{open: '[', close: ']', token: 'delimiter.square'},
{open: '(', close: ')', token: 'delimiter.parenthesis'},
{open: '<', close: '>', token:'delimiter.angle'}
{ open: ',(', close: ')', token: 'delimiter.parenthesis' }, // meta-programming syntax
{ open: '`(', close: ')', token: 'delimiter.parenthesis' },
{ open: '%(', close: ')', token: 'delimiter.parenthesis' },
{ open: '\'(', close: ')', token: 'delimiter.parenthesis' },
{ open: '\'{', close: '}', token: 'delimiter.parenthesis' },
{ open: '@(', close: ')', token: 'delimiter.parenthesis' },
{ open: '@{', close: '}', token: 'delimiter.brace' },
{ open: '@[', close: ']', token: 'delimiter.square' },
{ open: '#[', close: ']', token: 'delimiter.square' },
{ open: '{', close: '}', token: 'delimiter.curly' },
{ open: '[', close: ']', token: 'delimiter.square' },
{ open: '(', close: ')', token: 'delimiter.parenthesis' },
{ open: '<', close: '>', token: 'delimiter.angle' }
],
// we include these common regular expressions
@ -467,31 +467,31 @@ export var language = <ILanguage> {
tokenizer: {
root: [
// lexing_blankseq0
{regex: /[ \t\r\n]+/, action: {token: ''}},
{ regex: /[ \t\r\n]+/, action: { token: '' } },
// NOTE: (*) is an invalid ML-like comment!
{regex: /\(\*\)/, action: { token: 'invalid' }},
{regex: /\(\*/, action: { token: 'comment', next: 'lexing_COMMENT_block_ml' } },
{regex: /\(/, action: '@brackets'/*{ token: 'delimiter.parenthesis' }*/ },
{regex: /\)/, action: '@brackets'/*{ token: 'delimiter.parenthesis' }*/ },
{regex: /\[/, action: '@brackets'/*{ token: 'delimiter.bracket' }*/ },
{regex: /\]/, action: '@brackets'/*{ token: 'delimiter.bracket' }*/ },
{regex: /\{/, action: '@brackets'/*{ token: 'delimiter.brace' }*/ },
{regex: /\}/, action: '@brackets'/*{ token: 'delimiter.brace' }*/ },
{ regex: /\(\*\)/, action: { token: 'invalid' } },
{ regex: /\(\*/, action: { token: 'comment', next: 'lexing_COMMENT_block_ml' } },
{ regex: /\(/, action: '@brackets'/*{ token: 'delimiter.parenthesis' }*/ },
{ regex: /\)/, action: '@brackets'/*{ token: 'delimiter.parenthesis' }*/ },
{ regex: /\[/, action: '@brackets'/*{ token: 'delimiter.bracket' }*/ },
{ regex: /\]/, action: '@brackets'/*{ token: 'delimiter.bracket' }*/ },
{ regex: /\{/, action: '@brackets'/*{ token: 'delimiter.brace' }*/ },
{ regex: /\}/, action: '@brackets'/*{ token: 'delimiter.brace' }*/ },
// lexing_COMMA
{regex: /,\(/, action: '@brackets'/*{ token: 'delimiter.parenthesis' }*/ }, // meta-programming syntax
{regex: /,/, action: { token: 'delimiter.comma' } },
{ regex: /,\(/, action: '@brackets'/*{ token: 'delimiter.parenthesis' }*/ }, // meta-programming syntax
{ regex: /,/, action: { token: 'delimiter.comma' } },
{regex: /;/, action: { token: 'delimiter.semicolon' } },
{ regex: /;/, action: { token: 'delimiter.semicolon' } },
// lexing_AT
{regex: /@\(/, action: '@brackets'/* { token: 'delimiter.parenthesis' }*/ },
{regex: /@\[/, action: '@brackets'/* { token: 'delimiter.bracket' }*/ },
{regex: /@\{/, action: '@brackets'/*{ token: 'delimiter.brace' }*/ },
{ regex: /@\(/, action: '@brackets'/* { token: 'delimiter.parenthesis' }*/ },
{ regex: /@\[/, action: '@brackets'/* { token: 'delimiter.bracket' }*/ },
{ regex: /@\{/, action: '@brackets'/*{ token: 'delimiter.brace' }*/ },
// lexing_COLON
{regex: /:</, action: { token: 'keyword', next: '@lexing_EFFECT_commaseq0'} }, // T_COLONLT
{ regex: /:</, action: { token: 'keyword', next: '@lexing_EFFECT_commaseq0' } }, // T_COLONLT
/*
lexing_DOT:
@ -500,14 +500,15 @@ export var language = <ILanguage> {
. FLOATDOT => lexing_FLOAT_deciexp
. DIGIT => T_DOTINT
*/
{regex: /\.@symbolic+/, action: { token: 'identifier.sym' } },
{ regex: /\.@symbolic+/, action: { token: 'identifier.sym' } },
// FLOATDOT case
{regex: /\.@digit*@fexponent@FLOATSP*/, action: { token: 'number.float' } },
{regex: /\.@digit+/, action: { token: 'number.float' } }, // T_DOTINT
{ regex: /\.@digit*@fexponent@FLOATSP*/, action: { token: 'number.float' } },
{ regex: /\.@digit+/, action: { token: 'number.float' } }, // T_DOTINT
// 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' },
@ -527,14 +529,14 @@ export var language = <ILanguage> {
},
// lexing_PERCENT:
{regex: /%\(/, action: { token: 'delimiter.parenthesis' } },
{regex: /^%{(#|\^|\$)?/, action: { token: 'keyword', next: '@lexing_EXTCODE', nextEmbedded: 'text/javascript' } },
{regex: /^%}/, action: { token: 'keyword' } },
{ regex: /%\(/, action: { token: 'delimiter.parenthesis' } },
{ regex: /^%{(#|\^|\$)?/, action: { token: 'keyword', next: '@lexing_EXTCODE', nextEmbedded: 'text/javascript' } },
{ regex: /^%}/, action: { token: 'keyword' } },
// lexing_QUOTE
{regex: /'\(/, action: { token: 'delimiter.parenthesis' } },
{regex: /'\[/, action: { token: 'delimiter.bracket' } },
{regex: /'\{/, action: { token: 'delimiter.brace' } },
{ regex: /'\(/, action: { token: 'delimiter.parenthesis' } },
{ regex: /'\[/, action: { token: 'delimiter.bracket' } },
{ regex: /'\{/, action: { token: 'delimiter.brace' } },
[/(')(\\@ESCHAR|\\[xX]@xdigit+|\\@digit+)(')/, ['string', 'string.escape', 'string']],
[/'[^\\']'/, 'string'],
@ -542,16 +544,17 @@ export var language = <ILanguage> {
[/"/, 'string.quote', '@lexing_DQUOTE'],
// lexing_BQUOTE
{regex: /`\(/, action: '@brackets'/* { token: 'delimiter.parenthesis' }*/},
{ regex: /`\(/, action: '@brackets'/* { token: 'delimiter.parenthesis' }*/ },
// TODO: otherwise, try lexing_IDENT_sym
{regex: /\\/, action: { token: 'punctuation' } }, // just T_BACKSLASH
{ regex: /\\/, action: { token: 'punctuation' } }, // just T_BACKSLASH
// lexing_IDENT_alp:
// 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: /@irregular_keywords(?!@IDENTRST)/, action: { token: 'keyword' } },
{
regex: /@IDENTFST@IDENTRST*[<!\[]?/,
action: {
cases: {
// TODO: dynload and staload should be specially parsed
@ -567,12 +570,13 @@ export var language = <ILanguage> {
}
},
// lexing_IDENT_sym:
{regex: /\/\/\/\//, action: { token: 'comment', next: '@lexing_COMMENT_rest' }},
{regex: /\/\/.*$/, action: { token: 'comment' }},
{regex: /\/\*/, action: { token: 'comment', next: '@lexing_COMMENT_block_c' }},
{ regex: /\/\/\/\//, action: { token: 'comment', next: '@lexing_COMMENT_rest' } },
{ regex: /\/\/.*$/, action: { token: 'comment' } },
{ 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: /-<|=</, action: { token: 'keyword', next: '@lexing_EFFECT_commaseq0' } },
{
regex: /@symbolic+/,
action: {
cases: {
'@operators': 'keyword',
@ -589,35 +593,35 @@ export var language = <ILanguage> {
// - testing_intspseq0 => T_INT_hex
// lexing_INT_hex:
{regex: /0[xX]@xdigit+(@hexiexp|@fexponent_bin)@FLOATSP*/, action: { token: 'number.float' } },
{regex: /0[xX]@xdigit+@INTSP*/, action: {token: 'number.hex' } },
{regex: /0[0-7]+(?![0-9])@INTSP*/, action: { token: 'number.octal' } }, // lexing_INT_oct
{ regex: /0[xX]@xdigit+(@hexiexp|@fexponent_bin)@FLOATSP*/, action: { token: 'number.float' } },
{ regex: /0[xX]@xdigit+@INTSP*/, action: { token: 'number.hex' } },
{ regex: /0[0-7]+(?![0-9])@INTSP*/, action: { token: 'number.octal' } }, // lexing_INT_oct
//{regex: /0/, action: { token: 'number' } }, // INTZERO
// lexing_INT_dec:
// - testing_deciexp => lexing_FLOAT_deciexp
// - testing_fexponent => lexing_FLOAT_deciexp
// - otherwise => intspseq0 ([0-9]*[lLuU]?)
{regex: /@digit+(@fexponent|@deciexp)@FLOATSP*/, action: { token: 'number.float' } },
{regex: /@digit@digitseq0@INTSP*/, action: { token: 'number.decimal' } },
{ regex: /@digit+(@fexponent|@deciexp)@FLOATSP*/, action: { token: 'number.float' } },
{ regex: /@digit@digitseq0@INTSP*/, action: { token: 'number.decimal' } },
// DIGIT, if followed by digitseq0, is lexing_INT_dec
{regex: /@digit+@INTSP*/, action: { token: 'number' } },
{ regex: /@digit+@INTSP*/, action: { token: 'number' } },
],
lexing_COMMENT_block_ml: [
[/[^\(\*]+/, 'comment'],
[/\(\*/, 'comment', '@push' ],
[/\(\*/, 'comment.invalid' ],
[/\*\)/, 'comment', '@pop' ],
[/\(\*/, 'comment', '@push'],
[/\(\*/, 'comment.invalid'],
[/\*\)/, 'comment', '@pop'],
[/\*/, 'comment']
],
lexing_COMMENT_block_c: [
[/[^\/*]+/, 'comment' ],
[/[^\/*]+/, 'comment'],
// [/\/\*/, 'comment', '@push' ], // nested C-style block comments not allowed
// [/\/\*/, 'comment.invalid' ], // NOTE: this breaks block comments in the shape of /* //*/
[/\*\//, 'comment', '@pop' ],
[/[\/*]/, 'comment' ]
[/\*\//, 'comment', '@pop'],
[/[\/*]/, 'comment']
],
lexing_COMMENT_rest: [
[/$/, 'comment', '@pop'], // FIXME: does it match? docs say 'no'
@ -626,30 +630,31 @@ 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'},
'@default': {token: 'identifier'}
'@keywords_effects': { token: 'type.effect' },
'@default': { token: 'identifier' }
}
}
},
{regex: /,/, action: {token: 'punctuation'}},
{regex: />/, action: { token: '@rematch', next: '@pop' }},
{ regex: /,/, action: { token: 'punctuation' } },
{ regex: />/, action: { token: '@rematch', next: '@pop' } },
],
lexing_EXTCODE: [
{regex: /^%}/, action: { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }},
{regex: /[^%]+/, action: ''},
{ regex: /^%}/, action: { token: '@rematch', next: '@pop', nextEmbedded: '@pop' } },
{ regex: /[^%]+/, action: '' },
],
lexing_DQUOTE: [
{regex: /"/, action: { token: 'string.quote', next: '@pop' }},
{ regex: /"/, action: { token: 'string.quote', next: '@pop' } },
// AS-20160628: additional hi-lighting for variables in staload/dynload strings
{regex: /(\{\$)(@IDENTFST@IDENTRST*)(\})/, action: [{token: 'string.escape'},{ token: 'identifier' },{token: 'string.escape'}]},
{regex: /\\$/, action: { token: 'string.escape' }},
{regex: /\\(@ESCHAR|[xX]@xdigit+|@digit+)/, action: { token: 'string.escape' }},
{regex: /[^\\"]+/, action: {token: 'string' }}
{ regex: /(\{\$)(@IDENTFST@IDENTRST*)(\})/, action: [{ token: 'string.escape' }, { token: 'identifier' }, { token: 'string.escape' }] },
{ regex: /\\$/, action: { token: 'string.escape' } },
{ regex: /\\(@ESCHAR|[xX]@xdigit+|@digit+)/, action: { token: 'string.escape' } },
{ regex: /[^\\"]+/, action: { token: 'string' } }
],
},
};

View file

@ -8,7 +8,7 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
// the default separators except `$-`
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#%\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
comments: {
@ -16,9 +16,9 @@ export var conf:IRichLanguageConfiguration = {
blockComment: ['<#', '#>'],
},
brackets: [
['{','}'],
['[',']'],
['(',')']
['{', '}'],
['[', ']'],
['(', ')']
],
autoClosingPairs: [
{ open: '{', close: '}' },
@ -36,7 +36,7 @@ export var conf:IRichLanguageConfiguration = {
]
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
ignoreCase: true,
tokenPostfix: '.ps1',
@ -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,35 +102,89 @@ 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' } }],
[/[^\$`]+/,'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: [
[/[^#\.]+/, 'comment' ],
[/[^#\.]+/, 'comment'],
[/#>/, 'comment', '@pop'],
[/(\.)(@helpKeywords)(?!\w)/, { token: 'comment.keyword.$2' } ],
[/[\.#]/, 'comment' ]
[/(\.)(@helpKeywords)(?!\w)/, { token: 'comment.keyword.$2' }],
[/[\.#]/, 'comment']
],
},
};

View file

@ -8,15 +8,15 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
comments: {
lineComment: '#',
blockComment: ['\'\'\'', '\'\'\''],
},
brackets: [
['{','}'],
['[',']'],
['(',')']
['{', '}'],
['[', ']'],
['(', ')']
],
autoClosingPairs: [
{ open: '{', close: '}' },
@ -34,7 +34,7 @@ export var conf:IRichLanguageConfiguration = {
]
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '.python',
@ -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

@ -8,14 +8,14 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
comments: {
lineComment: '#'
},
brackets: [
['{','}'],
['[',']'],
['(',')']
['{', '}'],
['[', ']'],
['(', ')']
],
autoClosingPairs: [
{ open: '{', close: '}' },
@ -31,7 +31,7 @@ export var conf:IRichLanguageConfiguration = {
]
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '.r',

View file

@ -11,9 +11,9 @@ import ILanguage = monaco.languages.IMonarchLanguage;
// Allow for running under nodejs/requirejs in tests
var _monaco: typeof monaco = (typeof monaco === 'undefined' ? (<any>self).monaco : monaco);
const EMPTY_ELEMENTS:string[] = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'];
const EMPTY_ELEMENTS: string[] = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'];
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
comments: {
@ -64,7 +64,7 @@ export const htmlTokenTypes = {
}
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '',
// ignoreCase: true,
@ -77,9 +77,9 @@ export var language = <ILanguage> {
[/<!DOCTYPE/, 'metatag.html', '@doctype'],
[/<!--/, 'comment.html', '@comment'],
[/(<)(\w+)(\/>)/, [htmlTokenTypes.DELIM_START, 'tag.html', htmlTokenTypes.DELIM_END]],
[/(<)(script)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@script'} ]],
[/(<)(style)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@style'} ]],
[/(<)([:\w]+)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@otherTag'} ]],
[/(<)(script)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@script' }]],
[/(<)(style)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@style' }]],
[/(<)([:\w]+)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@otherTag' }]],
[/(<\/)(\w+)/, [htmlTokenTypes.DELIM_START, { token: 'tag.html', next: '@otherTag' }]],
[/</, htmlTokenTypes.DELIM_START],
[/[ \t\r\n]+/], // whitespace
@ -88,8 +88,8 @@ export var language = <ILanguage> {
doctype: [
[/@[^@]/, { token: '@rematch', switchTo: '@razorInSimpleState.comment' }],
[/[^>]+/, 'metatag.content.html' ],
[/>/, 'metatag.html', '@pop' ],
[/[^>]+/, 'metatag.content.html'],
[/>/, 'metatag.html', '@pop'],
],
comment: [
@ -119,15 +119,15 @@ export var language = <ILanguage> {
[/'([^']*)'/, 'attribute.value'],
[/[\w\-]+/, 'attribute.name'],
[/=/, 'delimiter'],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.text/javascript', nextEmbedded: 'text/javascript'} ],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.text/javascript', nextEmbedded: 'text/javascript' }],
[/[ \t\r\n]+/], // whitespace
[/(<\/)(script\s*)(>)/, [ htmlTokenTypes.DELIM_START, 'tag.html', { token: htmlTokenTypes.DELIM_END, next: '@pop' } ]]
[/(<\/)(script\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag.html', { token: htmlTokenTypes.DELIM_END, next: '@pop' }]]
],
// After <script ... type
scriptAfterType: [
[/@[^@]/, { token: '@rematch', switchTo: '@razorInSimpleState.scriptAfterType' }],
[/=/,'delimiter', '@scriptAfterTypeEquals'],
[/=/, 'delimiter', '@scriptAfterTypeEquals'],
[/[ \t\r\n]+/], // whitespace
[/<\/script\s*>/, { token: '@rematch', next: '@pop' }]
],
@ -135,8 +135,8 @@ export var language = <ILanguage> {
// After <script ... type =
scriptAfterTypeEquals: [
[/@[^@]/, { token: '@rematch', switchTo: '@razorInSimpleState.scriptAfterTypeEquals' }],
[/"([^"]*)"/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' } ],
[/'([^']*)'/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' } ],
[/"([^"]*)"/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' }],
[/'([^']*)'/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' }],
[/[ \t\r\n]+/], // whitespace
[/<\/script\s*>/, { token: '@rematch', next: '@pop' }]
],
@ -144,7 +144,7 @@ export var language = <ILanguage> {
// After <script ... type = $S2
scriptWithCustomType: [
[/@[^@]/, { token: '@rematch', switchTo: '@razorInSimpleState.scriptWithCustomType.$S2' }],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.$S2', nextEmbedded: '$S2'}],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@scriptEmbedded.$S2', nextEmbedded: '$S2' }],
[/"([^"]*)"/, 'attribute.value'],
[/'([^']*)'/, 'attribute.value'],
[/[\w\-]+/, 'attribute.name'],
@ -171,15 +171,15 @@ export var language = <ILanguage> {
[/'([^']*)'/, 'attribute.value'],
[/[\w\-]+/, 'attribute.name'],
[/=/, 'delimiter'],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.text/css', nextEmbedded: 'text/css'} ],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.text/css', nextEmbedded: 'text/css' }],
[/[ \t\r\n]+/], // whitespace
[/(<\/)(style\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag.html', { token: htmlTokenTypes.DELIM_END, next: '@pop' } ]]
[/(<\/)(style\s*)(>)/, [htmlTokenTypes.DELIM_START, 'tag.html', { token: htmlTokenTypes.DELIM_END, next: '@pop' }]]
],
// After <style ... type
styleAfterType: [
[/@[^@]/, { token: '@rematch', switchTo: '@razorInSimpleState.styleAfterType' }],
[/=/,'delimiter', '@styleAfterTypeEquals'],
[/=/, 'delimiter', '@styleAfterTypeEquals'],
[/[ \t\r\n]+/], // whitespace
[/<\/style\s*>/, { token: '@rematch', next: '@pop' }]
],
@ -187,8 +187,8 @@ export var language = <ILanguage> {
// After <style ... type =
styleAfterTypeEquals: [
[/@[^@]/, { token: '@rematch', switchTo: '@razorInSimpleState.styleAfterTypeEquals' }],
[/"([^"]*)"/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' } ],
[/'([^']*)'/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' } ],
[/"([^"]*)"/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' }],
[/'([^']*)'/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' }],
[/[ \t\r\n]+/], // whitespace
[/<\/style\s*>/, { token: '@rematch', next: '@pop' }]
],
@ -196,7 +196,7 @@ export var language = <ILanguage> {
// After <style ... type = $S2
styleWithCustomType: [
[/@[^@]/, { token: '@rematch', switchTo: '@razorInSimpleState.styleWithCustomType.$S2' }],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.$S2', nextEmbedded: '$S2'}],
[/>/, { token: htmlTokenTypes.DELIM_END, next: '@styleEmbedded.$S2', nextEmbedded: '$S2' }],
[/"([^"]*)"/, 'attribute.value'],
[/'([^']*)'/, 'attribute.value'],
[/[\w\-]+/, 'attribute.name'],
@ -216,7 +216,7 @@ export var language = <ILanguage> {
razorInSimpleState: [
[/@\*/, 'comment.cs', '@razorBlockCommentTopLevel'],
[/@[{(]/, 'metatag.cs', '@razorRootTopLevel'],
[/(@)(\s*[\w]+)/, ['metatag.cs', { token: 'identifier.cs', switchTo: '@$S2.$S3'} ]],
[/(@)(\s*[\w]+)/, ['metatag.cs', { token: 'identifier.cs', switchTo: '@$S2.$S3' }]],
[/[})]/, { token: 'metatag.cs', switchTo: '@$S2.$S3' }],
[/\*@/, { token: 'comment.cs', switchTo: '@$S2.$S3' }],
],
@ -224,7 +224,7 @@ export var language = <ILanguage> {
razorInEmbeddedState: [
[/@\*/, 'comment.cs', '@razorBlockCommentTopLevel'],
[/@[{(]/, 'metatag.cs', '@razorRootTopLevel'],
[/(@)(\s*[\w]+)/, ['metatag.cs', { token: 'identifier.cs', switchTo: '@$S2.$S3', nextEmbedded: '$S3'} ]],
[/(@)(\s*[\w]+)/, ['metatag.cs', { token: 'identifier.cs', switchTo: '@$S2.$S3', nextEmbedded: '$S3' }]],
[/[})]/, { token: 'metatag.cs', switchTo: '@$S2.$S3', nextEmbedded: '$S3' }],
[/\*@/, { token: 'comment.cs', switchTo: '@$S2.$S3', nextEmbedded: '$S3' }],
],
@ -242,15 +242,15 @@ export var language = <ILanguage> {
],
razorRootTopLevel: [
[/\{/, 'delimiter.bracket.cs', '@razorRoot'] ,
[/\(/, 'delimiter.parenthesis.cs', '@razorRoot'] ,
[/\{/, 'delimiter.bracket.cs', '@razorRoot'],
[/\(/, 'delimiter.parenthesis.cs', '@razorRoot'],
[/[})]/, '@rematch', '@pop'],
{ include: 'razorCommon' }
],
razorRoot: [
[/\{/, 'delimiter.bracket.cs', '@razorRoot'] ,
[/\(/, 'delimiter.parenthesis.cs', '@razorRoot'] ,
[/\{/, 'delimiter.bracket.cs', '@razorRoot'],
[/\(/, 'delimiter.parenthesis.cs', '@razorRoot'],
[/\}/, 'delimiter.bracket.cs', '@pop'],
[/\)/, 'delimiter.parenthesis.cs', '@pop'],
{ include: 'razorCommon' }
@ -259,13 +259,13 @@ export var language = <ILanguage> {
razorCommon: [
[/[a-zA-Z_]\w*/, {
cases: {
'@razorKeywords': { token:'keyword.cs' },
'@razorKeywords': { token: 'keyword.cs' },
'@default': 'identifier.cs'
}
}],
// brackets
[/[\[\]]/, 'delimiter.array.cs' ],
[/[\[\]]/, 'delimiter.array.cs'],
// whitespace
[/[ \t\r\n]+/],
@ -284,7 +284,7 @@ export var language = <ILanguage> {
[/(<\/)(\w+)(>)/, [htmlTokenTypes.DELIM_START, 'tag.html', htmlTokenTypes.DELIM_END]],
// delimiters
[/[\+\-\*\%\&\|\^\~\!\=\<\>\/\?\;\:\.\,]/, 'delimiter.cs' ],
[/[\+\-\*\%\&\|\^\~\!\=\<\>\/\?\;\:\.\,]/, 'delimiter.cs'],
// numbers
[/\d*\d+[eE]([\-+]?\d+)?/, 'number.float.cs'],

View file

@ -8,15 +8,15 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
comments: {
lineComment: '#',
blockComment: ['=begin', '=end'],
},
brackets: [
['(',')'],
['{','}'],
['[',']']
['(', ')'],
['{', '}'],
['[', ']']
],
autoClosingPairs: [
{ open: '{', close: '}' },
@ -83,7 +83,7 @@ export var conf:IRichLanguageConfiguration = {
* regular expression can also contain comments.
*/
export var language = <ILanguage> {
export var language = <ILanguage>{
tokenPostfix: '.ruby',
keywords: [
@ -105,11 +105,11 @@ export var language = <ILanguage> {
// these are closed by 'end' (if, while and until are handled separately)
declarations: [
'module','class','def','case','do','begin','for','if','while','until','unless'
'module', 'class', 'def', 'case', 'do', 'begin', 'for', 'if', 'while', 'until', 'unless'
],
linedecls: [
'def','case','do','begin','for','if','while','until','unless'
'def', 'case', 'do', 'begin', 'for', 'if', 'while', 'until', 'unless'
],
operators: [
@ -119,9 +119,9 @@ export var language = <ILanguage> {
],
brackets: [
{ open: '(', close: ')', token: 'delimiter.parenthesis'},
{ open: '{', close: '}', token: 'delimiter.curly'},
{ open: '[', close: ']', token: 'delimiter.square'}
{ open: '(', close: ')', token: 'delimiter.parenthesis' },
{ open: '{', close: '}', token: 'delimiter.curly' },
{ open: '[', close: ']', token: 'delimiter.square' }
],
// we include these common regular expressions
@ -150,56 +150,68 @@ 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
[/@[\w]*/, 'namespace.instance.identifier' ], // instance
[/@@[\w]*/, 'namespace.class.identifier' ], // class
[/[A-Z][\w]*[!?=]?/, 'constructor.identifier'], // constant
[/\$[\w]*/, 'global.constant'], // global
[/@[\w]*/, 'namespace.instance.identifier'], // instance
[/@@[\w]*/, 'namespace.class.identifier'], // class
// here document
[/<<-(@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' } ],
[/[ \t\r\n]+<<(@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' } ],
[/^<<(@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' } ],
[/<<-(@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' }],
[/[ \t\r\n]+<<(@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' }],
[/^<<(@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' }],
// whitespace
{ include: '@whitespace' },
// strings
[/"/, { token: 'string.d.delim', next: '@dstring.d."'} ],
[/'/, { token: 'string.sq.delim', next: '@sstring.sq' } ],
[/"/, { token: 'string.d.delim', next: '@dstring.d."' }],
[/'/, { token: 'string.sq.delim', next: '@sstring.sq' }],
// % literals. For efficiency, rematch in the 'pstring' state
[/%([rsqxwW]|Q?)/, { token: '@rematch', next: 'pstring' } ],
[/%([rsqxwW]|Q?)/, { token: '@rematch', next: 'pstring' }],
// commands and symbols
[/`/, { token: 'string.x.delim', next: '@dstring.x.`' } ],
[/`/, { token: 'string.x.delim', next: '@dstring.x.`' }],
[/:(\w|[$@])\w*[!?=]?/, 'string.s'],
[/:"/, { token: 'string.s.delim', next: '@dstring.s."' } ],
[/:'/, { token: 'string.s.delim', next: '@sstring.s' } ],
[/:"/, { token: 'string.s.delim', next: '@dstring.s."' }],
[/:'/, { token: 'string.s.delim', next: '@sstring.s' }],
// regular expressions. Lookahead for a (not escaped) closing forwardslash on the same line
[/\/(?=(\\\/|[^\/\n])+\/)/, { token: 'regexp.delim', next: '@regexp' } ],
[/\/(?=(\\\/|[^\/\n])+\/)/, { token: 'regexp.delim', next: '@regexp' }],
// delimiters and operators
[/[{}()\[\]]/, '@brackets'],
[/@symbols/, { cases: { '@keywordops': 'keyword',
'@operators' : 'operator',
'@default' : '' } } ],
[/@symbols/, {
cases: {
'@keywordops': 'keyword',
'@operators': 'operator',
'@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
'do' : { token: 'keyword', switchTo: '@root.$S2' }, // do on same line: not an open bracket here
[/[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,22 +252,26 @@ 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' }
],
// single quote strings (also used for symbols)
// sstring.<kind> where kind is 'sq' (single quote) or 's' (symbol)
sstring: [
[/[^\\']+/, 'string.$S2' ],
[/[^\\']+/, 'string.$S2'],
[/\\\\|\\'|\\$/, 'string.$S2.escape'],
[/\\./, 'string.$S2.invalid'],
[/'/, { token: 'string.$S2.delim', next: '@pop'} ]
[/'/, { token: 'string.$S2.delim', next: '@pop' }]
],
// double quoted "string".
@ -255,34 +279,42 @@ export var language = <ILanguage> {
// and delim is the ending delimiter (" or `)
dstring: [
[/[^\\`"#]+/, 'string.$S2'],
[/#/, 'string.$S2.escape', '@interpolated' ],
[/\\$/, 'string.$S2.escape' ],
[/#/, 'string.$S2.escape', '@interpolated'],
[/\\$/, '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'] }}],
[/.*/, 'string.heredoc' ],
[/^(\s*)(@heredelim)$/, {
cases: {
'$2==$S2': ['string.heredoc', { token: 'string.heredoc.delimiter', next: '@pop' }],
'@default': ['string.heredoc', 'string.heredoc']
}
}],
[/.*/, 'string.heredoc'],
],
// interpolated sequence
interpolated: [
[/\$\w*/, 'global.constant', '@pop' ],
[/@\w*/, 'namespace.class.identifier', '@pop' ],
[/@@\w*/, 'namespace.instance.identifier', '@pop' ],
[/\$\w*/, 'global.constant', '@pop'],
[/@\w*/, 'namespace.class.identifier', '@pop'],
[/@@\w*/, 'namespace.instance.identifier', '@pop'],
[/[{]/, { token: 'string.escape.curly', switchTo: '@interpolated_compound' }],
['', '', '@pop' ], // just a # is interpreted as a #
['', '', '@pop'], // just a # is interpreted as a #
],
// any code
interpolated_compound: [
[/[}]/, { token: 'string.escape.curly', next: '@pop'} ],
[/[}]/, { token: 'string.escape.curly', next: '@pop' }],
{ include: '@root' },
],
@ -293,72 +325,76 @@ 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' },
'$#==$S2' : { token: 'regexp.delim', next: '@push' }, // nested delimiters are allowed..
'~[)}\\]]' : '@brackets.regexp.escape.control',
[/[^\(\{\[\\]/, {
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' },
],
// We match regular expression quite precisely
regexp: [
{ include: '@regexcontrol' },
[/[^\\\/]/, 'regexp' ],
['/[ixmp]*', { token: 'regexp.delim'}, '@pop' ],
[/[^\\\/]/, 'regexp'],
['/[ixmp]*', { token: 'regexp.delim' }, '@pop'],
],
regexcontrol: [
[/(\{)(\d+(?:,\d*)?)(\})/, ['@brackets.regexp.escape.control', 'regexp.escape.control', '@brackets.regexp.escape.control'] ],
[/(\[)(\^?)/, ['@brackets.regexp.escape.control',{ token: 'regexp.escape.control', next: '@regexrange'}]],
[/(\()(\?[:=!])/, ['@brackets.regexp.escape.control', 'regexp.escape.control'] ],
[/(\{)(\d+(?:,\d*)?)(\})/, ['@brackets.regexp.escape.control', 'regexp.escape.control', '@brackets.regexp.escape.control']],
[/(\[)(\^?)/, ['@brackets.regexp.escape.control', { token: 'regexp.escape.control', next: '@regexrange' }]],
[/(\()(\?[:=!])/, ['@brackets.regexp.escape.control', 'regexp.escape.control']],
[/\(\?#/, { token: 'regexp.escape.control', next: '@regexpcomment' }],
[/[()]/, '@brackets.regexp.escape.control'],
[/@regexpctl/, 'regexp.escape.control'],
[/\\$/, 'regexp.escape' ],
[/@regexpesc/, 'regexp.escape' ],
[/\\\./, 'regexp.invalid' ],
[/#/, 'regexp.escape', '@interpolated' ],
[/\\$/, 'regexp.escape'],
[/@regexpesc/, 'regexp.escape'],
[/\\\./, 'regexp.invalid'],
[/#/, 'regexp.escape', '@interpolated'],
],
regexrange: [
[/-/, 'regexp.escape.control'],
[/\^/, 'regexp.invalid'],
[/\\$/, 'regexp.escape' ],
[/\\$/, 'regexp.escape'],
[/@regexpesc/, 'regexp.escape'],
[/[^\]]/, 'regexp'],
[/\]/, '@brackets.regexp.escape.control', '@pop'],
],
regexpcomment: [
[ /[^)]+/, 'comment' ],
[ /\)/, { token: 'regexp.escape.control', next: '@pop' } ]
[/[^)]+/, 'comment'],
[/\)/, { token: 'regexp.escape.control', next: '@pop' }]
],
// % quoted strings
// A bit repetitive since we need to often special case the kind of ending delimiter
pstring: [
[/%([qws])\(/, { token: 'string.$1.delim', switchTo: '@qstring.$1.(.)' } ],
[/%([qws])\[/, { token: 'string.$1.delim', switchTo: '@qstring.$1.[.]' } ],
[/%([qws])\{/, { token: 'string.$1.delim', switchTo: '@qstring.$1.{.}' } ],
[/%([qws])</, { token: 'string.$1.delim', switchTo: '@qstring.$1.<.>' } ],
[/%([qws])(@delim)/, { token: 'string.$1.delim', switchTo: '@qstring.$1.$2.$2' } ],
[/%([qws])\(/, { token: 'string.$1.delim', switchTo: '@qstring.$1.(.)' }],
[/%([qws])\[/, { token: 'string.$1.delim', switchTo: '@qstring.$1.[.]' }],
[/%([qws])\{/, { token: 'string.$1.delim', switchTo: '@qstring.$1.{.}' }],
[/%([qws])</, { token: 'string.$1.delim', switchTo: '@qstring.$1.<.>' }],
[/%([qws])(@delim)/, { token: 'string.$1.delim', switchTo: '@qstring.$1.$2.$2' }],
[/%r\(/, { token: 'regexp.delim', switchTo: '@pregexp.(.)' } ],
[/%r\[/, { token: 'regexp.delim', switchTo: '@pregexp.[.]' } ],
[/%r\{/, { token: 'regexp.delim', switchTo: '@pregexp.{.}' } ],
[/%r</, { token: 'regexp.delim', switchTo: '@pregexp.<.>' } ],
[/%r(@delim)/, { token: 'regexp.delim', switchTo: '@pregexp.$1.$1' } ],
[/%r\(/, { token: 'regexp.delim', switchTo: '@pregexp.(.)' }],
[/%r\[/, { token: 'regexp.delim', switchTo: '@pregexp.[.]' }],
[/%r\{/, { token: 'regexp.delim', switchTo: '@pregexp.{.}' }],
[/%r</, { token: 'regexp.delim', switchTo: '@pregexp.<.>' }],
[/%r(@delim)/, { token: 'regexp.delim', switchTo: '@pregexp.$1.$1' }],
[/%(x|W|Q?)\(/, { token: 'string.$1.delim', switchTo: '@qqstring.$1.(.)' } ],
[/%(x|W|Q?)\[/, { token: 'string.$1.delim', switchTo: '@qqstring.$1.[.]' } ],
[/%(x|W|Q?)\{/, { token: 'string.$1.delim', switchTo: '@qqstring.$1.{.}' } ],
[/%(x|W|Q?)</, { token: 'string.$1.delim', switchTo: '@qqstring.$1.<.>' } ],
[/%(x|W|Q?)(@delim)/, { token: 'string.$1.delim', switchTo: '@qqstring.$1.$2.$2' } ],
[/%(x|W|Q?)\(/, { token: 'string.$1.delim', switchTo: '@qqstring.$1.(.)' }],
[/%(x|W|Q?)\[/, { token: 'string.$1.delim', switchTo: '@qqstring.$1.[.]' }],
[/%(x|W|Q?)\{/, { token: 'string.$1.delim', switchTo: '@qqstring.$1.{.}' }],
[/%(x|W|Q?)</, { token: 'string.$1.delim', switchTo: '@qqstring.$1.<.>' }],
[/%(x|W|Q?)(@delim)/, { token: 'string.$1.delim', switchTo: '@qqstring.$1.$2.$2' }],
[/%([rqwsxW]|Q?)./, { token: 'invalid', next: '@pop' } ], // recover
[/./, { token: 'invalid', next: '@pop' } ], // recover
[/%([rqwsxW]|Q?)./, { token: 'invalid', next: '@pop' }], // recover
[/./, { token: 'invalid', next: '@pop' }], // recover
],
// non-expanded quoted string.
@ -367,11 +403,15 @@ export var language = <ILanguage> {
// open = open delimiter
// close = close delimiter
qstring: [
[/\\$/, 'string.$S2.escape' ],
[/\\./, 'string.$S2.escape' ],
[/./, { cases: { '$#==$S4' : { token: 'string.$S2.delim', next: '@pop' },
'$#==$S3' : { token: 'string.$S2.delim', next: '@push' }, // nested delimiters are allowed..
'@default': 'string.$S2' }}],
[/\\$/, 'string.$S2.escape'],
[/\\./, 'string.$S2.escape'],
[/./, {
cases: {
'$#==$S4': { token: 'string.$S2.delim', next: '@pop' },
'$#==$S3': { token: 'string.$S2.delim', next: '@push' }, // nested delimiters are allowed..
'@default': 'string.$S2'
}
}],
],
// expanded quoted string.
@ -380,7 +420,7 @@ export var language = <ILanguage> {
// open = open delimiter
// close = close delimiter
qqstring: [
[/#/, 'string.$S2.escape', '@interpolated' ],
[/#/, 'string.$S2.escape', '@interpolated'],
{ include: '@qstring' }
],
@ -388,15 +428,15 @@ export var language = <ILanguage> {
// whitespace & comments
whitespace: [
[/[ \t\r\n]+/, ''],
[/^\s*=begin\b/, 'comment', '@comment' ],
[/^\s*=begin\b/, 'comment', '@comment'],
[/#.*$/, 'comment'],
],
comment: [
[/[^=]+/, 'comment' ],
[/^\s*=begin\b/, 'comment.invalid' ], // nested comment
[/^\s*=end\b.*/, 'comment', '@pop' ],
[/[=]/, 'comment' ]
[/[^=]+/, 'comment'],
[/^\s*=begin\b/, 'comment.invalid'], // nested comment
[/^\s*=end\b.*/, 'comment', '@pop'],
[/[=]/, 'comment']
],
}
};

View file

@ -41,7 +41,7 @@ const TOKEN_PROPERTY = 'attribute.name';
const TOKEN_VALUE = 'attribute.value';
const TOKEN_AT_KEYWORD = 'keyword';
export var language = <IMonarchLanguage> {
export var language = <IMonarchLanguage>{
defaultToken: '',
tokenPostfix: '.scss',

File diff suppressed because one or more lines are too long

View file

@ -8,15 +8,15 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
comments: {
lineComment: '--',
blockComment: ['/*', '*/'],
},
brackets: [
['{','}'],
['[',']'],
['(',')']
['{', '}'],
['[', ']'],
['(', ')']
],
autoClosingPairs: [
{ open: '{', close: '}' },
@ -34,7 +34,7 @@ export var conf:IRichLanguageConfiguration = {
]
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '.sql',
ignoreCase: true,
@ -956,101 +956,101 @@ export var language = <ILanguage> {
],
operators: [
// Logical
'ALL','AND','ANY','BETWEEN','EXISTS','IN','LIKE','NOT','OR','SOME',
'ALL', 'AND', 'ANY', 'BETWEEN', 'EXISTS', 'IN', 'LIKE', 'NOT', 'OR', 'SOME',
// Set
'EXCEPT','INTERSECT','UNION',
'EXCEPT', 'INTERSECT', 'UNION',
// Join
'APPLY','CROSS','FULL','INNER','JOIN','LEFT','OUTER','RIGHT',
'APPLY', 'CROSS', 'FULL', 'INNER', 'JOIN', 'LEFT', 'OUTER', 'RIGHT',
// Predicates
'CONTAINS','FREETEXT','IS','NULL',
'CONTAINS', 'FREETEXT', 'IS', 'NULL',
// Pivoting
'PIVOT','UNPIVOT',
'PIVOT', 'UNPIVOT',
// Merging
'MATCHED'
],
builtinFunctions: [
// Aggregate
'AVG','CHECKSUM_AGG','COUNT','COUNT_BIG','GROUPING','GROUPING_ID','MAX','MIN','SUM','STDEV','STDEVP','VAR','VARP',
'AVG', 'CHECKSUM_AGG', 'COUNT', 'COUNT_BIG', 'GROUPING', 'GROUPING_ID', 'MAX', 'MIN', 'SUM', 'STDEV', 'STDEVP', 'VAR', 'VARP',
// Analytic
'CUME_DIST','FIRST_VALUE','LAG','LAST_VALUE','LEAD','PERCENTILE_CONT','PERCENTILE_DISC','PERCENT_RANK',
'CUME_DIST', 'FIRST_VALUE', 'LAG', 'LAST_VALUE', 'LEAD', 'PERCENTILE_CONT', 'PERCENTILE_DISC', 'PERCENT_RANK',
// Collation
'COLLATE','COLLATIONPROPERTY','TERTIARY_WEIGHTS',
'COLLATE', 'COLLATIONPROPERTY', 'TERTIARY_WEIGHTS',
// Azure
'FEDERATION_FILTERING_VALUE',
// Conversion
'CAST','CONVERT','PARSE','TRY_CAST','TRY_CONVERT','TRY_PARSE',
'CAST', 'CONVERT', 'PARSE', 'TRY_CAST', 'TRY_CONVERT', 'TRY_PARSE',
// Cryptographic
'ASYMKEY_ID','ASYMKEYPROPERTY','CERTPROPERTY','CERT_ID','CRYPT_GEN_RANDOM',
'DECRYPTBYASYMKEY','DECRYPTBYCERT','DECRYPTBYKEY','DECRYPTBYKEYAUTOASYMKEY','DECRYPTBYKEYAUTOCERT','DECRYPTBYPASSPHRASE',
'ENCRYPTBYASYMKEY','ENCRYPTBYCERT','ENCRYPTBYKEY','ENCRYPTBYPASSPHRASE','HASHBYTES','IS_OBJECTSIGNED',
'KEY_GUID','KEY_ID','KEY_NAME','SIGNBYASYMKEY','SIGNBYCERT','SYMKEYPROPERTY','VERIFYSIGNEDBYCERT','VERIFYSIGNEDBYASYMKEY',
'ASYMKEY_ID', 'ASYMKEYPROPERTY', 'CERTPROPERTY', 'CERT_ID', 'CRYPT_GEN_RANDOM',
'DECRYPTBYASYMKEY', 'DECRYPTBYCERT', 'DECRYPTBYKEY', 'DECRYPTBYKEYAUTOASYMKEY', 'DECRYPTBYKEYAUTOCERT', 'DECRYPTBYPASSPHRASE',
'ENCRYPTBYASYMKEY', 'ENCRYPTBYCERT', 'ENCRYPTBYKEY', 'ENCRYPTBYPASSPHRASE', 'HASHBYTES', 'IS_OBJECTSIGNED',
'KEY_GUID', 'KEY_ID', 'KEY_NAME', 'SIGNBYASYMKEY', 'SIGNBYCERT', 'SYMKEYPROPERTY', 'VERIFYSIGNEDBYCERT', 'VERIFYSIGNEDBYASYMKEY',
// Cursor
'CURSOR_STATUS',
// Datatype
'DATALENGTH','IDENT_CURRENT','IDENT_INCR','IDENT_SEED','IDENTITY','SQL_VARIANT_PROPERTY',
'DATALENGTH', 'IDENT_CURRENT', 'IDENT_INCR', 'IDENT_SEED', 'IDENTITY', 'SQL_VARIANT_PROPERTY',
// Datetime
'CURRENT_TIMESTAMP','DATEADD','DATEDIFF','DATEFROMPARTS','DATENAME','DATEPART','DATETIME2FROMPARTS','DATETIMEFROMPARTS',
'DATETIMEOFFSETFROMPARTS','DAY','EOMONTH','GETDATE','GETUTCDATE','ISDATE','MONTH','SMALLDATETIMEFROMPARTS','SWITCHOFFSET',
'SYSDATETIME','SYSDATETIMEOFFSET','SYSUTCDATETIME','TIMEFROMPARTS','TODATETIMEOFFSET','YEAR',
'CURRENT_TIMESTAMP', 'DATEADD', 'DATEDIFF', 'DATEFROMPARTS', 'DATENAME', 'DATEPART', 'DATETIME2FROMPARTS', 'DATETIMEFROMPARTS',
'DATETIMEOFFSETFROMPARTS', 'DAY', 'EOMONTH', 'GETDATE', 'GETUTCDATE', 'ISDATE', 'MONTH', 'SMALLDATETIMEFROMPARTS', 'SWITCHOFFSET',
'SYSDATETIME', 'SYSDATETIMEOFFSET', 'SYSUTCDATETIME', 'TIMEFROMPARTS', 'TODATETIMEOFFSET', 'YEAR',
// Logical
'CHOOSE','COALESCE','IIF','NULLIF',
'CHOOSE', 'COALESCE', 'IIF', 'NULLIF',
// Mathematical
'ABS','ACOS','ASIN','ATAN','ATN2','CEILING','COS','COT','DEGREES','EXP','FLOOR','LOG','LOG10',
'PI','POWER','RADIANS','RAND','ROUND','SIGN','SIN','SQRT','SQUARE','TAN',
'ABS', 'ACOS', 'ASIN', 'ATAN', 'ATN2', 'CEILING', 'COS', 'COT', 'DEGREES', 'EXP', 'FLOOR', 'LOG', 'LOG10',
'PI', 'POWER', 'RADIANS', 'RAND', 'ROUND', 'SIGN', 'SIN', 'SQRT', 'SQUARE', 'TAN',
// Metadata
'APP_NAME','APPLOCK_MODE','APPLOCK_TEST','ASSEMBLYPROPERTY','COL_LENGTH','COL_NAME','COLUMNPROPERTY',
'DATABASE_PRINCIPAL_ID','DATABASEPROPERTYEX','DB_ID','DB_NAME','FILE_ID','FILE_IDEX','FILE_NAME','FILEGROUP_ID',
'FILEGROUP_NAME','FILEGROUPPROPERTY','FILEPROPERTY','FULLTEXTCATALOGPROPERTY','FULLTEXTSERVICEPROPERTY',
'INDEX_COL','INDEXKEY_PROPERTY','INDEXPROPERTY','OBJECT_DEFINITION','OBJECT_ID',
'OBJECT_NAME','OBJECT_SCHEMA_NAME','OBJECTPROPERTY','OBJECTPROPERTYEX','ORIGINAL_DB_NAME','PARSENAME',
'SCHEMA_ID','SCHEMA_NAME','SCOPE_IDENTITY','SERVERPROPERTY','STATS_DATE','TYPE_ID','TYPE_NAME','TYPEPROPERTY',
'APP_NAME', 'APPLOCK_MODE', 'APPLOCK_TEST', 'ASSEMBLYPROPERTY', 'COL_LENGTH', 'COL_NAME', 'COLUMNPROPERTY',
'DATABASE_PRINCIPAL_ID', 'DATABASEPROPERTYEX', 'DB_ID', 'DB_NAME', 'FILE_ID', 'FILE_IDEX', 'FILE_NAME', 'FILEGROUP_ID',
'FILEGROUP_NAME', 'FILEGROUPPROPERTY', 'FILEPROPERTY', 'FULLTEXTCATALOGPROPERTY', 'FULLTEXTSERVICEPROPERTY',
'INDEX_COL', 'INDEXKEY_PROPERTY', 'INDEXPROPERTY', 'OBJECT_DEFINITION', 'OBJECT_ID',
'OBJECT_NAME', 'OBJECT_SCHEMA_NAME', 'OBJECTPROPERTY', 'OBJECTPROPERTYEX', 'ORIGINAL_DB_NAME', 'PARSENAME',
'SCHEMA_ID', 'SCHEMA_NAME', 'SCOPE_IDENTITY', 'SERVERPROPERTY', 'STATS_DATE', 'TYPE_ID', 'TYPE_NAME', 'TYPEPROPERTY',
// Ranking
'DENSE_RANK','NTILE','RANK','ROW_NUMBER',
'DENSE_RANK', 'NTILE', 'RANK', 'ROW_NUMBER',
// Replication
'PUBLISHINGSERVERNAME',
// Rowset
'OPENDATASOURCE','OPENQUERY','OPENROWSET','OPENXML',
'OPENDATASOURCE', 'OPENQUERY', 'OPENROWSET', 'OPENXML',
// Security
'CERTENCODED','CERTPRIVATEKEY','CURRENT_USER','HAS_DBACCESS','HAS_PERMS_BY_NAME','IS_MEMBER','IS_ROLEMEMBER','IS_SRVROLEMEMBER',
'LOGINPROPERTY','ORIGINAL_LOGIN','PERMISSIONS','PWDENCRYPT','PWDCOMPARE','SESSION_USER','SESSIONPROPERTY','SUSER_ID','SUSER_NAME',
'SUSER_SID','SUSER_SNAME','SYSTEM_USER','USER','USER_ID','USER_NAME',
'CERTENCODED', 'CERTPRIVATEKEY', 'CURRENT_USER', 'HAS_DBACCESS', 'HAS_PERMS_BY_NAME', 'IS_MEMBER', 'IS_ROLEMEMBER', 'IS_SRVROLEMEMBER',
'LOGINPROPERTY', 'ORIGINAL_LOGIN', 'PERMISSIONS', 'PWDENCRYPT', 'PWDCOMPARE', 'SESSION_USER', 'SESSIONPROPERTY', 'SUSER_ID', 'SUSER_NAME',
'SUSER_SID', 'SUSER_SNAME', 'SYSTEM_USER', 'USER', 'USER_ID', 'USER_NAME',
// String
'ASCII','CHAR','CHARINDEX','CONCAT','DIFFERENCE','FORMAT','LEFT','LEN','LOWER','LTRIM','NCHAR','PATINDEX',
'QUOTENAME','REPLACE','REPLICATE','REVERSE','RIGHT','RTRIM','SOUNDEX','SPACE','STR','STUFF','SUBSTRING','UNICODE','UPPER',
'ASCII', 'CHAR', 'CHARINDEX', 'CONCAT', 'DIFFERENCE', 'FORMAT', 'LEFT', 'LEN', 'LOWER', 'LTRIM', 'NCHAR', 'PATINDEX',
'QUOTENAME', 'REPLACE', 'REPLICATE', 'REVERSE', 'RIGHT', 'RTRIM', 'SOUNDEX', 'SPACE', 'STR', 'STUFF', 'SUBSTRING', 'UNICODE', 'UPPER',
// System
'BINARY_CHECKSUM','CHECKSUM','CONNECTIONPROPERTY','CONTEXT_INFO','CURRENT_REQUEST_ID','ERROR_LINE','ERROR_NUMBER','ERROR_MESSAGE',
'ERROR_PROCEDURE','ERROR_SEVERITY','ERROR_STATE','FORMATMESSAGE','GETANSINULL','GET_FILESTREAM_TRANSACTION_CONTEXT','HOST_ID',
'HOST_NAME','ISNULL','ISNUMERIC','MIN_ACTIVE_ROWVERSION','NEWID','NEWSEQUENTIALID','ROWCOUNT_BIG','XACT_STATE',
'BINARY_CHECKSUM', 'CHECKSUM', 'CONNECTIONPROPERTY', 'CONTEXT_INFO', 'CURRENT_REQUEST_ID', 'ERROR_LINE', 'ERROR_NUMBER', 'ERROR_MESSAGE',
'ERROR_PROCEDURE', 'ERROR_SEVERITY', 'ERROR_STATE', 'FORMATMESSAGE', 'GETANSINULL', 'GET_FILESTREAM_TRANSACTION_CONTEXT', 'HOST_ID',
'HOST_NAME', 'ISNULL', 'ISNUMERIC', 'MIN_ACTIVE_ROWVERSION', 'NEWID', 'NEWSEQUENTIALID', 'ROWCOUNT_BIG', 'XACT_STATE',
// TextImage
'TEXTPTR','TEXTVALID',
'TEXTPTR', 'TEXTVALID',
// Trigger
'COLUMNS_UPDATED','EVENTDATA','TRIGGER_NESTLEVEL','UPDATE',
'COLUMNS_UPDATED', 'EVENTDATA', 'TRIGGER_NESTLEVEL', 'UPDATE',
// ChangeTracking
'CHANGETABLE','CHANGE_TRACKING_CONTEXT','CHANGE_TRACKING_CURRENT_VERSION','CHANGE_TRACKING_IS_COLUMN_IN_MASK','CHANGE_TRACKING_MIN_VALID_VERSION',
'CHANGETABLE', 'CHANGE_TRACKING_CONTEXT', 'CHANGE_TRACKING_CURRENT_VERSION', 'CHANGE_TRACKING_IS_COLUMN_IN_MASK', 'CHANGE_TRACKING_MIN_VALID_VERSION',
// FullTextSearch
'CONTAINSTABLE','FREETEXTTABLE',
'CONTAINSTABLE', 'FREETEXTTABLE',
// SemanticTextSearch
'SEMANTICKEYPHRASETABLE','SEMANTICSIMILARITYDETAILSTABLE','SEMANTICSIMILARITYTABLE',
'SEMANTICKEYPHRASETABLE', 'SEMANTICSIMILARITYDETAILSTABLE', 'SEMANTICSIMILARITYTABLE',
// FileStream
'FILETABLEROOTPATH','GETFILENAMESPACEPATH','GETPATHLOCATOR','PATHNAME',
'FILETABLEROOTPATH', 'GETFILENAMESPACEPATH', 'GETPATHLOCATOR', 'PATHNAME',
// ServiceBroker
'GET_TRANSMISSION_STATUS'
],
builtinVariables: [
// Configuration
'@@DATEFIRST','@@DBTS','@@LANGID','@@LANGUAGE','@@LOCK_TIMEOUT','@@MAX_CONNECTIONS','@@MAX_PRECISION','@@NESTLEVEL',
'@@OPTIONS','@@REMSERVER','@@SERVERNAME','@@SERVICENAME','@@SPID','@@TEXTSIZE','@@VERSION',
'@@DATEFIRST', '@@DBTS', '@@LANGID', '@@LANGUAGE', '@@LOCK_TIMEOUT', '@@MAX_CONNECTIONS', '@@MAX_PRECISION', '@@NESTLEVEL',
'@@OPTIONS', '@@REMSERVER', '@@SERVERNAME', '@@SERVICENAME', '@@SPID', '@@TEXTSIZE', '@@VERSION',
// Cursor
'@@CURSOR_ROWS','@@FETCH_STATUS',
'@@CURSOR_ROWS', '@@FETCH_STATUS',
// Datetime
'@@DATEFIRST',
// Metadata
'@@PROCID',
// System
'@@ERROR','@@IDENTITY','@@ROWCOUNT','@@TRANCOUNT',
'@@ERROR', '@@IDENTITY', '@@ROWCOUNT', '@@TRANCOUNT',
// Stats
'@@CONNECTIONS','@@CPU_BUSY','@@IDLE','@@IO_BUSY','@@PACKET_ERRORS','@@PACK_RECEIVED','@@PACK_SENT',
'@@TIMETICKS','@@TOTAL_ERRORS','@@TOTAL_READ','@@TOTAL_WRITE'
'@@CONNECTIONS', '@@CPU_BUSY', '@@IDLE', '@@IO_BUSY', '@@PACKET_ERRORS', '@@PACK_RECEIVED', '@@PACK_SENT',
'@@TIMETICKS', '@@TOTAL_ERRORS', '@@TOTAL_READ', '@@TOTAL_WRITE'
],
pseudoColumns: [
'$ACTION', '$IDENTITY', '$ROWGUID', '$PARTITION'
@ -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

@ -7,15 +7,15 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
comments: {
lineComment: '//',
blockComment: ['/*', '*/'],
},
brackets: [
['{','}'],
['[',']'],
['(',')']
['{', '}'],
['[', ']'],
['(', ')']
],
autoClosingPairs: [
{ open: '{', close: '}' },
@ -35,7 +35,7 @@ export var conf:IRichLanguageConfiguration = {
]
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '.swift',
@ -46,7 +46,7 @@ export var language = <ILanguage> {
'@autoclosure', '@noescape', '@noreturn', '@NSApplicationMain', '@NSCopying', '@NSManaged',
'@objc', '@UIApplicationMain', '@noreturn', '@availability', '@IBAction', '@IBDesignable', '@IBInspectable', '@IBOutlet'
],
accessmodifiers: [ 'public', 'private', 'internal' ],
accessmodifiers: ['public', 'private', 'internal'],
keywords: [
'__COLUMN__', '__FILE__', '__FUNCTION__', '__LINE__', 'as', 'as!', 'as?', 'associativity', 'break', 'case', 'catch',
'class', 'continue', 'convenience', 'default', 'deinit', 'didSet', 'do', 'dynamic', 'dynamicType',
@ -87,69 +87,84 @@ export var language = <ILanguage> {
comment: [
[ /\/\/\/.*$/, 'comment.doc' ],
[ /\/\*\*/, 'comment.doc', '@commentdocbody' ],
[ /\/\/.*$/, 'comment' ],
[ /\/\*/, 'comment', '@commentbody' ]
[/\/\/\/.*$/, 'comment.doc'],
[/\/\*\*/, 'comment.doc', '@commentdocbody'],
[/\/\/.*$/, 'comment'],
[/\/\*/, 'comment', '@commentbody']
],
commentdocbody: [
[ /\/\*/, 'comment', '@commentbody' ],
[ /\*\//, 'comment.doc', '@pop' ],
[ /\:[a-zA-Z]+\:/, 'comment.doc.param' ],
[ /./, 'comment.doc' ]
[/\/\*/, 'comment', '@commentbody'],
[/\*\//, 'comment.doc', '@pop'],
[/\:[a-zA-Z]+\:/, 'comment.doc.param'],
[/./, 'comment.doc']
],
commentbody: [
[ /\/\*/, 'comment', '@commentbody' ],
[ /\*\//, 'comment', '@pop' ],
[ /./, 'comment' ]
[/\/\*/, 'comment', '@commentbody'],
[/\*\//, 'comment', '@pop'],
[/./, 'comment']
],
attribute: [
[ /\@@identifier/, { cases: { '@attributes': 'keyword.control', '@default': '' } } ]
[/\@@identifier/, {
cases: {
'@attributes': 'keyword.control',
'@default': ''
}
}]
],
literal: [
[ /"/, { token: 'string.quote', next: '@stringlit' } ],
[ /0[b]([01]_?)+/, 'number.binary' ],
[ /0[o]([0-7]_?)+/, 'number.octal' ],
[ /0[x]([0-9a-fA-F]_?)+([pP][\-+](\d_?)+)?/, 'number.hex' ],
[ /(\d_?)*\.(\d_?)+([eE][\-+]?(\d_?)+)?/, 'number.float'],
[ /(\d_?)+/, 'number' ]
[/"/, { token: 'string.quote', next: '@stringlit' }],
[/0[b]([01]_?)+/, 'number.binary'],
[/0[o]([0-7]_?)+/, 'number.octal'],
[/0[x]([0-9a-fA-F]_?)+([pP][\-+](\d_?)+)?/, 'number.hex'],
[/(\d_?)*\.(\d_?)+([eE][\-+]?(\d_?)+)?/, 'number.float'],
[/(\d_?)+/, 'number']
],
stringlit: [
[ /\\\(/, { token: 'operator', next: '@interpolatedexpression' } ],
[ /@escapes/, 'string' ],
[ /\\./, 'string.escape.invalid' ],
[ /"/, { token: 'string.quote', next: '@pop' } ],
[ /./, 'string' ]
[/\\\(/, { token: 'operator', next: '@interpolatedexpression' }],
[/@escapes/, 'string'],
[/\\./, 'string.escape.invalid'],
[/"/, { token: 'string.quote', next: '@pop' }],
[/./, 'string']
],
interpolatedexpression: [
[ /\(/, { token: 'operator', next: '@interpolatedexpression' } ],
[ /\)/, { token: 'operator', next: '@pop' } ],
[/\(/, { token: 'operator', next: '@interpolatedexpression' }],
[/\)/, { token: 'operator', next: '@pop' }],
{ include: '@literal' },
{ include: '@keyword' },
{ include: '@symbol' }
],
keyword: [
[ /`/, { token: 'operator', next: '@escapedkeyword' } ],
[ /@identifier/, { cases: { '@keywords': 'keyword', '[A-Z][\a-zA-Z0-9$]*': 'type.identifier', '@default': 'identifier' } }]
[/`/, { token: 'operator', next: '@escapedkeyword' }],
[/@identifier/, {
cases: {
'@keywords': 'keyword', '[A-Z][\a-zA-Z0-9$]*': 'type.identifier',
'@default': 'identifier'
}
}]
],
escapedkeyword: [
[ /`/, { token: 'operator', next: '@pop' } ],
[ /./, 'identifier' ]
[/`/, { token: 'operator', next: '@pop' }],
[/./, 'identifier']
],
// symbol: [
// [ /@symbols/, 'operator' ],
// [ /@operators/, 'operator' ]
// ],
// symbol: [
// [ /@symbols/, 'operator' ],
// [ /@operators/, 'operator' ]
// ],
invokedmethod: [
[/([.])(@identifier)/, { cases: { '$2': ['delimeter', 'type.identifier'], '@default': '' } }],
[/([.])(@identifier)/, {
cases: {
'$2': ['delimeter', 'type.identifier'],
'@default': ''
}
}],
]
}
};

126
src/vb.ts
View file

@ -8,38 +8,38 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
comments: {
lineComment: '\'',
blockComment: ['/*', '*/'],
},
brackets: [
['{','}'],['[',']'],['(',')'],['<','>'],
['addhandler','end addhandler'],
['class','end class'],
['enum','end enum'],
['event','end event'],
['function','end function'],
['get','end get'],
['if','end if'],
['interface','end interface'],
['module','end module'],
['namespace','end namespace'],
['operator','end operator'],
['property','end property'],
['raiseevent','end raiseevent'],
['removehandler','end removehandler'],
['select','end select'],
['set','end set'],
['structure','end structure'],
['sub','end sub'],
['synclock','end synclock'],
['try','end try'],
['while','end while'],
['with','end with'],
['using','end using'],
['do','loop'],
['for','next']
['{', '}'], ['[', ']'], ['(', ')'], ['<', '>'],
['addhandler', 'end addhandler'],
['class', 'end class'],
['enum', 'end enum'],
['event', 'end event'],
['function', 'end function'],
['get', 'end get'],
['if', 'end if'],
['interface', 'end interface'],
['module', 'end module'],
['namespace', 'end namespace'],
['operator', 'end operator'],
['property', 'end property'],
['raiseevent', 'end raiseevent'],
['removehandler', 'end removehandler'],
['select', 'end select'],
['set', 'end set'],
['structure', 'end structure'],
['sub', 'end sub'],
['synclock', 'end synclock'],
['try', 'end try'],
['while', 'end while'],
['with', 'end with'],
['using', 'end using'],
['do', 'loop'],
['for', 'next']
],
autoClosingPairs: [
{ open: '{', close: '}', notIn: ['string', 'comment'] },
@ -50,41 +50,41 @@ export var conf:IRichLanguageConfiguration = {
]
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '.vb',
ignoreCase: true,
brackets: [
{ token:'delimiter.bracket', open: '{', close: '}'},
{ token:'delimiter.array', open: '[', close: ']'},
{ token:'delimiter.parenthesis', open: '(', close: ')'},
{ token:'delimiter.angle', open: '<', close: '>'},
{ token: 'delimiter.bracket', open: '{', close: '}' },
{ token: 'delimiter.array', open: '[', close: ']' },
{ token: 'delimiter.parenthesis', open: '(', close: ')' },
{ token: 'delimiter.angle', open: '<', close: '>' },
// Special bracket statement pairs
// according to https://msdn.microsoft.com/en-us/library/tsw2a11z.aspx
{ token: 'keyword.tag-addhandler', open: 'addhandler', close: 'end addhandler'},
{ token: 'keyword.tag-class', open: 'class', close: 'end class'},
{ token: 'keyword.tag-enum', open: 'enum', close: 'end enum'},
{ token: 'keyword.tag-event', open: 'event', close: 'end event'},
{ token: 'keyword.tag-function', open: 'function', close: 'end function'},
{ token: 'keyword.tag-get', open: 'get', close: 'end get'},
{ token: 'keyword.tag-if', open: 'if', close: 'end if'},
{ token: 'keyword.tag-interface', open: 'interface', close: 'end interface'},
{ token: 'keyword.tag-module', open: 'module', close: 'end module'},
{ token: 'keyword.tag-namespace', open: 'namespace', close: 'end namespace'},
{ token: 'keyword.tag-operator', open: 'operator', close: 'end operator'},
{ token: 'keyword.tag-property', open: 'property', close: 'end property'},
{ token: 'keyword.tag-raiseevent', open: 'raiseevent', close: 'end raiseevent'},
{ token: 'keyword.tag-removehandler', open: 'removehandler', close: 'end removehandler'},
{ token: 'keyword.tag-select', open: 'select', close: 'end select'},
{ token: 'keyword.tag-set', open: 'set', close: 'end set'},
{ token: 'keyword.tag-structure', open: 'structure', close: 'end structure'},
{ token: 'keyword.tag-sub', open: 'sub', close: 'end sub'},
{ token: 'keyword.tag-synclock', open: 'synclock', close: 'end synclock'},
{ token: 'keyword.tag-try', open: 'try', close: 'end try'},
{ token: 'keyword.tag-while', open: 'while', close: 'end while'},
{ token: 'keyword.tag-with', open: 'with', close: 'end with'},
{ token: 'keyword.tag-addhandler', open: 'addhandler', close: 'end addhandler' },
{ token: 'keyword.tag-class', open: 'class', close: 'end class' },
{ token: 'keyword.tag-enum', open: 'enum', close: 'end enum' },
{ token: 'keyword.tag-event', open: 'event', close: 'end event' },
{ token: 'keyword.tag-function', open: 'function', close: 'end function' },
{ token: 'keyword.tag-get', open: 'get', close: 'end get' },
{ token: 'keyword.tag-if', open: 'if', close: 'end if' },
{ token: 'keyword.tag-interface', open: 'interface', close: 'end interface' },
{ token: 'keyword.tag-module', open: 'module', close: 'end module' },
{ token: 'keyword.tag-namespace', open: 'namespace', close: 'end namespace' },
{ token: 'keyword.tag-operator', open: 'operator', close: 'end operator' },
{ token: 'keyword.tag-property', open: 'property', close: 'end property' },
{ token: 'keyword.tag-raiseevent', open: 'raiseevent', close: 'end raiseevent' },
{ token: 'keyword.tag-removehandler', open: 'removehandler', close: 'end removehandler' },
{ token: 'keyword.tag-select', open: 'select', close: 'end select' },
{ token: 'keyword.tag-set', open: 'set', close: 'end set' },
{ token: 'keyword.tag-structure', open: 'structure', close: 'end structure' },
{ token: 'keyword.tag-sub', open: 'sub', close: 'end sub' },
{ token: 'keyword.tag-synclock', open: 'synclock', close: 'end synclock' },
{ token: 'keyword.tag-try', open: 'try', close: 'end try' },
{ token: 'keyword.tag-while', open: 'while', close: 'end while' },
{ token: 'keyword.tag-with', open: 'with', close: 'end with' },
// Other pairs
{ token: 'keyword.tag-using', open: 'using', close: 'end using' },
@ -130,16 +130,20 @@ export var language = <ILanguage> {
{ include: '@whitespace' },
// special ending tag-words
[/next(?!\w)/, { token: 'keyword.tag-for'}],
[/next(?!\w)/, { token: 'keyword.tag-for' }],
[/loop(?!\w)/, { token: 'keyword.tag-do' }],
// usual ending tags
[/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'},
'@keywords': {token:'keyword.$0'},
'@default': 'identifier' } }],
[/[a-zA-Z_]\w*/, {
cases: {
'@tagwords': { token: 'keyword.tag-$0' },
'@keywords': { token: 'keyword.$0' },
'@default': 'identifier'
}
}],
// Preprocessor directive
[/^\s*#\w+/, 'keyword'],
@ -159,8 +163,8 @@ export var language = <ILanguage> {
[/@symbols/, 'delimiter'],
// strings
[/"([^"\\]|\\.)*$/, 'string.invalid' ], // non-teminated string
[/"/, 'string', '@string' ],
[/"([^"\\]|\\.)*$/, 'string.invalid'], // non-teminated string
[/"/, 'string', '@string'],
],
@ -173,7 +177,7 @@ export var language = <ILanguage> {
[/[^\\"]+/, 'string'],
[/@escapes/, 'string.escape'],
[/\\./, 'string.escape.invalid'],
[/"C?/, 'string', '@pop' ]
[/"C?/, 'string', '@pop']
],
},
};

View file

@ -8,12 +8,12 @@
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
import ILanguage = monaco.languages.IMonarchLanguage;
export var conf:IRichLanguageConfiguration = {
export var conf: IRichLanguageConfiguration = {
comments: {
blockComment: ['<!--', '-->'],
},
brackets: [
['<','>']
['<', '>']
],
autoClosingPairs: [
{ open: '<', close: '>' },
@ -27,7 +27,7 @@ export var conf:IRichLanguageConfiguration = {
]
};
export var language = <ILanguage> {
export var language = <ILanguage>{
defaultToken: '',
tokenPostfix: '.xml',
@ -77,7 +77,7 @@ export var language = <ILanguage> {
],
tag: [
[/[ \t\r\n]+/, '' ],
[/[ \t\r\n]+/, ''],
[/(@qualifiedName)(\s*=\s*)("[^"]*"|'[^']*')/, ['attribute.name', '', 'attribute.value']],
[/(@qualifiedName)(\s*=\s*)("[^">?\/]*|'[^'>?\/]*)(?=[\?\/]\>)/, ['attribute.name', '', 'attribute.value']],
[/(@qualifiedName)(\s*=\s*)("[^">]*|'[^'>]*)/, ['attribute.name', '', 'attribute.value']],
@ -95,10 +95,10 @@ export var language = <ILanguage> {
],
comment: [
[/[^<\-]+/, 'comment.content' ],
[/-->/, { token: 'comment', next: '@pop' } ],
[/[^<\-]+/, 'comment.content'],
[/-->/, { token: 'comment', next: '@pop' }],
[/<!--/, 'comment.content.invalid'],
[/[<\-]/, 'comment.content' ]
[/[<\-]/, 'comment.content']
],
},
};

View file

@ -26,7 +26,7 @@ export const conf: IRichLanguageConfiguration = {
],
};
export const language = <ILanguage> {
export const language = <ILanguage>{
tokenPostfix: '.yaml',
brackets: [
@ -48,8 +48,8 @@ export const language = <ILanguage> {
tokenizer: {
root: [
{include: '@whitespace'},
{include: '@comment'},
{ include: '@whitespace' },
{ include: '@comment' },
// Directive
[/%[^ ]+.*$/, 'meta.directive'],
@ -61,10 +61,10 @@ export const language = <ILanguage> {
// Block Structure Indicators
[/[-?:](?= )/, 'operators'],
{include: '@anchor'},
{include: '@tagHandle'},
{include: '@flowCollections'},
{include: '@blockStyle'},
{ include: '@anchor' },
{ include: '@tagHandle' },
{ include: '@flowCollections' },
{ include: '@blockStyle' },
// Numbers
[/@numberInteger(?![ \t]*\S+)/, 'number'],
@ -78,16 +78,21 @@ export const language = <ILanguage> {
// Key:Value pair
[/(".*?"|'.*?'|.*?)([ \t]*)(:)( |$)/, ['type', 'white', 'operators', 'white']],
{include: '@flowScalars'},
{ include: '@flowScalars' },
// String nodes
[/.+$/, {cases: {'@keywords': 'keyword', '@default': 'string'}}]
[/.+$/, {
cases: {
'@keywords': 'keyword',
'@default': 'string'
}
}]
],
// Flow Collection: Flow Mapping
object: [
{include: '@whitespace'},
{include: '@comment'},
{ include: '@whitespace' },
{ include: '@comment' },
// Flow Mapping termination
[/\}/, '@brackets', '@pop'],
@ -102,22 +107,27 @@ export const language = <ILanguage> {
[/(?:".*?"|'.*?'|[^,\{\[]+?)(?=: )/, 'type'],
// Start Flow Style
{include: '@flowCollections'},
{include: '@flowScalars'},
{ include: '@flowCollections' },
{ include: '@flowScalars' },
// Scalar Data types
{include: '@tagHandle'},
{include: '@anchor'},
{include: '@flowNumber'},
{ include: '@tagHandle' },
{ include: '@anchor' },
{ include: '@flowNumber' },
// Other value (keyword or string)
[/[^\},]+/, {cases: {'@keywords': 'keyword', '@default': 'string'}}]
[/[^\},]+/, {
cases: {
'@keywords': 'keyword',
'@default': 'string'
}
}]
],
// Flow Collection: Flow Sequence
array: [
{include: '@whitespace'},
{include: '@comment'},
{ include: '@whitespace' },
{ include: '@comment' },
// Flow Sequence termination
[/\]/, '@brackets', '@pop'],
@ -126,16 +136,21 @@ export const language = <ILanguage> {
[/,/, 'delimiter.comma'],
// Start Flow Style
{include: '@flowCollections'},
{include: '@flowScalars'},
{ include: '@flowCollections' },
{ include: '@flowScalars' },
// Scalar Data types
{include: '@tagHandle'},
{include: '@anchor'},
{include: '@flowNumber'},
{ include: '@tagHandle' },
{ include: '@anchor' },
{ 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

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('bat', [
// Keywords
@ -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

@ -5,7 +5,7 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('cpp', [
// Keywords
@ -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

@ -5,7 +5,7 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('csharp', [
@ -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

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('css', [
// Skip whitespace
@ -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,46 +456,49 @@ 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}
[{
line: '.even { background: #fff url(data:image/gif;base64,R0lGODlhBgASALMAAOfn5+rq6uvr6+zs7O7u7vHx8fPz8/b29vj4+P39/f///wAAAAAAAAAAAAAAAAAAACwAAAAABgASAAAIMAAVCBxIsKDBgwgTDkzAsKGAhxARSJx4oKJFAxgzFtjIkYDHjwNCigxAsiSAkygDAgA7) repeat-x bottom}',
tokens: [
{startIndex: 0, type: 'tag.css'},
{startIndex: 5, type: ''},
{startIndex: 6, type: 'delimiter.bracket.css'},
{startIndex: 7, type: ''},
{startIndex: 8, type: 'attribute.name.css'},
{startIndex: 19, type: ''},
{startIndex: 20, type: 'attribute.value.hex.css'},
{startIndex: 24, type: ''},
{startIndex: 25, type: 'attribute.value.css'},
{startIndex: 28, type: 'delimiter.parenthesis.css'},
{startIndex: 29, type: 'string.css'},
{startIndex: 215, type: 'delimiter.parenthesis.css'},
{startIndex: 216, type: ''},
{startIndex: 217, type: 'attribute.value.css'},
{startIndex: 225, type: ''},
{startIndex: 226, type: 'attribute.value.css'},
{startIndex: 232, type: 'delimiter.bracket.css'}
]}],
{ startIndex: 0, type: 'tag.css' },
{ startIndex: 5, type: '' },
{ startIndex: 6, type: 'delimiter.bracket.css' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'attribute.name.css' },
{ startIndex: 19, type: '' },
{ startIndex: 20, type: 'attribute.value.hex.css' },
{ startIndex: 24, type: '' },
{ startIndex: 25, type: 'attribute.value.css' },
{ startIndex: 28, type: 'delimiter.parenthesis.css' },
{ startIndex: 29, type: 'string.css' },
{ startIndex: 215, type: 'delimiter.parenthesis.css' },
{ startIndex: 216, type: '' },
{ startIndex: 217, type: 'attribute.value.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)}
[{
line: '.a{background:url(/a.jpg)}',
tokens: [
{startIndex: 0, type: 'tag.css'},
{startIndex: 2, type: 'delimiter.bracket.css'},
{startIndex: 3, type: 'attribute.name.css'},
{startIndex: 14, type: 'attribute.value.css'},
{startIndex: 17, type: 'delimiter.parenthesis.css'},
{startIndex: 18, type: 'string.css'},
{startIndex: 24, type: 'delimiter.parenthesis.css'},
{startIndex: 25, type: 'delimiter.bracket.css'}
]}],
{ startIndex: 0, type: 'tag.css' },
{ startIndex: 2, type: 'delimiter.bracket.css' },
{ startIndex: 3, type: 'attribute.name.css' },
{ startIndex: 14, type: 'attribute.value.css' },
{ startIndex: 17, type: 'delimiter.parenthesis.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

@ -5,7 +5,7 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('dockerfile', [
// All
@ -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

@ -5,7 +5,7 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('fsharp', [
// comments - single line
@ -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

@ -5,8 +5,8 @@
'use strict';
import {testTokenization} from './testRunner';
import {htmlTokenTypes} from '../src/handlebars';
import { testTokenization } from './testRunner';
import { htmlTokenTypes } from '../src/handlebars';
const HTML_DELIM_START = htmlTokenTypes.DELIM_START;
const HTML_DELIM_END = htmlTokenTypes.DELIM_END;
@ -30,13 +30,13 @@ testTokenization(['handlebars', 'css'], [
[{
line: '<h1>handlebars!</h1>',
tokens: [
{ startIndex:0, type: HTML_DELIM_START },
{ startIndex:1, type: getTag('h1') },
{ startIndex:3, type: HTML_DELIM_END },
{ startIndex:4, type: '' },
{ startIndex:15, type: HTML_DELIM_START },
{ startIndex:17, type: getTag('h1') },
{ startIndex:19, type: HTML_DELIM_END }
{ startIndex: 0, type: HTML_DELIM_START },
{ startIndex: 1, type: getTag('h1') },
{ startIndex: 3, type: HTML_DELIM_END },
{ startIndex: 4, type: '' },
{ startIndex: 15, type: HTML_DELIM_START },
{ startIndex: 17, type: getTag('h1') },
{ startIndex: 19, type: HTML_DELIM_END }
]
}],
@ -44,17 +44,17 @@ testTokenization(['handlebars', 'css'], [
[{
line: '<h1>{{ title }}</h1>',
tokens: [
{ startIndex:0, type: HTML_DELIM_START },
{ startIndex:1, type: getTag('h1') },
{ startIndex:3, type: HTML_DELIM_END },
{ startIndex:4, type: handlebarsTokenTypes.EMBED },
{ startIndex:6, type: '' },
{ startIndex:7, type: handlebarsTokenTypes.VARIABLE },
{ startIndex:12, type: '' },
{ startIndex:13, type: handlebarsTokenTypes.EMBED },
{ startIndex:15, type: HTML_DELIM_START },
{ startIndex:17, type: getTag('h1') },
{ startIndex:19, type: HTML_DELIM_END }
{ startIndex: 0, type: HTML_DELIM_START },
{ startIndex: 1, type: getTag('h1') },
{ startIndex: 3, type: HTML_DELIM_END },
{ startIndex: 4, type: handlebarsTokenTypes.EMBED },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: handlebarsTokenTypes.VARIABLE },
{ startIndex: 12, type: '' },
{ startIndex: 13, type: handlebarsTokenTypes.EMBED },
{ startIndex: 15, type: HTML_DELIM_START },
{ startIndex: 17, type: getTag('h1') },
{ startIndex: 19, type: HTML_DELIM_END }
]
}],
@ -62,15 +62,15 @@ testTokenization(['handlebars', 'css'], [
[{
line: '<h1>{{title}}</h1>',
tokens: [
{ startIndex:0, type: HTML_DELIM_START },
{ startIndex:1, type: getTag('h1') },
{ startIndex:3, type: HTML_DELIM_END },
{ startIndex:4, type: handlebarsTokenTypes.EMBED },
{ startIndex:6, type: handlebarsTokenTypes.VARIABLE },
{ startIndex:11, type: handlebarsTokenTypes.EMBED },
{ startIndex:13, type: HTML_DELIM_START },
{ startIndex:15, type: getTag('h1') },
{ startIndex:17, type: HTML_DELIM_END }
{ startIndex: 0, type: HTML_DELIM_START },
{ startIndex: 1, type: getTag('h1') },
{ startIndex: 3, type: HTML_DELIM_END },
{ startIndex: 4, type: handlebarsTokenTypes.EMBED },
{ startIndex: 6, type: handlebarsTokenTypes.VARIABLE },
{ startIndex: 11, type: handlebarsTokenTypes.EMBED },
{ startIndex: 13, type: HTML_DELIM_START },
{ startIndex: 15, type: getTag('h1') },
{ startIndex: 17, type: HTML_DELIM_END }
]
}],
@ -78,17 +78,17 @@ testTokenization(['handlebars', 'css'], [
[{
line: '<h1>{{{ title }}}</h1>',
tokens: [
{ startIndex:0, type: HTML_DELIM_START },
{ startIndex:1, type: getTag('h1') },
{ startIndex:3, type: HTML_DELIM_END },
{ startIndex:4, type: handlebarsTokenTypes.EMBED_UNESCAPED },
{ startIndex:7, type: '' },
{ startIndex:8, type: handlebarsTokenTypes.VARIABLE },
{ startIndex:13, type: '' },
{ startIndex:14, type: handlebarsTokenTypes.EMBED_UNESCAPED },
{ startIndex:17, type: HTML_DELIM_START },
{ startIndex:19, type: getTag('h1') },
{ startIndex:21, type: HTML_DELIM_END }
{ startIndex: 0, type: HTML_DELIM_START },
{ startIndex: 1, type: getTag('h1') },
{ startIndex: 3, type: HTML_DELIM_END },
{ startIndex: 4, type: handlebarsTokenTypes.EMBED_UNESCAPED },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: handlebarsTokenTypes.VARIABLE },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: handlebarsTokenTypes.EMBED_UNESCAPED },
{ startIndex: 17, type: HTML_DELIM_START },
{ startIndex: 19, type: getTag('h1') },
{ startIndex: 21, type: HTML_DELIM_END }
]
}],
@ -96,29 +96,29 @@ testTokenization(['handlebars', 'css'], [
[{
line: '<ul>{{#each items}}<li>{{item}}</li>{{/each}}</ul>',
tokens: [
{ startIndex:0, type: HTML_DELIM_START },
{ startIndex:1, type: getTag('ul') },
{ startIndex:3, type: HTML_DELIM_END },
{ startIndex:4, type: handlebarsTokenTypes.EMBED },
{ startIndex:6, type: handlebarsTokenTypes.KEYWORD },
{ startIndex:11, type: '' },
{ startIndex:12, type: handlebarsTokenTypes.VARIABLE },
{ startIndex:17, type: handlebarsTokenTypes.EMBED },
{ startIndex:19, type: HTML_DELIM_START },
{ startIndex:20, type: getTag('li') },
{ startIndex:22, type: HTML_DELIM_END },
{ startIndex:23, type: handlebarsTokenTypes.EMBED },
{ startIndex:25, type: handlebarsTokenTypes.VARIABLE },
{ startIndex:29, type: handlebarsTokenTypes.EMBED },
{ startIndex:31, type: HTML_DELIM_START },
{ startIndex:33, type: getTag('li') },
{ startIndex:35, type: HTML_DELIM_END },
{ startIndex:36, type: handlebarsTokenTypes.EMBED },
{ startIndex:38, type: handlebarsTokenTypes.KEYWORD },
{ startIndex:43, type: handlebarsTokenTypes.EMBED },
{ startIndex:45, type: HTML_DELIM_START },
{ startIndex:47, type: getTag('ul') },
{ startIndex:49, type: HTML_DELIM_END }
{ startIndex: 0, type: HTML_DELIM_START },
{ startIndex: 1, type: getTag('ul') },
{ startIndex: 3, type: HTML_DELIM_END },
{ startIndex: 4, type: handlebarsTokenTypes.EMBED },
{ startIndex: 6, type: handlebarsTokenTypes.KEYWORD },
{ startIndex: 11, type: '' },
{ startIndex: 12, type: handlebarsTokenTypes.VARIABLE },
{ startIndex: 17, type: handlebarsTokenTypes.EMBED },
{ startIndex: 19, type: HTML_DELIM_START },
{ startIndex: 20, type: getTag('li') },
{ startIndex: 22, type: HTML_DELIM_END },
{ startIndex: 23, type: handlebarsTokenTypes.EMBED },
{ startIndex: 25, type: handlebarsTokenTypes.VARIABLE },
{ startIndex: 29, type: handlebarsTokenTypes.EMBED },
{ startIndex: 31, type: HTML_DELIM_START },
{ startIndex: 33, type: getTag('li') },
{ startIndex: 35, type: HTML_DELIM_END },
{ startIndex: 36, type: handlebarsTokenTypes.EMBED },
{ startIndex: 38, type: handlebarsTokenTypes.KEYWORD },
{ startIndex: 43, type: handlebarsTokenTypes.EMBED },
{ startIndex: 45, type: HTML_DELIM_START },
{ startIndex: 47, type: getTag('ul') },
{ startIndex: 49, type: HTML_DELIM_END }
]
}],
@ -126,38 +126,38 @@ testTokenization(['handlebars', 'css'], [
[{
line: '<div>',
tokens: [
{ startIndex:0, type: HTML_DELIM_START },
{ startIndex:1, type: getTag('div') },
{ startIndex:4, type: HTML_DELIM_END }
{ startIndex: 0, type: HTML_DELIM_START },
{ startIndex: 1, type: getTag('div') },
{ startIndex: 4, type: HTML_DELIM_END }
]
}, {
line: '{{#if foo}}',
tokens: [
{ startIndex:0, type: handlebarsTokenTypes.EMBED },
{ startIndex:2, type: handlebarsTokenTypes.KEYWORD },
{ startIndex:5, type: '' },
{ startIndex:6, type: handlebarsTokenTypes.VARIABLE },
{ startIndex:9, type: handlebarsTokenTypes.EMBED }
{ startIndex: 0, type: handlebarsTokenTypes.EMBED },
{ startIndex: 2, type: handlebarsTokenTypes.KEYWORD },
{ startIndex: 5, type: '' },
{ startIndex: 6, type: handlebarsTokenTypes.VARIABLE },
{ startIndex: 9, type: handlebarsTokenTypes.EMBED }
]
}, {
line: '<span>{{bar}}</span>',
tokens: [
{ startIndex:0, type: HTML_DELIM_START },
{ startIndex:1, type: getTag('span') },
{ startIndex:5, type: HTML_DELIM_END },
{ startIndex:6, type: handlebarsTokenTypes.EMBED },
{ startIndex:8, type: handlebarsTokenTypes.VARIABLE },
{ startIndex:11, type: handlebarsTokenTypes.EMBED },
{ startIndex:13, type: HTML_DELIM_START },
{ startIndex:15, type: getTag('span') },
{ startIndex:19, type: HTML_DELIM_END }
{ startIndex: 0, type: HTML_DELIM_START },
{ startIndex: 1, type: getTag('span') },
{ startIndex: 5, type: HTML_DELIM_END },
{ startIndex: 6, type: handlebarsTokenTypes.EMBED },
{ startIndex: 8, type: handlebarsTokenTypes.VARIABLE },
{ startIndex: 11, type: handlebarsTokenTypes.EMBED },
{ startIndex: 13, type: HTML_DELIM_START },
{ startIndex: 15, type: getTag('span') },
{ startIndex: 19, type: HTML_DELIM_END }
]
}, {
line: '{{/if}}',
tokens: [
{ startIndex:0, type: handlebarsTokenTypes.EMBED },
{ startIndex:2, type: handlebarsTokenTypes.KEYWORD },
{ startIndex:5, type: handlebarsTokenTypes.EMBED }
{ startIndex: 0, type: handlebarsTokenTypes.EMBED },
{ startIndex: 2, type: handlebarsTokenTypes.KEYWORD },
{ startIndex: 5, type: handlebarsTokenTypes.EMBED }
]
}],
@ -165,9 +165,9 @@ testTokenization(['handlebars', 'css'], [
[{
line: '</div>',
tokens: [
{ startIndex:0, type: HTML_DELIM_START },
{ startIndex:2, type: getTag('div') },
{ startIndex:5, type: HTML_DELIM_END }
{ startIndex: 0, type: HTML_DELIM_START },
{ startIndex: 2, type: getTag('div') },
{ startIndex: 5, type: HTML_DELIM_END }
]
}],
@ -175,27 +175,27 @@ testTokenization(['handlebars', 'css'], [
[{
line: '<script type="text/x-handlebars-template"><h1>{{ title }}</h1></script>',
tokens: [
{ startIndex:0, type: HTML_DELIM_START },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: '' },
{ startIndex:8, type: HTML_ATTRIB_NAME },
{ startIndex:12, type: DELIM_ASSIGN },
{ startIndex:13, type: HTML_ATTRIB_VALUE },
{ startIndex:41, type: HTML_DELIM_END },
{ startIndex:42, type: HTML_DELIM_START },
{ startIndex:43, type: getTag('h1') },
{ startIndex:45, type: HTML_DELIM_END },
{ startIndex:46, type: handlebarsTokenTypes.EMBED },
{ startIndex:48, type: '' },
{ startIndex:49, type: handlebarsTokenTypes.VARIABLE },
{ startIndex:54, type: '' },
{ startIndex:55, type: handlebarsTokenTypes.EMBED },
{ startIndex:57, type: HTML_DELIM_START },
{ startIndex:59, type: getTag('h1') },
{ startIndex:61, type: HTML_DELIM_END },
{ startIndex:62, type: HTML_DELIM_START },
{ startIndex:64, type: getTag('script') },
{ startIndex:70, type: HTML_DELIM_END }
{ startIndex: 0, type: HTML_DELIM_START },
{ startIndex: 1, type: getTag('script') },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: HTML_ATTRIB_NAME },
{ startIndex: 12, type: DELIM_ASSIGN },
{ startIndex: 13, type: HTML_ATTRIB_VALUE },
{ startIndex: 41, type: HTML_DELIM_END },
{ startIndex: 42, type: HTML_DELIM_START },
{ startIndex: 43, type: getTag('h1') },
{ startIndex: 45, type: HTML_DELIM_END },
{ startIndex: 46, type: handlebarsTokenTypes.EMBED },
{ startIndex: 48, type: '' },
{ startIndex: 49, type: handlebarsTokenTypes.VARIABLE },
{ startIndex: 54, type: '' },
{ startIndex: 55, type: handlebarsTokenTypes.EMBED },
{ startIndex: 57, type: HTML_DELIM_START },
{ startIndex: 59, type: getTag('h1') },
{ startIndex: 61, type: HTML_DELIM_END },
{ startIndex: 62, type: HTML_DELIM_START },
{ startIndex: 64, type: getTag('script') },
{ startIndex: 70, type: HTML_DELIM_END }
]
}],
@ -203,35 +203,35 @@ testTokenization(['handlebars', 'css'], [
[{
line: '<script type="text/x-handlebars-template">',
tokens: [
{ startIndex:0, type: HTML_DELIM_START },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: '' },
{ startIndex:8, type: HTML_ATTRIB_NAME },
{ startIndex:12, type: DELIM_ASSIGN },
{ startIndex:13, type: HTML_ATTRIB_VALUE },
{ startIndex:41, type: HTML_DELIM_END }
{ startIndex: 0, type: HTML_DELIM_START },
{ startIndex: 1, type: getTag('script') },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: HTML_ATTRIB_NAME },
{ startIndex: 12, type: DELIM_ASSIGN },
{ startIndex: 13, type: HTML_ATTRIB_VALUE },
{ startIndex: 41, type: HTML_DELIM_END }
]
}, {
line: '<h1>{{ title }}</h1>',
tokens: [
{ startIndex:0, type: HTML_DELIM_START },
{ startIndex:1, type: getTag('h1') },
{ startIndex:3, type: HTML_DELIM_END },
{ startIndex:4, type: handlebarsTokenTypes.EMBED },
{ startIndex:6, type: '' },
{ startIndex:7, type: handlebarsTokenTypes.VARIABLE },
{ startIndex:12, type: '' },
{ startIndex:13, type: handlebarsTokenTypes.EMBED },
{ startIndex:15, type: HTML_DELIM_START },
{ startIndex:17, type: getTag('h1') },
{ startIndex:19, type: HTML_DELIM_END }
{ startIndex: 0, type: HTML_DELIM_START },
{ startIndex: 1, type: getTag('h1') },
{ startIndex: 3, type: HTML_DELIM_END },
{ startIndex: 4, type: handlebarsTokenTypes.EMBED },
{ startIndex: 6, type: '' },
{ startIndex: 7, type: handlebarsTokenTypes.VARIABLE },
{ startIndex: 12, type: '' },
{ startIndex: 13, type: handlebarsTokenTypes.EMBED },
{ startIndex: 15, type: HTML_DELIM_START },
{ startIndex: 17, type: getTag('h1') },
{ startIndex: 19, type: HTML_DELIM_END }
]
}, {
line: '</script>',
tokens: [
{ startIndex:0, type: HTML_DELIM_START },
{ startIndex:2, type: getTag('script') },
{ startIndex:8, type: HTML_DELIM_END }
{ startIndex: 0, type: HTML_DELIM_START },
{ startIndex: 2, type: getTag('script') },
{ startIndex: 8, type: HTML_DELIM_END }
]
}],
@ -239,18 +239,18 @@ testTokenization(['handlebars', 'css'], [
[{
line: '{{foo}}<script></script>{{bar}}',
tokens: [
{ startIndex:0, type: handlebarsTokenTypes.EMBED },
{ startIndex:2, type: handlebarsTokenTypes.VARIABLE },
{ startIndex:5, type: handlebarsTokenTypes.EMBED },
{ startIndex:7, type: HTML_DELIM_START },
{ startIndex:8, type: getTag('script') },
{ startIndex:14, type: HTML_DELIM_END },
{ startIndex: 0, type: handlebarsTokenTypes.EMBED },
{ startIndex: 2, type: handlebarsTokenTypes.VARIABLE },
{ startIndex: 5, type: handlebarsTokenTypes.EMBED },
{ startIndex: 7, type: HTML_DELIM_START },
{ startIndex: 8, type: getTag('script') },
{ startIndex: 14, type: HTML_DELIM_END },
// { startIndex:15, type: HTML_DELIM_START },
{ startIndex:17, type: getTag('script') },
{ startIndex:23, type: HTML_DELIM_END },
{ startIndex:24, type: handlebarsTokenTypes.EMBED },
{ startIndex:26, type: handlebarsTokenTypes.VARIABLE },
{ startIndex:29, type: handlebarsTokenTypes.EMBED }
{ startIndex: 17, type: getTag('script') },
{ startIndex: 23, type: HTML_DELIM_END },
{ startIndex: 24, type: handlebarsTokenTypes.EMBED },
{ startIndex: 26, type: handlebarsTokenTypes.VARIABLE },
{ startIndex: 29, type: handlebarsTokenTypes.EMBED }
]
}],
@ -258,9 +258,9 @@ testTokenization(['handlebars', 'css'], [
[{
line: '{{else}}',
tokens: [
{ startIndex:0, type: handlebarsTokenTypes.EMBED },
{ startIndex:2, type: handlebarsTokenTypes.KEYWORD },
{ startIndex:6, type: handlebarsTokenTypes.EMBED }
{ startIndex: 0, type: handlebarsTokenTypes.EMBED },
{ startIndex: 2, type: handlebarsTokenTypes.KEYWORD },
{ startIndex: 6, type: handlebarsTokenTypes.EMBED }
]
}],
@ -268,9 +268,9 @@ testTokenization(['handlebars', 'css'], [
[{
line: '{{elseFoo}}',
tokens: [
{ startIndex:0, type: handlebarsTokenTypes.EMBED },
{ startIndex:2, type: handlebarsTokenTypes.VARIABLE },
{ startIndex:9, type: handlebarsTokenTypes.EMBED }
{ startIndex: 0, type: handlebarsTokenTypes.EMBED },
{ startIndex: 2, type: handlebarsTokenTypes.VARIABLE },
{ startIndex: 9, type: handlebarsTokenTypes.EMBED }
]
}],
@ -278,13 +278,13 @@ testTokenization(['handlebars', 'css'], [
[{
line: '<a href="/posts/{{permalink}}">',
tokens: [
{ startIndex:0, type: HTML_DELIM_START },
{ startIndex:1, type: getTag('a') },
{ startIndex:2, type: '' },
{ startIndex:3, type: HTML_ATTRIB_NAME },
{ startIndex:7, type: DELIM_ASSIGN },
{ startIndex:8, type: HTML_ATTRIB_VALUE },
{ startIndex:30, type: HTML_DELIM_END }
{ startIndex: 0, type: HTML_DELIM_START },
{ startIndex: 1, type: getTag('a') },
{ startIndex: 2, type: '' },
{ startIndex: 3, type: HTML_ATTRIB_NAME },
{ startIndex: 7, type: DELIM_ASSIGN },
{ startIndex: 8, type: HTML_ATTRIB_VALUE },
{ startIndex: 30, type: HTML_DELIM_END }
]
}]
]);

View file

@ -5,8 +5,8 @@
'use strict';
import {testTokenization} from './testRunner';
import {htmlTokenTypes} from '../src/html';
import { testTokenization } from './testRunner';
import { htmlTokenTypes } from '../src/html';
const DELIM_START = htmlTokenTypes.DELIM_START + '.html';
const DELIM_END = htmlTokenTypes.DELIM_END + '.html';
@ -14,7 +14,7 @@ const ATTRIB_NAME = 'attribute.name.html';
const DELIM_ASSIGN = 'delimiter.html';
const ATTRIB_VALUE = 'attribute.value.html';
function getTag(name:string): string {
function getTag(name: string): string {
return htmlTokenTypes.getTag(name) + '.html';
}
@ -29,8 +29,8 @@ testTokenization(['html', 'css'], [
[{
line: '<abc',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('abc') }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('abc') }
]
}],
@ -38,8 +38,8 @@ testTokenization(['html', 'css'], [
[{
line: '<input',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('input') }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('input') }
]
}],
@ -47,8 +47,8 @@ testTokenization(['html', 'css'], [
[{
line: '< abc',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: '' }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: '' }
]
}],
@ -56,8 +56,8 @@ testTokenization(['html', 'css'], [
[{
line: '< abc>',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: '' }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: '' }
]
}],
@ -65,10 +65,10 @@ testTokenization(['html', 'css'], [
[{
line: 'i <len;',
tokens: [
{ startIndex:0, type: '' },
{ startIndex:2, type: DELIM_START },
{ startIndex:3, type: getTag('len') },
{ startIndex:6, type: '' }
{ startIndex: 0, type: '' },
{ startIndex: 2, type: DELIM_START },
{ startIndex: 3, type: getTag('len') },
{ startIndex: 6, type: '' }
]
}],
@ -76,7 +76,7 @@ testTokenization(['html', 'css'], [
[{
line: '<',
tokens: [
{ startIndex:0, type: DELIM_START }
{ startIndex: 0, type: DELIM_START }
]
}],
@ -84,8 +84,8 @@ testTokenization(['html', 'css'], [
[{
line: '</a',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:2, type: getTag('a') }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 2, type: getTag('a') }
]
}],
@ -93,9 +93,9 @@ testTokenization(['html', 'css'], [
[{
line: '<abc>',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('abc') },
{ startIndex: 4, type: DELIM_END }
]
}],
@ -103,10 +103,10 @@ testTokenization(['html', 'css'], [
[{
line: '<abc >',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('abc') },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: DELIM_END }
]
}],
@ -114,9 +114,9 @@ testTokenization(['html', 'css'], [
[{
line: '<foo:bar>',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('foo-bar') },
{ startIndex:8, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('foo-bar') },
{ startIndex: 8, type: DELIM_END }
]
}],
@ -124,9 +124,9 @@ testTokenization(['html', 'css'], [
[{
line: '</abc>',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:2, type: getTag('abc') },
{ startIndex:5, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 2, type: getTag('abc') },
{ startIndex: 5, type: DELIM_END }
]
}],
@ -134,10 +134,10 @@ testTokenization(['html', 'css'], [
[{
line: '</abc >',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:2, type: getTag('abc') },
{ startIndex:5, type: '' },
{ startIndex:7, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 2, type: getTag('abc') },
{ startIndex: 5, type: '' },
{ startIndex: 7, type: DELIM_END }
]
}],
@ -145,10 +145,10 @@ testTokenization(['html', 'css'], [
[{
line: '<abc />',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('abc') },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: DELIM_END }
]
}],
@ -156,17 +156,17 @@ testTokenization(['html', 'css'], [
[{
line: '<script type="text/javascript">var i= 10;</script>',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: '' },
{ startIndex:8, type: ATTRIB_NAME },
{ startIndex:12, type: DELIM_ASSIGN },
{ startIndex:13, type: ATTRIB_VALUE },
{ startIndex:30, type: DELIM_END },
{ startIndex:31, type: '' },
{ startIndex:41, type: DELIM_START },
{ startIndex:43, type: getTag('script') },
{ startIndex:49, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('script') },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: ATTRIB_NAME },
{ startIndex: 12, type: DELIM_ASSIGN },
{ startIndex: 13, type: ATTRIB_VALUE },
{ startIndex: 30, type: DELIM_END },
{ startIndex: 31, type: '' },
{ startIndex: 41, type: DELIM_START },
{ startIndex: 43, type: getTag('script') },
{ startIndex: 49, type: DELIM_END }
]
}],
@ -174,25 +174,25 @@ testTokenization(['html', 'css'], [
[{
line: '<script type="text/javascript">',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: '' },
{ startIndex:8, type: ATTRIB_NAME },
{ startIndex:12, type: DELIM_ASSIGN },
{ startIndex:13, type: ATTRIB_VALUE },
{ startIndex:30, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('script') },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: ATTRIB_NAME },
{ startIndex: 12, type: DELIM_ASSIGN },
{ startIndex: 13, type: ATTRIB_VALUE },
{ startIndex: 30, type: DELIM_END }
]
}, {
line: 'var i= 10;',
tokens: [
{ startIndex:0, type: '' },
{ startIndex: 0, type: '' },
]
}, {
line: '</script>',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:2, type: getTag('script') },
{ startIndex:8, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 2, type: getTag('script') },
{ startIndex: 8, type: DELIM_END }
]
}],
@ -200,21 +200,21 @@ testTokenization(['html', 'css'], [
[{
line: '<script type="text/javascript">var i= 10;',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: '' },
{ startIndex:8, type: ATTRIB_NAME },
{ startIndex:12, type: DELIM_ASSIGN },
{ startIndex:13, type: ATTRIB_VALUE },
{ startIndex:30, type: DELIM_END },
{ startIndex:31, type: '' },
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('script') },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: ATTRIB_NAME },
{ startIndex: 12, type: DELIM_ASSIGN },
{ startIndex: 13, type: ATTRIB_VALUE },
{ startIndex: 30, type: DELIM_END },
{ startIndex: 31, type: '' },
]
}, {
line: '</script>',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:2, type: getTag('script') },
{ startIndex:8, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 2, type: getTag('script') },
{ startIndex: 8, type: DELIM_END }
]
}],
@ -222,21 +222,21 @@ testTokenization(['html', 'css'], [
[{
line: '<script type="text/javascript">',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: '' },
{ startIndex:8, type: ATTRIB_NAME },
{ startIndex:12, type: DELIM_ASSIGN },
{ startIndex:13, type: ATTRIB_VALUE },
{ startIndex:30, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('script') },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: ATTRIB_NAME },
{ startIndex: 12, type: DELIM_ASSIGN },
{ startIndex: 13, type: ATTRIB_VALUE },
{ startIndex: 30, type: DELIM_END }
]
}, {
line: 'var i= 10;</script>',
tokens: [
{ startIndex:0, type: '' },
{ startIndex:10, type: DELIM_START },
{ startIndex:12, type: getTag('script') },
{ startIndex:18, type: DELIM_END }
{ startIndex: 0, type: '' },
{ startIndex: 10, type: DELIM_START },
{ startIndex: 12, type: getTag('script') },
{ startIndex: 18, type: DELIM_END }
]
}],
@ -244,22 +244,22 @@ testTokenization(['html', 'css'], [
[{
line: '<script type="text/plain">a',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: '' },
{ startIndex:8, type: ATTRIB_NAME },
{ startIndex:12, type: DELIM_ASSIGN },
{ startIndex:13, type: ATTRIB_VALUE },
{ startIndex:25, type: DELIM_END },
{ startIndex:26, type: '' },
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('script') },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: ATTRIB_NAME },
{ startIndex: 12, type: DELIM_ASSIGN },
{ startIndex: 13, type: ATTRIB_VALUE },
{ startIndex: 25, type: DELIM_END },
{ startIndex: 26, type: '' },
]
},{
}, {
line: '<a</script>',
tokens: [
{ startIndex:0, type: '' },
{ startIndex:2, type: DELIM_START },
{ startIndex:4, type: getTag('script') },
{ startIndex:10, type: DELIM_END }
{ startIndex: 0, type: '' },
{ startIndex: 2, type: DELIM_START },
{ startIndex: 4, type: getTag('script') },
{ startIndex: 10, type: DELIM_END }
]
}],
@ -267,20 +267,20 @@ testTokenization(['html', 'css'], [
[{
line: '<script>a</script><script>b</script>',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: DELIM_END },
{ startIndex:8, type: '' },
{ startIndex:9, type: DELIM_START },
{ startIndex:11, type: getTag('script') },
{ startIndex:17, type: DELIM_END },
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('script') },
{ startIndex: 7, type: DELIM_END },
{ startIndex: 8, type: '' },
{ startIndex: 9, type: DELIM_START },
{ startIndex: 11, type: getTag('script') },
{ startIndex: 17, type: DELIM_END },
// { startIndex:18, type: DELIM_START },
{ startIndex:19, type: getTag('script') },
{ startIndex:25, type: DELIM_END },
{ startIndex:26, type: '' },
{ startIndex:27, type: DELIM_START },
{ startIndex:29, type: getTag('script') },
{ startIndex:35, type: DELIM_END }
{ startIndex: 19, type: getTag('script') },
{ startIndex: 25, type: DELIM_END },
{ startIndex: 26, type: '' },
{ startIndex: 27, type: DELIM_START },
{ startIndex: 29, type: getTag('script') },
{ startIndex: 35, type: DELIM_END }
]
}],
@ -288,16 +288,16 @@ testTokenization(['html', 'css'], [
[{
line: '<script type="text/javascript"></script>',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: '' },
{ startIndex:8, type: ATTRIB_NAME },
{ startIndex:12, type: DELIM_ASSIGN },
{ startIndex:13, type: ATTRIB_VALUE },
{ startIndex:30, type: DELIM_END },
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('script') },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: ATTRIB_NAME },
{ startIndex: 12, type: DELIM_ASSIGN },
{ startIndex: 13, type: ATTRIB_VALUE },
{ startIndex: 30, type: DELIM_END },
// { startIndex:31, type: DELIM_START },
{ startIndex:33, type: getTag('script') },
{ startIndex:39, type: DELIM_END }
{ startIndex: 33, type: getTag('script') },
{ startIndex: 39, type: DELIM_END }
]
}],
@ -305,13 +305,13 @@ testTokenization(['html', 'css'], [
[{
line: '<script>var i= 10;</script>',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: DELIM_END },
{ startIndex:8, type: '' },
{ startIndex:18, type: DELIM_START },
{ startIndex:20, type: getTag('script') },
{ startIndex:26, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('script') },
{ startIndex: 7, type: DELIM_END },
{ startIndex: 8, type: '' },
{ startIndex: 18, type: DELIM_START },
{ startIndex: 20, type: getTag('script') },
{ startIndex: 26, type: DELIM_END }
]
}],
@ -319,20 +319,20 @@ testTokenization(['html', 'css'], [
[{
line: '<script type="text/javascript" src="main.js"></script>',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('script') },
{ startIndex:7, type: '' },
{ startIndex:8, type: ATTRIB_NAME },
{ startIndex:12, type: DELIM_ASSIGN },
{ startIndex:13, type: ATTRIB_VALUE },
{ startIndex:30, type: '' },
{ startIndex:31, type: ATTRIB_NAME },
{ startIndex:34, type: DELIM_ASSIGN },
{ startIndex:35, type: ATTRIB_VALUE },
{ startIndex:44, type: DELIM_END },
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('script') },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: ATTRIB_NAME },
{ startIndex: 12, type: DELIM_ASSIGN },
{ startIndex: 13, type: ATTRIB_VALUE },
{ startIndex: 30, type: '' },
{ startIndex: 31, type: ATTRIB_NAME },
{ startIndex: 34, type: DELIM_ASSIGN },
{ startIndex: 35, type: ATTRIB_VALUE },
{ startIndex: 44, type: DELIM_END },
// { startIndex:45, type: DELIM_START },
{ startIndex:47, type: getTag('script') },
{ startIndex:53, type: DELIM_END }
{ startIndex: 47, type: getTag('script') },
{ startIndex: 53, type: DELIM_END }
]
}],
@ -340,13 +340,13 @@ testTokenization(['html', 'css'], [
[{
line: '<abc foo="bar">',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: DELIM_ASSIGN },
{ startIndex:9, type: ATTRIB_VALUE },
{ startIndex:14, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('abc') },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: ATTRIB_NAME },
{ startIndex: 8, type: DELIM_ASSIGN },
{ startIndex: 9, type: ATTRIB_VALUE },
{ startIndex: 14, type: DELIM_END }
]
}],
@ -354,13 +354,13 @@ testTokenization(['html', 'css'], [
[{
line: '<abc foo=\'bar\'>',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: DELIM_ASSIGN },
{ startIndex:9, type: ATTRIB_VALUE },
{ startIndex:14, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('abc') },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: ATTRIB_NAME },
{ startIndex: 8, type: DELIM_ASSIGN },
{ startIndex: 9, type: ATTRIB_VALUE },
{ startIndex: 14, type: DELIM_END }
]
}],
@ -368,13 +368,13 @@ testTokenization(['html', 'css'], [
[{
line: '<abc foo="">',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: DELIM_ASSIGN },
{ startIndex:9, type: ATTRIB_VALUE },
{ startIndex:11, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('abc') },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: ATTRIB_NAME },
{ startIndex: 8, type: DELIM_ASSIGN },
{ startIndex: 9, type: ATTRIB_VALUE },
{ startIndex: 11, type: DELIM_END }
]
}],
@ -382,17 +382,17 @@ testTokenization(['html', 'css'], [
[{
line: '<abc foo="bar" bar=\'foo\'>',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: DELIM_ASSIGN },
{ startIndex:9, type: ATTRIB_VALUE },
{ startIndex:14, type: '' },
{ startIndex:15, type: ATTRIB_NAME },
{ startIndex:18, type: DELIM_ASSIGN },
{ startIndex:19, type: ATTRIB_VALUE },
{ startIndex:24, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('abc') },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: ATTRIB_NAME },
{ startIndex: 8, type: DELIM_ASSIGN },
{ startIndex: 9, type: ATTRIB_VALUE },
{ startIndex: 14, type: '' },
{ startIndex: 15, type: ATTRIB_NAME },
{ startIndex: 18, type: DELIM_ASSIGN },
{ startIndex: 19, type: ATTRIB_VALUE },
{ startIndex: 24, type: DELIM_END }
]
}],
@ -400,17 +400,17 @@ testTokenization(['html', 'css'], [
[{
line: '<abc foo=bar bar=help-me>',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: DELIM_ASSIGN },
{ startIndex:9, type: ATTRIB_NAME }, // slightly incorrect
{ startIndex:12, type: '' },
{ startIndex:13, type: ATTRIB_NAME },
{ startIndex:16, type: DELIM_ASSIGN },
{ startIndex:17, type: ATTRIB_NAME }, // slightly incorrect
{ startIndex:24, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('abc') },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: ATTRIB_NAME },
{ startIndex: 8, type: DELIM_ASSIGN },
{ startIndex: 9, type: ATTRIB_NAME }, // slightly incorrect
{ startIndex: 12, type: '' },
{ startIndex: 13, type: ATTRIB_NAME },
{ startIndex: 16, type: DELIM_ASSIGN },
{ startIndex: 17, type: ATTRIB_NAME }, // slightly incorrect
{ startIndex: 24, type: DELIM_END }
]
}],
@ -418,14 +418,14 @@ testTokenization(['html', 'css'], [
[{
line: '<abc foo= "bar">',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: DELIM_ASSIGN },
{ startIndex:9, type: '' },
{ startIndex:11, type: ATTRIB_VALUE },
{ startIndex:16, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('abc') },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: ATTRIB_NAME },
{ startIndex: 8, type: DELIM_ASSIGN },
{ startIndex: 9, type: '' },
{ startIndex: 11, type: ATTRIB_VALUE },
{ startIndex: 16, type: DELIM_END }
]
}],
@ -433,15 +433,15 @@ testTokenization(['html', 'css'], [
[{
line: '<abc foo = "bar">',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: '' },
{ startIndex:9, type: DELIM_ASSIGN },
{ startIndex:10, type: '' },
{ startIndex:11, type: ATTRIB_VALUE },
{ startIndex:16, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('abc') },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: ATTRIB_NAME },
{ startIndex: 8, type: '' },
{ startIndex: 9, type: DELIM_ASSIGN },
{ startIndex: 10, type: '' },
{ startIndex: 11, type: ATTRIB_VALUE },
{ startIndex: 16, type: DELIM_END }
]
}],
@ -449,11 +449,11 @@ testTokenization(['html', 'css'], [
[{
line: '<abc foo>',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('abc') },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: ATTRIB_NAME },
{ startIndex: 8, type: DELIM_END }
]
}],
@ -461,13 +461,13 @@ testTokenization(['html', 'css'], [
[{
line: '<abc foo bar>',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: '' },
{ startIndex:9, type: ATTRIB_NAME },
{ startIndex:12, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('abc') },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: ATTRIB_NAME },
{ startIndex: 8, type: '' },
{ startIndex: 9, type: ATTRIB_NAME },
{ startIndex: 12, type: DELIM_END }
]
}],
@ -475,14 +475,14 @@ testTokenization(['html', 'css'], [
[{
line: '<abc foo!@#="bar">',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: '' },
{ startIndex:11, type: DELIM_ASSIGN },
{ startIndex:12, type: ATTRIB_VALUE },
{ startIndex:17, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('abc') },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: ATTRIB_NAME },
{ startIndex: 8, type: '' },
{ startIndex: 11, type: DELIM_ASSIGN },
{ startIndex: 12, type: ATTRIB_VALUE },
{ startIndex: 17, type: DELIM_END }
]
}],
@ -490,25 +490,25 @@ testTokenization(['html', 'css'], [
[{
line: '<abc #myinput (click)="bar" [value]="someProperty" *ngIf="someCondition">',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:6, type: ATTRIB_NAME },
{ startIndex:13, type: '' },
{ startIndex:15, type: ATTRIB_NAME },
{ startIndex:20, type: '' },
{ startIndex:21, type: DELIM_ASSIGN },
{ startIndex:22, type: ATTRIB_VALUE },
{ startIndex:27, type: '' },
{ startIndex:29, type: ATTRIB_NAME },
{ startIndex:34, type: '' },
{ startIndex:35, type: DELIM_ASSIGN },
{ startIndex:36, type: ATTRIB_VALUE },
{ startIndex:50, type: '' },
{ startIndex:52, type: ATTRIB_NAME },
{ startIndex:56, type: DELIM_ASSIGN },
{ startIndex:57, type: ATTRIB_VALUE },
{ startIndex:72, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('abc') },
{ startIndex: 4, type: '' },
{ startIndex: 6, type: ATTRIB_NAME },
{ startIndex: 13, type: '' },
{ startIndex: 15, type: ATTRIB_NAME },
{ startIndex: 20, type: '' },
{ startIndex: 21, type: DELIM_ASSIGN },
{ startIndex: 22, type: ATTRIB_VALUE },
{ startIndex: 27, type: '' },
{ startIndex: 29, type: ATTRIB_NAME },
{ startIndex: 34, type: '' },
{ startIndex: 35, type: DELIM_ASSIGN },
{ startIndex: 36, type: ATTRIB_VALUE },
{ startIndex: 50, type: '' },
{ startIndex: 52, type: ATTRIB_NAME },
{ startIndex: 56, type: DELIM_ASSIGN },
{ startIndex: 57, type: ATTRIB_VALUE },
{ startIndex: 72, type: DELIM_END }
]
}],
@ -516,13 +516,13 @@ testTokenization(['html', 'css'], [
[{
line: '<abc foo=">',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('abc') },
{ startIndex:4, type: '' },
{ startIndex:5, type: ATTRIB_NAME },
{ startIndex:8, type: DELIM_ASSIGN },
{ startIndex:9, type: '' },
{ startIndex:10, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('abc') },
{ startIndex: 4, type: '' },
{ startIndex: 5, type: ATTRIB_NAME },
{ startIndex: 8, type: DELIM_ASSIGN },
{ startIndex: 9, type: '' },
{ startIndex: 10, type: DELIM_END }
]
}],
@ -530,9 +530,9 @@ testTokenization(['html', 'css'], [
[{
line: '<!--a-->',
tokens: [
{ startIndex:0, type: DELIM_COMMENT },
{ startIndex:4, type: COMMENT },
{ startIndex:5, type: DELIM_COMMENT }
{ startIndex: 0, type: DELIM_COMMENT },
{ startIndex: 4, type: COMMENT },
{ startIndex: 5, type: DELIM_COMMENT }
]
}],
@ -540,9 +540,9 @@ testTokenization(['html', 'css'], [
[{
line: '<!--a>foo bar</a -->',
tokens: [
{ startIndex:0, type: DELIM_COMMENT },
{ startIndex:4, type: COMMENT },
{ startIndex:17, type: DELIM_COMMENT }
{ startIndex: 0, type: DELIM_COMMENT },
{ startIndex: 4, type: COMMENT },
{ startIndex: 17, type: DELIM_COMMENT }
]
}],
@ -550,19 +550,19 @@ testTokenization(['html', 'css'], [
[{
line: '<!--a>',
tokens: [
{ startIndex:0, type: DELIM_COMMENT },
{ startIndex:4, type: COMMENT }
{ startIndex: 0, type: DELIM_COMMENT },
{ startIndex: 4, type: COMMENT }
]
},{
}, {
line: 'foo ',
tokens: [
{ startIndex:0, type: COMMENT },
{ startIndex: 0, type: COMMENT },
]
},{
}, {
line: 'bar</a -->',
tokens: [
{ startIndex:0, type: COMMENT },
{ startIndex:7, type: DELIM_COMMENT }
{ startIndex: 0, type: COMMENT },
{ startIndex: 7, type: DELIM_COMMENT }
]
}],
@ -570,9 +570,9 @@ testTokenization(['html', 'css'], [
[{
line: '<!DOCTYPE a>',
tokens: [
{ startIndex:0, type: DELIM_DOCTYPE },
{ startIndex:9, type: DOCTYPE },
{ startIndex:11, type: DELIM_DOCTYPE }
{ startIndex: 0, type: DELIM_DOCTYPE },
{ startIndex: 9, type: DOCTYPE },
{ startIndex: 11, type: DELIM_DOCTYPE }
]
}],
@ -580,9 +580,9 @@ testTokenization(['html', 'css'], [
[{
line: '<!doctype a>',
tokens: [
{ startIndex:0, type: DELIM_DOCTYPE },
{ startIndex:9, type: DOCTYPE },
{ startIndex:11, type: DELIM_DOCTYPE }
{ startIndex: 0, type: DELIM_DOCTYPE },
{ startIndex: 9, type: DOCTYPE },
{ startIndex: 11, type: DELIM_DOCTYPE }
]
}],
@ -590,14 +590,14 @@ testTokenization(['html', 'css'], [
[{
line: '<!DOCTYPE a',
tokens: [
{ startIndex:0, type: DELIM_DOCTYPE },
{ startIndex:9, type: DOCTYPE },
{ startIndex: 0, type: DELIM_DOCTYPE },
{ startIndex: 9, type: DOCTYPE },
]
}, {
line: '"foo" \'bar\'>',
tokens: [
{ startIndex:0, type: DOCTYPE },
{ startIndex:11, type: DELIM_DOCTYPE }
{ startIndex: 0, type: DOCTYPE },
{ startIndex: 11, type: DELIM_DOCTYPE }
]
}],
@ -605,13 +605,13 @@ testTokenization(['html', 'css'], [
[{
line: '<asdf:bar>asd</asdf:bar>',
tokens: [
{ startIndex:0, type: DELIM_START },
{ startIndex:1, type: getTag('asdf:bar') },
{ startIndex:9, type: DELIM_END },
{ startIndex:10, type: '' },
{ startIndex:13, type: DELIM_START },
{ startIndex:15, type: getTag('asdf:bar') },
{ startIndex:23, type: DELIM_END }
{ startIndex: 0, type: DELIM_START },
{ startIndex: 1, type: getTag('asdf:bar') },
{ startIndex: 9, type: DELIM_END },
{ startIndex: 10, type: '' },
{ startIndex: 13, type: DELIM_START },
{ startIndex: 15, type: getTag('asdf:bar') },
{ startIndex: 23, type: DELIM_END }
]
}]
]);

View file

@ -5,7 +5,7 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('jade', [
// Tags [Jade]
@ -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

@ -5,7 +5,7 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('java', [
// Comments - single line
@ -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' }
]}]
]
}]
]);

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,7 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('lua', [
@ -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

@ -5,7 +5,7 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('markdown', [

View file

@ -5,7 +5,7 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('msdax', [
// Comments
@ -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

@ -5,7 +5,7 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('objective-c', [
// Keywords
@ -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

@ -5,7 +5,7 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('postiats', [
// Keywords
@ -22,34 +22,39 @@ testTokenization('postiats', [
{ startIndex: 21, type: 'identifier.pats' },
{ startIndex: 25, type: 'delimiter.parenthesis.pats' },
{ startIndex: 26, type: '' },
{ startIndex: 27, type: 'keyword.pats'}
]}],
{ 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',
@ -89,23 +97,25 @@ testTokenization('postiats', [
{ startIndex: 0, type: 'keyword.pats' },
{ startIndex: 3, type: '' },
{ startIndex: 4, type: 'identifier.pats' },
{ startIndex: 5, type: 'keyword.pats'},
{ startIndex: 5, type: 'keyword.pats' },
{ startIndex: 6, type: 'type.pats' },
{ startIndex: 9, type: '' },
{ startIndex: 10, type: 'keyword.pats' },
{ startIndex: 11, type: '' },
{ startIndex: 12, type: 'number.decimal.pats' },
{ startIndex: 13, type: 'delimiter.semicolon.pats'},
{ startIndex: 14, type: ''},
{ 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,52 +248,60 @@ 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' }
]}],
]
}],
/*
/*
[{
line: '5\'5llU',
tokens: [
@ -286,114 +313,132 @@ testTokenization('postiats', [
tokens: [
{ startIndex: 0, type: 'number.pats' }
]}],
*/
*/
[{
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,26 +789,29 @@ 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: ''},
{startIndex: 2, type: 'keyword.pats'},
{startIndex: 5, type: ''},
{startIndex: 6, type: 'identifier.pats'},
{startIndex: 7, type: ''},
{startIndex: 8, type: 'keyword.pats'},
{startIndex: 9, type: ''},
{startIndex: 10, type: 'identifier.pats'},
{startIndex: 11, type: ''},
{startIndex: 12, type: 'operator.pats'},
{startIndex: 13, type: ''},
{startIndex: 14, type: 'identifier.pats'}
]}, {
{ startIndex: 0, type: '' },
{ startIndex: 2, type: 'keyword.pats' },
{ startIndex: 5, type: '' },
{ startIndex: 6, type: 'identifier.pats' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'keyword.pats' },
{ startIndex: 9, type: '' },
{ startIndex: 10, type: 'identifier.pats' },
{ startIndex: 11, type: '' },
{ startIndex: 12, type: 'operator.pats' },
{ startIndex: 13, type: '' },
{ startIndex: 14, type: 'identifier.pats' }
]
}, {
line: 'in',
tokens: [
{startIndex: 0, type: 'keyword.pats'}
]}, {
{ 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'}
]}, {
{ 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'}
]}, {
{ 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

@ -5,7 +5,7 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('powershell', [
// Comments - single line
@ -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

@ -5,7 +5,7 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('python', [
// Keywords
@ -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

@ -5,7 +5,7 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('r', [
// Keywords
@ -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

@ -5,8 +5,8 @@
'use strict';
import {testTokenization} from './testRunner';
import {htmlTokenTypes} from '../src/php';
import { testTokenization } from './testRunner';
import { htmlTokenTypes } from '../src/php';
const EMBED_CS = 'metatag.cs';
@ -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; }',
@ -100,21 +103,23 @@ testTokenization('razor', [
[{
line: 'test@xyz<br>',
tokens: [
{ startIndex:0, type: '' },
{ startIndex:4, type: EMBED_CS },
{ startIndex:5, type: 'identifier.cs' },
{ startIndex:8, type: htmlTokenTypes.DELIM_START },
{ startIndex:9, type: htmlTokenTypes.getTag('br') },
{ startIndex:11, type: htmlTokenTypes.DELIM_END }
]}],
{ startIndex: 0, type: '' },
{ startIndex: 4, type: EMBED_CS },
{ startIndex: 5, type: 'identifier.cs' },
{ startIndex: 8, type: htmlTokenTypes.DELIM_START },
{ startIndex: 9, type: htmlTokenTypes.getTag('br') },
{ startIndex: 11, type: htmlTokenTypes.DELIM_END }
]
}],
[{
line: 'test@xyz',
tokens: [
{ startIndex:0, type: '' },
{ startIndex:4, type: EMBED_CS },
{ startIndex:5, type: 'identifier.cs' }
]}],
{ startIndex: 0, type: '' },
{ startIndex: 4, type: EMBED_CS },
{ startIndex: 5, type: 'identifier.cs' }
]
}],
[{
line: 'test @ xyz',
@ -122,35 +127,39 @@ testTokenization('razor', [
{ startIndex: 0, type: '' },
{ startIndex: 5, type: EMBED_CS },
{ startIndex: 6, type: 'identifier.cs' }
]}],
]
}],
[{
line: 'test @(foo) xyz',
tokens: [
{ startIndex:0, type: '' },
{ startIndex:5, type: EMBED_CS },
{ startIndex:7, type: 'identifier.cs' },
{ startIndex:10, type: EMBED_CS },
{ startIndex:11, type: '' }
]}],
{ startIndex: 0, type: '' },
{ startIndex: 5, type: EMBED_CS },
{ startIndex: 7, type: 'identifier.cs' },
{ startIndex: 10, type: EMBED_CS },
{ startIndex: 11, type: '' }
]
}],
[{
line: 'test @(foo(\")\")) xyz',
tokens: [
{ startIndex:0, type: '' },
{ startIndex:5, type: EMBED_CS },
{ startIndex:7, type: 'identifier.cs' },
{ startIndex:10, type: 'delimiter.parenthesis.cs' },
{ startIndex:11, type: 'string.cs' },
{ startIndex:14, type: 'delimiter.parenthesis.cs' },
{ startIndex:15, type: EMBED_CS },
{ startIndex:16, type: '' }
]}],
{ startIndex: 0, type: '' },
{ startIndex: 5, type: EMBED_CS },
{ startIndex: 7, type: 'identifier.cs' },
{ startIndex: 10, type: 'delimiter.parenthesis.cs' },
{ startIndex: 11, type: 'string.cs' },
{ 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: '' }
]}]
{ startIndex: 0, type: '' }
]
}]
]);

View file

@ -5,7 +5,7 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('ruby', [
// Keywords
@ -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

@ -4,9 +4,9 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {testTokenization as actualTestTokenization, ITestItem} from './testRunner';
import { testTokenization as actualTestTokenization, ITestItem } from './testRunner';
function testTokenization(_language:string|string[], tests:ITestItem[][]): void {
function testTokenization(_language: string | string[], tests: ITestItem[][]): void {
tests = tests.map(t => {
return t.map(t => {
return {
@ -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

@ -1,6 +1,6 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('sol', [
// Keywords
@ -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

@ -5,7 +5,7 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('sql', [
// Comments
@ -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

@ -5,7 +5,7 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('swift', [
@ -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,11 +72,12 @@ 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:',
tokens:[
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 4, type: 'keyword.swift' } /* 'public' */,
{ startIndex: 10, type: '' },
@ -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

@ -5,7 +5,7 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('vb', [
@ -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

@ -5,7 +5,7 @@
'use strict';
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('xml', [
// Complete Start Tag with Whitespace
@ -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' }
]}]
]
}]
]);

View file

@ -1,4 +1,4 @@
import {testTokenization} from './testRunner';
import { testTokenization } from './testRunner';
testTokenization('yaml', [
// YAML directive
@ -238,7 +238,7 @@ testTokenization('yaml', [
}, {
startIndex: 24,
type: 'delimiter.bracket.yaml'
}, ]
},]
}],
// Flow Sequence - Data types