less.test.ts 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290
  1. /*---------------------------------------------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Licensed under the MIT License. See License.txt in the project root for license information.
  4. *--------------------------------------------------------------------------------------------*/
  5. 'use strict';
  6. import {testTokenization} from './testRunner';
  7. testTokenization(['less'], [
  8. // Keywords
  9. [{
  10. line: 'isnumber(10);',
  11. tokens: [
  12. { startIndex: 0, type: 'keyword.less' },
  13. { startIndex: 8, type: 'delimiter.parenthesis.less' },
  14. { startIndex: 9, type: 'attribute.value.number.less' },
  15. { startIndex: 11, type: 'delimiter.parenthesis.less' },
  16. { startIndex: 12, type: 'delimiter.less' }
  17. ]}],
  18. [{
  19. line: 'iskeyword(@test) ;mix',
  20. tokens: [
  21. { startIndex: 0, type: 'keyword.less' },
  22. { startIndex: 9, type: 'delimiter.parenthesis.less'},
  23. { startIndex: 10, type: 'variable.less' },
  24. { startIndex: 15, type: 'delimiter.parenthesis.less' },
  25. { startIndex: 16, type: '' },
  26. { startIndex: 17, type: 'delimiter.less' },
  27. { startIndex: 18, type: 'keyword.less' }
  28. ]}],
  29. [{
  30. line: 'whenn',
  31. tokens: [
  32. { startIndex: 0, type: 'tag.less' },
  33. ]}],
  34. [{
  35. line: ' round ',
  36. tokens: [
  37. { startIndex: 0, type: '' },
  38. { startIndex: 4, type: 'keyword.less' },
  39. { startIndex: 9, type: '' }
  40. ]}],
  41. // Units
  42. [{
  43. line: 'isnumber(10px);',
  44. tokens: [
  45. { startIndex: 0, type: 'keyword.less' },
  46. { startIndex: 8, type: 'delimiter.parenthesis.less' },
  47. { startIndex: 9, type: 'attribute.value.number.less' },
  48. { startIndex: 11, type: 'attribute.value.unit.less' },
  49. { startIndex: 13, type: 'delimiter.parenthesis.less' },
  50. { startIndex: 14, type: 'delimiter.less' }
  51. ]}],
  52. [{
  53. line: 'pxx ',
  54. tokens: [
  55. { startIndex: 0, type: 'tag.less' },
  56. { startIndex: 3, type: '' }
  57. ]}],
  58. // single line Strings
  59. [{
  60. line: '@test: "I\'m a LESS String\";',
  61. tokens: [
  62. { startIndex:0, type: 'variable.less'},
  63. { startIndex:5, type: 'delimiter.less'},
  64. { startIndex:6, type: ''},
  65. { startIndex:7, type: 'string.delimiter.less'},
  66. { startIndex:8, type: 'string.less'},
  67. { startIndex:25, type: 'string.delimiter.less'},
  68. { startIndex:26, type: 'delimiter.less'}
  69. ]}],
  70. [{
  71. line: '@test: "concatenated" + "String";',
  72. tokens: [
  73. { startIndex:0, type: 'variable.less'},
  74. { startIndex:5, type: 'delimiter.less'},
  75. { startIndex:6, type: ''},
  76. { startIndex:7, type: 'string.delimiter.less'},
  77. { startIndex:8, type: 'string.less'},
  78. { startIndex:20, type: 'string.delimiter.less'},
  79. { startIndex:21, type: ''},
  80. { startIndex:22, type: 'operator.less'},
  81. { startIndex:23, type: ''},
  82. { startIndex:24, type: 'string.delimiter.less'},
  83. { startIndex:25, type: 'string.less'},
  84. { startIndex:31, type: 'string.delimiter.less'},
  85. { startIndex:32, type: 'delimiter.less'}
  86. ]}],
  87. [{
  88. line: '@test: "quote in\'adasdsa\\"asd\' a string"',
  89. tokens: [
  90. { startIndex:0, type: 'variable.less' },
  91. { startIndex:5, type: 'delimiter.less'},
  92. { startIndex:6, type: ''},
  93. { startIndex:7, type: 'string.delimiter.less'},
  94. { startIndex:8, type: 'string.less'},
  95. { startIndex:39, type: 'string.delimiter.less'},
  96. ]}],
  97. [{
  98. line: '@test: \'doublequote in\"ada\\\'sds\\\'a\"asd a string\'',
  99. tokens: [
  100. { startIndex:0, type: 'variable.less' },
  101. { startIndex:5, type: 'delimiter.less'},
  102. { startIndex:6, type: ''},
  103. { startIndex:7, type: 'string.delimiter.less'},
  104. { startIndex:8, type: 'string.less'},
  105. { startIndex:47, type: 'string.delimiter.less'}
  106. ]}],
  107. // Comments - range comment, multiple lines
  108. [{
  109. line: '/* start of multiline comment',
  110. tokens: [
  111. {startIndex:0, type: 'comment.less'}
  112. ]},{
  113. line: 'a comment between without a star',
  114. tokens: [
  115. {startIndex:0, type: 'comment.less'}
  116. ]}, {
  117. line: 'end of multiline comment*/',
  118. tokens: [
  119. {startIndex:0, type: 'comment.less'}
  120. ]}, {
  121. line: 'when /* start a comment',
  122. tokens: [
  123. { startIndex:0, type: 'keyword.less' },
  124. { startIndex:4, type: '' },
  125. { startIndex:5, type: 'comment.less' },
  126. ]}, {
  127. line: ' a ',
  128. tokens: [
  129. { startIndex:0, type: 'comment.less' }
  130. ]}, {
  131. line: 'and end it */ 2;',
  132. tokens: [
  133. { startIndex:0, type: 'comment.less' },
  134. { startIndex:13, type: '' },
  135. { startIndex:14, type: 'attribute.value.number.less' },
  136. { startIndex:15, type: 'delimiter.less' }
  137. ]}],
  138. // Numbers
  139. [{
  140. line: '0',
  141. tokens: [
  142. { startIndex:0, type: 'attribute.value.number.less' }
  143. ]}],
  144. [{
  145. line: ' 0',
  146. tokens: [
  147. { startIndex:0, type: '' },
  148. { startIndex:1, type: 'attribute.value.number.less' }
  149. ]}],
  150. [{
  151. line: ' 0 ',
  152. tokens: [
  153. { startIndex:0, type: '' },
  154. { startIndex:1, type: 'attribute.value.number.less' },
  155. { startIndex:2, type: '' }
  156. ]}],
  157. [{
  158. line: '0 ',
  159. tokens: [
  160. { startIndex:0, type: 'attribute.value.number.less' },
  161. { startIndex:1, type: '' }
  162. ]}],
  163. [{
  164. line: '@test: 0+0',
  165. tokens: [
  166. { startIndex:0, type: 'variable.less' },
  167. { startIndex:5, type: 'delimiter.less' },
  168. { startIndex:6, type: '' },
  169. { startIndex:7, type: 'attribute.value.number.less' },
  170. { startIndex:8, type: 'operator.less' },
  171. { startIndex:9, type: 'attribute.value.number.less' }
  172. ]}],
  173. [{
  174. line: '@test: 100+10.00',
  175. tokens: [
  176. { startIndex:0, type: 'variable.less' },
  177. { startIndex:5, type: 'delimiter.less' },
  178. { startIndex:6, type: '' },
  179. { startIndex:7, type: 'attribute.value.number.less' },
  180. { startIndex:10, type: 'operator.less' },
  181. { startIndex:11, type: 'attribute.value.number.less' }
  182. ]}],
  183. [{
  184. line: '@test: 0 + 0',
  185. tokens: [
  186. { startIndex:0, type: 'variable.less' },
  187. { startIndex:5, type: 'delimiter.less' },
  188. { startIndex:6, type: '' },
  189. { startIndex:7, type: 'attribute.value.number.less' },
  190. { startIndex:8, type: '' },
  191. { startIndex:9, type: 'operator.less' },
  192. { startIndex:10, type: '' },
  193. { startIndex:11, type: 'attribute.value.number.less' }
  194. ]}],
  195. [{
  196. line: '0123',
  197. tokens: [{ startIndex:0, type: 'attribute.value.number.less' }]}],
  198. [{
  199. line: '#012343',
  200. tokens: [{ startIndex: 0, type: 'attribute.value.hex.less' }]}],
  201. // Bracket Matching
  202. [{
  203. line: '[1,2,3]',
  204. tokens: [
  205. { startIndex:0, type: 'delimiter.bracket.less' },
  206. { startIndex:1, type: 'attribute.value.number.less' },
  207. { startIndex:2, type: 'delimiter.less' },
  208. { startIndex:3, type: 'attribute.value.number.less' },
  209. { startIndex:4, type: 'delimiter.less' },
  210. { startIndex:5, type: 'attribute.value.number.less' },
  211. { startIndex:6, type: 'delimiter.bracket.less' }
  212. ]}],
  213. [{
  214. line: 'foo(123);',
  215. tokens: [
  216. { startIndex:0, type: 'tag.less' },
  217. { startIndex:3, type: 'delimiter.parenthesis.less' },
  218. { startIndex:4, type: 'attribute.value.number.less' },
  219. { startIndex:7, type: 'delimiter.parenthesis.less' },
  220. { startIndex:8, type: 'delimiter.less' }
  221. ]}],
  222. // No Bracket Matching inside strings
  223. [{
  224. line: '@test: \'[{()}]\'',
  225. tokens: [
  226. { startIndex:0, type: 'variable.less' },
  227. { startIndex:5, type: 'delimiter.less' },
  228. { startIndex:6, type: '' },
  229. { startIndex:7, type: 'string.delimiter.less' },
  230. { startIndex:8, type: 'string.less' },
  231. { startIndex:14, type: 'string.delimiter.less' }
  232. ]}],
  233. // Singleline Comments
  234. [{
  235. line: '//',
  236. tokens: [{ startIndex:0, type: 'comment.less' }]}],
  237. [{
  238. line: ' // a comment',
  239. tokens: [
  240. { startIndex:0, type: '' },
  241. { startIndex:4, type: 'comment.less' }
  242. ]}],
  243. [{
  244. line: '// a comment',
  245. tokens: [{ startIndex:0, type: 'comment.less' }]}],
  246. [{
  247. line: '//sticky comment',
  248. tokens: [{ startIndex:0, type: 'comment.less' }]}],
  249. [{
  250. line: '@something : 2; // my comment // this is a nice one',
  251. tokens: [
  252. { startIndex:0, type: 'variable.less'},
  253. { startIndex:10, type: ''},
  254. { startIndex:11, type: 'delimiter.less'},
  255. { startIndex:12, type: ''},
  256. { startIndex:13, type: 'attribute.value.number.less'},
  257. { startIndex:14, type: 'delimiter.less'},
  258. { startIndex:15, type: ''},
  259. { startIndex:16, type: 'comment.less'}
  260. ]}],
  261. [{
  262. line: '.something(@some, @other) when (iscolor(@other)) { aname// my commen',
  263. tokens: [
  264. { startIndex:0, type: 'tag.class.less'},
  265. { startIndex:10, type: 'delimiter.parenthesis.less'},
  266. { startIndex:11, type: 'variable.less'},
  267. { startIndex:16, type: 'delimiter.less'},
  268. { startIndex:17, type: ''},
  269. { startIndex:18, type: 'variable.less'},
  270. { startIndex:24, type: 'delimiter.parenthesis.less'},
  271. { startIndex:25, type: ''},
  272. { startIndex:26, type: 'keyword.less'},
  273. { startIndex:30, type: ''},
  274. { startIndex:31, type: 'delimiter.parenthesis.less'},
  275. { startIndex:32, type: 'keyword.less'},
  276. { startIndex:39, type: 'delimiter.parenthesis.less'},
  277. { startIndex:40, type: 'variable.less'},
  278. { startIndex:46, type: 'delimiter.parenthesis.less'},
  279. { startIndex:48, type: ''},
  280. { startIndex:49, type: 'delimiter.curly.less'},
  281. { startIndex:50, type: ''},
  282. { startIndex:51, type: 'tag.less'},
  283. { startIndex:56, type: 'comment.less'}
  284. ]}],
  285. [{
  286. line: '.something(@some//mycomment',
  287. tokens: [
  288. { startIndex:0, type: 'tag.class.less'},
  289. { startIndex:10, type: 'delimiter.parenthesis.less'},
  290. { startIndex:11, type: 'variable.less'},
  291. { startIndex:16, type: 'comment.less'}
  292. ]}],
  293. [{
  294. line: '@something : #2;',
  295. tokens: [
  296. { startIndex:0, type: 'variable.less'},
  297. { startIndex:10, type: ''},
  298. { startIndex:11, type: 'delimiter.less'},
  299. { startIndex:12, type: ''},
  300. { startIndex:13, type: 'attribute.value.hex.less'},
  301. { startIndex:15, type: 'delimiter.less'}
  302. ]}],
  303. // Singleline Range-Comments
  304. [{
  305. line: '/*slcomment*/',
  306. tokens: [{ startIndex:0, type: 'comment.less' }]}],
  307. [{
  308. line: '/* slcomment */',
  309. tokens: [{ startIndex: 0, type: 'comment.less' }]}],
  310. [{
  311. line: '/*sl/com* ment*/',
  312. tokens: [{ startIndex: 0, type: 'comment.less' }]}],
  313. [{
  314. line: '/**/',
  315. tokens: [{ startIndex: 0, type: 'comment.less' }]}],
  316. [{
  317. line: '@something: /*comm/* * /ent*/2;',
  318. tokens: [
  319. { startIndex:0, type: 'variable.less' },
  320. { startIndex:10, type: 'delimiter.less' },
  321. { startIndex:11, type: '' },
  322. { startIndex:12, type: 'comment.less' },
  323. { startIndex:29, type: 'attribute.value.number.less' },
  324. { startIndex:30, type: 'delimiter.less' }
  325. ]}],
  326. [{
  327. line: '@something: /*comment*/ 2;',
  328. tokens: [
  329. { startIndex:0, type: 'variable.less' },
  330. { startIndex:10, type: 'delimiter.less' },
  331. { startIndex:11, type: '' },
  332. { startIndex:12, type: 'comment.less' },
  333. { startIndex:23, type: '' },
  334. { startIndex:24, type: 'attribute.value.number.less' },
  335. { startIndex:25, type: 'delimiter.less' }
  336. ]}],
  337. // Comments - range comment, multi lines
  338. [{
  339. line: '/* a multiline comment',
  340. tokens: [
  341. { startIndex:0, type: 'comment.less' }
  342. ]}, {
  343. line: 'can actually span',
  344. tokens: [
  345. { startIndex:0, type: 'comment.less' }
  346. ]}, {
  347. line: 'multiple lines */',
  348. tokens: [
  349. { startIndex:0, type: 'comment.less' }
  350. ]}],
  351. [{
  352. line: '@some /* start a comment here',
  353. tokens: [
  354. { startIndex:0, type: 'variable.less' },
  355. { startIndex:5, type: '' },
  356. { startIndex:6, type: 'comment.less' }
  357. ]}, {
  358. line: ' span over this line and ',
  359. tokens: [
  360. { startIndex:0, type: 'comment.less' }
  361. ]}, {
  362. line: 'end it there */ : 2;',
  363. tokens: [
  364. { startIndex:0, type: 'comment.less' },
  365. { startIndex:15, type: '' },
  366. { startIndex:16, type: 'delimiter.less' },
  367. { startIndex:17, type: '' },
  368. { startIndex:18, type: 'attribute.value.number.less' },
  369. { startIndex:19, type: 'delimiter.less' }
  370. ]}],
  371. // Escape Strings
  372. [{
  373. line: '.class { filter: ~"ms:alwaysHasItsOwnSyntax.For.Stuff()";',
  374. tokens: [
  375. { startIndex:0, type: 'tag.class.less' },
  376. { startIndex:6, type: '' },
  377. { startIndex:7, type: 'delimiter.curly.less' },
  378. { startIndex:8, type: '' },
  379. { startIndex:9, type: 'attribute.name.less' },
  380. { startIndex:15, type: 'delimiter.less' },
  381. { startIndex:16, type: '' },
  382. { startIndex:17, type: 'string.delimiter.less' },
  383. { startIndex:19, type: 'string.less' },
  384. { startIndex:55, type: 'string.delimiter.less' },
  385. { startIndex:56, type: 'delimiter.less' }
  386. ]}],
  387. // Guards
  388. [{
  389. line: '.class {.mixin (@a) when (@a > 10), (@a < -10) { }',
  390. tokens: [
  391. { startIndex:0, type: 'tag.class.less' },
  392. { startIndex:6, type: '' },
  393. { startIndex:7, type: 'delimiter.curly.less' },
  394. { startIndex:8, type: 'tag.class.less' },
  395. { startIndex:14, type: '' },
  396. { startIndex:15, type: 'delimiter.parenthesis.less' },
  397. { startIndex:16, type: 'variable.less' },
  398. { startIndex:18, type: 'delimiter.parenthesis.less' },
  399. { startIndex:19, type: '' },
  400. { startIndex:20, type: 'keyword.less' },
  401. { startIndex:24, type: '' },
  402. { startIndex:25, type: 'delimiter.parenthesis.less' },
  403. { startIndex:26, type: 'variable.less' },
  404. { startIndex:28, type: '' },
  405. { startIndex:29, type: 'operator.less' },
  406. { startIndex:30, type: '' },
  407. { startIndex:31, type: 'attribute.value.number.less' },
  408. { startIndex:33, type: 'delimiter.parenthesis.less' },
  409. { startIndex:34, type: 'delimiter.less' },
  410. { startIndex:35, type: '' },
  411. { startIndex:36, type: 'delimiter.parenthesis.less' },
  412. { startIndex:37, type: 'variable.less' },
  413. { startIndex:39, type: '' },
  414. { startIndex:40, type: 'operator.less' },
  415. { startIndex:41, type: '' },
  416. { startIndex:42, type: 'operator.less' },
  417. { startIndex:43, type: 'attribute.value.number.less' },
  418. { startIndex:45, type: 'delimiter.parenthesis.less' },
  419. { startIndex:46, type: '' },
  420. { startIndex:47, type: 'delimiter.curly.less' },
  421. { startIndex:48, type: '' },
  422. { startIndex:49, type: 'delimiter.curly.less' }
  423. ]}],
  424. [{
  425. line: '.truth (@a) when (@a = true) { }',
  426. tokens: [
  427. { startIndex:0, type: 'tag.class.less' },
  428. { startIndex:6, type: '' },
  429. { startIndex:7, type: 'delimiter.parenthesis.less' },
  430. { startIndex:8, type: 'variable.less' },
  431. { startIndex:10, type: 'delimiter.parenthesis.less' },
  432. { startIndex:11, type: '' },
  433. { startIndex:12, type: 'keyword.less' },
  434. { startIndex:16, type: '' },
  435. { startIndex:17, type: 'delimiter.parenthesis.less' },
  436. { startIndex:18, type: 'variable.less' },
  437. { startIndex:20, type: '' },
  438. { startIndex:21, type: 'operator.less' },
  439. { startIndex:22, type: '' },
  440. { startIndex:23, type: 'keyword.less' },
  441. { startIndex:27, type: 'delimiter.parenthesis.less' },
  442. { startIndex:28, type: '' },
  443. { startIndex:29, type: 'delimiter.curly.less' },
  444. { startIndex:30, type: '' },
  445. { startIndex:31, type: 'delimiter.curly.less' }
  446. ]}],
  447. [{
  448. line: '.max (@a, @b) when (@a > @b) { width: @a; }',
  449. tokens: [
  450. { startIndex:0, type: 'tag.class.less' },
  451. { startIndex:4, type: '' },
  452. { startIndex:5, type: 'delimiter.parenthesis.less' },
  453. { startIndex:6, type: 'variable.less' },
  454. { startIndex:8, type: 'delimiter.less' },
  455. { startIndex:9, type: '' },
  456. { startIndex:10, type: 'variable.less' },
  457. { startIndex:12, type: 'delimiter.parenthesis.less' },
  458. { startIndex:13, type: '' },
  459. { startIndex:14, type: 'keyword.less' },
  460. { startIndex:18, type: '' },
  461. { startIndex:19, type: 'delimiter.parenthesis.less' },
  462. { startIndex:20, type: 'variable.less' },
  463. { startIndex:22, type: '' },
  464. { startIndex:23, type: 'operator.less' },
  465. { startIndex:24, type: '' },
  466. { startIndex:25, type: 'variable.less' },
  467. { startIndex:27, type: 'delimiter.parenthesis.less' },
  468. { startIndex:28, type: '' },
  469. { startIndex:29, type: 'delimiter.curly.less' },
  470. { startIndex:30, type: '' },
  471. { startIndex:31, type: 'attribute.name.less' },
  472. { startIndex:36, type: 'delimiter.less' },
  473. { startIndex:37, type: '' },
  474. { startIndex:38, type: 'variable.less' },
  475. { startIndex:40, type: 'delimiter.less' },
  476. { startIndex:41, type: '' },
  477. { startIndex:42, type: 'delimiter.curly.less' }
  478. ]}],
  479. [{
  480. line: '.mixin (@a, @b: 0) when (isnumber(@b)) { }',
  481. tokens: [
  482. { startIndex:0, type: 'tag.class.less' },
  483. { startIndex:6, type: '' },
  484. { startIndex:7, type: 'delimiter.parenthesis.less' },
  485. { startIndex:8, type: 'variable.less' },
  486. { startIndex:10, type: 'delimiter.less' },
  487. { startIndex:11, type: '' },
  488. { startIndex:12, type: 'variable.less' },
  489. { startIndex:14, type: 'delimiter.less' },
  490. { startIndex:15, type: '' },
  491. { startIndex:16, type: 'attribute.value.number.less' },
  492. { startIndex:17, type: 'delimiter.parenthesis.less' },
  493. { startIndex:18, type: '' },
  494. { startIndex:19, type: 'keyword.less' },
  495. { startIndex:23, type: '' },
  496. { startIndex:24, type: 'delimiter.parenthesis.less' },
  497. { startIndex:25, type: 'keyword.less' },
  498. { startIndex:33, type: 'delimiter.parenthesis.less' },
  499. { startIndex:34, type: 'variable.less' },
  500. { startIndex:36, type: 'delimiter.parenthesis.less' },
  501. { startIndex:38, type: '' },
  502. { startIndex:39, type: 'delimiter.curly.less' },
  503. { startIndex:40, type: '' },
  504. { startIndex:41, type: 'delimiter.curly.less' }
  505. ]}],
  506. [{
  507. line: '.mixin (@a, @b: black) when (iscolor(@b)) { }',
  508. tokens: [
  509. { startIndex:0, type: 'tag.class.less' },
  510. { startIndex:6, type: '' },
  511. { startIndex:7, type: 'delimiter.parenthesis.less' },
  512. { startIndex:8, type: 'variable.less' },
  513. { startIndex:10, type: 'delimiter.less' },
  514. { startIndex:11, type: '' },
  515. { startIndex:12, type: 'variable.less' },
  516. { startIndex:14, type: 'delimiter.less' },
  517. { startIndex:15, type: '' },
  518. { startIndex:16, type: 'attribute.value.less' },
  519. { startIndex:21, type: 'delimiter.parenthesis.less' },
  520. { startIndex:22, type: '' },
  521. { startIndex:23, type: 'keyword.less' },
  522. { startIndex:27, type: '' },
  523. { startIndex:28, type: 'delimiter.parenthesis.less' },
  524. { startIndex:29, type: 'keyword.less' },
  525. { startIndex:36, type: 'delimiter.parenthesis.less' },
  526. { startIndex:37, type: 'variable.less' },
  527. { startIndex:39, type: 'delimiter.parenthesis.less' },
  528. { startIndex:41, type: '' },
  529. { startIndex:42, type: 'delimiter.curly.less' },
  530. { startIndex:43, type: '' },
  531. { startIndex:44, type: 'delimiter.curly.less' }
  532. ]}],
  533. // Nested JavaScript
  534. [{
  535. line: '@test: `function display()` //works well',
  536. tokens: [
  537. { startIndex:0, type: 'variable.less' },
  538. { startIndex:5, type: 'delimiter.less' },
  539. { startIndex:6, type: '' },
  540. { startIndex:7, type: 'delimiter.backtick.less' },
  541. { startIndex:8, type: '' },
  542. { startIndex:26, type: 'delimiter.backtick.less' },
  543. { startIndex:27, type: '' },
  544. { startIndex:28, type: 'comment.less'}
  545. ]}],
  546. // Attribute in a .class(...)
  547. [{
  548. line: '.box-shadow(inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6));',
  549. tokens: [
  550. { startIndex:0, type: 'tag.class.less' },
  551. { startIndex:11, type: 'delimiter.parenthesis.less' },
  552. { startIndex:12, type: 'attribute.value.less' },
  553. { startIndex:17, type: '' },
  554. { startIndex:18, type: 'attribute.value.number.less' },
  555. { startIndex:19, type: '' },
  556. { startIndex:20, type: 'attribute.value.number.less' },
  557. { startIndex:21, type: 'attribute.value.unit.less' },
  558. { startIndex:23, type: '' },
  559. { startIndex:24, type: 'attribute.value.number.less' },
  560. { startIndex:25, type: 'attribute.value.unit.less'},
  561. { startIndex:27, type: '' },
  562. { startIndex:28, type: 'attribute.value.less' },
  563. { startIndex:32, type: 'delimiter.parenthesis.less' },
  564. { startIndex:33, type: 'attribute.value.number.less' },
  565. { startIndex:34, type: 'delimiter.less' },
  566. { startIndex:35, type: 'attribute.value.number.less' },
  567. { startIndex:36, type: 'delimiter.less' },
  568. { startIndex:37, type: 'attribute.value.number.less' },
  569. { startIndex:38, type: 'delimiter.less' },
  570. { startIndex:39, type: 'attribute.value.number.less' },
  571. { startIndex:43, type: 'delimiter.parenthesis.less' },
  572. { startIndex:44, type: 'delimiter.less' },
  573. { startIndex:45, type: '' },
  574. { startIndex:46, type: 'attribute.value.number.less' },
  575. { startIndex:47, type: '' },
  576. { startIndex:48, type: 'attribute.value.number.less' },
  577. { startIndex:49, type: '' },
  578. { startIndex:50, type: 'attribute.value.number.less' },
  579. { startIndex:51, type: 'attribute.value.unit.less' },
  580. { startIndex:53, type: '' },
  581. { startIndex:54, type: 'attribute.value.less' },
  582. { startIndex:58, type: 'delimiter.parenthesis.less' },
  583. { startIndex:59, type: 'attribute.value.number.less' },
  584. { startIndex:61, type: 'delimiter.less' },
  585. { startIndex:62, type: 'attribute.value.number.less' },
  586. { startIndex:65, type: 'delimiter.less' },
  587. { startIndex:66, type: 'attribute.value.number.less' },
  588. { startIndex:69, type: 'delimiter.less' },
  589. { startIndex:70, type: 'attribute.value.number.less' },
  590. { startIndex:72, type: 'delimiter.parenthesis.less' },
  591. { startIndex:74, type: 'delimiter.less' }
  592. ]}],
  593. // Difficult little bugs... => String mismatches
  594. [{
  595. line: 'input[type="radio"]',
  596. tokens: [
  597. { startIndex:0, type: 'tag.less' },
  598. { startIndex:5, type: 'delimiter.bracket.less' },
  599. { startIndex:6, type: 'tag.less' },
  600. { startIndex:10, type: 'operator.less' },
  601. { startIndex:11, type: 'string.delimiter.less' },
  602. { startIndex:12, type: 'string.less' },
  603. { startIndex:17, type: 'string.delimiter.less' },
  604. { startIndex:18, type: 'delimiter.bracket.less' }
  605. ]}],
  606. [{
  607. line: '~\'.offset@{index}\')',
  608. tokens: [
  609. { startIndex:0, type: 'string.delimiter.less' },
  610. { startIndex:2, type: 'string.less' },
  611. { startIndex:17, type: 'string.delimiter.less' },
  612. { startIndex:18, type: 'delimiter.parenthesis.less' }
  613. ]}],
  614. [{
  615. line: 'some("\\42");',
  616. tokens: [
  617. { startIndex:0, type: 'tag.less' },
  618. { startIndex:4, type: 'delimiter.parenthesis.less' },
  619. { startIndex:5, type: 'string.delimiter.less' },
  620. { startIndex:6, type: 'string.less' },
  621. { startIndex:9, type: 'string.delimiter.less' },
  622. { startIndex:10, type: 'delimiter.parenthesis.less' },
  623. { startIndex:11, type: 'delimiter.less' }
  624. ]}],
  625. [{
  626. line: ' ~ "icon-"',
  627. tokens: [
  628. { startIndex:0, type: '' },
  629. { startIndex:1, type: 'operator.less' },
  630. { startIndex:2, type: '' },
  631. { startIndex:3, type: 'string.delimiter.less' },
  632. { startIndex:4, type: 'string.less' },
  633. { startIndex:9, type: 'string.delimiter.less' }
  634. ]}],
  635. // Difficult little bugs... => Operator mismatches
  636. [{
  637. line: 'class^="icon-"',
  638. tokens: [
  639. { startIndex:0, type: 'tag.less' },
  640. { startIndex:5, type: 'operator.less' },
  641. { startIndex:7, type: 'string.delimiter.less' },
  642. { startIndex:8, type: 'string.less' },
  643. { startIndex:13, type: 'string.delimiter.less' }
  644. ]}],
  645. [{
  646. line: 'class*="icon-"',
  647. tokens: [
  648. { startIndex:0, type: 'tag.less' },
  649. { startIndex:5, type: 'operator.less' },
  650. { startIndex:7, type: 'string.delimiter.less' },
  651. { startIndex:8, type: 'string.less' },
  652. { startIndex:13, type: 'string.delimiter.less' }
  653. ]}],
  654. [{
  655. line: 'class~="icon-"',
  656. tokens: [
  657. { startIndex:0, type: 'tag.less' },
  658. { startIndex:5, type: 'operator.less' },
  659. { startIndex:7, type: 'string.delimiter.less' },
  660. { startIndex:8, type: 'string.less' },
  661. { startIndex:13, type: 'string.delimiter.less' }
  662. ]}],
  663. [{
  664. line: 'class ~ = "icon-"',
  665. tokens: [
  666. { startIndex:0, type: 'tag.less' },
  667. { startIndex:5, type: '' },
  668. { startIndex:6, type: 'operator.less' },
  669. { startIndex:7, type: '' },
  670. { startIndex:8, type: 'operator.less' },
  671. { startIndex:9, type: '' },
  672. { startIndex:10, type: 'string.delimiter.less' },
  673. { startIndex:11, type: 'string.less' },
  674. { startIndex:16, type: 'string.delimiter.less' }
  675. ]}],
  676. [{
  677. line: 'class|="icon-"',
  678. tokens: [
  679. { startIndex:0, type: 'tag.less' },
  680. { startIndex:5, type: 'operator.less' },
  681. { startIndex:7, type: 'string.delimiter.less' },
  682. { startIndex:8, type: 'string.less' },
  683. { startIndex:13, type: 'string.delimiter.less' }
  684. ]}],
  685. [{
  686. line: '.hide-text { font: 0/0 a; }',
  687. tokens: [
  688. { startIndex:0, type: 'tag.class.less' },
  689. { startIndex:10, type: '' },
  690. { startIndex:11, type: 'delimiter.curly.less' },
  691. { startIndex:12, type: '' },
  692. { startIndex:13, type: 'attribute.name.less' },
  693. { startIndex:17, type: 'delimiter.less' },
  694. { startIndex:18, type: '' },
  695. { startIndex:19, type: 'attribute.value.number.less' },
  696. { startIndex:20, type: 'operator.less' },
  697. { startIndex:21, type: 'attribute.value.number.less' },
  698. { startIndex:22, type: '' },
  699. { startIndex:23, type: 'attribute.value.less' },
  700. { startIndex:24, type: 'delimiter.less' },
  701. { startIndex:25, type: '' },
  702. { startIndex:26, type: 'delimiter.curly.less' }
  703. ]}],
  704. // Difficult little bugs... => Numbers in classes
  705. [{
  706. line: '.translate3d(@x, @y, @z) { -webkit-transform: translate3d(@x, @y, @z); }',
  707. tokens: [
  708. { startIndex:0, type: 'tag.class.less' },
  709. { startIndex:12, type: 'delimiter.parenthesis.less' },
  710. { startIndex:13, type: 'variable.less' },
  711. { startIndex:15, type: 'delimiter.less' },
  712. { startIndex:16, type: '' },
  713. { startIndex:17, type: 'variable.less' },
  714. { startIndex:19, type: 'delimiter.less' },
  715. { startIndex:20, type: '' },
  716. { startIndex:21, type: 'variable.less' },
  717. { startIndex:23, type: 'delimiter.parenthesis.less' },
  718. { startIndex:24, type: '' },
  719. { startIndex:25, type: 'delimiter.curly.less' },
  720. { startIndex:26, type: '' },
  721. { startIndex:27, type: 'attribute.name.less' },
  722. { startIndex:44, type: 'delimiter.less' },
  723. { startIndex:45, type: '' },
  724. { startIndex:46, type: 'attribute.value.less' },
  725. { startIndex:57, type: 'delimiter.parenthesis.less' },
  726. { startIndex:58, type: 'variable.less' },
  727. { startIndex:60, type: 'delimiter.less' },
  728. { startIndex:61, type: '' },
  729. { startIndex:62, type: 'variable.less' },
  730. { startIndex:64, type: 'delimiter.less' },
  731. { startIndex:65, type: '' },
  732. { startIndex:66, type: 'variable.less' },
  733. { startIndex:68, type: 'delimiter.parenthesis.less' },
  734. { startIndex:69, type: 'delimiter.less' },
  735. { startIndex:70, type: '' },
  736. { startIndex:71, type: 'delimiter.curly.less' }
  737. ]}],
  738. // Difficult little bugs... => Generic mismatches, worst case...
  739. [{
  740. line: '.dropdown-menu > li > a:hover > [class=" icon-"]',
  741. tokens: [
  742. { startIndex:0, type: 'tag.class.less' },
  743. { startIndex:14, type: '' },
  744. { startIndex:15, type: 'operator.less' },
  745. { startIndex:16, type: '' },
  746. { startIndex:17, type: 'tag.less' },
  747. { startIndex:19, type: '' },
  748. { startIndex:20, type: 'operator.less' },
  749. { startIndex:21, type: '' },
  750. { startIndex:22, type: 'tag.less' },
  751. { startIndex:29, type: '' },
  752. { startIndex:30, type: 'operator.less' },
  753. { startIndex:31, type: '' },
  754. { startIndex:32, type: 'delimiter.bracket.less' },
  755. { startIndex:33, type: 'tag.less' },
  756. { startIndex:38, type: 'operator.less' },
  757. { startIndex:39, type: 'string.delimiter.less' },
  758. { startIndex:40, type: 'string.less' },
  759. { startIndex:46, type: 'string.delimiter.less' },
  760. { startIndex:47, type: 'delimiter.bracket.less' }
  761. ]}],
  762. [{
  763. 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))); }',
  764. tokens: [
  765. { startIndex:0, type: 'tag.class.less' },
  766. { startIndex:12, type: 'delimiter.parenthesis.less' },
  767. { startIndex:13, type: 'variable.less' },
  768. { startIndex:19, type: 'delimiter.less' },
  769. { startIndex:20, type: '' },
  770. { startIndex:21, type: 'attribute.value.hex.less' },
  771. { startIndex:28, type: 'delimiter.less' },
  772. { startIndex:29, type: '' },
  773. { startIndex:30, type: 'variable.less' },
  774. { startIndex:36, type: 'delimiter.less' },
  775. { startIndex:37, type: '' },
  776. { startIndex:38, type: 'attribute.value.number.less' },
  777. { startIndex:39, type: 'delimiter.less' },
  778. { startIndex:40, type: '' },
  779. { startIndex:41, type: 'variable.less' },
  780. { startIndex:46, type: 'delimiter.less' },
  781. { startIndex:47, type: '' },
  782. { startIndex:48, type: 'attribute.value.number.less' },
  783. { startIndex:51, type: 'delimiter.parenthesis.less' },
  784. { startIndex:52, type: '' },
  785. { startIndex:53, type: 'delimiter.curly.less' },
  786. { startIndex:54, type: '' },
  787. { startIndex:55, type: 'attribute.name.less' },
  788. { startIndex:65, type: 'delimiter.less' },
  789. { startIndex:66, type: '' },
  790. { startIndex:67, type: 'attribute.value.less' },
  791. { startIndex:83, type: 'delimiter.parenthesis.less' },
  792. { startIndex:84, type: 'attribute.value.less' },
  793. { startIndex:94, type: 'delimiter.parenthesis.less' },
  794. { startIndex:95, type: 'attribute.value.number.less' },
  795. { startIndex:96, type: 'delimiter.less' },
  796. { startIndex:97, type: '' },
  797. { startIndex:98, type: 'attribute.value.less' },
  798. { startIndex:101, type: 'delimiter.parenthesis.less' },
  799. { startIndex:102, type: 'variable.less' },
  800. { startIndex:108, type: 'delimiter.less' },
  801. { startIndex:109, type: 'variable.less' },
  802. { startIndex:115, type: 'delimiter.less' },
  803. { startIndex:116, type: 'variable.less' },
  804. { startIndex:122, type: 'delimiter.parenthesis.less' },
  805. { startIndex:124, type: 'delimiter.less' },
  806. { startIndex:125, type: '' },
  807. { startIndex:126, type: 'attribute.value.less' },
  808. { startIndex:136, type: 'delimiter.parenthesis.less' },
  809. { startIndex:137, type: 'attribute.value.number.less' },
  810. { startIndex:138, type: 'delimiter.less' },
  811. { startIndex:139, type: '' },
  812. { startIndex:140, type: 'attribute.value.less' },
  813. { startIndex:143, type: 'delimiter.parenthesis.less' },
  814. { startIndex:144, type: 'variable.less' },
  815. { startIndex:149, type: 'delimiter.less' },
  816. { startIndex:150, type: 'variable.less' },
  817. { startIndex:155, type: 'delimiter.less' },
  818. { startIndex:156, type: 'variable.less' },
  819. { startIndex:161, type: 'delimiter.parenthesis.less' },
  820. { startIndex:164, type: 'delimiter.less' },
  821. { startIndex:165, type: '' },
  822. { startIndex:166, type: 'delimiter.curly.less' }
  823. ]}],
  824. // Here CSS Tests from CSS File
  825. // Skip whitespace
  826. [{
  827. line: ' body ',
  828. tokens: [
  829. { startIndex: 0, type: '' },
  830. { startIndex: 6, type: 'tag.less' },
  831. { startIndex: 10, type: '' }
  832. ]}],
  833. // CSS rule
  834. // body {
  835. // margin: 0;
  836. // padding: 3em 6em;
  837. // font-family: tahoma, arial, sans-serif;
  838. // text-decoration: none !important;
  839. // color: #000
  840. // }
  841. [{
  842. line: 'body {',
  843. tokens: [
  844. { startIndex: 0, type: 'tag.less' },
  845. { startIndex: 4, type: '' },
  846. { startIndex: 5, type: 'delimiter.curly.less' }
  847. ]}, {
  848. line: ' margin: 0;',
  849. tokens: [
  850. { startIndex: 0, type: '' },
  851. { startIndex: 2, type: 'attribute.name.less' },
  852. { startIndex: 8, type: 'delimiter.less' },
  853. { startIndex: 9, type: '' },
  854. { startIndex: 10, type: 'attribute.value.number.less' },
  855. { startIndex: 11, type: 'delimiter.less' }
  856. ]}, {
  857. line: ' padding: 3em 6em;',
  858. tokens: [
  859. { startIndex: 0, type: '' },
  860. { startIndex: 2, type: 'attribute.name.less' },
  861. { startIndex: 9, type: 'delimiter.less' },
  862. { startIndex: 10, type: '' },
  863. { startIndex: 11, type: 'attribute.value.number.less' },
  864. { startIndex: 12, type: 'attribute.value.unit.less' },
  865. { startIndex: 14, type: '' },
  866. { startIndex: 15, type: 'attribute.value.number.less' },
  867. { startIndex: 16, type: 'attribute.value.unit.less' },
  868. { startIndex: 18, type: 'delimiter.less' }
  869. ]}, {
  870. line: ' font-family: tahoma, arial, sans-serif;',
  871. tokens: [
  872. { startIndex: 0, type: '' },
  873. { startIndex: 2, type: 'attribute.name.less' },
  874. { startIndex: 13, type: 'delimiter.less' },
  875. { startIndex: 14, type: '' },
  876. { startIndex: 15, type: 'attribute.value.less' },
  877. { startIndex: 21, type: 'delimiter.less' },
  878. { startIndex: 22, type: '' },
  879. { startIndex: 23, type: 'attribute.value.less' },
  880. { startIndex: 28, type: 'delimiter.less' },
  881. { startIndex: 29, type: '' },
  882. { startIndex: 30, type: 'attribute.value.less' },
  883. { startIndex: 40, type: 'delimiter.less' }
  884. ]}, {
  885. line: ' text-decoration: none !important;',
  886. tokens: [
  887. { startIndex: 0, type: '' },
  888. { startIndex: 2, type: 'attribute.name.less' },
  889. { startIndex: 17, type: 'delimiter.less' },
  890. { startIndex: 18, type: '' },
  891. { startIndex: 19, type: 'attribute.value.less' },
  892. { startIndex: 23, type: '' },
  893. { startIndex: 24, type: 'keyword.less' },
  894. { startIndex: 34, type: 'delimiter.less' }
  895. ]}, {
  896. line: ' color: #000;',
  897. tokens: [
  898. { startIndex: 0, type: '' },
  899. { startIndex: 2, type: 'attribute.name.less' },
  900. { startIndex: 7, type: 'delimiter.less' },
  901. { startIndex: 8, type: '' },
  902. { startIndex: 9, type: 'attribute.value.hex.less' },
  903. { startIndex: 13, type: 'delimiter.less' }
  904. ]}, {
  905. line: ' }',
  906. tokens: [
  907. { startIndex: 0, type: '' },
  908. { startIndex: 2, type: 'delimiter.curly.less' }
  909. ]}],
  910. // CSS units and numbers
  911. [{
  912. line: '* { padding: 3em -9pt -0.5px; }',
  913. tokens: [
  914. { startIndex: 0, type: 'operator.less' },
  915. { startIndex: 1, type: '' },
  916. { startIndex: 2, type: 'delimiter.curly.less' },
  917. { startIndex: 3, type: '' },
  918. { startIndex: 4, type: 'attribute.name.less' },
  919. { startIndex: 11, type: 'delimiter.less' },
  920. { startIndex: 12, type: '' },
  921. { startIndex: 13, type: 'attribute.value.number.less' },
  922. { startIndex: 14, type: 'attribute.value.unit.less' },
  923. { startIndex: 16, type: '' },
  924. { startIndex: 17, type: 'operator.less' },
  925. { startIndex: 18, type: 'attribute.value.number.less' },
  926. { startIndex: 19, type: 'attribute.value.unit.less' },
  927. { startIndex: 21, type: '' },
  928. { startIndex: 22, type: 'operator.less' },
  929. { startIndex: 23, type: 'attribute.value.number.less' },
  930. { startIndex: 26, type: 'attribute.value.unit.less' },
  931. { startIndex: 28, type: 'delimiter.less' },
  932. { startIndex: 29, type: '' },
  933. { startIndex: 30, type: 'delimiter.curly.less' }
  934. ]}],
  935. // CSS single line comment
  936. // h1 /*comment*/ p {
  937. [{
  938. line: 'h1 /*comment*/ p {',
  939. tokens: [
  940. { startIndex: 0, type: 'tag.less' },
  941. { startIndex: 2, type: '' },
  942. { startIndex: 3, type: 'comment.less' },
  943. { startIndex: 14, type: '' },
  944. { startIndex: 15, type: 'tag.less' },
  945. { startIndex: 16, type: '' },
  946. { startIndex: 17, type: 'delimiter.curly.less' }
  947. ]}],
  948. // CSS multi line comment
  949. // h1 /*com
  950. // ment*/ p {
  951. [{
  952. line: 'h1 /*com',
  953. tokens: [
  954. { startIndex: 0, type: 'tag.less' },
  955. { startIndex: 2, type: '' },
  956. { startIndex: 3, type: 'comment.less' }
  957. ]}, {
  958. line: 'ment*/ p',
  959. tokens: [
  960. { startIndex: 0, type: 'comment.less' },
  961. { startIndex: 6, type: '' },
  962. { startIndex: 7, type: 'tag.less' }
  963. ]}],
  964. // CSS ID rule
  965. // #myID {
  966. // font-size: 80%;
  967. // content: 'contents';
  968. // }
  969. [{
  970. line: '#myID {',
  971. tokens: [
  972. { startIndex: 0, type: 'tag.id.less' },
  973. { startIndex: 5, type: '' },
  974. { startIndex: 6, type: 'delimiter.curly.less' }
  975. ]}],
  976. // CSS Class rules
  977. // .myID {
  978. // h1 > p {
  979. [{
  980. line: '.myID {',
  981. tokens: [
  982. { startIndex: 0, type: 'tag.class.less' },
  983. { startIndex: 5, type: '' },
  984. { startIndex: 6, type: 'delimiter.curly.less' }
  985. ]}],
  986. // CSS @import etc
  987. // @import url('something.less'); {
  988. [{
  989. line: '@import url(\"something.less\");',
  990. tokens: [
  991. { startIndex: 0, type: 'keyword.less' },
  992. { startIndex: 7, type: '' },
  993. { startIndex: 8, type: 'tag.less' },
  994. { startIndex: 12, type: 'string.delimiter.less' },
  995. { startIndex: 13, type: 'string.less' },
  996. { startIndex: 27, type: 'string.delimiter.less' },
  997. { startIndex: 28, type: 'delimiter.parenthesis.less' },
  998. { startIndex: 29, type: 'delimiter.less' }
  999. ]}],
  1000. // CSS multi-line string with an escaped newline
  1001. // body {
  1002. // content: 'con\
  1003. // tent';
  1004. [{
  1005. line: 'body {',
  1006. tokens: [
  1007. { startIndex: 0, type: 'tag.less' },
  1008. { startIndex: 4, type: '' },
  1009. { startIndex: 5, type: 'delimiter.curly.less' },
  1010. ]}, {
  1011. line: ' content: \"con\\',
  1012. tokens: [
  1013. { startIndex: 0, type: '' },
  1014. { startIndex: 2, type: 'attribute.name.less' },
  1015. { startIndex: 9, type: 'delimiter.less' },
  1016. { startIndex: 10, type: '' },
  1017. { startIndex: 11, type: 'string.delimiter.less' },
  1018. { startIndex: 12, type: 'string.less' }
  1019. ]}, {
  1020. line: 'tent\";',
  1021. tokens: [
  1022. { startIndex: 0, type: 'string.less' },
  1023. { startIndex: 4, type: 'string.delimiter.less' },
  1024. { startIndex: 5, type: 'delimiter.less' }
  1025. ]}],
  1026. // CSS empty string value
  1027. // body {
  1028. // content: '';
  1029. [{
  1030. line: 'body {',
  1031. tokens: [
  1032. { startIndex: 0, type: 'tag.less' },
  1033. { startIndex: 4, type: '' },
  1034. { startIndex: 5, type: 'delimiter.curly.less' },
  1035. ]}, {
  1036. line: ' content: \"\";',
  1037. tokens: [
  1038. { startIndex: 0, type: '' },
  1039. { startIndex: 2, type: 'attribute.name.less' },
  1040. { startIndex: 9, type: 'delimiter.less' },
  1041. { startIndex: 10, type: '' },
  1042. { startIndex: 11, type: 'string.delimiter.less' },
  1043. { startIndex: 13, type: 'delimiter.less' }
  1044. ]}],
  1045. // CSS font face
  1046. // @font-face {
  1047. // font-family: 'Opificio';
  1048. // }
  1049. [{
  1050. line: '@font-face {',
  1051. tokens: [
  1052. { startIndex: 0, type: 'variable.less' },
  1053. { startIndex: 10, type: '' },
  1054. { startIndex: 11, type: 'delimiter.curly.less' }
  1055. ]}, {
  1056. line: ' font-family: "Opificio";',
  1057. tokens: [
  1058. { startIndex: 0, type: '' },
  1059. { startIndex: 2, type: 'attribute.name.less' },
  1060. { startIndex: 13, type: 'delimiter.less' },
  1061. { startIndex: 14, type: '' },
  1062. { startIndex: 15, type: 'string.delimiter.less' },
  1063. { startIndex: 16, type: 'string.less' },
  1064. { startIndex: 24, type: 'string.delimiter.less' },
  1065. { startIndex: 25, type: 'delimiter.less' }
  1066. ]}],
  1067. // CSS string with escaped quotes
  1068. // 's\"tr'
  1069. [{
  1070. line: '"s\\"tr\\"sadsad',
  1071. tokens: [
  1072. { startIndex: 0, type: 'string.delimiter.less' },
  1073. { startIndex: 1, type: 'string.less' }
  1074. ]}],
  1075. // EG: Bracket Matching
  1076. [{
  1077. line: 'p{}',
  1078. tokens: [
  1079. { startIndex: 0, type: 'tag.less' },
  1080. { startIndex: 1, type: 'delimiter.curly.less' },
  1081. ]}],
  1082. [{
  1083. line: 'p:nth() {}',
  1084. tokens: [
  1085. { startIndex: 0, type: 'tag.less' },
  1086. { startIndex: 5, type: 'delimiter.parenthesis.less' },
  1087. { startIndex: 7, type: '' },
  1088. { startIndex: 8, type: 'delimiter.curly.less' },
  1089. ]}],
  1090. // EG: import statement - bug #10308
  1091. // @import url('something.css');@import url('something.css');
  1092. [{
  1093. line: '@import url(\"something.css\");@import url(\"something.css\");',
  1094. tokens: [
  1095. { startIndex: 0, type: 'keyword.less' },
  1096. { startIndex: 7, type: '' },
  1097. { startIndex: 8, type: 'tag.less' },
  1098. { startIndex: 12, type: 'string.delimiter.less' },
  1099. { startIndex: 13, type: 'string.less' },
  1100. { startIndex: 26, type: 'string.delimiter.less' },
  1101. { startIndex: 27, type: 'delimiter.parenthesis.less' },
  1102. { startIndex: 28, type: 'delimiter.less' },
  1103. { startIndex: 29, type: 'keyword.less' },
  1104. { startIndex: 36, type: '' },
  1105. { startIndex: 37, type: 'tag.less' },
  1106. { startIndex: 41, type: 'string.delimiter.less' },
  1107. { startIndex: 42, type: 'string.less' },
  1108. { startIndex: 55, type: 'string.delimiter.less' },
  1109. { startIndex: 56, type: 'delimiter.parenthesis.less' },
  1110. { startIndex: 57, type: 'delimiter.less' }
  1111. ]}],
  1112. // EG: Triple quotes - bug #9870
  1113. [{
  1114. line: '""""',
  1115. tokens: [
  1116. { startIndex: 0, type: 'string.delimiter.less' },
  1117. ]}],
  1118. // EG: CSS @import related coloring bug 9553
  1119. // @import url('something.css');
  1120. // .rule1{}
  1121. // .rule2{}
  1122. [{
  1123. line: '@import url("something.css");',
  1124. tokens: [
  1125. { startIndex: 0, type: 'keyword.less' },
  1126. { startIndex: 7, type: '' },
  1127. { startIndex: 8, type: 'tag.less' },
  1128. { startIndex: 12, type: 'string.delimiter.less' },
  1129. { startIndex: 13, type: 'string.less' },
  1130. { startIndex: 26, type: 'string.delimiter.less' },
  1131. { startIndex: 27, type: 'delimiter.parenthesis.less' },
  1132. { startIndex: 28, type: 'delimiter.less' }
  1133. ]}, {
  1134. line: '.rule1{}',
  1135. tokens: [
  1136. { startIndex: 0, type: 'tag.class.less' },
  1137. { startIndex: 6, type: 'delimiter.curly.less' },
  1138. ]}, {
  1139. line: '.rule2{}',
  1140. tokens: [
  1141. { startIndex: 0, type: 'tag.class.less' },
  1142. { startIndex: 6, type: 'delimiter.curly.less' },
  1143. ]}],
  1144. // EG: CSS key frame animation syntax
  1145. [{
  1146. line: '@-webkit-keyframes infinite-spinning {',
  1147. tokens: [
  1148. { startIndex: 0, type: 'variable.less' },
  1149. { startIndex: 18, type: '' },
  1150. { startIndex: 19, type: 'tag.less' },
  1151. { startIndex: 36, type: '' },
  1152. { startIndex: 37, type: 'delimiter.curly.less' }
  1153. ]}, {
  1154. line: ' from {',
  1155. tokens: [
  1156. { startIndex: 0, type: '' },
  1157. { startIndex: 2, type: 'tag.less' },
  1158. { startIndex: 6, type: '' },
  1159. { startIndex: 7, type: 'delimiter.curly.less' }
  1160. ]}, {
  1161. line: ' -webkit-transform: rotate(0deg);',
  1162. tokens: [
  1163. { startIndex: 0, type: '' },
  1164. { startIndex: 2, type: 'attribute.name.less' },
  1165. { startIndex: 19, type: 'delimiter.less' },
  1166. { startIndex: 20, type: '' },
  1167. { startIndex: 21, type: 'attribute.value.less' },
  1168. { startIndex: 27, type: 'delimiter.parenthesis.less' },
  1169. { startIndex: 28, type: 'attribute.value.number.less' },
  1170. { startIndex: 29, type: 'attribute.value.unit.less' },
  1171. { startIndex: 32, type: 'delimiter.parenthesis.less' },
  1172. { startIndex: 33, type: 'delimiter.less' }
  1173. ]}, {
  1174. line: ' }',
  1175. tokens: [
  1176. { startIndex: 0, type: '' },
  1177. { startIndex: 2, type: 'delimiter.curly.less' }
  1178. ]}, {
  1179. line: ' to {',
  1180. tokens: [
  1181. { startIndex: 0, type: '' },
  1182. { startIndex: 2, type: 'tag.less' },
  1183. { startIndex: 4, type: '' },
  1184. { startIndex: 5, type: 'delimiter.curly.less' }
  1185. ]}, {
  1186. line: ' -webkit-transform: rotate(360deg);',
  1187. tokens: [
  1188. { startIndex: 0, type: '' },
  1189. { startIndex: 2, type: 'attribute.name.less' },
  1190. { startIndex: 19, type: 'delimiter.less' },
  1191. { startIndex: 20, type: '' },
  1192. { startIndex: 21, type: 'attribute.value.less' },
  1193. { startIndex: 27, type: 'delimiter.parenthesis.less' },
  1194. { startIndex: 28, type: 'attribute.value.number.less' },
  1195. { startIndex: 31, type: 'attribute.value.unit.less' },
  1196. { startIndex: 34, type: 'delimiter.parenthesis.less' },
  1197. { startIndex: 35, type: 'delimiter.less' }
  1198. ]}, {
  1199. line: ' }',
  1200. tokens: [
  1201. { startIndex: 0, type: '' },
  1202. { startIndex: 2, type: 'delimiter.curly.less' }
  1203. ]}, {
  1204. line: '}',
  1205. tokens: [
  1206. { startIndex: 0, type: 'delimiter.curly.less' }
  1207. ]}]
  1208. ]);