csharp.test.ts 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914
  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('csharp', [
  8. // Generated from sample
  9. [{
  10. line: 'using System;',
  11. tokens: [
  12. { startIndex: 0, type: 'keyword.using.cs' },
  13. { startIndex: 5, type: '' },
  14. { startIndex: 6, type: 'namespace.cs' },
  15. { startIndex: 12, type: 'delimiter.cs' }
  16. ]
  17. }, {
  18. line: 'using System.Collections.Generic;',
  19. tokens: [
  20. { startIndex: 0, type: 'keyword.using.cs' },
  21. { startIndex: 5, type: '' },
  22. { startIndex: 6, type: 'namespace.cs' },
  23. { startIndex: 12, type: 'delimiter.cs' },
  24. { startIndex: 13, type: 'namespace.cs' },
  25. { startIndex: 24, type: 'delimiter.cs' },
  26. { startIndex: 25, type: 'namespace.cs' },
  27. { startIndex: 32, type: 'delimiter.cs' }
  28. ]
  29. }, {
  30. line: 'using System.Diagnostics;',
  31. tokens: [
  32. { startIndex: 0, type: 'keyword.using.cs' },
  33. { startIndex: 5, type: '' },
  34. { startIndex: 6, type: 'namespace.cs' },
  35. { startIndex: 12, type: 'delimiter.cs' },
  36. { startIndex: 13, type: 'namespace.cs' },
  37. { startIndex: 24, type: 'delimiter.cs' }
  38. ]
  39. }, {
  40. line: 'using System.Linq;',
  41. tokens: [
  42. { startIndex: 0, type: 'keyword.using.cs' },
  43. { startIndex: 5, type: '' },
  44. { startIndex: 6, type: 'namespace.cs' },
  45. { startIndex: 12, type: 'delimiter.cs' },
  46. { startIndex: 13, type: 'namespace.cs' },
  47. { startIndex: 17, type: 'delimiter.cs' }
  48. ]
  49. }, {
  50. line: 'using System.Text;',
  51. tokens: [
  52. { startIndex: 0, type: 'keyword.using.cs' },
  53. { startIndex: 5, type: '' },
  54. { startIndex: 6, type: 'namespace.cs' },
  55. { startIndex: 12, type: 'delimiter.cs' },
  56. { startIndex: 13, type: 'namespace.cs' },
  57. { startIndex: 17, type: 'delimiter.cs' }
  58. ]
  59. }, {
  60. line: 'using System.Threading.Tasks;',
  61. tokens: [
  62. { startIndex: 0, type: 'keyword.using.cs' },
  63. { startIndex: 5, type: '' },
  64. { startIndex: 6, type: 'namespace.cs' },
  65. { startIndex: 12, type: 'delimiter.cs' },
  66. { startIndex: 13, type: 'namespace.cs' },
  67. { startIndex: 22, type: 'delimiter.cs' },
  68. { startIndex: 23, type: 'namespace.cs' },
  69. { startIndex: 28, type: 'delimiter.cs' }
  70. ]
  71. }, {
  72. line: '',
  73. tokens: [
  74. ]
  75. }, {
  76. line: 'namespace VS',
  77. tokens: [
  78. { startIndex: 0, type: 'keyword.namespace.cs' },
  79. { startIndex: 9, type: '' },
  80. { startIndex: 10, type: 'namespace.cs' }
  81. ]
  82. }, {
  83. line: '{',
  84. tokens: [
  85. { startIndex: 0, type: 'delimiter.curly.cs' }
  86. ]
  87. }, {
  88. line: ' class Program',
  89. tokens: [
  90. { startIndex: 0, type: '' },
  91. { startIndex: 1, type: 'keyword.class.cs' },
  92. { startIndex: 6, type: '' },
  93. { startIndex: 7, type: 'identifier.cs' }
  94. ]
  95. }, {
  96. line: ' {',
  97. tokens: [
  98. { startIndex: 0, type: '' },
  99. { startIndex: 1, type: 'delimiter.curly.cs' }
  100. ]
  101. }, {
  102. line: ' static void Main(string[] args)',
  103. tokens: [
  104. { startIndex: 0, type: '' },
  105. { startIndex: 2, type: 'keyword.static.cs' },
  106. { startIndex: 8, type: '' },
  107. { startIndex: 9, type: 'keyword.void.cs' },
  108. { startIndex: 13, type: '' },
  109. { startIndex: 14, type: 'identifier.cs' },
  110. { startIndex: 18, type: 'delimiter.parenthesis.cs' },
  111. { startIndex: 19, type: 'keyword.string.cs' },
  112. { startIndex: 25, type: 'delimiter.square.cs' },
  113. { startIndex: 27, type: '' },
  114. { startIndex: 28, type: 'identifier.cs' },
  115. { startIndex: 32, type: 'delimiter.parenthesis.cs' }
  116. ]
  117. }, {
  118. line: ' {',
  119. tokens: [
  120. { startIndex: 0, type: '' },
  121. { startIndex: 2, type: 'delimiter.curly.cs' }
  122. ]
  123. }, {
  124. line: ' ProcessStartInfo si = new ProcessStartInfo();',
  125. tokens: [
  126. { startIndex: 0, type: '' },
  127. { startIndex: 3, type: 'identifier.cs' },
  128. { startIndex: 19, type: '' },
  129. { startIndex: 20, type: 'identifier.cs' },
  130. { startIndex: 22, type: '' },
  131. { startIndex: 23, type: 'delimiter.cs' },
  132. { startIndex: 24, type: '' },
  133. { startIndex: 25, type: 'keyword.new.cs' },
  134. { startIndex: 28, type: '' },
  135. { startIndex: 29, type: 'identifier.cs' },
  136. { startIndex: 45, type: 'delimiter.parenthesis.cs' },
  137. { startIndex: 47, type: 'delimiter.cs' }
  138. ]
  139. }, {
  140. line: ' float load= 3.2e02f;',
  141. tokens: [
  142. { startIndex: 0, type: '' },
  143. { startIndex: 3, type: 'keyword.float.cs' },
  144. { startIndex: 8, type: '' },
  145. { startIndex: 9, type: 'identifier.cs' },
  146. { startIndex: 13, type: 'delimiter.cs' },
  147. { startIndex: 14, type: '' },
  148. { startIndex: 15, type: 'number.float.cs' },
  149. { startIndex: 22, type: 'delimiter.cs' }
  150. ]
  151. }, {
  152. line: '',
  153. tokens: [
  154. ]
  155. }, {
  156. line: ' si.FileName = @"tools\\\\node.exe";',
  157. tokens: [
  158. { startIndex: 0, type: '' },
  159. { startIndex: 3, type: 'identifier.cs' },
  160. { startIndex: 5, type: 'delimiter.cs' },
  161. { startIndex: 6, type: 'identifier.cs' },
  162. { startIndex: 14, type: '' },
  163. { startIndex: 15, type: 'delimiter.cs' },
  164. { startIndex: 16, type: '' },
  165. { startIndex: 17, type: 'string.quote.cs' },
  166. { startIndex: 19, type: 'string.cs' },
  167. { startIndex: 34, type: 'string.quote.cs' },
  168. { startIndex: 35, type: 'delimiter.cs' }
  169. ]
  170. }, {
  171. line: ' si.Arguments = "tools\\\\simpl3server.js";',
  172. tokens: [
  173. { startIndex: 0, type: '' },
  174. { startIndex: 3, type: 'identifier.cs' },
  175. { startIndex: 5, type: 'delimiter.cs' },
  176. { startIndex: 6, type: 'identifier.cs' },
  177. { startIndex: 15, type: '' },
  178. { startIndex: 16, type: 'delimiter.cs' },
  179. { startIndex: 17, type: '' },
  180. { startIndex: 18, type: 'string.quote.cs' },
  181. { startIndex: 19, type: 'string.cs' },
  182. { startIndex: 24, type: 'string.escape.cs' },
  183. { startIndex: 26, type: 'string.cs' },
  184. { startIndex: 41, type: 'string.quote.cs' },
  185. { startIndex: 42, type: 'delimiter.cs' }
  186. ]
  187. }, {
  188. line: ' ',
  189. tokens: [
  190. { startIndex: 0, type: '' }
  191. ]
  192. }, {
  193. line: ' string someString = $"hello{outside+variable}the string again {{ escaped";',
  194. tokens: [
  195. { startIndex: 0, type: '' },
  196. { startIndex: 3, type: 'keyword.string.cs' },
  197. { startIndex: 9, type: '' },
  198. { startIndex: 10, type: 'identifier.cs' },
  199. { startIndex: 20, type: '' },
  200. { startIndex: 21, type: 'delimiter.cs' },
  201. { startIndex: 22, type: '' },
  202. { startIndex: 23, type: 'string.quote.cs' },
  203. { startIndex: 25, type: 'string.cs' },
  204. { startIndex: 30, type: 'string.quote.cs' },
  205. { startIndex: 31, type: 'identifier.cs' },
  206. { startIndex: 38, type: 'delimiter.cs' },
  207. { startIndex: 39, type: 'identifier.cs' },
  208. { startIndex: 47, type: 'string.quote.cs' },
  209. { startIndex: 48, type: 'string.cs' },
  210. { startIndex: 65, type: 'string.escape.cs' },
  211. { startIndex: 67, type: 'string.cs' },
  212. { startIndex: 75, type: 'string.quote.cs' },
  213. { startIndex: 76, type: 'delimiter.cs' }
  214. ]
  215. }, {
  216. line: ' var @string = 5;',
  217. tokens: [
  218. { startIndex: 0, type: '' },
  219. { startIndex: 3, type: 'keyword.var.cs' },
  220. { startIndex: 6, type: '' },
  221. { startIndex: 7, type: 'identifier.cs' },
  222. { startIndex: 14, type: '' },
  223. { startIndex: 15, type: 'delimiter.cs' },
  224. { startIndex: 16, type: '' },
  225. { startIndex: 17, type: 'number.cs' },
  226. { startIndex: 18, type: 'delimiter.cs' }
  227. ]
  228. }, {
  229. line: ' ',
  230. tokens: [
  231. { startIndex: 0, type: '' }
  232. ]
  233. }, {
  234. line: ' if (x == 4)',
  235. tokens: [
  236. { startIndex: 0, type: '' },
  237. { startIndex: 3, type: 'keyword.if.cs' },
  238. { startIndex: 5, type: '' },
  239. { startIndex: 6, type: 'delimiter.parenthesis.cs' },
  240. { startIndex: 7, type: 'identifier.cs' },
  241. { startIndex: 8, type: '' },
  242. { startIndex: 9, type: 'delimiter.cs' },
  243. { startIndex: 11, type: '' },
  244. { startIndex: 12, type: 'number.cs' },
  245. { startIndex: 13, type: 'delimiter.parenthesis.cs' }
  246. ]
  247. }, {
  248. line: ' {',
  249. tokens: [
  250. { startIndex: 0, type: '' },
  251. { startIndex: 3, type: 'delimiter.curly.cs' }
  252. ]
  253. }, {
  254. line: ' for (int i = 4; i<10; i++)',
  255. tokens: [
  256. { startIndex: 0, type: '' },
  257. { startIndex: 4, type: 'keyword.for.cs' },
  258. { startIndex: 7, type: '' },
  259. { startIndex: 8, type: 'delimiter.parenthesis.cs' },
  260. { startIndex: 9, type: 'keyword.int.cs' },
  261. { startIndex: 12, type: '' },
  262. { startIndex: 13, type: 'identifier.cs' },
  263. { startIndex: 14, type: '' },
  264. { startIndex: 15, type: 'delimiter.cs' },
  265. { startIndex: 16, type: '' },
  266. { startIndex: 17, type: 'number.cs' },
  267. { startIndex: 18, type: 'delimiter.cs' },
  268. { startIndex: 19, type: '' },
  269. { startIndex: 20, type: 'identifier.cs' },
  270. { startIndex: 21, type: 'delimiter.angle.cs' },
  271. { startIndex: 22, type: 'number.cs' },
  272. { startIndex: 24, type: 'delimiter.cs' },
  273. { startIndex: 25, type: '' },
  274. { startIndex: 26, type: 'identifier.cs' },
  275. { startIndex: 27, type: 'delimiter.cs' },
  276. { startIndex: 29, type: 'delimiter.parenthesis.cs' }
  277. ]
  278. }, {
  279. line: ' {',
  280. tokens: [
  281. { startIndex: 0, type: '' },
  282. { startIndex: 4, type: 'delimiter.curly.cs' }
  283. ]
  284. }, {
  285. line: ' var d = i;',
  286. tokens: [
  287. { startIndex: 0, type: '' },
  288. { startIndex: 5, type: 'keyword.var.cs' },
  289. { startIndex: 8, type: '' },
  290. { startIndex: 9, type: 'identifier.cs' },
  291. { startIndex: 10, type: '' },
  292. { startIndex: 11, type: 'delimiter.cs' },
  293. { startIndex: 12, type: '' },
  294. { startIndex: 13, type: 'identifier.cs' },
  295. { startIndex: 14, type: 'delimiter.cs' }
  296. ]
  297. }, {
  298. line: ' }',
  299. tokens: [
  300. { startIndex: 0, type: '' },
  301. { startIndex: 4, type: 'delimiter.curly.cs' }
  302. ]
  303. }, {
  304. line: ' }',
  305. tokens: [
  306. { startIndex: 0, type: '' },
  307. { startIndex: 3, type: 'delimiter.curly.cs' }
  308. ]
  309. }, {
  310. line: ' else',
  311. tokens: [
  312. { startIndex: 0, type: '' },
  313. { startIndex: 3, type: 'keyword.else.cs' }
  314. ]
  315. }, {
  316. line: ' {',
  317. tokens: [
  318. { startIndex: 0, type: '' },
  319. { startIndex: 3, type: 'delimiter.curly.cs' }
  320. ]
  321. }, {
  322. line: ' return;',
  323. tokens: [
  324. { startIndex: 0, type: '' },
  325. { startIndex: 4, type: 'keyword.return.cs' },
  326. { startIndex: 10, type: 'delimiter.cs' }
  327. ]
  328. }, {
  329. line: ' }',
  330. tokens: [
  331. { startIndex: 0, type: '' },
  332. { startIndex: 3, type: 'delimiter.curly.cs' }
  333. ]
  334. }, {
  335. line: ' ',
  336. tokens: [
  337. { startIndex: 0, type: '' }
  338. ]
  339. }, {
  340. line: '',
  341. tokens: [
  342. ]
  343. }, {
  344. line: ' Process.Start(si);',
  345. tokens: [
  346. { startIndex: 0, type: '' },
  347. { startIndex: 3, type: 'identifier.cs' },
  348. { startIndex: 10, type: 'delimiter.cs' },
  349. { startIndex: 11, type: 'identifier.cs' },
  350. { startIndex: 16, type: 'delimiter.parenthesis.cs' },
  351. { startIndex: 17, type: 'identifier.cs' },
  352. { startIndex: 19, type: 'delimiter.parenthesis.cs' },
  353. { startIndex: 20, type: 'delimiter.cs' }
  354. ]
  355. }, {
  356. line: ' }',
  357. tokens: [
  358. { startIndex: 0, type: '' },
  359. { startIndex: 2, type: 'delimiter.curly.cs' }
  360. ]
  361. }, {
  362. line: ' }',
  363. tokens: [
  364. { startIndex: 0, type: '' },
  365. { startIndex: 1, type: 'delimiter.curly.cs' }
  366. ]
  367. }, {
  368. line: '}',
  369. tokens: [
  370. { startIndex: 0, type: 'delimiter.curly.cs' }
  371. ]
  372. }, {
  373. line: '',
  374. tokens: [
  375. ]
  376. }, {
  377. line: '#pragma region /MapLayer/*Image* /// ',
  378. tokens: [
  379. { startIndex: 0, type: 'namespace.cpp.cs' }
  380. ]
  381. }, {
  382. line: 'namespace ShouldNotBeAComment {}',
  383. tokens: [
  384. { startIndex: 0, type: 'keyword.namespace.cs' },
  385. { startIndex: 9, type: '' },
  386. { startIndex: 10, type: 'namespace.cs' },
  387. { startIndex: 29, type: '' },
  388. { startIndex: 30, type: 'delimiter.curly.cs' }
  389. ]
  390. }, {
  391. line: '#pragma endregion Region_1',
  392. tokens: [
  393. { startIndex: 0, type: 'namespace.cpp.cs' }
  394. ]
  395. }],
  396. // Keywords
  397. [{
  398. line: 'namespace VS { class Program { static void Main(string[] args) {} } }',
  399. tokens: [
  400. { startIndex: 0, type: 'keyword.namespace.cs' },
  401. { startIndex: 9, type: '' },
  402. { startIndex: 10, type: 'namespace.cs' },
  403. { startIndex: 12, type: '' },
  404. { startIndex: 13, type: 'delimiter.curly.cs' },
  405. { startIndex: 14, type: '' },
  406. { startIndex: 15, type: 'keyword.class.cs' },
  407. { startIndex: 20, type: '' },
  408. { startIndex: 21, type: 'identifier.cs' },
  409. { startIndex: 28, type: '' },
  410. { startIndex: 29, type: 'delimiter.curly.cs' },
  411. { startIndex: 30, type: '' },
  412. { startIndex: 31, type: 'keyword.static.cs' },
  413. { startIndex: 37, type: '' },
  414. { startIndex: 38, type: 'keyword.void.cs' },
  415. { startIndex: 42, type: '' },
  416. { startIndex: 43, type: 'identifier.cs' },
  417. { startIndex: 47, type: 'delimiter.parenthesis.cs' },
  418. { startIndex: 48, type: 'keyword.string.cs' },
  419. { startIndex: 54, type: 'delimiter.square.cs' },
  420. { startIndex: 56, type: '' },
  421. { startIndex: 57, type: 'identifier.cs' },
  422. { startIndex: 61, type: 'delimiter.parenthesis.cs' },
  423. { startIndex: 62, type: '' },
  424. { startIndex: 63, type: 'delimiter.curly.cs' },
  425. { startIndex: 65, type: '' },
  426. { startIndex: 66, type: 'delimiter.curly.cs' },
  427. { startIndex: 67, type: '' },
  428. { startIndex: 68, type: 'delimiter.curly.cs' }
  429. ]
  430. }],
  431. // Comments - single line
  432. [{
  433. line: '//',
  434. tokens: [
  435. { startIndex: 0, type: 'comment.cs' }
  436. ]
  437. }],
  438. [{
  439. line: ' // a comment',
  440. tokens: [
  441. { startIndex: 0, type: '' },
  442. { startIndex: 4, type: 'comment.cs' }
  443. ]
  444. }],
  445. [{
  446. line: '// a comment',
  447. tokens: [
  448. { startIndex: 0, type: 'comment.cs' }
  449. ]
  450. }],
  451. [{
  452. line: '//sticky comment',
  453. tokens: [
  454. { startIndex: 0, type: 'comment.cs' }
  455. ]
  456. }],
  457. [{
  458. line: '/almost a comment',
  459. tokens: [
  460. { startIndex: 0, type: 'delimiter.cs' },
  461. { startIndex: 1, type: 'identifier.cs' },
  462. { startIndex: 7, type: '' },
  463. { startIndex: 8, type: 'identifier.cs' },
  464. { startIndex: 9, type: '' },
  465. { startIndex: 10, type: 'identifier.cs' }
  466. ]
  467. }],
  468. [{
  469. line: '1 / 2; /* comment',
  470. tokens: [
  471. { startIndex: 0, type: 'number.cs' },
  472. { startIndex: 1, type: '' },
  473. { startIndex: 2, type: 'delimiter.cs' },
  474. { startIndex: 3, type: '' },
  475. { startIndex: 4, type: 'number.cs' },
  476. { startIndex: 5, type: 'delimiter.cs' },
  477. { startIndex: 6, type: '' },
  478. { startIndex: 7, type: 'comment.cs' }
  479. ]
  480. }],
  481. [{
  482. line: 'var x = 1; // my comment // is a nice one',
  483. tokens: [
  484. { startIndex: 0, type: 'keyword.var.cs' },
  485. { startIndex: 3, type: '' },
  486. { startIndex: 4, type: 'identifier.cs' },
  487. { startIndex: 5, type: '' },
  488. { startIndex: 6, type: 'delimiter.cs' },
  489. { startIndex: 7, type: '' },
  490. { startIndex: 8, type: 'number.cs' },
  491. { startIndex: 9, type: 'delimiter.cs' },
  492. { startIndex: 10, type: '' },
  493. { startIndex: 11, type: 'comment.cs' }
  494. ]
  495. }],
  496. // Comments - range comment, single line
  497. [{
  498. line: '/* a simple comment */',
  499. tokens: [
  500. { startIndex: 0, type: 'comment.cs' }
  501. ]
  502. }],
  503. [{
  504. line: 'var x = /* a simple comment */ 1;',
  505. tokens: [
  506. { startIndex: 0, type: 'keyword.var.cs' },
  507. { startIndex: 3, type: '' },
  508. { startIndex: 4, type: 'identifier.cs' },
  509. { startIndex: 5, type: '' },
  510. { startIndex: 6, type: 'delimiter.cs' },
  511. { startIndex: 7, type: '' },
  512. { startIndex: 8, type: 'comment.cs' },
  513. { startIndex: 30, type: '' },
  514. { startIndex: 31, type: 'number.cs' },
  515. { startIndex: 32, type: 'delimiter.cs' }
  516. ]
  517. }],
  518. [{
  519. line: 'var x = /* comment */ 1; */',
  520. tokens: [
  521. { startIndex: 0, type: 'keyword.var.cs' },
  522. { startIndex: 3, type: '' },
  523. { startIndex: 4, type: 'identifier.cs' },
  524. { startIndex: 5, type: '' },
  525. { startIndex: 6, type: 'delimiter.cs' },
  526. { startIndex: 7, type: '' },
  527. { startIndex: 8, type: 'comment.cs' },
  528. { startIndex: 21, type: '' },
  529. { startIndex: 22, type: 'number.cs' },
  530. { startIndex: 23, type: 'delimiter.cs' },
  531. { startIndex: 24, type: '' }
  532. ]
  533. }],
  534. [{
  535. line: 'x = /**/;',
  536. tokens: [
  537. { startIndex: 0, type: 'identifier.cs' },
  538. { startIndex: 1, type: '' },
  539. { startIndex: 2, type: 'delimiter.cs' },
  540. { startIndex: 3, type: '' },
  541. { startIndex: 4, type: 'comment.cs' },
  542. { startIndex: 8, type: 'delimiter.cs' }
  543. ]
  544. }],
  545. [{
  546. line: 'x = /*/;',
  547. tokens: [
  548. { startIndex: 0, type: 'identifier.cs' },
  549. { startIndex: 1, type: '' },
  550. { startIndex: 2, type: 'delimiter.cs' },
  551. { startIndex: 3, type: '' },
  552. { startIndex: 4, type: 'comment.cs' }
  553. ]
  554. }],
  555. // Numbers
  556. [{
  557. line: '0',
  558. tokens: [
  559. { startIndex: 0, type: 'number.cs' }
  560. ]
  561. }],
  562. [{
  563. line: '123_456',
  564. tokens: [
  565. { startIndex: 0, type: 'number.cs' }
  566. ]
  567. }],
  568. [{
  569. line: '0x',
  570. tokens: [
  571. { startIndex: 0, type: 'number.cs' },
  572. { startIndex: 1, type: 'identifier.cs' }
  573. ]
  574. }],
  575. [{
  576. line: '0b',
  577. tokens: [
  578. { startIndex: 0, type: 'number.cs' },
  579. { startIndex: 1, type: 'identifier.cs' }
  580. ]
  581. }],
  582. [{
  583. line: '0x123',
  584. tokens: [
  585. { startIndex: 0, type: 'number.hex.cs' }
  586. ]
  587. }],
  588. [{
  589. line: '0x123_456',
  590. tokens: [
  591. { startIndex: 0, type: 'number.hex.cs' }
  592. ]
  593. }],
  594. [{
  595. line: '0b101',
  596. tokens: [
  597. { startIndex: 0, type: 'number.hex.cs' }
  598. ]
  599. }],
  600. [{
  601. line: '0b1010_0001',
  602. tokens: [
  603. { startIndex: 0, type: 'number.hex.cs' }
  604. ]
  605. }],
  606. [{
  607. line: '23.5',
  608. tokens: [
  609. { startIndex: 0, type: 'number.float.cs' }
  610. ]
  611. }],
  612. [{
  613. line: '1_23.5',
  614. tokens: [
  615. { startIndex: 0, type: 'number.float.cs' }
  616. ]
  617. }],
  618. [{
  619. line: '23.5e3',
  620. tokens: [
  621. { startIndex: 0, type: 'number.float.cs' }
  622. ]
  623. }],
  624. [{
  625. line: '23.5E3',
  626. tokens: [
  627. { startIndex: 0, type: 'number.float.cs' }
  628. ]
  629. }],
  630. [{
  631. line: '23.5F',
  632. tokens: [
  633. { startIndex: 0, type: 'number.float.cs' }
  634. ]
  635. }],
  636. [{
  637. line: '23.5f',
  638. tokens: [
  639. { startIndex: 0, type: 'number.float.cs' }
  640. ]
  641. }],
  642. [{
  643. line: '2_3.5f',
  644. tokens: [
  645. { startIndex: 0, type: 'number.float.cs' }
  646. ]
  647. }],
  648. [{
  649. line: '1.72E3F',
  650. tokens: [
  651. { startIndex: 0, type: 'number.float.cs' }
  652. ]
  653. }],
  654. [{
  655. line: '1.72E3f',
  656. tokens: [
  657. { startIndex: 0, type: 'number.float.cs' }
  658. ]
  659. }],
  660. [{
  661. line: '1.72e3F',
  662. tokens: [
  663. { startIndex: 0, type: 'number.float.cs' }
  664. ]
  665. }],
  666. [{
  667. line: '1.72e3f',
  668. tokens: [
  669. { startIndex: 0, type: 'number.float.cs' }
  670. ]
  671. }],
  672. [{
  673. line: '23.5D',
  674. tokens: [
  675. { startIndex: 0, type: 'number.float.cs' }
  676. ]
  677. }],
  678. [{
  679. line: '456_123.5D',
  680. tokens: [
  681. { startIndex: 0, type: 'number.float.cs' }
  682. ]
  683. }],
  684. [{
  685. line: '23.5d',
  686. tokens: [
  687. { startIndex: 0, type: 'number.float.cs' }
  688. ]
  689. }],
  690. [{
  691. line: '1.72E3D',
  692. tokens: [
  693. { startIndex: 0, type: 'number.float.cs' }
  694. ]
  695. }],
  696. [{
  697. line: '1.72E3d',
  698. tokens: [
  699. { startIndex: 0, type: 'number.float.cs' }
  700. ]
  701. }],
  702. [{
  703. line: '1.720_123E3d',
  704. tokens: [
  705. { startIndex: 0, type: 'number.float.cs' }
  706. ]
  707. }],
  708. [{
  709. line: '1.72e3D',
  710. tokens: [
  711. { startIndex: 0, type: 'number.float.cs' }
  712. ]
  713. }],
  714. [{
  715. line: '1.72e3d',
  716. tokens: [
  717. { startIndex: 0, type: 'number.float.cs' }
  718. ]
  719. }],
  720. [{
  721. line: '0+0',
  722. tokens: [
  723. { startIndex: 0, type: 'number.cs' },
  724. { startIndex: 1, type: 'delimiter.cs' },
  725. { startIndex: 2, type: 'number.cs' }
  726. ]
  727. }],
  728. [{
  729. line: '100+10',
  730. tokens: [
  731. { startIndex: 0, type: 'number.cs' },
  732. { startIndex: 3, type: 'delimiter.cs' },
  733. { startIndex: 4, type: 'number.cs' }
  734. ]
  735. }],
  736. [{
  737. line: '0 + 0',
  738. tokens: [
  739. { startIndex: 0, type: 'number.cs' },
  740. { startIndex: 1, type: '' },
  741. { startIndex: 2, type: 'delimiter.cs' },
  742. { startIndex: 3, type: '' },
  743. { startIndex: 4, type: 'number.cs' }
  744. ]
  745. }],
  746. // Strings
  747. [{
  748. line: 'x = "string";',
  749. tokens: [
  750. { startIndex: 0, type: 'identifier.cs' },
  751. { startIndex: 1, type: '' },
  752. { startIndex: 2, type: 'delimiter.cs' },
  753. { startIndex: 3, type: '' },
  754. { startIndex: 4, type: 'string.quote.cs' },
  755. { startIndex: 5, type: 'string.cs' },
  756. { startIndex: 11, type: 'string.quote.cs' },
  757. { startIndex: 12, type: 'delimiter.cs' }
  758. ]
  759. }],
  760. [{
  761. line: 'x = "stri\\"ng";',
  762. tokens: [
  763. { startIndex: 0, type: 'identifier.cs' },
  764. { startIndex: 1, type: '' },
  765. { startIndex: 2, type: 'delimiter.cs' },
  766. { startIndex: 3, type: '' },
  767. { startIndex: 4, type: 'string.quote.cs' },
  768. { startIndex: 5, type: 'string.cs' },
  769. { startIndex: 9, type: 'string.escape.cs' },
  770. { startIndex: 11, type: 'string.cs' },
  771. { startIndex: 13, type: 'string.quote.cs' },
  772. { startIndex: 14, type: 'delimiter.cs' }
  773. ]
  774. }],
  775. // Verbatim Strings
  776. [{
  777. line: 'x = @"verbatimstring";',
  778. tokens: [
  779. { startIndex: 0, type: 'identifier.cs' },
  780. { startIndex: 1, type: '' },
  781. { startIndex: 2, type: 'delimiter.cs' },
  782. { startIndex: 3, type: '' },
  783. { startIndex: 4, type: 'string.quote.cs' },
  784. { startIndex: 6, type: 'string.cs' },
  785. { startIndex: 20, type: 'string.quote.cs' },
  786. { startIndex: 21, type: 'delimiter.cs' }
  787. ]
  788. }],
  789. [{
  790. line: 'x = @"verbatim""string";',
  791. tokens: [
  792. { startIndex: 0, type: 'identifier.cs' },
  793. { startIndex: 1, type: '' },
  794. { startIndex: 2, type: 'delimiter.cs' },
  795. { startIndex: 3, type: '' },
  796. { startIndex: 4, type: 'string.quote.cs' },
  797. { startIndex: 6, type: 'string.cs' },
  798. { startIndex: 14, type: 'string.escape.cs' },
  799. { startIndex: 16, type: 'string.cs' },
  800. { startIndex: 22, type: 'string.quote.cs' },
  801. { startIndex: 23, type: 'delimiter.cs' }
  802. ]
  803. }],
  804. [{
  805. line: 'x = @"verbatim\\string\\";',
  806. tokens: [
  807. { startIndex: 0, type: 'identifier.cs' },
  808. { startIndex: 1, type: '' },
  809. { startIndex: 2, type: 'delimiter.cs' },
  810. { startIndex: 3, type: '' },
  811. { startIndex: 4, type: 'string.quote.cs' },
  812. { startIndex: 6, type: 'string.cs' },
  813. { startIndex: 22, type: 'string.quote.cs' },
  814. { startIndex: 23, type: 'delimiter.cs' }
  815. ]
  816. }],
  817. [{
  818. line: 'x = @"verbatim',
  819. tokens: [
  820. { startIndex: 0, type: 'identifier.cs' },
  821. { startIndex: 1, type: '' },
  822. { startIndex: 2, type: 'delimiter.cs' },
  823. { startIndex: 3, type: '' },
  824. { startIndex: 4, type: 'string.quote.cs' },
  825. { startIndex: 6, type: 'string.cs' }
  826. ]
  827. }, {
  828. line: 'string";',
  829. tokens: [
  830. { startIndex: 0, type: 'string.cs' },
  831. { startIndex: 6, type: 'string.quote.cs' },
  832. { startIndex: 7, type: 'delimiter.cs' }
  833. ]
  834. }],
  835. [{
  836. line: 'x = $@"verbatim {interpolated} string{{}}"" ";',
  837. tokens: [
  838. { startIndex: 0, type: "identifier.cs" },
  839. { startIndex: 1, type: "" },
  840. { startIndex: 2, type: "delimiter.cs" },
  841. { startIndex: 3, type: "" },
  842. { startIndex: 4, type: "string.quote.cs" },
  843. { startIndex: 7, type: "string.cs" },
  844. { startIndex: 16, type: "string.quote.cs" },
  845. { startIndex: 17, type: "identifier.cs" },
  846. { startIndex: 29, type: "string.quote.cs" },
  847. { startIndex: 30, type: "string.cs" },
  848. { startIndex: 37, type: "string.escape.cs" },
  849. { startIndex: 39, type: "string.cs" },
  850. { startIndex: 41, type: "string.escape.cs" },
  851. { startIndex: 43, type: "string.cs" },
  852. { startIndex: 44, type: "string.quote.cs" },
  853. { startIndex: 45, type: "delimiter.cs" },
  854. ]
  855. }],
  856. ]);