123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924 |
- /*---------------------------------------------------------------------------------------------
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *--------------------------------------------------------------------------------------------*/
- import { testTokenization } from '../test/testRunner';
- testTokenization('javascript', [
- // Keywords
- [
- {
- line: 'var x = function() { };',
- tokens: [
- { startIndex: 0, type: 'keyword.js' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'identifier.js' },
- { startIndex: 5, type: '' },
- { startIndex: 6, type: 'delimiter.js' },
- { startIndex: 7, type: '' },
- { startIndex: 8, type: 'keyword.js' },
- { startIndex: 16, type: 'delimiter.parenthesis.js' },
- { startIndex: 18, type: '' },
- { startIndex: 19, type: 'delimiter.bracket.js' },
- { startIndex: 20, type: '' },
- { startIndex: 21, type: 'delimiter.bracket.js' },
- { startIndex: 22, type: 'delimiter.js' }
- ]
- }
- ],
- [
- {
- line: ' var ',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 4, type: 'keyword.js' },
- { startIndex: 7, type: '' }
- ]
- }
- ],
- // identifiers
- [
- {
- line: 'foo;',
- tokens: [
- { startIndex: 0, type: 'identifier.js' },
- { startIndex: 3, type: 'delimiter.js' }
- ]
- }
- ],
- [
- {
- line: 'foo() { return 1; }',
- tokens: [
- { startIndex: 0, type: 'identifier.js' },
- { startIndex: 3, type: 'delimiter.parenthesis.js' },
- { startIndex: 5, type: '' },
- { startIndex: 6, type: 'delimiter.bracket.js' },
- { startIndex: 7, type: '' },
- { startIndex: 8, type: 'keyword.js' },
- { startIndex: 14, type: '' },
- { startIndex: 15, type: 'number.js' },
- { startIndex: 16, type: 'delimiter.js' },
- { startIndex: 17, type: '' },
- { startIndex: 18, type: 'delimiter.bracket.js' }
- ]
- }
- ],
- [
- {
- line: '#foo;',
- tokens: [
- { startIndex: 0, type: 'identifier.js' },
- { startIndex: 4, type: 'delimiter.js' }
- ]
- }
- ],
- [
- {
- line: '#foo() { return 1; }',
- tokens: [
- { startIndex: 0, type: 'identifier.js' },
- { startIndex: 4, type: 'delimiter.parenthesis.js' },
- { startIndex: 6, type: '' },
- { startIndex: 7, type: 'delimiter.bracket.js' },
- { startIndex: 8, type: '' },
- { startIndex: 9, type: 'keyword.js' },
- { startIndex: 15, type: '' },
- { startIndex: 16, type: 'number.js' },
- { startIndex: 17, type: 'delimiter.js' },
- { startIndex: 18, type: '' },
- { startIndex: 19, type: 'delimiter.bracket.js' }
- ]
- }
- ],
- // Comments - single line
- [
- {
- line: '//',
- tokens: [{ startIndex: 0, type: 'comment.js' }]
- }
- ],
- [
- {
- line: ' // a comment',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 4, type: 'comment.js' }
- ]
- }
- ],
- [
- {
- line: '// a comment',
- tokens: [{ startIndex: 0, type: 'comment.js' }]
- }
- ],
- [
- {
- line: '// a comment /*',
- tokens: [{ startIndex: 0, type: 'comment.js' }]
- }
- ],
- [
- {
- line: '// a comment /**',
- tokens: [{ startIndex: 0, type: 'comment.js' }]
- }
- ],
- [
- {
- line: '//sticky comment',
- tokens: [{ startIndex: 0, type: 'comment.js' }]
- }
- ],
- [
- {
- line: 'var x = 1; // my comment // is a nice one',
- tokens: [
- { startIndex: 0, type: 'keyword.js' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'identifier.js' },
- { startIndex: 5, type: '' },
- { startIndex: 6, type: 'delimiter.js' },
- { startIndex: 7, type: '' },
- { startIndex: 8, type: 'number.js' },
- { startIndex: 9, type: 'delimiter.js' },
- { startIndex: 10, type: '' },
- { startIndex: 11, type: 'comment.js' }
- ]
- }
- ],
- // Comments - range comment, single line
- [
- {
- line: '/* a simple comment */',
- tokens: [{ startIndex: 0, type: 'comment.js' }]
- }
- ],
- [
- {
- line: 'var x = /* a simple comment */ 1;',
- tokens: [
- { startIndex: 0, type: 'keyword.js' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'identifier.js' },
- { startIndex: 5, type: '' },
- { startIndex: 6, type: 'delimiter.js' },
- { startIndex: 7, type: '' },
- { startIndex: 8, type: 'comment.js' },
- { startIndex: 30, type: '' },
- { startIndex: 31, type: 'number.js' },
- { startIndex: 32, type: 'delimiter.js' }
- ]
- }
- ],
- [
- {
- line: 'x = /**/;',
- tokens: [
- { startIndex: 0, type: 'identifier.js' },
- { startIndex: 1, type: '' },
- { startIndex: 2, type: 'delimiter.js' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'comment.js' },
- { startIndex: 8, type: 'delimiter.js' }
- ]
- }
- ],
- [
- {
- line: 'x = /*/;',
- tokens: [
- { startIndex: 0, type: 'identifier.js' },
- { startIndex: 1, type: '' },
- { startIndex: 2, type: 'delimiter.js' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'comment.js' }
- ]
- }
- ],
- // Comments - range comment, multi lines
- [
- {
- line: '/* a multiline comment',
- tokens: [{ startIndex: 0, type: 'comment.js' }]
- },
- {
- line: 'can actually span',
- tokens: [{ startIndex: 0, type: 'comment.js' }]
- },
- {
- line: 'multiple lines */',
- tokens: [{ startIndex: 0, type: 'comment.js' }]
- }
- ],
- [
- {
- line: 'var x = /* start a comment',
- tokens: [
- { startIndex: 0, type: 'keyword.js' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'identifier.js' },
- { startIndex: 5, type: '' },
- { startIndex: 6, type: 'delimiter.js' },
- { startIndex: 7, type: '' },
- { startIndex: 8, type: 'comment.js' }
- ]
- },
- {
- line: ' a ',
- tokens: [{ startIndex: 0, type: 'comment.js' }]
- },
- {
- line: 'and end it */ var a = 2;',
- tokens: [
- { startIndex: 0, type: 'comment.js' },
- { startIndex: 13, type: '' },
- { startIndex: 14, type: 'keyword.js' },
- { startIndex: 17, type: '' },
- { startIndex: 18, type: 'identifier.js' },
- { startIndex: 19, type: '' },
- { startIndex: 20, type: 'delimiter.js' },
- { startIndex: 21, type: '' },
- { startIndex: 22, type: 'number.js' },
- { startIndex: 23, type: 'delimiter.js' }
- ]
- }
- ],
- // Strings
- [
- {
- line: "var a = 'a';",
- tokens: [
- { startIndex: 0, type: 'keyword.js' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'identifier.js' },
- { startIndex: 5, type: '' },
- { startIndex: 6, type: 'delimiter.js' },
- { startIndex: 7, type: '' },
- { startIndex: 8, type: 'string.js' },
- { startIndex: 11, type: 'delimiter.js' }
- ]
- }
- ],
- [
- {
- line: '"use strict";',
- tokens: [
- { startIndex: 0, type: 'string.js' },
- { startIndex: 12, type: 'delimiter.js' }
- ]
- }
- ],
- [
- {
- line: 'b = a + " \'cool\' "',
- tokens: [
- { startIndex: 0, type: 'identifier.js' },
- { startIndex: 1, type: '' },
- { startIndex: 2, type: 'delimiter.js' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'identifier.js' },
- { startIndex: 5, type: '' },
- { startIndex: 6, type: 'delimiter.js' },
- { startIndex: 7, type: '' },
- { startIndex: 8, type: 'string.js' }
- ]
- }
- ],
- [
- {
- line: '"escaping \\"quotes\\" is cool"',
- tokens: [
- { startIndex: 0, type: 'string.js' },
- { startIndex: 10, type: 'string.escape.js' },
- { startIndex: 12, type: 'string.js' },
- { startIndex: 18, type: 'string.escape.js' },
- { startIndex: 20, type: 'string.js' }
- ]
- }
- ],
- [
- {
- line: "'''",
- tokens: [
- { startIndex: 0, type: 'string.js' },
- { startIndex: 2, type: 'string.invalid.js' }
- ]
- }
- ],
- [
- {
- line: "'\\''",
- tokens: [
- { startIndex: 0, type: 'string.js' },
- { startIndex: 1, type: 'string.escape.js' },
- { startIndex: 3, type: 'string.js' }
- ]
- }
- ],
- [
- {
- line: "'be careful \\not to escape'",
- tokens: [
- { startIndex: 0, type: 'string.js' },
- { startIndex: 12, type: 'string.escape.js' },
- { startIndex: 14, type: 'string.js' }
- ]
- }
- ],
- // Numbers
- [
- {
- line: '0',
- tokens: [{ startIndex: 0, type: 'number.js' }]
- }
- ],
- [
- {
- line: ' 0',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 1, type: 'number.js' }
- ]
- }
- ],
- [
- {
- line: ' 0 ',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 1, type: 'number.js' },
- { startIndex: 2, type: '' }
- ]
- }
- ],
- [
- {
- line: '0 ',
- tokens: [
- { startIndex: 0, type: 'number.js' },
- { startIndex: 1, type: '' }
- ]
- }
- ],
- [
- {
- line: '0+0',
- tokens: [
- { startIndex: 0, type: 'number.js' },
- { startIndex: 1, type: 'delimiter.js' },
- { startIndex: 2, type: 'number.js' }
- ]
- }
- ],
- [
- {
- line: '100+10',
- tokens: [
- { startIndex: 0, type: 'number.js' },
- { startIndex: 3, type: 'delimiter.js' },
- { startIndex: 4, type: 'number.js' }
- ]
- }
- ],
- [
- {
- line: '0 + 0',
- tokens: [
- { startIndex: 0, type: 'number.js' },
- { startIndex: 1, type: '' },
- { startIndex: 2, type: 'delimiter.js' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'number.js' }
- ]
- }
- ],
- [
- {
- line: '0123',
- tokens: [{ startIndex: 0, type: 'number.octal.js' }]
- }
- ],
- [
- {
- line: '01239',
- tokens: [
- { startIndex: 0, type: 'number.octal.js' },
- { startIndex: 4, type: 'number.js' }
- ]
- }
- ],
- [
- {
- line: '0o123',
- tokens: [{ startIndex: 0, type: 'number.octal.js' }]
- }
- ],
- [
- {
- line: '0O123',
- tokens: [{ startIndex: 0, type: 'number.octal.js' }]
- }
- ],
- [
- {
- line: '0x',
- tokens: [
- { startIndex: 0, type: 'number.js' },
- { startIndex: 1, type: 'identifier.js' }
- ]
- }
- ],
- [
- {
- line: '0x123',
- tokens: [{ startIndex: 0, type: 'number.hex.js' }]
- }
- ],
- [
- {
- line: '0X123',
- tokens: [{ startIndex: 0, type: 'number.hex.js' }]
- }
- ],
- [
- {
- line: '0b101',
- tokens: [{ startIndex: 0, type: 'number.binary.js' }]
- }
- ],
- [
- {
- line: '0B101',
- tokens: [{ startIndex: 0, type: 'number.binary.js' }]
- }
- ],
- // Bigint
- [
- {
- line: '0n',
- tokens: [{ startIndex: 0, type: 'number.js' }]
- }
- ],
- [
- {
- line: ' 0n',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 1, type: 'number.js' }
- ]
- }
- ],
- [
- {
- line: ' 0n ',
- tokens: [
- { startIndex: 0, type: '' },
- { startIndex: 1, type: 'number.js' },
- { startIndex: 3, type: '' }
- ]
- }
- ],
- [
- {
- line: '0n ',
- tokens: [
- { startIndex: 0, type: 'number.js' },
- { startIndex: 2, type: '' }
- ]
- }
- ],
- [
- {
- line: '0n+0n',
- tokens: [
- { startIndex: 0, type: 'number.js' },
- { startIndex: 2, type: 'delimiter.js' },
- { startIndex: 3, type: 'number.js' }
- ]
- }
- ],
- [
- {
- line: '100n+10n',
- tokens: [
- { startIndex: 0, type: 'number.js' },
- { startIndex: 4, type: 'delimiter.js' },
- { startIndex: 5, type: 'number.js' }
- ]
- }
- ],
- [
- {
- line: '0n + 0n',
- tokens: [
- { startIndex: 0, type: 'number.js' },
- { startIndex: 2, type: '' },
- { startIndex: 3, type: 'delimiter.js' },
- { startIndex: 4, type: '' },
- { startIndex: 5, type: 'number.js' }
- ]
- }
- ],
- [
- {
- line: '0b101n',
- tokens: [{ startIndex: 0, type: 'number.binary.js' }]
- }
- ],
- [
- {
- line: '0123n',
- tokens: [{ startIndex: 0, type: 'number.octal.js' }]
- }
- ],
- [
- {
- line: '0o123n',
- tokens: [{ startIndex: 0, type: 'number.octal.js' }]
- }
- ],
- [
- {
- line: '0x123n',
- tokens: [{ startIndex: 0, type: 'number.hex.js' }]
- }
- ],
- // Regular Expressions
- [
- {
- line: '//',
- tokens: [{ startIndex: 0, type: 'comment.js' }]
- }
- ],
- [
- {
- line: '/**/',
- tokens: [{ startIndex: 0, type: 'comment.js' }]
- }
- ],
- [
- {
- line: '/***/',
- tokens: [{ startIndex: 0, type: 'comment.doc.js' }]
- }
- ],
- [
- {
- line: '5 / 3;',
- tokens: [
- { startIndex: 0, type: 'number.js' },
- { startIndex: 1, type: '' },
- { startIndex: 2, type: 'delimiter.js' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'number.js' },
- { startIndex: 5, type: 'delimiter.js' }
- ]
- }
- ],
- // Advanced regular expressions
- [
- {
- line: '1 / 2; /* comment',
- tokens: [
- { startIndex: 0, type: 'number.js' },
- { startIndex: 1, type: '' },
- { startIndex: 2, type: 'delimiter.js' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'number.js' },
- { startIndex: 5, type: 'delimiter.js' },
- { startIndex: 6, type: '' },
- { startIndex: 7, type: 'comment.js' }
- ]
- }
- ],
- [
- {
- line: '1 / 2 / x / b;',
- tokens: [
- { startIndex: 0, type: 'number.js' },
- { startIndex: 1, type: '' },
- { startIndex: 2, type: 'delimiter.js' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'number.js' },
- { startIndex: 5, type: '' },
- { startIndex: 6, type: 'delimiter.js' },
- { startIndex: 7, type: '' },
- { startIndex: 8, type: 'identifier.js' },
- { startIndex: 9, type: '' },
- { startIndex: 10, type: 'delimiter.js' },
- { startIndex: 11, type: '' },
- { startIndex: 12, type: 'identifier.js' },
- { startIndex: 13, type: 'delimiter.js' }
- ]
- }
- ],
- [
- {
- line: "x = /foo/.test('')",
- tokens: [
- { startIndex: 0, type: 'identifier.js' },
- { startIndex: 1, type: '' },
- { startIndex: 2, type: 'delimiter.js' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'regexp.js' },
- { startIndex: 9, type: 'delimiter.js' },
- { startIndex: 10, type: 'identifier.js' },
- { startIndex: 14, type: 'delimiter.parenthesis.js' },
- { startIndex: 15, type: 'string.js' },
- { startIndex: 17, type: 'delimiter.parenthesis.js' }
- ]
- }
- ],
- [
- {
- line: '/foo/',
- tokens: [{ startIndex: 0, type: 'regexp.js' }]
- }
- ],
- [
- {
- line: '/foo/g',
- tokens: [
- { startIndex: 0, type: 'regexp.js' },
- { startIndex: 5, type: 'keyword.other.js' }
- ]
- }
- ],
- [
- {
- line: '/foo/dgimsuy',
- tokens: [
- { startIndex: 0, type: 'regexp.js' },
- { startIndex: 5, type: 'keyword.other.js' }
- ]
- }
- ],
- [
- {
- line: '/foo/q', // invalid flag
- tokens: [
- { startIndex: 0, type: 'delimiter.js' },
- { startIndex: 1, type: 'identifier.js' },
- { startIndex: 4, type: 'delimiter.js' },
- { startIndex: 5, type: 'identifier.js' }
- ]
- }
- ],
- [
- {
- line: 'x = 1 + f(2 / 3, /foo/)',
- tokens: [
- { startIndex: 0, type: 'identifier.js' },
- { startIndex: 1, type: '' },
- { startIndex: 2, type: 'delimiter.js' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'number.js' },
- { startIndex: 5, type: '' },
- { startIndex: 6, type: 'delimiter.js' },
- { startIndex: 7, type: '' },
- { startIndex: 8, type: 'identifier.js' },
- { startIndex: 9, type: 'delimiter.parenthesis.js' },
- { startIndex: 10, type: 'number.js' },
- { startIndex: 11, type: '' },
- { startIndex: 12, type: 'delimiter.js' },
- { startIndex: 13, type: '' },
- { startIndex: 14, type: 'number.js' },
- { startIndex: 15, type: 'delimiter.js' },
- { startIndex: 16, type: '' },
- { startIndex: 17, type: 'regexp.js' },
- { startIndex: 22, type: 'delimiter.parenthesis.js' }
- ]
- }
- ],
- [
- {
- line: 'a /ads/ b;',
- tokens: [
- { startIndex: 0, type: 'identifier.js' },
- { startIndex: 1, type: '' },
- { startIndex: 2, type: 'delimiter.js' },
- { startIndex: 3, type: 'identifier.js' },
- { startIndex: 6, type: 'delimiter.js' },
- { startIndex: 7, type: '' },
- { startIndex: 8, type: 'identifier.js' },
- { startIndex: 9, type: 'delimiter.js' }
- ]
- }
- ],
- [
- {
- line: '1/(2/3)/2/3;',
- tokens: [
- { startIndex: 0, type: 'number.js' },
- { startIndex: 1, type: 'delimiter.js' },
- { startIndex: 2, type: 'delimiter.parenthesis.js' },
- { startIndex: 3, type: 'number.js' },
- { startIndex: 4, type: 'delimiter.js' },
- { startIndex: 5, type: 'number.js' },
- { startIndex: 6, type: 'delimiter.parenthesis.js' },
- { startIndex: 7, type: 'delimiter.js' },
- { startIndex: 8, type: 'number.js' },
- { startIndex: 9, type: 'delimiter.js' },
- { startIndex: 10, type: 'number.js' },
- { startIndex: 11, type: 'delimiter.js' }
- ]
- }
- ],
- [
- {
- line: '{ key: 123 }',
- tokens: [
- { startIndex: 0, type: 'delimiter.bracket.js' },
- { startIndex: 1, type: '' },
- { startIndex: 2, type: 'identifier.js' },
- { startIndex: 5, type: 'delimiter.js' },
- { startIndex: 6, type: '' },
- { startIndex: 7, type: 'number.js' },
- { startIndex: 10, type: '' },
- { startIndex: 11, type: 'delimiter.bracket.js' }
- ]
- }
- ],
- [
- {
- line: '[1,2,3]',
- tokens: [
- { startIndex: 0, type: 'delimiter.square.js' },
- { startIndex: 1, type: 'number.js' },
- { startIndex: 2, type: 'delimiter.js' },
- { startIndex: 3, type: 'number.js' },
- { startIndex: 4, type: 'delimiter.js' },
- { startIndex: 5, type: 'number.js' },
- { startIndex: 6, type: 'delimiter.square.js' }
- ]
- }
- ],
- [
- {
- line: 'foo(123);',
- tokens: [
- { startIndex: 0, type: 'identifier.js' },
- { startIndex: 3, type: 'delimiter.parenthesis.js' },
- { startIndex: 4, type: 'number.js' },
- { startIndex: 7, type: 'delimiter.parenthesis.js' },
- { startIndex: 8, type: 'delimiter.js' }
- ]
- }
- ],
- [
- {
- line: '{a:{b:[]}}',
- tokens: [
- { startIndex: 0, type: 'delimiter.bracket.js' },
- { startIndex: 1, type: 'identifier.js' },
- { startIndex: 2, type: 'delimiter.js' },
- { startIndex: 3, type: 'delimiter.bracket.js' },
- { startIndex: 4, type: 'identifier.js' },
- { startIndex: 5, type: 'delimiter.js' },
- { startIndex: 6, type: 'delimiter.square.js' },
- { startIndex: 8, type: 'delimiter.bracket.js' }
- ]
- }
- ],
- [
- {
- line: 'x = "[{()}]"',
- tokens: [
- { startIndex: 0, type: 'identifier.js' },
- { startIndex: 1, type: '' },
- { startIndex: 2, type: 'delimiter.js' },
- { startIndex: 3, type: '' },
- { startIndex: 4, type: 'string.js' }
- ]
- }
- ],
- [
- {
- line: 'test ? 1 : 2',
- tokens: [
- { startIndex: 0, type: 'identifier.js' },
- { startIndex: 4, type: '' },
- { startIndex: 5, type: 'delimiter.js' },
- { startIndex: 6, type: '' },
- { startIndex: 7, type: 'number.js' },
- { startIndex: 8, type: '' },
- { startIndex: 9, type: 'delimiter.js' },
- { startIndex: 10, type: '' },
- { startIndex: 11, type: 'number.js' }
- ]
- }
- ],
- [
- {
- line: 'couldBeNullish ?? 1',
- tokens: [
- { startIndex: 0, type: 'identifier.js' },
- { startIndex: 14, type: '' },
- { startIndex: 15, type: 'delimiter.js' },
- { startIndex: 17, type: '' },
- { startIndex: 18, type: 'number.js' }
- ]
- }
- ],
- [
- {
- line: "`${5 + 'x' + 3}a${4}`",
- tokens: [
- { startIndex: 0, type: 'string.js' },
- { startIndex: 1, type: 'delimiter.bracket.js' },
- { startIndex: 3, type: 'number.js' },
- { startIndex: 4, type: '' },
- { startIndex: 5, type: 'delimiter.js' },
- { startIndex: 6, type: '' },
- { startIndex: 7, type: 'string.js' },
- { startIndex: 10, type: '' },
- { startIndex: 11, type: 'delimiter.js' },
- { startIndex: 12, type: '' },
- { startIndex: 13, type: 'number.js' },
- { startIndex: 14, type: 'delimiter.bracket.js' },
- { startIndex: 15, type: 'string.js' },
- { startIndex: 16, type: 'delimiter.bracket.js' },
- { startIndex: 18, type: 'number.js' },
- { startIndex: 19, type: 'delimiter.bracket.js' },
- { startIndex: 20, type: 'string.js' }
- ]
- }
- ]
- ]);
|