lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

syntax_test_js.js (44694B)


      1 // SYNTAX TEST "Packages/JavaScript/JavaScript.sublime-syntax"
      2 
      3 // This object literal is technically broken since foo() does not have a
      4 // method body, but we include it here to ensure that highlighting is not
      5 // broken as the user is typing
      6 let a = { otherIdentifier, foo(), baz: 1 }
      7 //      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping
      8 //        ^^^^^^^^^^^^^^^ variable.other.readwrite
      9 //                         ^^^ entity.name.function
     10 //                                ^^^ meta.mapping.key
     11 
     12 someFunction({
     13     prop1, prop2, prop3
     14 //  ^ variable.other.readwrite
     15 //         ^ variable.other.readwrite
     16 //                ^ variable.other.readwrite
     17 });
     18 
     19     function foo() {
     20 //  ^^^^^^^^^^^^^^^^ meta.function - meta.function meta.function
     21 //  ^^^^^^^^ keyword.declaration.function
     22 //           ^^^ entity.name.function
     23     }
     24 //  ^ meta.function meta.block
     25 
     26     var bar = function() {
     27 //  ^^^ keyword.declaration
     28 //      ^^^ entity.name.function variable.other.readwrite
     29 //            ^^^^^^^^^^^^ meta.function - meta.function meta.function
     30 //            ^^^^^^^^ keyword.declaration.function
     31     }
     32 
     33     baz = function*()
     34 //  ^^^ entity.name.function variable.other.readwrite
     35 //        ^^^^^^^^^^^ meta.function - meta.function meta.function
     36 //        ^^^^^^^^ keyword.declaration.function
     37 //                ^ keyword.declaration.generator
     38     {
     39 
     40     }
     41 
     42     async /**//**//**/ function foo() {}
     43 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function
     44 
     45 // Better highlighting when typing
     46 function
     47 function() {}
     48 // <- keyword.declaration.function - entity.name.function
     49 
     50 function foo(){}/**/
     51 //              ^ - meta.function
     52 
     53 // This is a comment function() { }
     54 // <- punctuation.definition.comment
     55 // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash
     56 
     57 /**
     58 // <- comment.block.documentation punctuation.definition.comment.begin
     59 */
     60 // <- comment.block.documentation punctuation.definition.comment.end
     61 
     62 /**
     63     *
     64 //  ^ comment.block.documentation.js punctuation.definition.comment.js
     65 */
     66 
     67 /*
     68 // <- comment.block punctuation.definition.comment
     69 */
     70 
     71 x --> y;
     72 //^^ keyword.operator.arithmetic.js
     73 //  ^ keyword.operator.comparison.js
     74 
     75 #! /usr/bin/env node
     76 // <- comment.line.shebang punctuation.definition.comment
     77 
     78  #! /usr/bin/env node
     79 //^^^^^^^^^^^^^^^^^^^ - comment.line.shebang
     80 
     81 /*@if /*/
     82 //     ^^ punctuation.definition.comment.end
     83 
     84 // /*
     85 not_a_comment;
     86 // <- -comment
     87 
     88 /* // */
     89 not_a_comment;
     90 // <- -comment
     91 
     92 /* /* */
     93 not_a_comment;
     94 // <- -comment
     95 
     96 '// /* not a comment';
     97 // ^^^^^^^^^^^^^^^^^^^ -comment
     98 
     99 "// /* not a comment";
    100 // ^^^^^^^^^^^^^^^^^^^ -comment
    101 
    102 `// /* not a comment`;
    103 // ^^^^^^^^^^^^^^^^^^^ -comment
    104 
    105 ({
    106     '// /* not a comment': x => x,
    107 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -comment
    108 
    109     "// /* not a comment": x => x,
    110 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -comment
    111 
    112     '// /* not a comment'() {},
    113 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -comment() {}
    114 
    115     "// /* not a comment"() {},
    116 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -comment() {}
    117 });
    118 
    119 1
    120     /* Block Comment */
    121 //  ^^^^^^^^^^^^^^^^^^^ comment.block
    122 
    123 {
    124     let _$Foobar1Ù𝓩ʷªאξ‿ᛮↂ〩;
    125 //      ^^^^^^^^^^^^^^^^^^^ variable.other.readwrite
    126 
    127     let ಠ_ಠ;
    128 //      ^^^ variable.other.readwrite
    129 
    130     function \u004axyz () {}; // Letter J
    131 //           ^^^^^^^^^ entity.name.function
    132 
    133     function xyz\u004axyz () {};
    134 //           ^^^^^^^^^^^^ entity.name.function
    135 
    136     function xyz\u{0ca0}xyz () {}; // Letter ಠ
    137 //           ^^^^^^^^^^^^^^ entity.name.function
    138 
    139     import$;export$;class$;throw$;break$;continue$;goto$;return$;debugger$;let$;const$;var$;
    140 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - keyword
    141 
    142     switch$;do$;while$;for$;if$;with$:try$;catch$;finally$;new$;delete$;typeof$;void$;
    143 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - keyword
    144 
    145     true$;false$;null$;undefined$;NaN$;Infinity$;this$;
    146 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - constant.language
    147 
    148     x
    149     instanceof$;
    150 //  ^^^^^^^^^^^ - keyword
    151 
    152     x
    153     in$;
    154 //  ^^^ - keyword
    155 
    156     await$ [];
    157 //  ^^^^^^ variable.other
    158 //         ^^ meta.brackets - meta.sequence
    159 
    160     yield$ [];
    161 //  ^^^^^^ variable.other
    162 //         ^^ meta.brackets - meta.sequence
    163 
    164 };
    165 
    166 var str = '\':';
    167 var str2 = NaN;
    168 // <- keyword.declaration
    169 //   ^ variable.other.readwrite
    170 //       ^ keyword.operator.assignment
    171 //         ^^^ constant.language.nan
    172 
    173 tag`Hello ${ a + b } world\nanother ${expression}.`;
    174 // <- variable.function.tagged-template
    175 // ^ punctuation.definition.string.begin
    176 // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string
    177 // ^^^^^^^ string.quoted.other
    178 //        ^^^^^^^^^^ meta.interpolation - string
    179 //        ^ punctuation.section.interpolation.begin
    180 //           ^ variable.other.readwrite
    181 //             ^ keyword.operator.arithmetic
    182 //               ^ source.js.embedded
    183 //                 ^ punctuation.section.interpolation.end
    184 //                  ^^^^^^^^^^^^^^^^ string.quoted.other
    185 //                        ^ constant.character.escape
    186 //                                  ^^^^^^^^^^^^^ meta.interpolation - string
    187 //                                  ^^ punctuation.section.interpolation.begin
    188 //                                              ^ punctuation.section.interpolation.end
    189 //                                               ^^ string.quoted.other
    190 //                                                ^ punctuation.definition.string.end
    191 
    192 tag `template`;
    193 // <- variable.function.tagged-template
    194 //  ^^^^^^^^^^ meta.string string.quoted.other
    195 
    196 x ? y // y is a template tag!
    197 `template` : z;
    198 //         ^ keyword.operator.ternary
    199 
    200     1``
    201     /a/;
    202 //  ^^^ - string
    203 //  ^ keyword.operator.arithmetic
    204 //    ^ keyword.operator.arithmetic
    205 
    206 mylabel:
    207 // ^ entity.name.label
    208 //     ^ punctuation.separator
    209 
    210 // Ensure a ternary identifier isn't recognized as a label
    211 true ? str : str2
    212 //      ^ - entity.name.label
    213 
    214 a = test ? a + b : c;
    215 //         ^ variable.other.readwrite
    216 //             ^ variable.other.readwrite
    217 
    218 {{foo}}
    219 // ^ meta.block meta.block variable.other.readwrite
    220 
    221 var obj = {
    222 //        ^ meta.mapping punctuation.section.block.begin - meta.block
    223     key: bar,
    224     // <- meta.mapping.key
    225     $key2: "string value",
    226     // ^ meta.mapping.key
    227     //   ^ - constant.other
    228     //     ^^^^^^^^^^^^^^ meta.string string.quoted.double
    229 
    230     $keyFunc: function() {
    231 //  ^^^^^^^^ meta.mapping.key.dollar entity.name.function
    232 //  ^ punctuation.dollar
    233 //   ^^^^^^^ - punctuation.dollar
    234 //            ^^^^^^^^^^^^ meta.function
    235     },
    236 
    237     class: null, // Keys are IdentifierNames, not merely Identifiers
    238 //  ^^^^^ meta.mapping.key
    239 
    240     [true==false ? 'one' : 'two']: false,
    241 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping.key
    242 //  ^ punctuation.section.brackets.begin
    243 //   ^^^^ constant.language
    244 //         ^^^^ constant.language
    245 //               ^ keyword.operator
    246 //                       ^ keyword.operator
    247 //                              ^ punctuation.section.brackets.end
    248 //                               ^ punctuation.separator.key-value
    249 
    250     "": true,
    251     // <- meta.mapping.key
    252 
    253     "key4": true,
    254 //  ^^^^^^ meta.mapping.key meta.string string.quoted.double
    255 //        ^ punctuation.separator.key-value - string
    256     'key5': false,
    257 //  ^^^^^^meta.mapping.key meta.string string.quoted.single
    258 //        ^ punctuation.separator.key-value - string
    259 //          ^^^^^ constant.language.boolean.false
    260 
    261     objKey: new function() {
    262 //              ^^^^^^^^ keyword.declaration.function
    263         this.foo = baz;
    264 //      ^^^^ variable.language.this
    265 //          ^ punctuation.accessor
    266 //           ^^^ meta.property
    267     }(),
    268 
    269     objKey: new/**/function() {}(),
    270 //                 ^^^^^^^^ keyword.declaration.function
    271 
    272     objKey: new class Foo {
    273 //              ^^^^^ keyword.declaration.class
    274         get baz() {}
    275 //      ^^^ storage.type.accessor
    276 //          ^^^ entity.name.function
    277     }(),
    278 
    279     funcKey: function() {
    280 //  ^^^^^^^ meta.mapping.key entity.name.function
    281 //           ^^^^^^^^^^^^ meta.function
    282     },
    283 
    284     func2Key: function func2Key() {
    285 //  ^^^^^^^^ meta.mapping.key entity.name.function
    286 //            ^^^^^^^^^^^^^^^^^^^^^ meta.function
    287     },
    288 
    289     funcKeyArrow: () => {
    290 //  ^^^^^^^^^^^^ meta.mapping.key entity.name.function
    291 //                ^^^^^^^ meta.function
    292     },
    293 
    294     "funcStringKey": function funcStringKey()
    295 //  ^^^^^^^^^^^^^^^ meta.mapping.key meta.string string.quoted.double
    296 //   ^^^^^^^^^^^^^ entity.name.function
    297 //                   ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function
    298     { },
    299 
    300     'funcStringKey': function() {
    301 //  ^^^^^^^^^^^^^^^ meta.mapping.key meta.string string.quoted.single
    302 //   ^^^^^^^^^^^^^ entity.name.function
    303 //                   ^^^^^^^^^^^^ meta.function
    304     },
    305 
    306     'funcStringKeyArrow': () => {
    307 //  ^^^^^^^^^^^^^^^^^^^^ meta.mapping.key meta.string string.quoted.single
    308 //   ^^^^^^^^^^^^^^^^^^ entity.name.function
    309 //                        ^^^^^^^ meta.function
    310     },
    311 
    312     "func\\String2KeyArrow": (foo) => {
    313 //                           ^^^^^^^^^^ meta.function
    314 //  ^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping.key meta.string string.quoted.double
    315 //   ^^^^^^^^^^^^^^^^^^^^^ entity.name.function
    316 //       ^^ constant.character.escape
    317     },
    318 
    319     f: function(){} + 1,
    320 //                  ^ keyword.operator.arithmetic
    321 
    322     key: 'str' + (true ? 'true' : 'false'),
    323 //                ^^^^ constant.language.boolean.true
    324 
    325     qux()
    326 //  ^^^^^ meta.function
    327 //  ^^^ entity.name.function
    328     {},
    329 
    330     'funcStringMethod'() {
    331 //  ^^^^^^^^^^^^^^^^^^^^ meta.function
    332 //   ^^^^^^^^^^^^^^^^ entity.name.function
    333     },
    334 
    335     'funcStringMethodWithSameLineColon'() { var foo = { name: 'jeff' }; },
    336 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function
    337 //   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.function
    338 
    339     "key (": true,
    340 //  ^^^^^^^ meta.mapping.key
    341 
    342     "key \"(": true,
    343 //  ^^^^^^^^^ meta.mapping.key
    344 
    345     "key '(": true,
    346 //  ^^^^^^^^ meta.mapping.key
    347 
    348     static,
    349 //  ^^^^^^ variable.other.readwrite
    350 
    351     *baz(){
    352 //  ^^^^^^ meta.function
    353 //  ^ keyword.generator.asterisk
    354 //   ^^^ entity.name.function
    355     }
    356 
    357     ...foo,
    358 //  ^^^ keyword.operator.spread
    359 //     ^^^ variable.other.readwrite
    360 //        ^ punctuation.separator.comma
    361 
    362     ...bar(baz),
    363 //  ^^^ keyword.operator.spread
    364 //     ^^^^^^^^ meta.function-call
    365 //     ^^^ variable.function
    366 //             ^ punctuation.separator.comma
    367 
    368     get foo() {},
    369 //  ^^^^^^^^^^^^ meta.function
    370 //  ^^^ storage.type.accessor
    371 //      ^^^ entity.name.function
    372 
    373     get() {},
    374 //  ^^^^^^^^ meta.function
    375 //  ^^^ entity.name.function
    376 
    377     get: 42,
    378 //  ^^^ meta.mapping.key
    379 
    380     async() {}
    381 //  ^^^^^^^^^^ meta.function
    382 //  ^^^^^ entity.name.function
    383 //       ^^ meta.function.parameters
    384 //       ^ punctuation.section.group.begin
    385 //        ^ punctuation.section.group.end
    386 //          ^^ meta.block
    387 //          ^ punctuation.section.block.begin
    388 //           ^ punctuation.section.block.end
    389 }
    390 // <- meta.mapping - meta.block
    391 
    392 +{
    393 // <- keyword.operator
    394   '': +{1:} / undefined
    395 //^^ meta.string string.quoted
    396 //  ^ punctuation.separator.key-value
    397 //    ^ keyword.operator
    398 //      ^ constant.numeric
    399 //          ^ keyword.operator
    400 //            ^ constant.language
    401 };
    402 // <- meta.mapping punctuation.section.block.end
    403 
    404 ({
    405  // <- meta.mapping
    406   0.: {0.e+0: 0}
    407 //^^ meta.mapping.key constant.numeric
    408 //  ^ punctuation.separator.key-value
    409 //     ^^^^^ meta.mapping.key constant.numeric
    410 //            ^ constant.numeric
    411 });
    412 
    413 [ a, b, c ];
    414 // <- meta.sequence punctuation.section.brackets.begin
    415 // ^ meta.sequence punctuation.separator.comma
    416 // ^^^^^^^^ meta.sequence
    417 //        ^ meta.sequence punctuation.section.brackets.end
    418 
    419 function x() {}
    420 [ a, b, c ];
    421 // <- meta.sequence.js
    422 
    423 +
    424 function x() {}
    425 [ a, b, c ];
    426 // <- meta.brackets.js
    427 
    428 var $ = function(baz) {
    429 //  ^ entity.name.function variable.other.dollar.only punctuation.dollar
    430 //      ^^^^^^^^^^^^^ meta.function
    431 }
    432 
    433 $()
    434 // <- variable.other.dollar.only punctuation.dollar
    435 
    436 $foo = null;
    437 // <- variable.other.dollar punctuation.dollar
    438 // ^ variable.other.dollar - punctuation.dollar
    439 //     ^^^^ constant.language.null
    440 
    441 baz = "";
    442 // <- variable.other.readwrite
    443 //    ^^ meta.string string.quoted.double
    444 
    445 var qux = 100;
    446 // <- keyword.declaration
    447 //   ^ variable.other.readwrite
    448 //         ^ constant.numeric
    449 
    450 class MyClass extends TheirClass {
    451 // <- keyword.declaration.class
    452 //    ^^^^^^^ entity.name.class
    453 //            ^^^^^^^ storage.modifier.extends
    454 //                    ^^^^^^^^^^ entity.other.inherited-class
    455 //                               ^ meta.block punctuation.section.block.begin
    456 
    457     x = 42;
    458 //  ^ variable.other.readwrite
    459 //    ^ keyword.operator.assignment
    460 //      ^^ constant.numeric
    461 
    462     'y' = 42;
    463 //  ^^^ meta.string string.quoted.single
    464 //   ^ variable.other.readwrite
    465 //      ^ keyword.operator.assignment
    466 //        ^^ constant.numeric
    467 
    468     "z" = 42;
    469 //  ^^^ meta.string string.quoted.double
    470 //   ^ variable.other.readwrite
    471 //      ^ keyword.operator.assignment
    472 //        ^^ constant.numeric
    473 
    474     [w] = 42;
    475 //  ^ punctuation.section.brackets.begin
    476 //   ^ variable.other.readwrite
    477 //    ^ punctuation.section.brackets.end
    478 //      ^ keyword.operator.assignment
    479 //        ^^ constant.numeric
    480 
    481     #v = 42;
    482 //  ^ punctuation.definition.variable
    483 //   ^ variable.other.readwrite
    484 //     ^ keyword.operator.assignment
    485 //       ^^ constant.numeric
    486 
    487     f = a => b;
    488 //  ^ entity.name.function variable.other.readwrite
    489 //      ^^^^^^ meta.function
    490 //      ^ variable.parameter.function
    491 
    492     g = function() {};
    493 //  ^ entity.name.function variable.other.readwrite
    494 //      ^^^^^^^^^^^^^ meta.function
    495 
    496     #h = function() {};
    497 //  ^ punctuation.definition.variable
    498 //   ^ entity.name.function variable.other.readwrite
    499 //       ^^^^^^^^^^^^^ meta.function
    500 
    501     static x = 42;
    502 //  ^^^^^^ storage.modifier.js
    503 //         ^ variable.other.readwrite
    504 //           ^ keyword.operator.assignment
    505 //             ^^ constant.numeric
    506 
    507     static 'y' = 42;
    508 //  ^^^^^^ storage.modifier.js
    509 //         ^^^ meta.string string.quoted.single
    510 //          ^ variable.other.readwrite
    511 //             ^ keyword.operator.assignment
    512 //               ^^ constant.numeric
    513 
    514     static "z" = 42;
    515 //  ^^^^^^ storage.modifier.js
    516 //         ^^^ meta.string string.quoted.double
    517 //          ^ variable.other.readwrite
    518 //             ^ keyword.operator.assignment
    519 //               ^^ constant.numeric
    520 
    521     static [w] = 42;
    522 //  ^^^^^^ storage.modifier.js
    523 //         ^ punctuation.section.brackets.begin
    524 //          ^ variable.other.readwrite
    525 //           ^ punctuation.section.brackets.end
    526 //             ^ keyword.operator.assignment
    527 //               ^^ constant.numeric
    528 
    529     static #v = 42;
    530 //         ^ punctuation.definition.variable
    531 //          ^ variable.other.readwrite
    532 //            ^ keyword.operator.assignment
    533 //              ^^ constant.numeric
    534 
    535     static f = a => b;
    536 //         ^ entity.name.function variable.other.readwrite
    537 //             ^^^^^^ meta.function
    538 //             ^ variable.parameter.function
    539 
    540     static g = function() {};
    541 //         ^ entity.name.function variable.other.readwrite
    542 //             ^^^^^^^^^^^^^ meta.function
    543 
    544     foo // You thought I was a field...
    545     () { return '...but was a method all along!'; }
    546 //  ^^ meta.class meta.block meta.function
    547 
    548     someMethod() {
    549         return #e * 2;
    550 //             ^ punctuation.definition.variable
    551 //              ^ variable.other.readwrite
    552 //                ^ keyword.operator.arithmetic
    553 
    554         for (const param of this.#data.get('value')) {}
    555 //                               ^ punctuation.definition.variable
    556 //                                ^^^^ meta.property.object
    557     }
    558 
    559     #privateMethod() {}
    560 //  ^^^^^^^^^^^^^^^^^^^ meta.function
    561 //  ^^^^^^^^^^^^^^ entity.name.function.js
    562 //  ^ punctuation.definition.js
    563 
    564     constructor(el)
    565 //  ^^^^^^^^^^^^^^^ meta.function
    566     // ^ entity.name.function.constructor
    567     {
    568 //  ^ meta.class meta.block meta.function meta.block punctuation.section.block
    569         $.foo = "";
    570         super(el);
    571     }
    572 //  ^ meta.class meta.block meta.function meta.block punctuation.section.block
    573 
    574     get foo()
    575 //  ^^^^^^^^^ meta.function
    576     // <- storage.type.accessor
    577     //   ^ entity.name.function
    578     {
    579         return this._foo;
    580     }
    581 
    582     static foo(baz) {
    583 //  ^^^^^^ storage.modifier
    584 //         ^^^^^^^^^^ meta.function
    585     //     ^^^ entity.name.function
    586 
    587     }
    588 
    589     qux()
    590 //  ^^^^^ meta.function
    591     { }
    592 //  ^ meta.class meta.block meta.block punctuation.section.block.begin
    593 
    594     get bar () {
    595 //  ^^^^^^^^^^^^ meta.function
    596 //             ^ meta.class meta.block meta.block punctuation.section.block.begin
    597     // <- storage.type.accessor
    598     //   ^ entity.name.function
    599         return false;
    600     }
    601 
    602     baz() { return null }
    603 //  ^^^^^^^^^^^^^^^^^^^^^ meta.function
    604     // <- entity.name.function
    605 
    606     get() { return "foobar"; }
    607 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function
    608 //  ^^^ entity.name.function.js - storage.type.accessor
    609 
    610     set (value) { return value; }
    611 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function
    612 //       ^^^^^ variable.parameter.function.js
    613 //  ^^^ entity.name.function.js - storage.type.accessor
    614 
    615     set  abc(value1, value2) { return value1 + value2; }
    616 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function
    617 //  ^^^ storage.type.accessor - entity.name.function.js
    618 //       ^^^ entity.name.function.js
    619 //           ^^^^^^ variable.parameter.function.js
    620 //                 ^ punctuation.separator.parameter.function.js
    621 //                   ^^^^^^ variable.parameter.function.js
    622 
    623     static$
    624 //  ^^^^^^^ - storage
    625     () {};
    626 
    627     constructor$() {}
    628 //  ^^^^^^^^^^^^ entity.name.function - entity.name.function.constructor
    629 
    630     @foo bar() {}
    631 //  ^^^^ meta.annotation
    632 //  ^ punctuation.definition.annotation
    633 //   ^^^ variable.annotation
    634 //       ^^^ entity.name.function
    635 
    636     @foo.bar bar() {}
    637 //  ^^^^^^^^ meta.annotation
    638 //  ^ punctuation.definition.annotation
    639 //   ^^^ variable.other.readwrite - variable.annotation
    640 //       ^^^ variable.annotation
    641 //           ^^^ entity.name.function
    642 
    643     @(whatever) bar() {}
    644 //  ^^^^^^^^^^^ meta.annotation
    645 //  ^ punctuation.definition.annotation
    646 //   ^^^^^^^^^^ meta.group
    647 //              ^^^ entity.name.function
    648 
    649     ['foo']() {}
    650 //  ^^^^^^^^^^^^ meta.function
    651 
    652     static ['foo']() {}
    653 //         ^^^^^^^^^^^^ meta.function
    654 
    655     async foo() {}
    656 //  ^^^^^ keyword.declaration.async
    657 
    658     *foo() {}
    659 //  ^ keyword.generator.asterisk
    660 
    661     async *foo() {}
    662 //  ^^^^^ keyword.declaration.async
    663 //        ^ keyword.generator.asterisk
    664 
    665     static async foo() {}
    666 //         ^^^^^ keyword.declaration.async
    667 }
    668 // <- meta.block punctuation.section.block.end
    669 
    670 class Foo extends React.Component {
    671 //                ^^^^^ - entity.other.inherited-class
    672 //                      ^^^^^^^^^ entity.other.inherited-class
    673     constructor()
    674     {}
    675 
    676     [foo.bar](arg) {
    677 //   ^^^ variable.other
    678 //       ^^^ meta.property
    679 //            ^^^ variable.parameter
    680         return this.a;
    681     }
    682 }
    683 
    684 class Foo extends (Foo).Bar {}
    685 //                      ^^^ entity.other.inherited-class
    686 
    687 class Foo extends Bar
    688 //                ^^^ entity.other.inherited-class
    689     .baz {}
    690 //  ^^^^^^^ meta.class
    691 //  ^ punctuation.accessor
    692 //   ^^^ entity.other.inherited-class
    693 
    694 class Foo extends
    695 //        ^^^^^^^ storage.modifier.extends
    696 Bar {}
    697 
    698 class Foo extends getSomeClass() {}
    699 //                ^^^^^^^^^^^^ meta.function-call variable.function - entity.other.inherited-class
    700 
    701     (class extends Bar {});
    702 //         ^^^^^^^ storage.modifier.extends - entity.name.class
    703 
    704     (class extends class {} {});
    705 //   ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class
    706 //         ^^^^^^^ storage.modifier.extends
    707 //                 ^^^^^^^^ meta.class meta.class
    708 //                 ^^^^^ keyword.declaration.class
    709 
    710 // Better highlighting while typing.
    711 class
    712 class
    713 // <- keyword.declaration.class - entity.name.class
    714 
    715 class{}/**/
    716 //     ^ - meta.class
    717 
    718     () => {};
    719 //  ^^^^^^^^ meta.function - meta.function meta.function
    720 //  ^^ meta.function.parameters
    721 //  ^ punctuation.section.group.begin
    722 //   ^ punctuation.section.group.end
    723 //     ^^ keyword.declaration.function.arrow
    724 //        ^^ meta.block
    725 //        ^ punctuation.section.block
    726 //         ^ punctuation.section.block
    727 
    728     () => {};
    729 //  ^^^^^ meta.function
    730 //  ^ punctuation.section.group.begin
    731 //   ^ punctuation.section.group.end
    732 //        ^ meta.block punctuation.section.block.begin
    733 //         ^ meta.block punctuation.section.block.end
    734 
    735     (foo, bar = 42)
    736 //  ^^^^^^^^^^^^^^^ meta.function.parameters
    737 //   ^^^ meta.binding.name
    738 //        ^^^ meta.binding.name
    739     => 42;
    740 //  ^^^^^ meta.function
    741 //  ^^ keyword.declaration.function.arrow
    742 
    743     foo
    744 //  ^^^ meta.function.parameters variable.parameter.function
    745     => 42;
    746 //  ^^^^^ meta.function
    747 //  ^^ keyword.declaration.function.arrow
    748 
    749     async x => y;
    750 //  ^^^^^^^^^^^^ meta.function
    751 //  ^^^^^ keyword.declaration.async
    752 //        ^ meta.function.parameters variable.parameter.function
    753 //          ^^ keyword.declaration.function.arrow
    754 //             ^ variable.other.readwrite
    755 
    756     async (x) => y;
    757 //  ^^^^^^^^^^^^^^ meta.function
    758 //  ^^^^^ keyword.declaration.async
    759 //        ^^^ meta.function.parameters
    760 //         ^ variable.parameter.function
    761 //            ^^ keyword.declaration.function.arrow
    762 //               ^ variable.other.readwrite
    763 
    764     async => {};
    765 //  ^^^^^^^^^^^ meta.function
    766 //  ^^^^^ meta.function.parameters variable.parameter.function
    767 //        ^^ keyword.declaration.function.arrow
    768 
    769     async;
    770 //  ^^^^^ variable.other.readwrite
    771 
    772     async ();
    773 //  ^^^^^ variable.function
    774 
    775 const test = ({a, b, c=()=>({active:false}) }) => {};
    776 //    ^ entity.name.function
    777 //           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function
    778 //           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.parameters
    779 //            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.binding.destructuring
    780 //            ^ punctuation.section.block.begin
    781 //             ^ variable.parameter
    782 //                ^ variable.parameter
    783 //                   ^ variable.parameter
    784 //                     ^^^^ meta.function meta.function
    785 //                     ^^ meta.function meta.function.parameters
    786 //                     ^ punctuation.section.group.begin
    787 //                      ^ punctuation.section.group.end
    788 //                         ^^^^^^^^^^^^^^^^ meta.group
    789 //                                   ^ constant.language
    790 //                                          ^ punctuation.section.block.end
    791 
    792 ([a,
    793   b]) => { return x; }
    794 //    ^^^^^^^^^^^^^^^^ meta.function
    795 //    ^^ keyword.declaration.function.arrow
    796 //         ^^^^^^ meta.block keyword.control.flow
    797 
    798 (
    799     ()
    800     => { return; }
    801 //  ^^ keyword.declaration.function.arrow
    802 //     ^^^^^^^^^^^ meta.block - meta.mapping
    803 //       ^^^^^^ keyword.control.flow
    804 );
    805 
    806 ({
    807     a = {},
    808 //    ^ keyword.operator.assignment
    809 //      ^^ punctuation.section.block
    810 //        ^ punctuation.separator.parameter - keyword.operator.comma
    811     b,
    812 //   ^ punctuation.separator.parameter - keyword.operator.comma
    813 }) => null;
    814 // ^^ keyword.declaration.function.arrow
    815 
    816 MyClass.foo = function() {}
    817 // ^ support.class
    818 //       ^ entity.name.function
    819 //            ^^^^^^^^^^^^^ meta.function
    820 
    821 MyClass.foo = () => {}
    822 // ^ support.class
    823 //       ^ entity.name.function
    824 //            ^^^^^^^^ meta.function
    825 
    826 xhr.onload = function() {}
    827 //  ^ entity.name.function
    828 //           ^^^^^^^^^^^^^ meta.function
    829 
    830 xhr.onload = () => {}
    831 //  ^ entity.name.function
    832 //           ^^^^^^^^ meta.function
    833 
    834 var simpleArrow = foo => bar;
    835 //   ^ entity.name.function
    836 //                ^^^^^^^^^^ meta.function
    837 //                ^^^ variable.parameter.function
    838 //                    ^^ keyword.declaration.function.arrow
    839 
    840 var Proto = () => {
    841 //   ^ entity.name.function
    842 //          ^^^^^^^ meta.function
    843 //             ^ keyword.declaration.function.arrow
    844     this._var = 1;
    845 }
    846 
    847 var notAFunc = function$;
    848 //  ^^^^^^^^ - entity.name.function
    849 
    850 Proto.prototype.getVar = () => this._var;
    851 //                       ^^^^^^^^^^^^^^^ meta.function
    852 // ^ support.class
    853 //     ^ support.constant.prototype
    854 //                ^ entity.name.function
    855 //                           ^ keyword.declaration.function.arrow
    856 
    857 Class3.prototype = function() {
    858 // ^ support.class
    859 //       ^ support.constant.prototype
    860 //                 ^^^^^^^^^^^^ meta.function
    861 }
    862 
    863 Proto.prototype.attr
    864 // ^ support.class
    865 //     ^ support.constant.prototype
    866 //               ^ meta.property.object
    867 
    868 Proto.prototype = {
    869     funcName: function() {
    870 //  ^^^^^^^^ entity.name.function
    871 //          ^ punctuation.separator.key-value
    872 //            ^^^^^^^^^^^^ meta.function
    873     }
    874 }
    875 
    876 sources.DOM.status()
    877 sources.DOM
    878 // <- variable.other.readwrite
    879     .status()
    880     // ^ meta.function-call.method variable.function
    881 
    882     foo.#bar();
    883 //  ^^^^^^^^^^ meta.function-call.method.js
    884 //      ^^^^ variable.function.js
    885 //      ^ punctuation.definition.js
    886 //          ^^ meta.group.js
    887 
    888 return new Promise(resolve => preferenceObject.set({value}, resolve));
    889 //                                                                  ^ meta.function-call.constructor punctuation.section.group.end
    890 
    891 var anotherSingle = function(){a = param => param; return param2 => param2 * a}
    892 //                                 ^ meta.function variable.parameter.function
    893 //                                          ^ meta.block meta.block variable.other.readwrite
    894 //                                               ^ meta.block punctuation.terminator.statement
    895 //                                                        ^ meta.function variable.parameter.function
    896 //                                                                           ^ meta.block meta.block variable.other.readwrite
    897 //                                                                            ^ meta.block punctuation.section.block.end
    898 
    899 var foo = ~{a:function(){}.a()}
    900 //  ^^^ meta.binding.name
    901 //  ^^^ variable.other.readwrite
    902 //      ^ keyword.operator.assignment
    903 //        ^ keyword.operator.bitwise
    904 //         ^ punctuation.section.block.begin
    905 //         ^^^^^^^^^^^^^^^^^^^^ meta.mapping
    906 //            ^^^^^^^^^^^^ meta.function
    907 //          ^ entity.name.function
    908 //           ^ punctuation.separator.key-value
    909 //            ^^^^^^^^ keyword.declaration.function
    910 //                    ^ punctuation.section.group.begin
    911 //                     ^ punctuation.section.group.end
    912 //                      ^ meta.block punctuation.section.block.begin
    913 //                       ^ meta.block punctuation.section.block.end
    914 //                        ^ meta.mapping
    915 //                         ^^^ - meta.function
    916 //                         ^ variable.function - entity.name.function
    917 //                          ^ punctuation.section.group.begin
    918 //                           ^ punctuation.section.group.end
    919 //                            ^ punctuation.section.block.end
    920 //                             ^ - meta
    921 
    922 baz(foo(x => x('bar')));
    923 //                   ^ meta.function-call meta.function-call punctuation.section.group.end
    924 //                    ^ meta.function-call punctuation.section.group.end
    925 
    926 func(a, b);
    927 //^^^^^^^^ meta.function-call
    928 // ^ variable.function
    929 //  ^^^^^^ meta.group
    930 //  ^ punctuation.section.group.begin
    931 //   ^ variable.other.readwrite
    932 //    ^ punctuation.separator.comma
    933 //      ^ variable.other.readwrite
    934 //       ^ punctuation.section.group.end
    935 
    936 var instance = new Constructor(param1, param2)
    937 //                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.constructor
    938 //                 ^^^^^^^^^^^ variable.type
    939 //                            ^^^^^^^^^^^^^^^^ meta.group
    940 //                            ^ punctuation.section.group.begin
    941 //                             ^ variable.other.readwrite
    942 //                                           ^ punctuation.section.group.end
    943 
    944 var obj = new function() {}();
    945 //            ^^^^^^^^ keyword.declaration.function
    946 
    947 var obj2 = new class Foo{}();
    948 //             ^^^^^ keyword.declaration.class
    949 
    950 this.func()
    951 // <- variable.language.this
    952 arguments;
    953 // <- variable.language.arguments
    954 super.func();
    955 // <- variable.language.super
    956 globalThis;
    957 // <- variable.language.global
    958 
    959 foo[bar];
    960 // ^^^^^ meta.brackets
    961 // ^ punctuation.section.brackets.begin
    962 //     ^ punctuation.section.brackets.end
    963 
    964 var Constructor = function() {
    965     this._var = 1;
    966     // ^ variable.language.this
    967     this._method = function() {}
    968     // ^ variable.language.this
    969     //    ^ entity.name.function
    970 }
    971 
    972 // Tests to ensure the new keyword is highlighted properly even when the
    973 // following element is not an identifier
    974 var abc = new ABC(
    975 //        ^^^ keyword.operator.word.new
    976 //            ^^^^ meta.function-call.constructor
    977 //        ^^^^^^^^ - meta.instance.constructor
    978     'my-name-is-abc',
    979     new (function () {
    980 //  ^^^ keyword.operator.word.new
    981 //  ^^^^^^^^^^^^^^^^^^ - meta.instance.constructor
    982 //      ^^^^^^^^^^^^^^ meta.function-call.constructor meta.function-call.constructor meta.group
    983         var foo = 1;
    984 //      ^^^^^^^^^^^^ meta.function-call.constructor meta.function-call.constructor meta.group meta.block
    985     })
    986 );
    987 
    988 new foo()/**/;
    989 //       ^ - meta.function-call.constructor
    990 
    991 function f() {
    992     new.target;
    993 //  ^^^ keyword.operator.word.new
    994 //     ^ punctuation.accessor.dot.js
    995 //      ^^^^^^ variable.language.target
    996 
    997     new
    998 //  ^^^ keyword.operator.word.new
    999     .target;
   1000 //  ^ punctuation.accessor.dot.js
   1001 //   ^^^^^^ variable.language.target
   1002 }
   1003 
   1004 new Date().getTime()
   1005 //  ^^^^^^ meta.function-call.constructor
   1006 //  ^^^^ support.class
   1007 //^^^^^^^^^^^^^^^^^^ - meta.instance.constructor
   1008 
   1009 new $();
   1010 //  ^ variable.type.dollar.only punctuation.dollar
   1011 
   1012 new $Dollar();
   1013 //  ^ variable.type.dollar punctuation.dollar
   1014 
   1015 void {
   1016     'test1': [],
   1017     'test2': new SomeObjectHash["default"],
   1018 //               ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.constructor
   1019 //                             ^ meta.brackets
   1020     'test3': "asdf"
   1021 }
   1022 // <- meta.mapping punctuation.section.block.end
   1023 
   1024 // This tests parsing semi-broken object literals, which should help while a
   1025 // user is in the middle of typing code
   1026 void {
   1027     key1: true
   1028 //  ^^^^ meta.mapping.key.js
   1029     key2: 0
   1030 //  ^^^^ meta.mapping.key.js
   1031     key3: function()
   1032 //  ^^^^ meta.mapping.key.js entity.name.function
   1033     {
   1034 
   1035     }
   1036 }
   1037 
   1038 a = b.c
   1039 d = e.f
   1040 // <- variable.other.readwrite
   1041 
   1042 foo.bar().baz
   1043 // ^ punctuation.accessor
   1044 //       ^ punctuation.accessor
   1045 
   1046 width/2 + lineStart * Math.sin(i * 30 * π/180)
   1047 //   ^ keyword.operator.arithmetic
   1048 //                  ^ keyword.operator.arithmetic
   1049 //                         ^^^^^^^^^^^^^^^^^^^ meta.function-call.method
   1050 
   1051 var reg = /a+/gimy.exec('aabb')
   1052 //        ^^^^^^^^ meta.string string.regexp
   1053 //            ^^^^ keyword.other
   1054 //                ^ punctuation.accessor
   1055 
   1056 'aabbcc'.replace(/b+/, 'd');
   1057 //               ^^^^ meta.string string.regexp
   1058 //                 ^ keyword.operator.quantifier.regexp
   1059 
   1060 /a+(?:bc)/;
   1061 // <- meta.string string.regexp
   1062 //  ^^ punctuation.definition.group.no-capture.regexp
   1063 
   1064 'str'.match(/[" ]+/g);
   1065 //          ^^^^^^^^ meta.string string.regexp.js
   1066 
   1067 myvar = myvar.replace(/RTP\/SAVPF .*/, 'RTP/SAVPF ' + suffix);
   1068 //                    ^^^^^^^^^^^^^^^ meta.string string.regexp.js
   1069 
   1070 'foo'.bar() / baz
   1071 //            ^ variable.other.readwrite
   1072 
   1073 var g = 50
   1074 
   1075 g / 20 + 30 /g
   1076 //^ keyword.operator.arithmetic
   1077 //          ^ keyword.operator.arithmetic
   1078 
   1079 var h = foo() / 20 + 30 /g
   1080 //            ^ keyword.operator.arithmetic
   1081 //                      ^ keyword.operator.arithmetic
   1082 
   1083 foo['bar']/ 20 + 30 /g
   1084 //        ^ keyword.operator.arithmetic
   1085 //                  ^ keyword.operator.arithmetic
   1086 
   1087 foo.bar/ 20 + 30 /g
   1088 //     ^ keyword.operator.arithmetic
   1089 //               ^ keyword.operator.arithmetic
   1090 
   1091 var result = 200 / 400 + 500 /
   1092 //               ^ keyword.operator.arithmetic
   1093 //                           ^ keyword.operator.arithmetic
   1094 100;
   1095 
   1096 var re = /
   1097 [a-z]
   1098 /g
   1099 // <- meta.string string.regexp.js punctuation.definition.string.end
   1100  // <- keyword.other
   1101 
   1102 const a = 1 / /This is regex./ / 'This should be a string, not a regex.';
   1103 //          ^ keyword.operator
   1104 //            ^^^^^^^^^^^^^^^^ meta.string string.regexp
   1105 //                             ^ keyword.operator
   1106 //                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted
   1107 
   1108 a = /\//u + 0;
   1109 //  ^^^^ meta.string string.regexp
   1110 //      ^ keyword.other
   1111 //        ^ keyword.operator
   1112 //          ^ constant.numeric
   1113 
   1114 1 /**/ / 2 / /**/ 3;
   1115 //     ^ keyword.operator
   1116 //       ^ constant.numeric
   1117 //         ^ keyword.operator
   1118 
   1119     x
   1120     in y;
   1121 //  ^^ keyword.operator
   1122 
   1123     x
   1124     instanceof y;
   1125 //  ^^^^^^^^^^ keyword.operator
   1126 
   1127 var π = 3.141592653
   1128 //  ^ variable.other.readwrite
   1129 
   1130 var angle = 2*π / count // angle between circles
   1131 //              ^ keyword.operator.arithmetic
   1132 
   1133 var angle = 2*π / count /* angle between circles */
   1134 //              ^ keyword.operator.arithmetic
   1135 
   1136 undefined / (8 * 5) / "1"
   1137 //        ^ keyword.operator.arithmetic
   1138 //                  ^ keyword.operator.arithmetic
   1139 
   1140 '5' / 8 / '1'
   1141 //  ^ keyword.operator.arithmetic
   1142 //      ^ keyword.operator.arithmetic
   1143 
   1144 "5" / 8 / "1"
   1145 //  ^ keyword.operator.arithmetic
   1146 //      ^ keyword.operator.arithmetic
   1147 
   1148 `5` / 8 / `1`
   1149 //  ^ keyword.operator.arithmetic
   1150 //      ^ keyword.operator.arithmetic
   1151 
   1152 a = /foo\/bar/g // Ensure handling of escape / in regex detection
   1153 //  ^^^^^^^^^^^ meta.string string.regexp
   1154 //       ^ constant.character.escape
   1155 
   1156 var re = /^\/[^/]+/;
   1157 //             ^ constant.other.character-class.set.regexp
   1158 //               ^ keyword.operator.quantifier
   1159 
   1160 (y - 1) / ((x - 1) / -2);
   1161 //      ^ keyword.operator.arithmetic
   1162 //        ^ punctuation.section.group.begin
   1163 (y - 1) / ((x - 1) /  2);
   1164 //    ^ punctuation.section.group.end
   1165 //      ^ keyword.operator.arithmetic
   1166  y      / ((x - 1) / -2);
   1167 
   1168     1, 2;
   1169 //   ^ keyword.operator.comma - punctuation
   1170 
   1171     a;
   1172     [1, 2];
   1173 //    ^ meta.sequence punctuation.separator.comma - meta.brackets - keyword
   1174 
   1175     a
   1176     [1, 2];
   1177 //    ^ meta.brackets keyword.operator.comma - meta.sequence - punctuation
   1178 
   1179 define(['common'], function(common) {
   1180 //                 ^^^^^^^^^^^^^^^^^^ meta.function
   1181     var namedFunc = function() {
   1182 //        ^ meta.function
   1183     }
   1184 });
   1185 
   1186 new FooBar(function(){
   1187 //          ^ meta.function
   1188     var namedFunc2 = function() {
   1189 //        ^ meta.function
   1190     }
   1191 })
   1192 
   1193 ['foo'].bar = function() {
   1194 //      ^^^ entity.name.function meta.property.object
   1195 }
   1196 
   1197 ['foo'].$ = function() {
   1198 //      ^ entity.name.function meta.property.object.dollar.only punctuation.dollar
   1199 }
   1200 
   1201 ['foo'].$bar = function() {
   1202 //      ^^^^ entity.name.function meta.property.object.dollar
   1203 //      ^ punctuation.dollar
   1204 }
   1205 
   1206 {
   1207 // <- meta.block punctuation.section.block.begin
   1208     let foo = 1;
   1209 //  ^^^ meta.block keyword.declaration
   1210 //      ^^^ variable.other.readwrite
   1211 }
   1212 // <- meta.block punctuation.section.block.end
   1213 
   1214 var test =
   1215 {a: 1}
   1216 // <- meta.mapping punctuation.section.block.begin
   1217 
   1218 var arrowFuncBraceNextLine = () => /* comments! */
   1219 //  ^ entity.name.function
   1220 //                              ^^ keyword.declaration.function
   1221 //                                 ^^^^^^^^^^^^^^^ comment
   1222 {
   1223     foo.bar();
   1224 //  ^ - entity.name.function
   1225 }
   1226 
   1227 // Handle multi-line "concise" arrow function bodies
   1228 var conciseFunc = () =>
   1229   foo
   1230 //^^^ meta.block variable.other.readwrite
   1231   .bar();
   1232 //^^^^^^ meta.block
   1233 
   1234 // Handle an arrow function in a parenthetical group
   1235 (myFunc = (a) => a*2)
   1236 // <- meta.group punctuation.section.group.begin
   1237 // ^^^^ entity.name.function
   1238 //                  ^ meta.group punctuation.section.group.end - meta.block
   1239 
   1240 var o = { a: i => i * 2, b: i => i * 3 }
   1241 //        ^ entity.name.function
   1242 //                     ^ - meta.block
   1243 //                       ^ entity.name.function
   1244 
   1245 function test() {
   1246     return {a: 1};
   1247 //         ^^^^^^ meta.mapping
   1248 //          ^ meta.mapping.key
   1249 //             ^ constant.numeric
   1250 }
   1251 
   1252 $.each({})
   1253 // <- variable.other.dollar.only punctuation.dollar
   1254 //     ^ meta.mapping
   1255 
   1256 $varname.method()
   1257 // <- variable.other.dollar punctuation.dollar - variable.object.dollar.only
   1258 // ^ variable.other.dollar
   1259 
   1260 $.fn.new_plugin = function() {}
   1261 // <- variable.other.dollar.only punctuation.dollar
   1262 
   1263 $var.fn.name = () => {}
   1264 // <- variable.other.dollar punctuation.dollar - variable.other.dollar.only
   1265 // ^ variable.other.dollar - punctuation.dollar
   1266 
   1267 someFunction(() => [() => 'X']);
   1268 //                           ^ punctuation.section.brackets.end
   1269 
   1270 string = 'invalid
   1271 //               ^ invalid.illegal.newline
   1272 
   1273 string = 'invalid\ 
   1274 //                 ^ invalid.illegal.newline
   1275 
   1276 hex = 0xFA.5;
   1277 //         ^ invalid.illegal - constant.numeric
   1278 
   1279 hex = 0xFA.toString;
   1280 
   1281 octal = 079.0;
   1282 //          ^ invalid.illegal - constant.numeric
   1283 
   1284 strayBracket = ());
   1285 //               ^ invalid.illegal.stray-bracket-end
   1286 
   1287 strayBracket = []];
   1288 //               ^ invalid.illegal.stray-bracket-end
   1289 
   1290 strayBracket = {}};
   1291 //               ^ invalid.illegal.stray-bracket-end
   1292 
   1293 (a +) + c;
   1294 //   ^^^^ - meta.group
   1295 
   1296 (a =>) + c;
   1297 //    ^^^^ - meta.group
   1298 
   1299 function optionalParam(b=0) {};
   1300 //                    ^ punctuation.section.group.begin
   1301 //                      ^ keyword.operator.assignment
   1302 //                        ^ punctuation.section.group.end
   1303 
   1304 
   1305 var CONST;
   1306 //  ^^^^^ variable.other.constant
   1307 
   1308 return;
   1309 {a: 1};
   1310 // ^ meta.block - meta.mapping
   1311 
   1312 return/**/{a: 1}
   1313 //        ^^^^^^ meta.mapping - meta.block
   1314 
   1315 return
   1316 {a: 1};
   1317 // ^ meta.block - meta.mapping
   1318 
   1319 return/*
   1320 */{a: 1}
   1321 //^^^^^^ meta.block - meta.mapping
   1322 
   1323 const abc = new Set
   1324 
   1325     const x =
   1326     const y = 1; // Better highlighting while typing.
   1327 //  ^^^^^ keyword.declaration
   1328 
   1329     let x =
   1330     const y = 1; // Better highlighting while typing.
   1331 //  ^^^^^ keyword.declaration
   1332 
   1333 var o = {
   1334     a,
   1335     b,
   1336     c // comment
   1337 //  ^ variable.other.readwrite - entity.name.function
   1338 //    ^^ comment
   1339 }
   1340 
   1341 var query = {
   1342     type: type==undefined ? null : {$in: type.split(',')}
   1343 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping
   1344 //              ^^^^^^^^^ constant.language.undefined
   1345 //                        ^ keyword.operator.ternary
   1346 //                          ^^^^ constant.language.null
   1347 //                               ^ keyword.operator.ternary
   1348 //                                 ^ punctuation.section.block.begin
   1349 //                                   ^^ meta.mapping.key.js
   1350 //                                     ^ punctuation.separator.key-value.js
   1351 //                                                      ^ punctuation.section.block.end
   1352 };
   1353 
   1354 var str = `Hello, ${name}!`;
   1355 //        ^^^^^^^^^^^^^^^^^ meta.string
   1356 //        ^^^^^^^^ string.quoted.other
   1357 //                ^^^^^^^ meta.interpolation - string
   1358 //                       ^^ string.quoted.other
   1359 //                ^^ punctuation.section.interpolation.begin
   1360 //                  ^^^^ source.js.embedded variable.other.readwrite
   1361 //                      ^ punctuation.section.interpolation.end
   1362 
   1363 function yy (a, b) {
   1364 // ^^^^^^^^^^^^^^^^^ meta.function
   1365 //       ^^ entity.name.function
   1366 //          ^^^^^^ meta.function.parameters
   1367 //          ^ punctuation.section.group.begin
   1368 //           ^ variable.parameter.function
   1369 //            ^ punctuation.separator.parameter.function
   1370 //              ^ variable.parameter.function
   1371 //               ^ punctuation.section.group.end
   1372 //                 ^ meta.block punctuation.section.block.begin
   1373 }
   1374 // <- meta.function meta.block punctuation.section.block
   1375 
   1376 // Integers
   1377 
   1378     123_456_789_0n;
   1379 //  ^^^^^^^^^^^^^ meta.number.integer.decimal.js constant.numeric.value.js
   1380 //               ^ meta.number.integer.decimal.js constant.numeric.suffix.js
   1381 
   1382     0;
   1383 //  ^ meta.number.integer.decimal.js constant.numeric.value.js
   1384 
   1385     123 .foo;
   1386 //  ^^^ meta.number.integer.decimal.js constant.numeric.value.js
   1387 //      ^ punctuation.accessor
   1388 //       ^^^ meta.property.object
   1389 
   1390     +123;
   1391 //  ^ keyword.operator.arithmetic
   1392 //   ^^^ meta.number.integer.decimal.js constant.numeric.value.js - keyword
   1393 
   1394     -123;
   1395 //  ^ keyword.operator.arithmetic
   1396 //   ^^^ meta.number.integer.decimal.js constant.numeric.value.js - keyword
   1397 
   1398     + 123;
   1399 //  ^ keyword.operator.arithmetic
   1400 //   ^ - keyword - constant
   1401 //    ^^^ meta.number.integer.decimal.js constant.numeric.value.js - keyword
   1402 
   1403     123xyz;
   1404 //  ^^^^^^ invalid.illegal.numeric.decimal
   1405 
   1406     0123456789;
   1407 //  ^ meta.number.integer.octal.js constant.numeric.base.js invalid.deprecated.numeric.octal.js
   1408 //   ^^^^^^^^^ meta.number.integer.octal.js constant.numeric.value.js invalid.deprecated.numeric.octal.js
   1409 
   1410     0123456789xyz;
   1411 //  ^^^^^^^^^^^^^ invalid.illegal.numeric.octal
   1412 
   1413     0123456789.xyz;
   1414 //  ^ meta.number.integer.octal.js constant.numeric.base.js invalid.deprecated.numeric.octal.js
   1415 //   ^^^^^^^^^ meta.number.integer.octal.js constant.numeric.value.js invalid.deprecated.numeric.octal.js
   1416 //            ^ punctuation.accessor
   1417 //             ^^^ meta.property.object
   1418 
   1419     0123456789.123;
   1420 //  ^ meta.number.integer.octal.js constant.numeric.base.js invalid.deprecated.numeric.octal.js
   1421 //   ^^^^^^^^^ meta.number.integer.octal.js constant.numeric.value.js invalid.deprecated.numeric.octal.js
   1422 //            ^ punctuation.accessor.js
   1423 //             ^^^ invalid.illegal.illegal-identifier
   1424 
   1425     0b0110_1001_1001_0110n;
   1426 //  ^^ meta.number.integer.binary.js constant.numeric.base.js
   1427 //    ^^^^^^^^^^^^^^^^^^^ meta.number.integer.binary.js constant.numeric.value.js
   1428 //                       ^ meta.number.integer.binary.js constant.numeric.suffix.js
   1429 
   1430     0o0123_4567n;
   1431 //  ^^ meta.number.integer.octal.js constant.numeric.base.js
   1432 //    ^^^^^^^^^ meta.number.integer.octal.js constant.numeric.value.js
   1433 //             ^ meta.number.integer.octal.js constant.numeric.suffix.js
   1434 
   1435     0x01_23_45_67_89_ab_CD_efn;
   1436 //  ^^ meta.number.integer.hexadecimal.js constant.numeric.base.js
   1437 //    ^^^^^^^^^^^^^^^^^^^^^^^ meta.number.integer.hexadecimal.js constant.numeric.value.js
   1438 //                           ^ meta.number.integer.hexadecimal.js constant.numeric.suffix.js
   1439 
   1440     0B0; 0O0; 0X0;
   1441 //  ^^ meta.number.integer.binary.js constant.numeric.base.js
   1442 //    ^ meta.number.integer.binary.js constant.numeric.value.js
   1443 //     ^ punctuation.terminator.statement.js
   1444 //       ^^ meta.number.integer.octal.js constant.numeric.base.js
   1445 //         ^ meta.number.integer.octal.js constant.numeric.value.js
   1446 //          ^ punctuation.terminator.statement.js
   1447 //            ^^ meta.number.integer.hexadecimal.js constant.numeric.base.js
   1448 //              ^ meta.number.integer.hexadecimal.js constant.numeric.value.js
   1449 //               ^ punctuation.terminator.statement.js
   1450 
   1451     0b1.foo;
   1452 //  ^^^^^^^ - invalid
   1453 //  ^^ meta.number.integer.binary.js constant.numeric.base.js
   1454 //    ^ meta.number.integer.binary.js constant.numeric.value.js
   1455 //     ^ punctuation.accessor
   1456 //      ^^^ meta.property.object
   1457 
   1458     0b1.0;
   1459 //  ^^ meta.number.integer.binary.js constant.numeric.base.js
   1460 //    ^ meta.number.integer.binary.js constant.numeric.value.js
   1461 //     ^ punctuation.accessor
   1462 //      ^ invalid.illegal.illegal-identifier
   1463 
   1464     0b123;
   1465 //  ^^^^^ invalid.illegal.numeric.binary
   1466 
   1467 
   1468 // Floats
   1469 
   1470     1_234_567_890.123_456_789_0;
   1471 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.number.float.decimal.js constant.numeric.value.js
   1472 //               ^ punctuation.separator.decimal.js
   1473 
   1474     .123_456_789_0;
   1475 //  ^^^^^^^^^^^^^^ meta.number.float.decimal.js constant.numeric.value.js
   1476 //  ^ punctuation.separator.decimal
   1477 
   1478     12345e6_7_8;
   1479 //  ^^^^^^^^^^^ meta.number.float.decimal.js constant.numeric.value.js
   1480 
   1481     123.456e+789;
   1482 //  ^^^^^^^^^^^^ meta.number.float.decimal.js constant.numeric.value.js
   1483 //     ^ punctuation.separator.decimal
   1484 
   1485     .123E-7_8_9;
   1486 //  ^^^^^^^^^^^ meta.number.float.decimal.js constant.numeric.value.js
   1487 //  ^ punctuation.separator.decimal
   1488 
   1489     0123.45;
   1490 //  ^ meta.number.integer.octal.js constant.numeric.base.js invalid.deprecated.numeric.octal.js
   1491 //   ^^^ meta.number.integer.octal.js constant.numeric.value.js invalid.deprecated.numeric.octal.js
   1492 //      ^ punctuation.accessor
   1493 //       ^^ invalid.illegal - constant.numeric
   1494 
   1495     123.4foo;
   1496 //  ^^^^^^^^ invalid.illegal.numeric.decimal
   1497 
   1498     123.4e+foo;
   1499 //  ^^^^^^ invalid.illegal.numeric.decimal
   1500 
   1501     123..foo;
   1502 //  ^^^^ meta.number.float.decimal.js constant.numeric.value.js
   1503 //      ^ punctuation.accessor
   1504 //       ^^^ meta.property.object
   1505 
   1506 debugger;
   1507 // <- keyword.control.flow.debugger.js
   1508 
   1509 debugger
   1510 []
   1511 // <- meta.sequence
   1512 
   1513     a ?? b;
   1514 //    ^^ keyword.operator.logical
   1515 
   1516     a &&= b;
   1517 //    ^^^ keyword.operator.assignment.augmented
   1518 
   1519     a ||= b;
   1520 //    ^^^ keyword.operator.assignment.augmented
   1521 
   1522     a ??= b;
   1523 //    ^^^ keyword.operator.assignment.augmented
   1524 
   1525     a ?.5 : .7;
   1526 //    ^ keyword.operator.ternary
   1527 //     ^^ constant.numeric
   1528 //        ^ keyword.operator.ternary
   1529 
   1530     a?.b?.c;
   1531 //   ^^ punctuation.accessor
   1532 //     ^ meta.property.object
   1533 //      ^^ punctuation.accessor
   1534 //        ^ meta.property.object
   1535 
   1536     a?.[propName];
   1537 //   ^^^^^^^^^^^^ meta.brackets
   1538 //   ^^ punctuation.accessor
   1539 //     ^ punctuation.section.brackets.begin
   1540 
   1541     a?.();
   1542 //  ^^^^^ meta.function-call
   1543 //  ^ variable.function
   1544 //   ^^^^ meta.group
   1545 //   ^^ punctuation.accessor
   1546 //     ^ punctuation.section.group.begin
   1547 
   1548     a.b?.();
   1549 //  ^^^^^^^ meta.function-call.method
   1550 //    ^ variable.function
   1551 //