colorizer.test.ts 48.7 KB
Newer Older
E
Erich Gamma 已提交
1 2 3 4 5 6 7 8
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
'use strict';

import Modes = require('vs/editor/common/modes');
import modesUtil = require('vs/editor/test/common/modesUtil');
9
import * as lessTokenTypes from 'vs/languages/less/common/lessTokenTypes';
10 11 12 13
import {MockModeService} from 'vs/editor/test/common/mocks/mockModeService';
import {NULL_THREAD_SERVICE} from 'vs/platform/test/common/nullThreadService';
import {createInstantiationService} from 'vs/platform/instantiation/common/instantiationService';
import {LESSMode} from 'vs/languages/less/common/less';
14
import {MockTokenizingMode} from 'vs/editor/test/common/mocks/mockMode';
15 16 17 18 19 20 21 22 23 24 25

class LESSMockModeService extends MockModeService {
	isRegisteredMode(mimetypeOrModeId: string): boolean {
		if (mimetypeOrModeId === 'javascript') {
			return true;
		}
		throw new Error('Not implemented');
	}

	getMode(commaSeparatedMimetypesOrCommaSeparatedIds: string): Modes.IMode {
		if (commaSeparatedMimetypesOrCommaSeparatedIds === 'javascript') {
26
			return new MockTokenizingMode('js', 'mock-js');
27 28 29 30 31 32 33 34 35 36 37
		}
		throw new Error('Not implemented');
	}

	getModeIdForLanguageName(alias:string): string {
		if (alias === 'text/javascript') {
			return 'javascript';
		}
		throw new Error('Not implemented');
	}
}
E
Erich Gamma 已提交
38 39 40

