cpp.test.ts 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  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('cpp', [
  8. // Keywords
  9. [{
  10. line: 'int _tmain(int argc, _TCHAR* argv[])',
  11. tokens: [
  12. { startIndex: 0, type: 'keyword.int.cpp' },
  13. { startIndex: 3, type: '' },
  14. { startIndex: 4, type: 'identifier.cpp' },
  15. { startIndex: 10, type: 'delimiter.parenthesis.cpp' },
  16. { startIndex: 11, type: 'keyword.int.cpp' },
  17. { startIndex: 14, type: '' },
  18. { startIndex: 15, type: 'identifier.cpp' },
  19. { startIndex: 19, type: 'delimiter.cpp' },
  20. { startIndex: 20, type: '' },
  21. { startIndex: 21, type: 'identifier.cpp' },
  22. { startIndex: 27, type: 'delimiter.cpp' },
  23. { startIndex: 28, type: '' },
  24. { startIndex: 29, type: 'identifier.cpp' },
  25. { startIndex: 33, type: 'delimiter.square.cpp' },
  26. { startIndex: 35, type: 'delimiter.parenthesis.cpp' }
  27. ]}],
  28. // Comments - single line
  29. [{
  30. line: '//',
  31. tokens: [
  32. { startIndex: 0, type: 'comment.cpp' }
  33. ]}],
  34. [{
  35. line: ' // a comment',
  36. tokens: [
  37. { startIndex: 0, type: '' },
  38. { startIndex: 4, type: 'comment.cpp' }
  39. ]}],
  40. [{
  41. line: '// a comment',
  42. tokens: [
  43. { startIndex: 0, type: 'comment.cpp' }
  44. ]}],
  45. [{
  46. line: '//sticky comment',
  47. tokens: [
  48. { startIndex: 0, type: 'comment.cpp' }
  49. ]}],
  50. [{
  51. line: '/almost a comment',
  52. tokens: [
  53. { startIndex: 0, type: 'delimiter.cpp' },
  54. { startIndex: 1, type: 'identifier.cpp' },
  55. { startIndex: 7, type: '' },
  56. { startIndex: 8, type: 'identifier.cpp' },
  57. { startIndex: 9, type: '' },
  58. { startIndex: 10, type: 'identifier.cpp' }
  59. ]}],
  60. [{
  61. line: '/* //*/ a',
  62. tokens: [
  63. { startIndex: 0, type: 'comment.cpp' },
  64. { startIndex: 7, type: '' },
  65. { startIndex: 8, type: 'identifier.cpp' }
  66. ]}],
  67. [{
  68. line: '1 / 2; /* comment',
  69. tokens: [
  70. { startIndex: 0, type: 'number.cpp' },
  71. { startIndex: 1, type: '' },
  72. { startIndex: 2, type: 'delimiter.cpp' },
  73. { startIndex: 3, type: '' },
  74. { startIndex: 4, type: 'number.cpp' },
  75. { startIndex: 5, type: 'delimiter.cpp' },
  76. { startIndex: 6, type: '' },
  77. { startIndex: 7, type: 'comment.cpp' }
  78. ]}],
  79. [{
  80. line: 'int x = 1; // my comment // is a nice one',
  81. tokens: [
  82. { startIndex: 0, type: 'keyword.int.cpp' },
  83. { startIndex: 3, type: '' },
  84. { startIndex: 4, type: 'identifier.cpp' },
  85. { startIndex: 5, type: '' },
  86. { startIndex: 6, type: 'delimiter.cpp' },
  87. { startIndex: 7, type: '' },
  88. { startIndex: 8, type: 'number.cpp' },
  89. { startIndex: 9, type: 'delimiter.cpp' },
  90. { startIndex: 10, type: '' },
  91. { startIndex: 11, type: 'comment.cpp' }
  92. ]}],
  93. // Comments - range comment, single line
  94. [{
  95. line: '/* a simple comment */',
  96. tokens: [
  97. { startIndex: 0, type: 'comment.cpp' }
  98. ]}],
  99. [{
  100. line: 'int x = /* a simple comment */ 1;',
  101. tokens: [
  102. { startIndex: 0, type: 'keyword.int.cpp' },
  103. { startIndex: 3, type: '' },
  104. { startIndex: 4, type: 'identifier.cpp' },
  105. { startIndex: 5, type: '' },
  106. { startIndex: 6, type: 'delimiter.cpp' },
  107. { startIndex: 7, type: '' },
  108. { startIndex: 8, type: 'comment.cpp' },
  109. { startIndex: 30, type: '' },
  110. { startIndex: 31, type: 'number.cpp' },
  111. { startIndex: 32, type: 'delimiter.cpp' }
  112. ]}],
  113. [{
  114. line: 'int x = /* comment */ 1; */',
  115. tokens: [
  116. { startIndex: 0, type: 'keyword.int.cpp' },
  117. { startIndex: 3, type: '' },
  118. { startIndex: 4, type: 'identifier.cpp' },
  119. { startIndex: 5, type: '' },
  120. { startIndex: 6, type: 'delimiter.cpp' },
  121. { startIndex: 7, type: '' },
  122. { startIndex: 8, type: 'comment.cpp' },
  123. { startIndex: 21, type: '' },
  124. { startIndex: 22, type: 'number.cpp' },
  125. { startIndex: 23, type: 'delimiter.cpp' },
  126. { startIndex: 24, type: '' }
  127. ]}],
  128. [{
  129. line: 'x = /**/;',
  130. tokens: [
  131. { startIndex: 0, type: 'identifier.cpp' },
  132. { startIndex: 1, type: '' },
  133. { startIndex: 2, type: 'delimiter.cpp' },
  134. { startIndex: 3, type: '' },
  135. { startIndex: 4, type: 'comment.cpp' },
  136. { startIndex: 8, type: 'delimiter.cpp' }
  137. ]}],
  138. [{
  139. line: 'x = /*/;',
  140. tokens: [
  141. { startIndex: 0, type: 'identifier.cpp' },
  142. { startIndex: 1, type: '' },
  143. { startIndex: 2, type: 'delimiter.cpp' },
  144. { startIndex: 3, type: '' },
  145. { startIndex: 4, type: 'comment.cpp' }
  146. ]}],
  147. // Numbers
  148. [{
  149. line: '0',
  150. tokens: [
  151. { startIndex: 0, type: 'number.cpp' }
  152. ]}],
  153. [{
  154. line: '12l',
  155. tokens: [
  156. { startIndex: 0, type: 'number.cpp' }
  157. ]}],
  158. [{
  159. line: '34U',
  160. tokens: [
  161. { startIndex: 0, type: 'number.cpp' }
  162. ]}],
  163. [{
  164. line: '55LL',
  165. tokens: [
  166. { startIndex: 0, type: 'number.cpp' }
  167. ]}],
  168. [{
  169. line: '34ul',
  170. tokens: [
  171. { startIndex: 0, type: 'number.cpp' }
  172. ]}],
  173. [{
  174. line: '55llU',
  175. tokens: [
  176. { startIndex: 0, type: 'number.cpp' }
  177. ]}],
  178. [{
  179. line: '5\'5llU',
  180. tokens: [
  181. { startIndex: 0, type: 'number.cpp' }
  182. ]}],
  183. [{
  184. line: '100\'000\'000',
  185. tokens: [
  186. { startIndex: 0, type: 'number.cpp' }
  187. ]}],
  188. [{
  189. line: '0x100\'aafllU',
  190. tokens: [
  191. { startIndex: 0, type: 'number.hex.cpp' }
  192. ]}],
  193. [{
  194. line: '0342\'325',
  195. tokens: [
  196. { startIndex: 0, type: 'number.octal.cpp' }
  197. ]}],
  198. [{
  199. line: '0x123',
  200. tokens: [
  201. { startIndex: 0, type: 'number.hex.cpp' }
  202. ]}],
  203. [{
  204. line: '23.5',
  205. tokens: [
  206. { startIndex: 0, type: 'number.float.cpp' }
  207. ]}],
  208. [{
  209. line: '23.5e3',
  210. tokens: [
  211. { startIndex: 0, type: 'number.float.cpp' }
  212. ]}],
  213. [{
  214. line: '23.5E3',
  215. tokens: [
  216. { startIndex: 0, type: 'number.float.cpp' }
  217. ]}],
  218. [{
  219. line: '23.5F',
  220. tokens: [
  221. { startIndex: 0, type: 'number.float.cpp' }
  222. ]}],
  223. [{
  224. line: '23.5f',
  225. tokens: [
  226. { startIndex: 0, type: 'number.float.cpp' }
  227. ]}],
  228. [{
  229. line: '1.72E3F',
  230. tokens: [
  231. { startIndex: 0, type: 'number.float.cpp' }
  232. ]}],
  233. [{
  234. line: '1.72E3f',
  235. tokens: [
  236. { startIndex: 0, type: 'number.float.cpp' }
  237. ]}],
  238. [{
  239. line: '1.72e3F',
  240. tokens: [
  241. { startIndex: 0, type: 'number.float.cpp' }
  242. ]}],
  243. [{
  244. line: '1.72e3f',
  245. tokens: [
  246. { startIndex: 0, type: 'number.float.cpp' }
  247. ]}],
  248. [{
  249. line: '23.5L',
  250. tokens: [
  251. { startIndex: 0, type: 'number.float.cpp' }
  252. ]}],
  253. [{
  254. line: '23.5l',
  255. tokens: [
  256. { startIndex: 0, type: 'number.float.cpp' }
  257. ]}],
  258. [{
  259. line: '1.72E3L',
  260. tokens: [
  261. { startIndex: 0, type: 'number.float.cpp' }
  262. ]}],
  263. [{
  264. line: '1.72E3l',
  265. tokens: [
  266. { startIndex: 0, type: 'number.float.cpp' }
  267. ]}],
  268. [{
  269. line: '1.72e3L',
  270. tokens: [
  271. { startIndex: 0, type: 'number.float.cpp' }
  272. ]}],
  273. [{
  274. line: '1.72e3l',
  275. tokens: [
  276. { startIndex: 0, type: 'number.float.cpp' }
  277. ]}],
  278. [{
  279. line: '0+0',
  280. tokens: [
  281. { startIndex: 0, type: 'number.cpp' },
  282. { startIndex: 1, type: 'delimiter.cpp' },
  283. { startIndex: 2, type: 'number.cpp' }
  284. ]}],
  285. [{
  286. line: '100+10',
  287. tokens: [
  288. { startIndex: 0, type: 'number.cpp' },
  289. { startIndex: 3, type: 'delimiter.cpp' },
  290. { startIndex: 4, type: 'number.cpp' }
  291. ]}],
  292. [{
  293. line: '0 + 0',
  294. tokens: [
  295. { startIndex: 0, type: 'number.cpp' },
  296. { startIndex: 1, type: '' },
  297. { startIndex: 2, type: 'delimiter.cpp' },
  298. { startIndex: 3, type: '' },
  299. { startIndex: 4, type: 'number.cpp' }
  300. ]}],
  301. // Monarch Generated
  302. [{
  303. line: '#include<iostream>',
  304. tokens: [
  305. { startIndex: 0, type: 'keyword.cpp' },
  306. { startIndex: 8, type: 'delimiter.angle.cpp' },
  307. { startIndex: 9, type: 'identifier.cpp' },
  308. { startIndex: 17, type: 'delimiter.angle.cpp' }
  309. ]}, {
  310. line: '#include "/path/to/my/file.h"',
  311. tokens: [
  312. { startIndex: 0, type: 'keyword.cpp' },
  313. { startIndex: 8, type: '' },
  314. { startIndex: 9, type: 'string.cpp' }
  315. ]}, {
  316. line: '',
  317. tokens: [
  318. ]}, {
  319. line: '#ifdef VAR',
  320. tokens: [
  321. { startIndex: 0, type: 'keyword.cpp' },
  322. { startIndex: 6, type: '' },
  323. { startIndex: 7, type: 'identifier.cpp' }
  324. ]}, {
  325. line: '#define SUM(A,B) (A) + (B)',
  326. tokens: [
  327. { startIndex: 0, type: 'keyword.cpp' },
  328. { startIndex: 7, type: '' },
  329. { startIndex: 8, type: 'identifier.cpp' },
  330. { startIndex: 11, type: 'delimiter.parenthesis.cpp' },
  331. { startIndex: 12, type: 'identifier.cpp' },
  332. { startIndex: 13, type: 'delimiter.cpp' },
  333. { startIndex: 14, type: 'identifier.cpp' },
  334. { startIndex: 15, type: 'delimiter.parenthesis.cpp' },
  335. { startIndex: 16, type: '' },
  336. { startIndex: 17, type: 'delimiter.parenthesis.cpp' },
  337. { startIndex: 18, type: 'identifier.cpp' },
  338. { startIndex: 19, type: 'delimiter.parenthesis.cpp' },
  339. { startIndex: 20, type: '' },
  340. { startIndex: 21, type: 'delimiter.cpp' },
  341. { startIndex: 22, type: '' },
  342. { startIndex: 23, type: 'delimiter.parenthesis.cpp' },
  343. { startIndex: 24, type: 'identifier.cpp' },
  344. { startIndex: 25, type: 'delimiter.parenthesis.cpp' }
  345. ]}, {
  346. line: '',
  347. tokens: [
  348. ]}, {
  349. line: 'int main(int argc, char** argv)',
  350. tokens: [
  351. { startIndex: 0, type: 'keyword.int.cpp' },
  352. { startIndex: 3, type: '' },
  353. { startIndex: 4, type: 'identifier.cpp' },
  354. { startIndex: 8, type: 'delimiter.parenthesis.cpp' },
  355. { startIndex: 9, type: 'keyword.int.cpp' },
  356. { startIndex: 12, type: '' },
  357. { startIndex: 13, type: 'identifier.cpp' },
  358. { startIndex: 17, type: 'delimiter.cpp' },
  359. { startIndex: 18, type: '' },
  360. { startIndex: 19, type: 'keyword.char.cpp' },
  361. { startIndex: 23, type: '' },
  362. { startIndex: 26, type: 'identifier.cpp' },
  363. { startIndex: 30, type: 'delimiter.parenthesis.cpp' }
  364. ]}, {
  365. line: '{',
  366. tokens: [
  367. { startIndex: 0, type: 'delimiter.curly.cpp' }
  368. ]}, {
  369. line: ' return 0;',
  370. tokens: [
  371. { startIndex: 0, type: '' },
  372. { startIndex: 1, type: 'keyword.return.cpp' },
  373. { startIndex: 7, type: '' },
  374. { startIndex: 8, type: 'number.cpp' },
  375. { startIndex: 9, type: 'delimiter.cpp' }
  376. ]}, {
  377. line: '}',
  378. tokens: [
  379. { startIndex: 0, type: 'delimiter.curly.cpp' }
  380. ]}, {
  381. line: '',
  382. tokens: [
  383. ]}, {
  384. line: 'namespace TestSpace',
  385. tokens: [
  386. { startIndex: 0, type: 'keyword.namespace.cpp' },
  387. { startIndex: 9, type: '' },
  388. { startIndex: 10, type: 'identifier.cpp' }
  389. ]}, {
  390. line: '{',
  391. tokens: [
  392. { startIndex: 0, type: 'delimiter.curly.cpp' }
  393. ]}, {
  394. line: ' using Asdf.CDE;',
  395. tokens: [
  396. { startIndex: 0, type: '' },
  397. { startIndex: 1, type: 'keyword.using.cpp' },
  398. { startIndex: 6, type: '' },
  399. { startIndex: 7, type: 'identifier.cpp' },
  400. { startIndex: 11, type: 'delimiter.cpp' },
  401. { startIndex: 12, type: 'identifier.cpp' },
  402. { startIndex: 15, type: 'delimiter.cpp' }
  403. ]}, {
  404. line: ' template <typename T>',
  405. tokens: [
  406. { startIndex: 0, type: '' },
  407. { startIndex: 1, type: 'keyword.template.cpp' },
  408. { startIndex: 9, type: '' },
  409. { startIndex: 10, type: 'delimiter.angle.cpp' },
  410. { startIndex: 11, type: 'keyword.typename.cpp' },
  411. { startIndex: 19, type: '' },
  412. { startIndex: 20, type: 'identifier.cpp' },
  413. { startIndex: 21, type: 'delimiter.angle.cpp' }
  414. ]}, {
  415. line: ' class CoolClass : protected BaseClass',
  416. tokens: [
  417. { startIndex: 0, type: '' },
  418. { startIndex: 1, type: 'keyword.class.cpp' },
  419. { startIndex: 6, type: '' },
  420. { startIndex: 7, type: 'identifier.cpp' },
  421. { startIndex: 16, type: '' },
  422. { startIndex: 17, type: 'delimiter.cpp' },
  423. { startIndex: 18, type: '' },
  424. { startIndex: 19, type: 'keyword.protected.cpp' },
  425. { startIndex: 28, type: '' },
  426. { startIndex: 29, type: 'identifier.cpp' }
  427. ]}, {
  428. line: ' {',
  429. tokens: [
  430. { startIndex: 0, type: '' },
  431. { startIndex: 1, type: 'delimiter.curly.cpp' }
  432. ]}, {
  433. line: ' private:',
  434. tokens: [
  435. { startIndex: 0, type: '' },
  436. { startIndex: 2, type: 'keyword.private.cpp' },
  437. { startIndex: 9, type: 'delimiter.cpp' }
  438. ]}, {
  439. line: ' ',
  440. tokens: [
  441. { startIndex: 0, type: '' }
  442. ]}, {
  443. line: ' static T field;',
  444. tokens: [
  445. { startIndex: 0, type: '' },
  446. { startIndex: 2, type: 'keyword.static.cpp' },
  447. { startIndex: 8, type: '' },
  448. { startIndex: 9, type: 'identifier.cpp' },
  449. { startIndex: 10, type: '' },
  450. { startIndex: 11, type: 'identifier.cpp' },
  451. { startIndex: 16, type: 'delimiter.cpp' }
  452. ]}, {
  453. line: ' ',
  454. tokens: [
  455. { startIndex: 0, type: '' }
  456. ]}, {
  457. line: ' public:',
  458. tokens: [
  459. { startIndex: 0, type: '' },
  460. { startIndex: 2, type: 'keyword.public.cpp' },
  461. { startIndex: 8, type: 'delimiter.cpp' }
  462. ]}, {
  463. line: ' ',
  464. tokens: [
  465. { startIndex: 0, type: '' }
  466. ]}, {
  467. line: ' [[deprecated]]',
  468. tokens: [
  469. { startIndex: 0, type: '' },
  470. { startIndex: 2, type: 'annotation.cpp' }
  471. ]}, {
  472. line: ' foo method() const override',
  473. tokens: [
  474. { startIndex: 0, type: '' },
  475. { startIndex: 2, type: 'identifier.cpp' },
  476. { startIndex: 5, type: '' },
  477. { startIndex: 6, type: 'identifier.cpp' },
  478. { startIndex: 12, type: 'delimiter.parenthesis.cpp' },
  479. { startIndex: 14, type: '' },
  480. { startIndex: 15, type: 'keyword.const.cpp' },
  481. { startIndex: 20, type: '' },
  482. { startIndex: 21, type: 'keyword.override.cpp' }
  483. ]}, {
  484. line: ' {',
  485. tokens: [
  486. { startIndex: 0, type: '' },
  487. { startIndex: 2, type: 'delimiter.curly.cpp' }
  488. ]}, {
  489. line: ' auto s = new Bar();',
  490. tokens: [
  491. { startIndex: 0, type: '' },
  492. { startIndex: 3, type: 'keyword.auto.cpp' },
  493. { startIndex: 7, type: '' },
  494. { startIndex: 8, type: 'identifier.cpp' },
  495. { startIndex: 9, type: '' },
  496. { startIndex: 10, type: 'delimiter.cpp' },
  497. { startIndex: 11, type: '' },
  498. { startIndex: 12, type: 'keyword.new.cpp' },
  499. { startIndex: 15, type: '' },
  500. { startIndex: 16, type: 'identifier.cpp' },
  501. { startIndex: 19, type: 'delimiter.parenthesis.cpp' },
  502. { startIndex: 21, type: 'delimiter.cpp' }
  503. ]}, {
  504. line: ' ',
  505. tokens: [
  506. { startIndex: 0, type: '' }
  507. ]}, {
  508. line: ' if (s.field) {',
  509. tokens: [
  510. { startIndex: 0, type: '' },
  511. { startIndex: 3, type: 'keyword.if.cpp' },
  512. { startIndex: 5, type: '' },
  513. { startIndex: 6, type: 'delimiter.parenthesis.cpp' },
  514. { startIndex: 7, type: 'identifier.cpp' },
  515. { startIndex: 8, type: 'delimiter.cpp' },
  516. { startIndex: 9, type: 'identifier.cpp' },
  517. { startIndex: 14, type: 'delimiter.parenthesis.cpp' },
  518. { startIndex: 15, type: '' },
  519. { startIndex: 16, type: 'delimiter.curly.cpp' }
  520. ]}, {
  521. line: ' for(const auto & b : s.field) {',
  522. tokens: [
  523. { startIndex: 0, type: '' },
  524. { startIndex: 4, type: 'keyword.for.cpp' },
  525. { startIndex: 7, type: 'delimiter.parenthesis.cpp' },
  526. { startIndex: 8, type: 'keyword.const.cpp' },
  527. { startIndex: 13, type: '' },
  528. { startIndex: 14, type: 'keyword.auto.cpp' },
  529. { startIndex: 18, type: '' },
  530. { startIndex: 19, type: 'delimiter.cpp' },
  531. { startIndex: 20, type: '' },
  532. { startIndex: 21, type: 'identifier.cpp' },
  533. { startIndex: 22, type: '' },
  534. { startIndex: 23, type: 'delimiter.cpp' },
  535. { startIndex: 24, type: '' },
  536. { startIndex: 25, type: 'identifier.cpp' },
  537. { startIndex: 26, type: 'delimiter.cpp' },
  538. { startIndex: 27, type: 'identifier.cpp' },
  539. { startIndex: 32, type: 'delimiter.parenthesis.cpp' },
  540. { startIndex: 33, type: '' },
  541. { startIndex: 34, type: 'delimiter.curly.cpp' }
  542. ]}, {
  543. line: ' break;',
  544. tokens: [
  545. { startIndex: 0, type: '' },
  546. { startIndex: 5, type: 'keyword.break.cpp' },
  547. { startIndex: 10, type: 'delimiter.cpp' }
  548. ]}, {
  549. line: ' }',
  550. tokens: [
  551. { startIndex: 0, type: '' },
  552. { startIndex: 4, type: 'delimiter.curly.cpp' }
  553. ]}, {
  554. line: ' }',
  555. tokens: [
  556. { startIndex: 0, type: '' },
  557. { startIndex: 3, type: 'delimiter.curly.cpp' }
  558. ]}, {
  559. line: ' }',
  560. tokens: [
  561. { startIndex: 0, type: '' },
  562. { startIndex: 2, type: 'delimiter.curly.cpp' }
  563. ]}, {
  564. line: ' ',
  565. tokens: [
  566. { startIndex: 0, type: '' }
  567. ]}, {
  568. line: ' std::string s = "hello wordld\\n";',
  569. tokens: [
  570. { startIndex: 0, type: '' },
  571. { startIndex: 2, type: 'identifier.cpp' },
  572. { startIndex: 5, type: '' },
  573. { startIndex: 7, type: 'identifier.cpp' },
  574. { startIndex: 13, type: '' },
  575. { startIndex: 14, type: 'identifier.cpp' },
  576. { startIndex: 15, type: '' },
  577. { startIndex: 16, type: 'delimiter.cpp' },
  578. { startIndex: 17, type: '' },
  579. { startIndex: 18, type: 'string.cpp' },
  580. { startIndex: 31, type: 'string.escape.cpp' },
  581. { startIndex: 33, type: 'string.cpp' },
  582. { startIndex: 34, type: 'delimiter.cpp' }
  583. ]}, {
  584. line: ' ',
  585. tokens: [
  586. { startIndex: 0, type: '' }
  587. ]}, {
  588. line: ' int number = 123\'123\'123Ull;',
  589. tokens: [
  590. { startIndex: 0, type: '' },
  591. { startIndex: 2, type: 'keyword.int.cpp' },
  592. { startIndex: 5, type: '' },
  593. { startIndex: 6, type: 'identifier.cpp' },
  594. { startIndex: 12, type: '' },
  595. { startIndex: 13, type: 'delimiter.cpp' },
  596. { startIndex: 14, type: '' },
  597. { startIndex: 15, type: 'number.cpp' },
  598. { startIndex: 29, type: 'delimiter.cpp' }
  599. ]}, {
  600. line: ' }',
  601. tokens: [
  602. { startIndex: 0, type: '' },
  603. { startIndex: 1, type: 'delimiter.curly.cpp' }
  604. ]}, {
  605. line: '}',
  606. tokens: [
  607. { startIndex: 0, type: 'delimiter.curly.cpp' }
  608. ]}, {
  609. line: '',
  610. tokens: [
  611. ]}, {
  612. line: '#endif',
  613. tokens: [
  614. { startIndex: 0, type: 'keyword.cpp' }
  615. ]}]
  616. ]);