123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790 |
- /*---------------------------------------------------------------------------------------------
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *--------------------------------------------------------------------------------------------*/
- 'use strict';
- import { testTokenization } from '../test/testRunner';
- testTokenization('cpp', [
- // Keywords
- [{
- line: 'int _tmain(int argc, _TCHAR* argv[])',
- tokens: [
- { startIndex: 0, type: 'keyword.int.cpp' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'identifier.cpp' },
- { startIndex: 10, type: 'delimiter.parenthesis.cpp' },
- { startIndex: 11, type: 'keyword.int.cpp' },
- { startIndex: 14, type: '' },
- { startIndex: 15, type: 'identifier.cpp' },
- { startIndex: 19, type: 'delimiter.cpp' },
- { startIndex: 20, type: '' },
- { startIndex: 21, type: 'identifier.cpp' },
- { startIndex: 27, type: 'delimiter.cpp' },
- { startIndex: 28, type: '' },
- { startIndex: 29, type: 'identifier.cpp' },
- { startIndex: 33, type: 'delimiter.square.cpp' },
- { startIndex: 35, type: 'delimiter.parenthesis.cpp' }
- ]
- }],
- // Comments - single line
- [{
- line: '//',
- tokens: [
- { startIndex: 0, type: 'comment.cpp' }
- ]
- }],
- [{
- line: ' // a comment',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 4, type: 'comment.cpp' }
- ]
- }],
- [{
- line: '// a comment',
- tokens: [
- { startIndex: 0, type: 'comment.cpp' }
- ]
- }],
- [{
- line: '//sticky comment',
- tokens: [
- { startIndex: 0, type: 'comment.cpp' }
- ]
- }],
- [{
- line: '/almost a comment',
- tokens: [
- { startIndex: 0, type: 'delimiter.cpp' },
- { startIndex: 1, type: 'identifier.cpp' },
- { startIndex: 7, type: '' },
- { startIndex: 8, type: 'identifier.cpp' },
- { startIndex: 9, type: '' },
- { startIndex: 10, type: 'identifier.cpp' }
- ]
- }],
- [{
- line: '/* //*/ a',
- tokens: [
- { startIndex: 0, type: 'comment.cpp' },
- { startIndex: 7, type: '' },
- { startIndex: 8, type: 'identifier.cpp' }
- ]
- }],
- [{
- line: '1 / 2; /* comment',
- tokens: [
- { startIndex: 0, type: 'number.cpp' },
- { startIndex: 1, type: '' },
- { startIndex: 2, type: 'delimiter.cpp' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'number.cpp' },
- { startIndex: 5, type: 'delimiter.cpp' },
- { startIndex: 6, type: '' },
- { startIndex: 7, type: 'comment.cpp' }
- ]
- }],
- [{
- line: 'int x = 1; // my comment // is a nice one',
- tokens: [
- { startIndex: 0, type: 'keyword.int.cpp' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'identifier.cpp' },
- { startIndex: 5, type: '' },
- { startIndex: 6, type: 'delimiter.cpp' },
- { startIndex: 7, type: '' },
- { startIndex: 8, type: 'number.cpp' },
- { startIndex: 9, type: 'delimiter.cpp' },
- { startIndex: 10, type: '' },
- { startIndex: 11, type: 'comment.cpp' }
- ]
- }],
- // Comments - range comment, single line
- [{
- line: '/* a simple comment */',
- tokens: [
- { startIndex: 0, type: 'comment.cpp' }
- ]
- }],
- [{
- line: 'int x = /* a simple comment */ 1;',
- tokens: [
- { startIndex: 0, type: 'keyword.int.cpp' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'identifier.cpp' },
- { startIndex: 5, type: '' },
- { startIndex: 6, type: 'delimiter.cpp' },
- { startIndex: 7, type: '' },
- { startIndex: 8, type: 'comment.cpp' },
- { startIndex: 30, type: '' },
- { startIndex: 31, type: 'number.cpp' },
- { startIndex: 32, type: 'delimiter.cpp' }
- ]
- }],
- [{
- line: 'int x = /* comment */ 1; */',
- tokens: [
- { startIndex: 0, type: 'keyword.int.cpp' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'identifier.cpp' },
- { startIndex: 5, type: '' },
- { startIndex: 6, type: 'delimiter.cpp' },
- { startIndex: 7, type: '' },
- { startIndex: 8, type: 'comment.cpp' },
- { startIndex: 21, type: '' },
- { startIndex: 22, type: 'number.cpp' },
- { startIndex: 23, type: 'delimiter.cpp' },
- { startIndex: 24, type: '' }
- ]
- }],
- [{
- line: 'x = /**/;',
- tokens: [
- { startIndex: 0, type: 'identifier.cpp' },
- { startIndex: 1, type: '' },
- { startIndex: 2, type: 'delimiter.cpp' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'comment.cpp' },
- { startIndex: 8, type: 'delimiter.cpp' }
- ]
- }],
- [{
- line: 'x = /*/;',
- tokens: [
- { startIndex: 0, type: 'identifier.cpp' },
- { startIndex: 1, type: '' },
- { startIndex: 2, type: 'delimiter.cpp' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'comment.cpp' }
- ]
- }],
- // Numbers
- [{
- line: '0',
- tokens: [
- { startIndex: 0, type: 'number.cpp' }
- ]
- }],
- [{
- line: '12l',
- tokens: [
- { startIndex: 0, type: 'number.cpp' }
- ]
- }],
- [{
- line: '34U',
- tokens: [
- { startIndex: 0, type: 'number.cpp' }
- ]
- }],
- [{
- line: '55LL',
- tokens: [
- { startIndex: 0, type: 'number.cpp' }
- ]
- }],
- [{
- line: '34ul',
- tokens: [
- { startIndex: 0, type: 'number.cpp' }
- ]
- }],
- [{
- line: '55llU',
- tokens: [
- { startIndex: 0, type: 'number.cpp' }
- ]
- }],
- [{
- line: '5\'5llU',
- tokens: [
- { startIndex: 0, type: 'number.cpp' }
- ]
- }],
- [{
- line: '100\'000\'000',
- tokens: [
- { startIndex: 0, type: 'number.cpp' }
- ]
- }],
- [{
- line: '0x100\'aafllU',
- tokens: [
- { startIndex: 0, type: 'number.hex.cpp' }
- ]
- }],
- [{
- line: '0342\'325',
- tokens: [
- { startIndex: 0, type: 'number.octal.cpp' }
- ]
- }],
- [{
- line: '0x123',
- tokens: [
- { startIndex: 0, type: 'number.hex.cpp' }
- ]
- }],
- [{
- line: '23.5',
- tokens: [
- { startIndex: 0, type: 'number.float.cpp' }
- ]
- }],
- [{
- line: '23.5e3',
- tokens: [
- { startIndex: 0, type: 'number.float.cpp' }
- ]
- }],
- [{
- line: '23.5E3',
- tokens: [
- { startIndex: 0, type: 'number.float.cpp' }
- ]
- }],
- [{
- line: '23.5F',
- tokens: [
- { startIndex: 0, type: 'number.float.cpp' }
- ]
- }],
- [{
- line: '23.5f',
- tokens: [
- { startIndex: 0, type: 'number.float.cpp' }
- ]
- }],
- [{
- line: '1.72E3F',
- tokens: [
- { startIndex: 0, type: 'number.float.cpp' }
- ]
- }],
- [{
- line: '1.72E3f',
- tokens: [
- { startIndex: 0, type: 'number.float.cpp' }
- ]
- }],
- [{
- line: '1.72e3F',
- tokens: [
- { startIndex: 0, type: 'number.float.cpp' }
- ]
- }],
- [{
- line: '1.72e3f',
- tokens: [
- { startIndex: 0, type: 'number.float.cpp' }
- ]
- }],
- [{
- line: '23.5L',
- tokens: [
- { startIndex: 0, type: 'number.float.cpp' }
- ]
- }],
- [{
- line: '23.5l',
- tokens: [
- { startIndex: 0, type: 'number.float.cpp' }
- ]
- }],
- [{
- line: '1.72E3L',
- tokens: [
- { startIndex: 0, type: 'number.float.cpp' }
- ]
- }],
- [{
- line: '1.72E3l',
- tokens: [
- { startIndex: 0, type: 'number.float.cpp' }
- ]
- }],
- [{
- line: '1.72e3L',
- tokens: [
- { startIndex: 0, type: 'number.float.cpp' }
- ]
- }],
- [{
- line: '1.72e3l',
- tokens: [
- { startIndex: 0, type: 'number.float.cpp' }
- ]
- }],
- [{
- line: '0+0',
- tokens: [
- { startIndex: 0, type: 'number.cpp' },
- { startIndex: 1, type: 'delimiter.cpp' },
- { startIndex: 2, type: 'number.cpp' }
- ]
- }],
- [{
- line: '100+10',
- tokens: [
- { startIndex: 0, type: 'number.cpp' },
- { startIndex: 3, type: 'delimiter.cpp' },
- { startIndex: 4, type: 'number.cpp' }
- ]
- }],
- [{
- line: '0 + 0',
- tokens: [
- { startIndex: 0, type: 'number.cpp' },
- { startIndex: 1, type: '' },
- { startIndex: 2, type: 'delimiter.cpp' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'number.cpp' }
- ]
- }],
- // Monarch Generated
- [{
- line: '#include<iostream>',
- tokens: [
- { startIndex: 0, type: 'keyword.directive.include.cpp' },
- { startIndex: 8, type: 'keyword.directive.include.begin.cpp' },
- { startIndex: 9, type: 'string.include.identifier.cpp' },
- { startIndex: 17, type: 'keyword.directive.include.end.cpp' }
- ]
- }, {
- line: '#include "/path/to/my/file.h"',
- tokens: [
- { startIndex: 0, type: 'keyword.directive.include.cpp' },
- { startIndex: 8, type: '' },
- { startIndex: 9, type: 'keyword.directive.include.begin.cpp' },
- { startIndex: 10, type: 'string.include.identifier.cpp' },
- { startIndex: 28, type: 'keyword.directive.include.end.cpp' }
- ]
- }, {
- line: '',
- tokens: [
- ]
- }, {
- line: '#ifdef VAR',
- tokens: [
- { startIndex: 0, type: 'keyword.cpp' },
- { startIndex: 6, type: '' },
- { startIndex: 7, type: 'identifier.cpp' }
- ]
- }, {
- line: '#define SUM(A,B) (A) + (B)',
- tokens: [
- { startIndex: 0, type: 'keyword.cpp' },
- { startIndex: 7, type: '' },
- { startIndex: 8, type: 'identifier.cpp' },
- { startIndex: 11, type: 'delimiter.parenthesis.cpp' },
- { startIndex: 12, type: 'identifier.cpp' },
- { startIndex: 13, type: 'delimiter.cpp' },
- { startIndex: 14, type: 'identifier.cpp' },
- { startIndex: 15, type: 'delimiter.parenthesis.cpp' },
- { startIndex: 16, type: '' },
- { startIndex: 17, type: 'delimiter.parenthesis.cpp' },
- { startIndex: 18, type: 'identifier.cpp' },
- { startIndex: 19, type: 'delimiter.parenthesis.cpp' },
- { startIndex: 20, type: '' },
- { startIndex: 21, type: 'delimiter.cpp' },
- { startIndex: 22, type: '' },
- { startIndex: 23, type: 'delimiter.parenthesis.cpp' },
- { startIndex: 24, type: 'identifier.cpp' },
- { startIndex: 25, type: 'delimiter.parenthesis.cpp' }
- ]
- }, {
- line: '',
- tokens: [
- ]
- }, {
- line: 'int main(int argc, char** argv)',
- tokens: [
- { startIndex: 0, type: 'keyword.int.cpp' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'identifier.cpp' },
- { startIndex: 8, type: 'delimiter.parenthesis.cpp' },
- { startIndex: 9, type: 'keyword.int.cpp' },
- { startIndex: 12, type: '' },
- { startIndex: 13, type: 'identifier.cpp' },
- { startIndex: 17, type: 'delimiter.cpp' },
- { startIndex: 18, type: '' },
- { startIndex: 19, type: 'keyword.char.cpp' },
- { startIndex: 23, type: '' },
- { startIndex: 26, type: 'identifier.cpp' },
- { startIndex: 30, type: 'delimiter.parenthesis.cpp' }
- ]
- }, {
- line: '{',
- tokens: [
- { startIndex: 0, type: 'delimiter.curly.cpp' }
- ]
- }, {
- line: ' return 0;',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 1, type: 'keyword.return.cpp' },
- { startIndex: 7, type: '' },
- { startIndex: 8, type: 'number.cpp' },
- { startIndex: 9, type: 'delimiter.cpp' }
- ]
- }, {
- line: '}',
- tokens: [
- { startIndex: 0, type: 'delimiter.curly.cpp' }
- ]
- }, {
- line: '',
- tokens: [
- ]
- }, {
- line: 'namespace TestSpace',
- tokens: [
- { startIndex: 0, type: 'keyword.namespace.cpp' },
- { startIndex: 9, type: '' },
- { startIndex: 10, type: 'identifier.cpp' }
- ]
- }, {
- line: '{',
- tokens: [
- { startIndex: 0, type: 'delimiter.curly.cpp' }
- ]
- }, {
- line: ' using Asdf.CDE;',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 1, type: 'keyword.using.cpp' },
- { startIndex: 6, type: '' },
- { startIndex: 7, type: 'identifier.cpp' },
- { startIndex: 11, type: 'delimiter.cpp' },
- { startIndex: 12, type: 'identifier.cpp' },
- { startIndex: 15, type: 'delimiter.cpp' }
- ]
- }, {
- line: ' template <typename T>',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 1, type: 'keyword.template.cpp' },
- { startIndex: 9, type: '' },
- { startIndex: 10, type: 'delimiter.angle.cpp' },
- { startIndex: 11, type: 'keyword.typename.cpp' },
- { startIndex: 19, type: '' },
- { startIndex: 20, type: 'identifier.cpp' },
- { startIndex: 21, type: 'delimiter.angle.cpp' }
- ]
- }, {
- line: ' class CoolClass : protected BaseClass',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 1, type: 'keyword.class.cpp' },
- { startIndex: 6, type: '' },
- { startIndex: 7, type: 'identifier.cpp' },
- { startIndex: 16, type: '' },
- { startIndex: 17, type: 'delimiter.cpp' },
- { startIndex: 18, type: '' },
- { startIndex: 19, type: 'keyword.protected.cpp' },
- { startIndex: 28, type: '' },
- { startIndex: 29, type: 'identifier.cpp' }
- ]
- }, {
- line: ' {',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 1, type: 'delimiter.curly.cpp' }
- ]
- }, {
- line: ' private:',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 2, type: 'keyword.private.cpp' },
- { startIndex: 9, type: 'delimiter.cpp' }
- ]
- }, {
- line: ' ',
- tokens: [
- { startIndex: 0, type: '' }
- ]
- }, {
- line: ' static T field;',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 2, type: 'keyword.static.cpp' },
- { startIndex: 8, type: '' },
- { startIndex: 9, type: 'identifier.cpp' },
- { startIndex: 10, type: '' },
- { startIndex: 11, type: 'identifier.cpp' },
- { startIndex: 16, type: 'delimiter.cpp' }
- ]
- }, {
- line: ' ',
- tokens: [
- { startIndex: 0, type: '' }
- ]
- }, {
- line: ' public:',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 2, type: 'keyword.public.cpp' },
- { startIndex: 8, type: 'delimiter.cpp' }
- ]
- }, {
- line: ' ',
- tokens: [
- { startIndex: 0, type: '' }
- ]
- }, {
- line: ' [[deprecated]]',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 2, type: 'annotation.cpp' }
- ]
- }, {
- line: ' foo method() const override',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 2, type: 'identifier.cpp' },
- { startIndex: 5, type: '' },
- { startIndex: 6, type: 'identifier.cpp' },
- { startIndex: 12, type: 'delimiter.parenthesis.cpp' },
- { startIndex: 14, type: '' },
- { startIndex: 15, type: 'keyword.const.cpp' },
- { startIndex: 20, type: '' },
- { startIndex: 21, type: 'keyword.override.cpp' }
- ]
- }, {
- line: ' {',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 2, type: 'delimiter.curly.cpp' }
- ]
- }, {
- line: ' auto s = new Bar();',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 3, type: 'keyword.auto.cpp' },
- { startIndex: 7, type: '' },
- { startIndex: 8, type: 'identifier.cpp' },
- { startIndex: 9, type: '' },
- { startIndex: 10, type: 'delimiter.cpp' },
- { startIndex: 11, type: '' },
- { startIndex: 12, type: 'keyword.new.cpp' },
- { startIndex: 15, type: '' },
- { startIndex: 16, type: 'identifier.cpp' },
- { startIndex: 19, type: 'delimiter.parenthesis.cpp' },
- { startIndex: 21, type: 'delimiter.cpp' }
- ]
- }, {
- line: ' ',
- tokens: [
- { startIndex: 0, type: '' }
- ]
- }, {
- line: ' if (s.field) {',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 3, type: 'keyword.if.cpp' },
- { startIndex: 5, type: '' },
- { startIndex: 6, type: 'delimiter.parenthesis.cpp' },
- { startIndex: 7, type: 'identifier.cpp' },
- { startIndex: 8, type: 'delimiter.cpp' },
- { startIndex: 9, type: 'identifier.cpp' },
- { startIndex: 14, type: 'delimiter.parenthesis.cpp' },
- { startIndex: 15, type: '' },
- { startIndex: 16, type: 'delimiter.curly.cpp' }
- ]
- }, {
- line: ' for(const auto & b : s.field) {',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 4, type: 'keyword.for.cpp' },
- { startIndex: 7, type: 'delimiter.parenthesis.cpp' },
- { startIndex: 8, type: 'keyword.const.cpp' },
- { startIndex: 13, type: '' },
- { startIndex: 14, type: 'keyword.auto.cpp' },
- { startIndex: 18, type: '' },
- { startIndex: 19, type: 'delimiter.cpp' },
- { startIndex: 20, type: '' },
- { startIndex: 21, type: 'identifier.cpp' },
- { startIndex: 22, type: '' },
- { startIndex: 23, type: 'delimiter.cpp' },
- { startIndex: 24, type: '' },
- { startIndex: 25, type: 'identifier.cpp' },
- { startIndex: 26, type: 'delimiter.cpp' },
- { startIndex: 27, type: 'identifier.cpp' },
- { startIndex: 32, type: 'delimiter.parenthesis.cpp' },
- { startIndex: 33, type: '' },
- { startIndex: 34, type: 'delimiter.curly.cpp' }
- ]
- }, {
- line: ' break;',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 5, type: 'keyword.break.cpp' },
- { startIndex: 10, type: 'delimiter.cpp' }
- ]
- }, {
- line: ' }',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 4, type: 'delimiter.curly.cpp' }
- ]
- }, {
- line: ' }',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 3, type: 'delimiter.curly.cpp' }
- ]
- }, {
- line: ' }',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 2, type: 'delimiter.curly.cpp' }
- ]
- }, {
- line: ' ',
- tokens: [
- { startIndex: 0, type: '' }
- ]
- }, {
- line: ' std::string s = "hello wordld\\n";',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 2, type: 'identifier.cpp' },
- { startIndex: 5, type: '' },
- { startIndex: 7, type: 'identifier.cpp' },
- { startIndex: 13, type: '' },
- { startIndex: 14, type: 'identifier.cpp' },
- { startIndex: 15, type: '' },
- { startIndex: 16, type: 'delimiter.cpp' },
- { startIndex: 17, type: '' },
- { startIndex: 18, type: 'string.cpp' },
- { startIndex: 31, type: 'string.escape.cpp' },
- { startIndex: 33, type: 'string.cpp' },
- { startIndex: 34, type: 'delimiter.cpp' }
- ]
- }, {
- line: ' ',
- tokens: [
- { startIndex: 0, type: '' }
- ]
- }, {
- line: ' int number = 123\'123\'123Ull;',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 2, type: 'keyword.int.cpp' },
- { startIndex: 5, type: '' },
- { startIndex: 6, type: 'identifier.cpp' },
- { startIndex: 12, type: '' },
- { startIndex: 13, type: 'delimiter.cpp' },
- { startIndex: 14, type: '' },
- { startIndex: 15, type: 'number.cpp' },
- { startIndex: 29, type: 'delimiter.cpp' }
- ]
- }, {
- line: ' }',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 1, type: 'delimiter.curly.cpp' }
- ]
- }, {
- line: '}',
- tokens: [
- { startIndex: 0, type: 'delimiter.curly.cpp' }
- ]
- }, {
- line: '',
- tokens: [
- ]
- }, {
- line: '#endif',
- tokens: [
- { startIndex: 0, type: 'keyword.cpp' }
- ]
- }, {
- line: '# ifdef VAR',
- tokens: [
- { startIndex: 0, type: 'keyword.cpp' },
- { startIndex: 10, type: '' },
- { startIndex: 11, type: 'identifier.cpp' }
- ]
- }, {
- line: '# define SUM(A,B) (A) + (B)',
- tokens: [
- { startIndex: 0, type: 'keyword.cpp' },
- { startIndex: 8, type: '' },
- { startIndex: 9, type: 'identifier.cpp' },
- { startIndex: 12, type: 'delimiter.parenthesis.cpp' },
- { startIndex: 13, type: 'identifier.cpp' },
- { startIndex: 14, type: 'delimiter.cpp' },
- { startIndex: 15, type: 'identifier.cpp' },
- { startIndex: 16, type: 'delimiter.parenthesis.cpp' },
- { startIndex: 17, type: '' },
- { startIndex: 18, type: 'delimiter.parenthesis.cpp' },
- { startIndex: 19, type: 'identifier.cpp' },
- { startIndex: 20, type: 'delimiter.parenthesis.cpp' },
- { startIndex: 21, type: '' },
- { startIndex: 22, type: 'delimiter.cpp' },
- { startIndex: 23, type: '' },
- { startIndex: 24, type: 'delimiter.parenthesis.cpp' },
- { startIndex: 25, type: 'identifier.cpp' },
- { startIndex: 26, type: 'delimiter.parenthesis.cpp' }
- ]
- }, {
- line: 'uR"V0G0N(abc)V0G0N"def',
- tokens: [
- { startIndex: 0, type: 'string.raw.begin.cpp' },
- { startIndex: 9, type: 'string.raw.cpp' },
- { startIndex: 12, type: 'string.raw.end.cpp' },
- { startIndex: 19, type: 'identifier.cpp' }
- ]
- }]
- ]);
|