suite('LESS-tokenization', () => {

41 42
	let tokenizationSupport: Modes.ITokenizationSupport;
	let assertOnEnter: modesUtil.IOnEnterAsserter;
E
Erich Gamma 已提交
43

44
	(function() {
45 46 47 48 49
		let threadService = NULL_THREAD_SERVICE;
		let modeService = new LESSMockModeService();
		let inst = createInstantiationService({
			threadService: threadService,
			modeService: modeService
E
Erich Gamma 已提交
50
		});
51 52 53 54 55 56 57 58 59 60 61 62 63
		threadService.setInstantiationService(inst);

		let mode = new LESSMode(
			{ id: 'less' },
			inst,
			threadService,
			modeService,
			null,
			null
		);

		tokenizationSupport = mode.tokenizationSupport;
		assertOnEnter = modesUtil.createOnEnterAsserter(mode.getId(), mode.richEditSupport);
64
	})();
E
Erich Gamma 已提交
65 66

	test('', () => {
A
Alex Dima 已提交
67
		modesUtil.executeTests(tokenizationSupport, [
E
Erich Gamma 已提交
68 69 70 71 72 73
			// Keywords
			[{
			line: 'isnumber(10);',
			tokens: [
				{ startIndex: 0, type: 'keyword.less' },
				{ startIndex: 8, type: 'punctuation.parenthesis.less' },
74
				{ startIndex: 9, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
				{ startIndex: 11, type: 'punctuation.parenthesis.less' },
				{ startIndex: 12, type: 'punctuation.less' }
			]}],
			[{
			line: 'iskeyword(@test) ;mix',
			tokens: [
				{ startIndex: 0, type: 'keyword.less' },
				{ startIndex: 9, type: 'punctuation.parenthesis.less'},
				{ startIndex: 10, type: 'variable.less' },
				{ startIndex: 15, type: 'punctuation.parenthesis.less' },
				{ startIndex: 16, type: '' },
				{ startIndex: 17, type: 'punctuation.less' },
				{ startIndex: 18, type: 'keyword.less' }
			]}],

			[{
			line: 'whenn',
			tokens: [
93
				{ startIndex: 0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' }
E
Erich Gamma 已提交
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
			]}],

			[{
			line: '    round    ',
			tokens: [
				{ startIndex: 0, type: '' },
				{ startIndex: 4, type: 'keyword.less' },
				{ startIndex: 9, type: '' }
			]}],

			// Units
			[{
			line: 'isnumber(10px);',
			tokens: [
				{ startIndex: 0, type: 'keyword.less' },
				{ startIndex: 8, type: 'punctuation.parenthesis.less' },
110 111
				{ startIndex: 9, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex: 11, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
E
Erich Gamma 已提交
112 113 114 115 116 117 118
				{ startIndex: 13, type: 'punctuation.parenthesis.less' },
				{ startIndex: 14, type: 'punctuation.less' }
			]}],

			[{
			line: 'pxx',
			tokens: [
119
				{ startIndex: 0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' }
E
Erich Gamma 已提交
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
			]}],

			// single line Strings
			[{
			line: '@test: "I\'m a LESS String";',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: 'punctuation.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'string.punctuation.less' },
				{ startIndex:8, type: 'string.less' },
				{ startIndex:25, type: 'string.punctuation.less' },
				{ startIndex:26, type: 'punctuation.less' }
			]}],

			[{
			line: '@test: "concatenated" + "String";',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: 'punctuation.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'string.punctuation.less' },
				{ startIndex:8, type: 'string.less' },
				{ startIndex:20, type: 'string.punctuation.less' },
				{ startIndex:21, type: '' },
				{ startIndex:22, type: 'operator.less' },
				{ startIndex:23, type: '' },
				{ startIndex:24, type: 'string.punctuation.less' },
				{ startIndex:25, type: 'string.less' },
				{ startIndex:31, type: 'string.punctuation.less' },
				{ startIndex:32, type: 'punctuation.less' }
			]}],

			[{
			line: '@test: "quote in\'adasdsa\\"asd\' a string"',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: 'punctuation.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'string.punctuation.less' },
				{ startIndex:8, type: 'string.less' },
				{ startIndex:39, type: 'string.punctuation.less' }
			]}],

			[{
			line: '@test: \'doublequote in"ada\\\'sds\\\'a"asd a string\'',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: 'punctuation.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'string.punctuation.less' },
				{ startIndex:8, type: 'string.less' },
				{ startIndex:47, type: 'string.punctuation.less' }
			]}],

			// Comments - range comment, multiple lines
			[{
			line: '/* start of multiline comment',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}, {
			line: 'a comment between without a star',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}, {
			line: 'end of multiline comment*/',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}],

			[{
			line: 'when /* start a comment',
			tokens: [
				{ startIndex:0, type: 'keyword.less' },
				{ startIndex:4, type: '' },
				{ startIndex:5, type: 'comment.less' }
			]}, {
			line: ' a ',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}, {
			line: 'and end it */ 2;',
			tokens: [
				{ startIndex:0, type: 'comment.less' },
				{ startIndex:13, type: '' },
205
				{ startIndex:14, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
206 207 208 209 210 211 212
				{ startIndex:15, type: 'punctuation.less' }
			]}],

			// Numbers
			[{
			line: '0',
			tokens: [
213
				{ startIndex:0, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' }
E
Erich Gamma 已提交
214 215 216 217 218 219
			]}],

			[{
			line: ' 0',
			tokens: [
				{ startIndex:0, type: '' },
220
				{ startIndex:1, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' }
E
Erich Gamma 已提交
221 222 223 224 225 226
			]}],

			[{
			line: ' 0 ',
			tokens: [
				{ startIndex:0, type: '' },
227
				{ startIndex:1, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
228 229 230 231 232 233
				{ startIndex:2, type: '' }
			]}],

			[{
			line: '0 ',
			tokens: [
234
				{ startIndex:0, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
235 236 237 238 239 240 241 242 243
				{ startIndex:1, type: '' }
			]}],

			[{
			line: '@test: 0+0',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: 'punctuation.less' },
				{ startIndex:6, type: '' },
244
				{ startIndex:7, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
245
				{ startIndex:8, type: 'operator.less' },
246
				{ startIndex:9, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' }
E
Erich Gamma 已提交
247 248 249 250 251 252 253 254
			]}],

			[{
			line: '@test: 100+10.00',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: 'punctuation.less' },
				{ startIndex:6, type: '' },
255
				{ startIndex:7, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
256
				{ startIndex:10, type: 'operator.less' },
257
				{ startIndex:11, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' }
E
Erich Gamma 已提交
258 259 260 261 262 263 264 265
			]}],

			[{
			line: '@test: 0 + 0',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: 'punctuation.less' },
				{ startIndex:6, type: '' },
266
				{ startIndex:7, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
267 268 269
				{ startIndex:8, type: '' },
				{ startIndex:9, type: 'operator.less' },
				{ startIndex:10, type: '' },
270
				{ startIndex:11, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' }
E
Erich Gamma 已提交
271 272 273 274 275
			]}],

			[{
			line: '0123',
			tokens: [
276
				{ startIndex:0, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' }
E
Erich Gamma 已提交
277 278 279 280 281
			]}],

			[{
			line: '#012343',
			tokens: [
282
				{ startIndex:0, type: lessTokenTypes.TOKEN_VALUE + '.rgb-value.less' }
E
Erich Gamma 已提交
283 284 285 286 287
			]}],

			[{
			line: '[1,2,3]',
			tokens: [
288
				{ startIndex:0, type: 'punctuation.bracket.less' },
289
				{ startIndex:1, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
290
				{ startIndex:2, type: 'punctuation.less' },
291
				{ startIndex:3, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
292
				{ startIndex:4, type: 'punctuation.less' },
293
				{ startIndex:5, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
294
				{ startIndex:6, type: 'punctuation.bracket.less' }
E
Erich Gamma 已提交
295 296 297 298 299
			]}],

			[{
			line: 'foo(123);',
			tokens: [
300
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
301
				{ startIndex:3, type: 'punctuation.parenthesis.less' },
302
				{ startIndex:4, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
303
				{ startIndex:7, type: 'punctuation.parenthesis.less' },
E
Erich Gamma 已提交
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
				{ startIndex:8, type: 'punctuation.less' }
			]}],

			[{
			line: '@test: \'[{()}]\'',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: 'punctuation.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'string.punctuation.less' },
				{ startIndex:8, type: 'string.less' },
				{ startIndex:14, type: 'string.punctuation.less' }
			]}],

			// Singleline Comments
			[{
			line: '//',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}],

			[{
			line: '    // a comment',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:4, type: 'comment.less' }
			]}],

			[{
			line: '// a comment',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}],

			[{
			line: '//sticky comment',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}],

			[{
			line: '@something : 2; // my comment // this is a nice one',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:10, type: '' },
				{ startIndex:11, type: 'punctuation.less' },
				{ startIndex:12, type: '' },
351
				{ startIndex:13, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
352 353 354 355 356 357 358 359
				{ startIndex:14, type: 'punctuation.less' },
				{ startIndex:15, type: '' },
				{ startIndex:16, type: 'comment.less' }
			]}],

			[{
			line: '.something(@some, @other) when (iscolor(@other)) { aname// my commen',
			tokens: [
360
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
E
Erich Gamma 已提交
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377
				{ startIndex:10, type: 'punctuation.parenthesis.less' },
				{ startIndex:11, type: 'variable.less' },
				{ startIndex:16, type: 'punctuation.less' },
				{ startIndex:17, type: '' },
				{ startIndex:18, type: 'variable.less' },
				{ startIndex:24, type: 'punctuation.parenthesis.less' },
				{ startIndex:25, type: '' },
				{ startIndex:26, type: 'keyword.less' },
				{ startIndex:30, type: '' },
				{ startIndex:31, type: 'punctuation.parenthesis.less' },
				{ startIndex:32, type: 'keyword.less' },
				{ startIndex:39, type: 'punctuation.parenthesis.less' },
				{ startIndex:40, type: 'variable.less' },
				{ startIndex:46, type: 'punctuation.parenthesis.less' },
				{ startIndex:48, type: '' },
				{ startIndex:49, type: 'punctuation.curly.less' },
				{ startIndex:50, type: '' },
378
				{ startIndex:51, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
379 380 381 382 383 384
				{ startIndex:56, type: 'comment.less' }
			]}],

			[{
			line: '.something(@some//mycomment',
			tokens: [
385
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
E
Erich Gamma 已提交
386 387 388 389 390 391 392 393 394 395 396 397
				{ startIndex:10, type: 'punctuation.parenthesis.less' },
				{ startIndex:11, type: 'variable.less' },
				{ startIndex:16, type: 'comment.less' }
			]}],

			[{
			line: '@something : #2;',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:10, type: '' },
				{ startIndex:11, type: 'punctuation.less' },
				{ startIndex:12, type: '' },
398
				{ startIndex:13, type: lessTokenTypes.TOKEN_VALUE + '.rgb-value.less' },
E
Erich Gamma 已提交
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
				{ startIndex:15, type: 'punctuation.less' }
			]}],

			// Singleline Range-Comments
			[{
			line: '/*slcomment*/',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}],

			[{
			line: '/* slcomment */',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}],

			[{
			line: '/*sl/com* ment*/',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}],

			[{
			line: '/**/',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}],

			[{
			line: '@something: /*comm/* * /ent*/2;',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:10, type: 'punctuation.less' },
				{ startIndex:11, type: '' },
				{ startIndex:12, type: 'comment.less' },
434
				{ startIndex:29, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
435 436 437 438 439 440 441 442 443 444 445
				{ startIndex:30, type: 'punctuation.less' }
			]}],

			[{
			line: '@something: /*comment*/ 2;',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:10, type: 'punctuation.less' },
				{ startIndex:11, type: '' },
				{ startIndex:12, type: 'comment.less' },
				{ startIndex:23, type: '' },
446
				{ startIndex:24, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481
				{ startIndex:25, type: 'punctuation.less' }
			]}],

			// Comments - range comment, multi lines
			[{
			line: '/* a multiline comment',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}, {
			line: 'can actually span',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}, {
			line: 'multiple lines */',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}],

			[{
			line: '@some /* start a comment here',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: '' },
				{ startIndex:6, type: 'comment.less' }
			]}, {
			line: ' span over this line and ',
			tokens: [
				{ startIndex:0, type: 'comment.less' }
			]}, {
			line: 'end it there */ : 2;',
			tokens: [
				{ startIndex:0, type: 'comment.less' },
				{ startIndex:15, type: '' },
				{ startIndex:16, type: 'punctuation.less' },
				{ startIndex:17, type: '' },
482
				{ startIndex:18, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
483 484 485 486 487 488 489
				{ startIndex:19, type: 'punctuation.less' }
			]}],

			// Escape Strings
			[{
			line: '.class { filter: ~"ms:alwaysHasItsOwnSyntax.For.Stuff()";',
			tokens: [
490
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
E
Erich Gamma 已提交
491 492 493
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'punctuation.curly.less' },
				{ startIndex:8, type: '' },
494
				{ startIndex:9, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
E
Erich Gamma 已提交
495 496 497 498 499 500 501 502 503 504 505 506
				{ startIndex:15, type: 'punctuation.less' },
				{ startIndex:16, type: '' },
				{ startIndex:17, type: 'string.punctuation.less' },
				{ startIndex:19, type: 'string.less' },
				{ startIndex:55, type: 'string.punctuation.less' },
				{ startIndex:56, type: 'punctuation.less' }
			]}],

			// Guards
			[{
			line: '.class {.mixin (@a) when (@a > 10), (@a < -10) { }',
			tokens: [
507
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
E
Erich Gamma 已提交
508 509
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'punctuation.curly.less' },
510
				{ startIndex:8, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
E
Erich Gamma 已提交
511 512 513 514 515 516 517 518 519 520 521 522
				{ startIndex:14, type: '' },
				{ startIndex:15, type: 'punctuation.parenthesis.less' },
				{ startIndex:16, type: 'variable.less' },
				{ startIndex:18, type: 'punctuation.parenthesis.less' },
				{ startIndex:19, type: '' },
				{ startIndex:20, type: 'keyword.less' },
				{ startIndex:24, type: '' },
				{ startIndex:25, type: 'punctuation.parenthesis.less' },
				{ startIndex:26, type: 'variable.less' },
				{ startIndex:28, type: '' },
				{ startIndex:29, type: 'operator.less' },
				{ startIndex:30, type: '' },
523
				{ startIndex:31, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
524 525 526 527 528 529 530 531 532
				{ startIndex:33, type: 'punctuation.parenthesis.less' },
				{ startIndex:34, type: 'punctuation.less' },
				{ startIndex:35, type: '' },
				{ startIndex:36, type: 'punctuation.parenthesis.less' },
				{ startIndex:37, type: 'variable.less' },
				{ startIndex:39, type: '' },
				{ startIndex:40, type: 'operator.less' },
				{ startIndex:41, type: '' },
				{ startIndex:42, type: 'operator.less' },
533
				{ startIndex:43, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
534 535 536 537 538 539 540 541 542 543
				{ startIndex:45, type: 'punctuation.parenthesis.less' },
				{ startIndex:46, type: '' },
				{ startIndex:47, type: 'punctuation.curly.less' },
				{ startIndex:48, type: '' },
				{ startIndex:49, type: 'punctuation.curly.less' }
			]}],

			[{
			line: '.truth (@a) when (@a = true) { }',
			tokens: [
544
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
E
Erich Gamma 已提交
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'punctuation.parenthesis.less' },
				{ startIndex:8, type: 'variable.less' },
				{ startIndex:10, type: 'punctuation.parenthesis.less' },
				{ startIndex:11, type: '' },
				{ startIndex:12, type: 'keyword.less' },
				{ startIndex:16, type: '' },
				{ startIndex:17, type: 'punctuation.parenthesis.less' },
				{ startIndex:18, type: 'variable.less' },
				{ startIndex:20, type: '' },
				{ startIndex:21, type: 'operator.less' },
				{ startIndex:22, type: '' },
				{ startIndex:23, type: 'keyword.less' },
				{ startIndex:27, type: 'punctuation.parenthesis.less' },
				{ startIndex:28, type: '' },
				{ startIndex:29, type: 'punctuation.curly.less' },
				{ startIndex:30, type: '' },
				{ startIndex:31, type: 'punctuation.curly.less' }
			]}],

			[{
			line: '.max (@a, @b) when (@a > @b) { width: @a; }',
			tokens: [
568
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
E
Erich Gamma 已提交
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588
				{ startIndex:4, type: '' },
				{ startIndex:5, type: 'punctuation.parenthesis.less' },
				{ startIndex:6, type: 'variable.less' },
				{ startIndex:8, type: 'punctuation.less' },
				{ startIndex:9, type: '' },
				{ startIndex:10, type: 'variable.less' },
				{ startIndex:12, type: 'punctuation.parenthesis.less' },
				{ startIndex:13, type: '' },
				{ startIndex:14, type: 'keyword.less' },
				{ startIndex:18, type: '' },
				{ startIndex:19, type: 'punctuation.parenthesis.less' },
				{ startIndex:20, type: 'variable.less' },
				{ startIndex:22, type: '' },
				{ startIndex:23, type: 'operator.less' },
				{ startIndex:24, type: '' },
				{ startIndex:25, type: 'variable.less' },
				{ startIndex:27, type: 'punctuation.parenthesis.less' },
				{ startIndex:28, type: '' },
				{ startIndex:29, type: 'punctuation.curly.less' },
				{ startIndex:30, type: '' },
589
				{ startIndex:31, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
E
Erich Gamma 已提交
590 591 592 593 594 595 596 597 598 599 600
				{ startIndex:36, type: 'punctuation.less' },
				{ startIndex:37, type: '' },
				{ startIndex:38, type: 'variable.less' },
				{ startIndex:40, type: 'punctuation.less' },
				{ startIndex:41, type: '' },
				{ startIndex:42, type: 'punctuation.curly.less' }
			]}],

			[{
			line: '.mixin (@a, @b: 0) when (isnumber(@b)) { }',
			tokens: [
601
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
E
Erich Gamma 已提交
602 603 604 605 606 607 608 609
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'punctuation.parenthesis.less' },
				{ startIndex:8, type: 'variable.less' },
				{ startIndex:10, type: 'punctuation.less' },
				{ startIndex:11, type: '' },
				{ startIndex:12, type: 'variable.less' },
				{ startIndex:14, type: 'punctuation.less' },
				{ startIndex:15, type: '' },
610
				{ startIndex:16, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628
				{ startIndex:17, type: 'punctuation.parenthesis.less' },
				{ startIndex:18, type: '' },
				{ startIndex:19, type: 'keyword.less' },
				{ startIndex:23, type: '' },
				{ startIndex:24, type: 'punctuation.parenthesis.less' },
				{ startIndex:25, type: 'keyword.less' },
				{ startIndex:33, type: 'punctuation.parenthesis.less' },
				{ startIndex:34, type: 'variable.less' },
				{ startIndex:36, type: 'punctuation.parenthesis.less' },
				{ startIndex:38, type: '' },
				{ startIndex:39, type: 'punctuation.curly.less' },
				{ startIndex:40, type: '' },
				{ startIndex:41, type: 'punctuation.curly.less' }
			]}],

			[{
			line: '.mixin (@a, @b: black) when (iscolor(@b)) { }',
			tokens: [
629
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
E
Erich Gamma 已提交
630 631 632 633 634 635 636 637
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'punctuation.parenthesis.less' },
				{ startIndex:8, type: 'variable.less' },
				{ startIndex:10, type: 'punctuation.less' },
				{ startIndex:11, type: '' },
				{ startIndex:12, type: 'variable.less' },
				{ startIndex:14, type: 'punctuation.less' },
				{ startIndex:15, type: '' },
638
				{ startIndex:16, type: lessTokenTypes.TOKEN_VALUE + '.less' },
E
Erich Gamma 已提交
639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661
				{ startIndex:21, type: 'punctuation.parenthesis.less' },
				{ startIndex:22, type: '' },
				{ startIndex:23, type: 'keyword.less' },
				{ startIndex:27, type: '' },
				{ startIndex:28, type: 'punctuation.parenthesis.less' },
				{ startIndex:29, type: 'keyword.less' },
				{ startIndex:36, type: 'punctuation.parenthesis.less' },
				{ startIndex:37, type: 'variable.less' },
				{ startIndex:39, type: 'punctuation.parenthesis.less' },
				{ startIndex:41, type: '' },
				{ startIndex:42, type: 'punctuation.curly.less' },
				{ startIndex:43, type: '' },
				{ startIndex:44, type: 'punctuation.curly.less' }
			]}],

			// Nested JavaScript
			[{
			line: '@test: `function display()` //works well',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:5, type: 'punctuation.less' },
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'punctuation.backtick.less' },
662
				{ startIndex:8, type: 'mock-js' },
E
Erich Gamma 已提交
663 664 665 666 667 668 669 670 671
				{ startIndex:26, type: 'punctuation.backtick.less' },
				{ startIndex:27, type: '' },
				{ startIndex:28, type: 'comment.less' }
			]}],

			// Attribute in a .class(...)
			[{
			line: '.box-shadow(inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6));',
			tokens: [
672
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
E
Erich Gamma 已提交
673
				{ startIndex:11, type: 'punctuation.parenthesis.less' },
674
				{ startIndex:12, type: lessTokenTypes.TOKEN_VALUE + '.less' },
E
Erich Gamma 已提交
675
				{ startIndex:17, type: '' },
676
				{ startIndex:18, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
677
				{ startIndex:19, type: '' },
678 679
				{ startIndex:20, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:21, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
E
Erich Gamma 已提交
680
				{ startIndex:23, type: '' },
681 682
				{ startIndex:24, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:25, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
E
Erich Gamma 已提交
683
				{ startIndex:27, type: '' },
684
				{ startIndex:28, type: lessTokenTypes.TOKEN_VALUE + '.less' },
E
Erich Gamma 已提交
685
				{ startIndex:32, type: 'punctuation.parenthesis.less' },
686
				{ startIndex:33, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
687
				{ startIndex:34, type: 'punctuation.less' },
688
				{ startIndex:35, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
689
				{ startIndex:36, type: 'punctuation.less' },
690
				{ startIndex:37, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
691
				{ startIndex:38, type: 'punctuation.less' },
692
				{ startIndex:39, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
693 694 695
				{ startIndex:43, type: 'punctuation.parenthesis.less' },
				{ startIndex:44, type: 'punctuation.less' },
				{ startIndex:45, type: '' },
696
				{ startIndex:46, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
697
				{ startIndex:47, type: '' },
698
				{ startIndex:48, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
699
				{ startIndex:49, type: '' },
700 701
				{ startIndex:50, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:51, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
E
Erich Gamma 已提交
702
				{ startIndex:53, type: '' },
703
				{ startIndex:54, type: lessTokenTypes.TOKEN_VALUE + '.less' },
E
Erich Gamma 已提交
704
				{ startIndex:58, type: 'punctuation.parenthesis.less' },
705
				{ startIndex:59, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
706
				{ startIndex:61, type: 'punctuation.less' },
707
				{ startIndex:62, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
708
				{ startIndex:65, type: 'punctuation.less' },
709
				{ startIndex:66, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
710
				{ startIndex:69, type: 'punctuation.less' },
711
				{ startIndex:70, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
712 713 714 715 716 717 718 719
				{ startIndex:72, type: 'punctuation.parenthesis.less' },
				{ startIndex:74, type: 'punctuation.less' }
			]}],

			// Difficult little bugs... => String mismatches
			[{
			line: 'input[type="radio"]',
			tokens: [
720
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
721
				{ startIndex:5, type: 'punctuation.bracket.less' },
722
				{ startIndex:6, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741
				{ startIndex:10, type: 'operator.less' },
				{ startIndex:11, type: 'string.punctuation.less' },
				{ startIndex:12, type: 'string.less' },
				{ startIndex:17, type: 'string.punctuation.less' },
				{ startIndex:18, type: 'punctuation.bracket.less' }
			]}],

			[{
			line: '~\'.offset@{index}\')',
			tokens: [
				{ startIndex:0, type: 'string.punctuation.less' },
				{ startIndex:2, type: 'string.less' },
				{ startIndex:17, type: 'string.punctuation.less' },
				{ startIndex:18, type: 'punctuation.parenthesis.less' }
			]}],

			[{
			line: 'some("\\42");',
			tokens: [
742
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765
				{ startIndex:4, type: 'punctuation.parenthesis.less' },
				{ startIndex:5, type: 'string.punctuation.less' },
				{ startIndex:6, type: 'string.less' },
				{ startIndex:9, type: 'string.punctuation.less' },
				{ startIndex:10, type: 'punctuation.parenthesis.less' },
				{ startIndex:11, type: 'punctuation.less' }
			]}],

			[{
			line: ' ~ "icon-"',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:1, type: 'operator.less' },
				{ startIndex:2, type: '' },
				{ startIndex:3, type: 'string.punctuation.less' },
				{ startIndex:4, type: 'string.less' },
				{ startIndex:9, type: 'string.punctuation.less' }
			]}],

			// Difficult little bugs... => Operator mismatches
			[{
			line: 'class^="icon-"',
			tokens: [
766
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
767 768 769 770 771 772 773 774 775
				{ startIndex:5, type: 'operator.less' },
				{ startIndex:7, type: 'string.punctuation.less' },
				{ startIndex:8, type: 'string.less' },
				{ startIndex:13, type: 'string.punctuation.less' }
			]}],

			[{
			line: 'class*="icon-"',
			tokens: [
776
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
777 778 779 780 781 782 783 784 785
				{ startIndex:5, type: 'operator.less' },
				{ startIndex:7, type: 'string.punctuation.less' },
				{ startIndex:8, type: 'string.less' },
				{ startIndex:13, type: 'string.punctuation.less' }
			]}],

			[{
			line: 'class~="icon-"',
			tokens: [
786
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
787 788 789 790 791 792 793 794 795
				{ startIndex:5, type: 'operator.less' },
				{ startIndex:7, type: 'string.punctuation.less' },
				{ startIndex:8, type: 'string.less' },
				{ startIndex:13, type: 'string.punctuation.less' }
			]}],

			[{
			line: 'class ~ = "icon-"',
			tokens: [
796
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
797 798 799 800 801 802 803 804 805 806 807 808 809
				{ startIndex:5, type: '' },
				{ startIndex:6, type: 'operator.less' },
				{ startIndex:7, type: '' },
				{ startIndex:8, type: 'operator.less' },
				{ startIndex:9, type: '' },
				{ startIndex:10, type: 'string.punctuation.less' },
				{ startIndex:11, type: 'string.less' },
				{ startIndex:16, type: 'string.punctuation.less' }
			]}],

			[{
			line: 'class|="icon-"',
			tokens: [
810
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
811 812 813 814 815 816 817 818 819
				{ startIndex:5, type: 'operator.less' },
				{ startIndex:7, type: 'string.punctuation.less' },
				{ startIndex:8, type: 'string.less' },
				{ startIndex:13, type: 'string.punctuation.less' }
			]}],

			[{
			line: '.hide-text { font: 0/0 a; }',
			tokens: [
820
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
E
Erich Gamma 已提交
821 822 823
				{ startIndex:10, type: '' },
				{ startIndex:11, type: 'punctuation.curly.less' },
				{ startIndex:12, type: '' },
824
				{ startIndex:13, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
E
Erich Gamma 已提交
825 826
				{ startIndex:17, type: 'punctuation.less' },
				{ startIndex:18, type: '' },
827
				{ startIndex:19, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
828
				{ startIndex:20, type: 'operator.less' },
829
				{ startIndex:21, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
830
				{ startIndex:22, type: '' },
831
				{ startIndex:23, type: lessTokenTypes.TOKEN_VALUE + '.less' },
E
Erich Gamma 已提交
832 833 834 835 836 837 838 839 840
				{ startIndex:24, type: 'punctuation.less' },
				{ startIndex:25, type: '' },
				{ startIndex:26, type: 'punctuation.curly.less' }
			]}],

			// Difficult little bugs... => Numbers in classes
			[{
			line: '.translate3d(@x, @y, @z) { -webkit-transform: translate3d(@x, @y, @z); }',
			tokens: [
841
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
E
Erich Gamma 已提交
842 843 844 845 846 847 848 849 850 851 852 853
				{ startIndex:12, type: 'punctuation.parenthesis.less' },
				{ startIndex:13, type: 'variable.less' },
				{ startIndex:15, type: 'punctuation.less' },
				{ startIndex:16, type: '' },
				{ startIndex:17, type: 'variable.less' },
				{ startIndex:19, type: 'punctuation.less' },
				{ startIndex:20, type: '' },
				{ startIndex:21, type: 'variable.less' },
				{ startIndex:23, type: 'punctuation.parenthesis.less' },
				{ startIndex:24, type: '' },
				{ startIndex:25, type: 'punctuation.curly.less' },
				{ startIndex:26, type: '' },
854
				{ startIndex:27, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
E
Erich Gamma 已提交
855 856
				{ startIndex:44, type: 'punctuation.less' },
				{ startIndex:45, type: '' },
857
				{ startIndex:46, type: lessTokenTypes.TOKEN_VALUE + '.less' },
E
Erich Gamma 已提交
858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875
				{ startIndex:57, type: 'punctuation.parenthesis.less' },
				{ startIndex:58, type: 'variable.less' },
				{ startIndex:60, type: 'punctuation.less' },
				{ startIndex:61, type: '' },
				{ startIndex:62, type: 'variable.less' },
				{ startIndex:64, type: 'punctuation.less' },
				{ startIndex:65, type: '' },
				{ startIndex:66, type: 'variable.less' },
				{ startIndex:68, type: 'punctuation.parenthesis.less' },
				{ startIndex:69, type: 'punctuation.less' },
				{ startIndex:70, type: '' },
				{ startIndex:71, type: 'punctuation.curly.less' }
			]}],

			// Difficult little bugs... => Generic mismatches, worst case...
			[{
			line: '.dropdown-menu > li > a:hover > [class=" icon-"]',
			tokens: [
876
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
E
Erich Gamma 已提交
877 878 879
				{ startIndex:14, type: '' },
				{ startIndex:15, type: 'operator.less' },
				{ startIndex:16, type: '' },
880
				{ startIndex:17, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
881 882 883
				{ startIndex:19, type: '' },
				{ startIndex:20, type: 'operator.less' },
				{ startIndex:21, type: '' },
884
				{ startIndex:22, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
885 886 887 888
				{ startIndex:29, type: '' },
				{ startIndex:30, type: 'operator.less' },
				{ startIndex:31, type: '' },
				{ startIndex:32, type: 'punctuation.bracket.less' },
889
				{ startIndex:33, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
890 891 892 893 894 895 896 897 898 899
				{ startIndex:38, type: 'operator.less' },
				{ startIndex:39, type: 'string.punctuation.less' },
				{ startIndex:40, type: 'string.less' },
				{ startIndex:46, type: 'string.punctuation.less' },
				{ startIndex:47, type: 'punctuation.bracket.less' }
			]}],

			[{
			line: '.bw-gradient(@color: #F5F5F5, @start: 0, @stop: 255) { background: -webkit-gradient(color-stop(0, rgb(@start,@start,@start)), color-stop(1, rgb(@stop,@stop,@stop))); }',
			tokens: [
900
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
E
Erich Gamma 已提交
901 902 903 904
				{ startIndex:12, type: 'punctuation.parenthesis.less' },
				{ startIndex:13, type: 'variable.less' },
				{ startIndex:19, type: 'punctuation.less' },
				{ startIndex:20, type: '' },
905
				{ startIndex:21, type: lessTokenTypes.TOKEN_VALUE + '.rgb-value.less' },
E
Erich Gamma 已提交
906 907 908 909 910
				{ startIndex:28, type: 'punctuation.less' },
				{ startIndex:29, type: '' },
				{ startIndex:30, type: 'variable.less' },
				{ startIndex:36, type: 'punctuation.less' },
				{ startIndex:37, type: '' },
911
				{ startIndex:38, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
912 913 914 915 916
				{ startIndex:39, type: 'punctuation.less' },
				{ startIndex:40, type: '' },
				{ startIndex:41, type: 'variable.less' },
				{ startIndex:46, type: 'punctuation.less' },
				{ startIndex:47, type: '' },
917
				{ startIndex:48, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
918 919 920 921
				{ startIndex:51, type: 'punctuation.parenthesis.less' },
				{ startIndex:52, type: '' },
				{ startIndex:53, type: 'punctuation.curly.less' },
				{ startIndex:54, type: '' },
922
				{ startIndex:55, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
E
Erich Gamma 已提交
923 924
				{ startIndex:65, type: 'punctuation.less' },
				{ startIndex:66, type: '' },
925
				{ startIndex:67, type: lessTokenTypes.TOKEN_VALUE + '.less' },
E
Erich Gamma 已提交
926
				{ startIndex:83, type: 'punctuation.parenthesis.less' },
927
				{ startIndex:84, type: lessTokenTypes.TOKEN_VALUE + '.less' },
E
Erich Gamma 已提交
928
				{ startIndex:94, type: 'punctuation.parenthesis.less' },
929
				{ startIndex:95, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
930 931
				{ startIndex:96, type: 'punctuation.less' },
				{ startIndex:97, type: '' },
932
				{ startIndex:98, type: lessTokenTypes.TOKEN_VALUE + '.less' },
E
Erich Gamma 已提交
933 934 935 936 937 938 939 940 941
				{ startIndex:101, type: 'punctuation.parenthesis.less' },
				{ startIndex:102, type: 'variable.less' },
				{ startIndex:108, type: 'punctuation.less' },
				{ startIndex:109, type: 'variable.less' },
				{ startIndex:115, type: 'punctuation.less' },
				{ startIndex:116, type: 'variable.less' },
				{ startIndex:122, type: 'punctuation.parenthesis.less' },
				{ startIndex:124, type: 'punctuation.less' },
				{ startIndex:125, type: '' },
942
				{ startIndex:126, type: lessTokenTypes.TOKEN_VALUE + '.less' },
E
Erich Gamma 已提交
943
				{ startIndex:136, type: 'punctuation.parenthesis.less' },
944
				{ startIndex:137, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
945 946
				{ startIndex:138, type: 'punctuation.less' },
				{ startIndex:139, type: '' },
947
				{ startIndex:140, type: lessTokenTypes.TOKEN_VALUE + '.less' },
E
Erich Gamma 已提交
948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964
				{ startIndex:143, type: 'punctuation.parenthesis.less' },
				{ startIndex:144, type: 'variable.less' },
				{ startIndex:149, type: 'punctuation.less' },
				{ startIndex:150, type: 'variable.less' },
				{ startIndex:155, type: 'punctuation.less' },
				{ startIndex:156, type: 'variable.less' },
				{ startIndex:161, type: 'punctuation.parenthesis.less' },
				{ startIndex:164, type: 'punctuation.less' },
				{ startIndex:165, type: '' },
				{ startIndex:166, type: 'punctuation.curly.less' }
			]}],

			// Skip whitespace
			[{
			line: '      body ',
			tokens: [
				{ startIndex:0, type: '' },
965
				{ startIndex:6, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
966 967 968 969 970 971 972 973 974 975 976 977 978 979
				{ startIndex:10, type: '' }
			]}],

			// CSS rule
			//	body {
			//	  margin: 0;
			//	  padding: 3em 6em;
			//	  font-family: tahoma, arial, sans-serif;
			//	  text-decoration: none !important;
			//	  color: #000
			//	}
			[{
			line: 'body {',
			tokens: [
980
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
981
				{ startIndex:4, type: '' },
982
				{ startIndex:5, type: 'punctuation.curly.less' }
E
Erich Gamma 已提交
983 984 985 986
			]}, {
			line: '  margin: 0;',
			tokens: [
				{ startIndex:0, type: '' },
987
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
E
Erich Gamma 已提交
988 989
				{ startIndex:8, type: 'punctuation.less' },
				{ startIndex:9, type: '' },
990
				{ startIndex:10, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
E
Erich Gamma 已提交
991 992 993 994 995
				{ startIndex:11, type: 'punctuation.less' }
			]}, {
			line: '  padding: 3em 6em;',
			tokens: [
				{ startIndex:0, type: '' },
996
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
E
Erich Gamma 已提交
997 998
				{ startIndex:9, type: 'punctuation.less' },
				{ startIndex:10, type: '' },
999 1000
				{ startIndex:11, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:12, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
E
Erich Gamma 已提交
1001
				{ startIndex:14, type: '' },
1002 1003
				{ startIndex:15, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:16, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
E
Erich Gamma 已提交
1004 1005 1006 1007 1008
				{ startIndex:18, type: 'punctuation.less' }
			]}, {
			line: '  font-family: tahoma, arial, sans-serif;',
			tokens: [
				{ startIndex:0, type: '' },
1009
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
E
Erich Gamma 已提交
1010 1011
				{ startIndex:13, type: 'punctuation.less' },
				{ startIndex:14, type: '' },
1012
				{ startIndex:15, type: lessTokenTypes.TOKEN_VALUE + '.less' },
E
Erich Gamma 已提交
1013 1014
				{ startIndex:21, type: 'punctuation.less' },
				{ startIndex:22, type: '' },
1015
				{ startIndex:23, type: lessTokenTypes.TOKEN_VALUE + '.less' },
E
Erich Gamma 已提交
1016 1017
				{ startIndex:28, type: 'punctuation.less' },
				{ startIndex:29, type: '' },
1018
				{ startIndex:30, type: lessTokenTypes.TOKEN_VALUE + '.less' },
E
Erich Gamma 已提交
1019 1020 1021 1022 1023
				{ startIndex:40, type: 'punctuation.less' }
			]}, {
			line: '  text-decoration: none !important;',
			tokens: [
				{ startIndex:0, type: '' },
1024
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
E
Erich Gamma 已提交
1025 1026
				{ startIndex:17, type: 'punctuation.less' },
				{ startIndex:18, type: '' },
1027
				{ startIndex:19, type: lessTokenTypes.TOKEN_VALUE + '.less' },
E
Erich Gamma 已提交
1028 1029 1030 1031 1032 1033 1034
				{ startIndex:23, type: '' },
				{ startIndex:24, type: 'keyword.less' },
				{ startIndex:34, type: 'punctuation.less' }
			]}, {
			line: '  color: #000;',
			tokens: [
				{ startIndex:0, type: '' },
1035
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
E
Erich Gamma 已提交
1036 1037
				{ startIndex:7, type: 'punctuation.less' },
				{ startIndex:8, type: '' },
1038
				{ startIndex:9, type: lessTokenTypes.TOKEN_VALUE + '.rgb-value.less' },
E
Erich Gamma 已提交
1039 1040 1041 1042 1043
				{ startIndex:13, type: 'punctuation.less' }
			]}, {
			line: '  }',
			tokens: [
				{ startIndex:0, type: '' },
1044
				{ startIndex:2, type: 'punctuation.curly.less' }
E
Erich Gamma 已提交
1045 1046 1047 1048 1049 1050 1051 1052 1053 1054
			]}],

			// CSS units and numbers
			[{
			line: '* { padding: 3em -9pt -0.5px; }',
			tokens: [
				{ startIndex:0, type: 'operator.less' },
				{ startIndex:1, type: '' },
				{ startIndex:2, type: 'punctuation.curly.less' },
				{ startIndex:3, type: '' },
1055
				{ startIndex:4, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
E
Erich Gamma 已提交
1056 1057
				{ startIndex:11, type: 'punctuation.less' },
				{ startIndex:12, type: '' },
1058 1059
				{ startIndex:13, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:14, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
E
Erich Gamma 已提交
1060 1061
				{ startIndex:16, type: '' },
				{ startIndex:17, type: 'operator.less' },
1062 1063
				{ startIndex:18, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:19, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
E
Erich Gamma 已提交
1064 1065
				{ startIndex:21, type: '' },
				{ startIndex:22, type: 'operator.less' },
1066 1067
				{ startIndex:23, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:26, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
E
Erich Gamma 已提交
1068 1069 1070 1071 1072 1073 1074 1075 1076 1077
				{ startIndex:28, type: 'punctuation.less' },
				{ startIndex:29, type: '' },
				{ startIndex:30, type: 'punctuation.curly.less' }
			]}],

			// CSS single line comment
			//	h1 /*comment*/ p  {
			[{
			line: 'h1 /*comment*/ p {',
			tokens: [
1078
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
1079 1080 1081
				{ startIndex:2, type: '' },
				{ startIndex:3, type: 'comment.less' },
				{ startIndex:14, type: '' },
1082
				{ startIndex:15, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
1083
				{ startIndex:16, type: '' },
1084
				{ startIndex:17, type: 'punctuation.curly.less' }
E
Erich Gamma 已提交
1085 1086 1087 1088 1089 1090 1091 1092
			]}],

			// CSS multi line comment
			//	h1 /*com
			//  ment*/ p  {
			[{
			line: 'h1 /*com',
			tokens: [
1093
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
1094 1095 1096 1097 1098 1099 1100
				{ startIndex:2, type: '' },
				{ startIndex:3, type: 'comment.less' }
			]}, {
			line: 'ment*/ p',
			tokens: [
				{ startIndex:0, type: 'comment.less' },
				{ startIndex:6, type: '' },
1101
				{ startIndex:7, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' }
E
Erich Gamma 已提交
1102 1103 1104 1105 1106 1107 1108 1109 1110 1111
			]}],

			// CSS ID rule
			//	#myID {
			//	  font-size: 80%;
			//	  content: 'contents';
			//	}
			[{
			line: '#myID {',
			tokens: [
1112
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.id.less' },
E
Erich Gamma 已提交
1113
				{ startIndex:5, type: '' },
1114
				{ startIndex:6, type: 'punctuation.curly.less' }
E
Erich Gamma 已提交
1115 1116 1117 1118 1119 1120 1121 1122
			]}],

			// CSS Class rules
			//	.myID {
			//	h1 > p {
			[{
			line: '.myID {',
			tokens: [
1123
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
E
Erich Gamma 已提交
1124
				{ startIndex:5, type: '' },
1125
				{ startIndex:6, type: 'punctuation.curly.less' }
E
Erich Gamma 已提交
1126 1127 1128 1129 1130 1131 1132 1133 1134
			]}],

			// CSS @import etc
			//	@import url('something.less'); {
			[{
			line: '@import url("something.less");',
			tokens: [
				{ startIndex:0, type: 'keyword.less' },
				{ startIndex:7, type: '' },
1135 1136
				{ startIndex:8, type: 'function.less' },
				{ startIndex:12, type: 'string.punctuation.less' },
E
Erich Gamma 已提交
1137
				{ startIndex:13, type: 'string.less' },
1138 1139
				{ startIndex:27, type: 'string.punctuation.less' },
				{ startIndex:28, type: 'punctuation.parenthesis.less' },
E
Erich Gamma 已提交
1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152
				{ startIndex:29, type: 'punctuation.less' }
			]}],

			// CSS multi-line string with an escaped newline
			//	body {
			//	content: 'con\
			//  tent';
			[{
			line: 'body {',
			tokens: null}, {
			line: '  content: "con\\',
			tokens: [
				{ startIndex:0, type: '' },
1153
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
E
Erich Gamma 已提交
1154 1155
				{ startIndex:9, type: 'punctuation.less' },
				{ startIndex:10, type: '' },
1156
				{ startIndex:11, type: 'string.punctuation.less' },
E
Erich Gamma 已提交
1157 1158 1159 1160 1161
				{ startIndex:12, type: 'string.less' }
			]}, {
			line: 'tent";',
			tokens: [
				{ startIndex:0, type: 'string.less' },
1162
				{ startIndex:4, type: 'string.punctuation.less' },
E
Erich Gamma 已提交
1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174
				{ startIndex:5, type: 'punctuation.less' }
			]}],

			// CSS empty string value
			//	body {
			//	content: '';
			[{
			line: 'body {',
			tokens: null}, {
			line: '  content: "";',
			tokens: [
				{ startIndex:0, type: '' },
1175
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
E
Erich Gamma 已提交
1176 1177
				{ startIndex:9, type: 'punctuation.less' },
				{ startIndex:10, type: '' },
1178
				{ startIndex:11, type: 'string.punctuation.less' },
E
Erich Gamma 已提交
1179 1180 1181 1182 1183 1184 1185 1186 1187 1188
				{ startIndex:13, type: 'punctuation.less' }
			]}],

			// LESS IE star hacks
			[{
			line: 'body {',
			tokens: null}, {
			line: '  _content: "";',
			tokens: [
				{ startIndex:0, type: '' },
1189
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
E
Erich Gamma 已提交
1190 1191
				{ startIndex:10, type: 'punctuation.less' },
				{ startIndex:11, type: '' },
1192
				{ startIndex:12, type: 'string.punctuation.less' },
E
Erich Gamma 已提交
1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204
				{ startIndex:14, type: 'punctuation.less' }
			]}],

			// CSS font face
			// @font-face {
			//     font-family: 'Opificio';
			// }
			[{
			line: '@font-face {',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:10, type: '' },
1205
				{ startIndex:11, type: 'punctuation.curly.less' }
E
Erich Gamma 已提交
1206 1207 1208 1209
			]}, {
			line: '  font-family: "Opificio";',
			tokens: [
				{ startIndex:0, type: '' },
1210
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
E
Erich Gamma 已提交
1211 1212
				{ startIndex:13, type: 'punctuation.less' },
				{ startIndex:14, type: '' },
1213
				{ startIndex:15, type: 'string.punctuation.less' },
E
Erich Gamma 已提交
1214
				{ startIndex:16, type: 'string.less' },
1215
				{ startIndex:24, type: 'string.punctuation.less' },
E
Erich Gamma 已提交
1216 1217 1218 1219 1220 1221 1222 1223
				{ startIndex:25, type: 'punctuation.less' }
			]}],

			// CSS string with escaped quotes
			//	's\"tr'
			[{
			line: '"s\\"tr\\"sadsad',
			tokens: [
1224
				{ startIndex:0, type: 'string.punctuation.less' },
E
Erich Gamma 已提交
1225 1226 1227 1228 1229 1230
				{ startIndex:1, type: 'string.less' }
			]}],

			[{
			line: 'p{}',
			tokens: [
1231
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
1232
				{ startIndex:1, type: 'punctuation.curly.less' }
E
Erich Gamma 已提交
1233 1234 1235 1236 1237
			]}],

			[{
			line: 'p:nth() {}',
			tokens: [
1238
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
1239
				{ startIndex:5, type: 'punctuation.parenthesis.less' },
E
Erich Gamma 已提交
1240
				{ startIndex:7, type: '' },
1241
				{ startIndex:8, type: 'punctuation.curly.less' }
E
Erich Gamma 已提交
1242 1243 1244 1245 1246 1247 1248 1249 1250
			]}],

			// EG: import statement - bug #10308
			//	@import url('something.css');@import url('something.css');
			[{
			line: '@import url("something.css");@import url("something.css");',
			tokens: [
				{ startIndex:0, type: 'keyword.less' },
				{ startIndex:7, type: '' },
1251 1252
				{ startIndex:8, type: 'function.less' },
				{ startIndex:12, type: 'string.punctuation.less' },
E
Erich Gamma 已提交
1253
				{ startIndex:13, type: 'string.less' },
1254 1255
				{ startIndex:26, type: 'string.punctuation.less' },
				{ startIndex:27, type: 'punctuation.parenthesis.less' },
E
Erich Gamma 已提交
1256 1257 1258
				{ startIndex:28, type: 'punctuation.less' },
				{ startIndex:29, type: 'keyword.less' },
				{ startIndex:36, type: '' },
1259
				{ startIndex:37, type: 'function.less' },
E
Erich Gamma 已提交
1260 1261 1262
				{ startIndex:41, type: 'string.punctuation.less' },
				{ startIndex:42, type: 'string.less' },
				{ startIndex:55, type: 'string.punctuation.less' },
1263
				{ startIndex:56, type: 'punctuation.parenthesis.less' },
E
Erich Gamma 已提交
1264 1265 1266 1267 1268 1269 1270
				{ startIndex:57, type: 'punctuation.less' }
			]}],

			// EG: Triple quotes - bug #9870
			[{
			line: '""""',
			tokens: [
1271
				{ startIndex:0, type: 'string.punctuation.less' }
E
Erich Gamma 已提交
1272 1273 1274 1275 1276 1277 1278 1279
			]}],

			// EG: CSS @import related coloring bug 9553
			[{
			line: '@import url("something.css");',
			tokens: [
				{ startIndex:0, type: 'keyword.less' },
				{ startIndex:7, type: '' },
1280
				{ startIndex:8, type: 'function.less' },
E
Erich Gamma 已提交
1281 1282 1283
				{ startIndex:12, type: 'string.punctuation.less' },
				{ startIndex:13, type: 'string.less' },
				{ startIndex:26, type: 'string.punctuation.less' },
1284
				{ startIndex:27, type: 'punctuation.parenthesis.less' },
E
Erich Gamma 已提交
1285 1286 1287 1288
				{ startIndex:28, type: 'punctuation.less' }
			]}, {
			line: '.rule1{}',
			tokens: [
1289
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
1290
				{ startIndex:6, type: 'punctuation.curly.less' }
E
Erich Gamma 已提交
1291 1292 1293
			]}, {
			line: '.rule2{}',
			tokens: [
1294
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
1295
				{ startIndex:6, type: 'punctuation.curly.less' }
E
Erich Gamma 已提交
1296 1297 1298 1299 1300 1301 1302 1303
			]}],

			// EG: CSS key frame animation syntax
			[{
			line: '@-webkit-keyframes infinite-spinning {',
			tokens: [
				{ startIndex:0, type: 'variable.less' },
				{ startIndex:18, type: '' },
1304
				{ startIndex:19, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
1305
				{ startIndex:36, type: '' },
1306
				{ startIndex:37, type: 'punctuation.curly.less' }
E
Erich Gamma 已提交
1307 1308 1309 1310
			]}, {
			line: '  from {',
			tokens: [
				{ startIndex:0, type: '' },
1311
				{ startIndex:2, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
1312 1313 1314 1315 1316 1317
				{ startIndex:6, type: '' },
				{ startIndex:7, type: 'punctuation.curly.less' }
			]}, {
			line: '  -webkit-transform: rotate(0deg);',
			tokens: [
				{ startIndex:0, type: '' },
1318
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
E
Erich Gamma 已提交
1319 1320
				{ startIndex:19, type: 'punctuation.less' },
				{ startIndex:20, type: '' },
1321
				{ startIndex:21, type: lessTokenTypes.TOKEN_VALUE + '.less' },
E
Erich Gamma 已提交
1322
				{ startIndex:27, type: 'punctuation.parenthesis.less' },
1323 1324
				{ startIndex:28, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:29, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
E
Erich Gamma 已提交
1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335
				{ startIndex:32, type: 'punctuation.parenthesis.less' },
				{ startIndex:33, type: 'punctuation.less' }
			]}, {
			line: '	 }',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:2, type: 'punctuation.curly.less' }
			]}, {
			line: '  to {',
			tokens: [
				{ startIndex:0, type: '' },
1336
				{ startIndex:2, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
1337 1338 1339 1340 1341 1342
				{ startIndex:4, type: '' },
				{ startIndex:5, type: 'punctuation.curly.less' }
			]}, {
			line: '  -webkit-transform: rotate(360deg);',
			tokens: [
				{ startIndex:0, type: '' },
1343
				{ startIndex:2, type: lessTokenTypes.TOKEN_PROPERTY + '.less' },
E
Erich Gamma 已提交
1344 1345
				{ startIndex:19, type: 'punctuation.less' },
				{ startIndex:20, type: '' },
1346
				{ startIndex:21, type: lessTokenTypes.TOKEN_VALUE + '.less' },
E
Erich Gamma 已提交
1347
				{ startIndex:27, type: 'punctuation.parenthesis.less' },
1348 1349
				{ startIndex:28, type: lessTokenTypes.TOKEN_VALUE + '.numeric.less' },
				{ startIndex:31, type: lessTokenTypes.TOKEN_VALUE + '.unit.less' },
E
Erich Gamma 已提交
1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368
				{ startIndex:34, type: 'punctuation.parenthesis.less' },
				{ startIndex:35, type: 'punctuation.less' }
			]}, {
			line: '	 }',
			tokens: [
				{ startIndex:0, type: '' },
				{ startIndex:2, type: 'punctuation.curly.less' }
			]}, {
			line: '}',
			tokens: [
				{ startIndex:0, type: 'punctuation.curly.less' }
			]}]
		]);
	});

	test('identifier escaping', function() {
		modesUtil.assertTokenization(tokenizationSupport, [{
			line: 'input[type= \\"submit\\"',
			tokens: [
1369
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
1370
				{ startIndex:5, type: 'punctuation.bracket.less'},
1371
				{ startIndex:6, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less' },
E
Erich Gamma 已提交
1372 1373
				{ startIndex:10, type: 'operator.less'},
				{ startIndex:11, type: ''},
1374
				{ startIndex:12, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less'}
E
Erich Gamma 已提交
1375 1376 1377 1378 1379 1380 1381 1382
			]}
		]);
	});

	test('identifier escaping 2', function() {
		modesUtil.assertTokenization(tokenizationSupport, [{
			line: '.\\34 hello { -moz-foo: --myvar }',
			tokens: [
1383
				{ startIndex:0, type: lessTokenTypes.TOKEN_SELECTOR + '.class.less' },
E
Erich Gamma 已提交
1384 1385 1386
				{ startIndex:10, type: ''},
				{ startIndex:11, type: 'punctuation.curly.less'},
				{ startIndex:12, type: ''},
1387
				{ startIndex:13, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less'},
E
Erich Gamma 已提交
1388
				{ startIndex:22, type: ''},
1389
				{ startIndex:23, type: lessTokenTypes.TOKEN_SELECTOR_TAG + '.less'},
E
Erich Gamma 已提交
1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402
				{ startIndex:30, type: ''},
				{ startIndex:31, type: 'punctuation.curly.less'},
			]}
		]);
	});

	test('onEnter', function() {
		assertOnEnter.indents('', '.myRule {', '');
		assertOnEnter.indents('', 'background: url(', '');
		assertOnEnter.indents('', '.myRule[', '');
		assertOnEnter.indentsOutdents('', '.myRule {', '}');
	});
});