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_jsx.jsx (6202B)


      1 // SYNTAX TEST "Packages/JavaScript/JSX.sublime-syntax"
      2 
      3     <foo />;
      4 //  ^^^^^^^ meta.jsx meta.tag
      5 //  ^ punctuation.definition.tag.begin
      6 //   ^^^ meta.tag.name entity.name.tag
      7 //       ^^ punctuation.definition.tag.end
      8 
      9     <foo>Hello!</foo>;
     10 //  ^^^^^^^^^^^^^^^^^ meta.jsx
     11 //  ^^^^^ meta.tag
     12 //  ^ punctuation.definition.tag.begin
     13 //   ^^^ meta.tag.name entity.name.tag
     14 //      ^ punctuation.definition.tag.end
     15 //       ^^^^^^ - meta.tag
     16 //             ^^^^^^ meta.tag
     17 //             ^^ punctuation.definition.tag.begin
     18 //               ^^^ meta.tag.name entity.name.tag
     19 //                  ^ punctuation.definition.tag.end
     20 
     21     <foo.bar.baz>Hello!</foo.bar.baz>;
     22 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.jsx
     23 //  ^^^^^^^^^^^^^ meta.tag
     24 //   ^^^^^^^^^^^ meta.tag.name
     25 //      ^ punctuation.accessor
     26 //          ^ punctuation.accessor
     27 //           ^^^ entity.name.tag
     28 //               ^^^^^^ - meta.tag
     29 //                     ^^^^^^^^^^^^^^ meta.tag
     30 //                       ^^^^^^^^^^^ meta.tag.name
     31 //                          ^ punctuation.accessor
     32 //                              ^ punctuation.accessor
     33 //                               ^^^ entity.name.tag
     34 
     35     <foo>Hello!<bar/>World!</foo>;
     36 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.jsx
     37 //  ^^^^^ meta.tag
     38 //       ^^^^^^ - meta.tag
     39 //             ^^^^^^ meta.tag
     40 //                   ^^^^^^ - meta.tag
     41 //                         ^^^^^^ meta.tag
     42 
     43     <foo></foo><bar>
     44 //  ^^^^^^^^^^^ meta.jsx
     45 //             ^^^^^ - meta.jsx
     46 //             ^ keyword.operator.comparison
     47 //              ^^^ variable
     48 //                 ^ keyword.operator.comparison
     49 0;
     50 
     51     <>Hello!</>;
     52 //  ^^^^^^^^^^^ meta.jsx
     53 //  ^^ meta.tag
     54 //  ^ punctuation.definition.tag.begin
     55 //   ^ punctuation.definition.tag.end
     56 //    ^^^^^^ - meta.tag
     57 //          ^^^ meta.tag
     58 //          ^^ punctuation.definition.tag.begin
     59 //            ^ punctuation.definition.tag.end
     60 
     61     <foo></foo>
     62     <bar>
     63 //  ^^^^^ - meta.jsx
     64 //  ^ keyword.operator.comparison
     65 //   ^^^ variable
     66 //      ^ keyword.operator.comparison
     67 0;
     68 
     69     </foo>;
     70 //   ^^^^ invalid.illegal.unmatched-tag
     71 
     72 <foo
     73     bar
     74 //  ^^^ meta.jsx meta.tag.attributes entity.other.attribute-name
     75 
     76     =
     77 //  ^ punctuation.separator.key-value
     78 
     79     'test'
     80 //  ^^^^^^ string.quoted.single
     81 
     82     baz='test'
     83 //  ^^^^^^^^^^ meta.jsx meta.tag.attributes
     84 //  ^^^ entity.other.attribute-name
     85 //     ^ punctuation.separator.key-value
     86 //      ^^^^^^ string.quoted.single
     87 //      ^ punctuation.definition.string.begin
     88 //           ^ punctuation.definition.string.end
     89 
     90     baz="test"
     91 //  ^^^^^^^^^^ meta.jsx meta.tag.attributes
     92 //  ^^^ entity.other.attribute-name
     93 //     ^ punctuation.separator.key-value
     94 //      ^^^^^^ string.quoted.double
     95 //      ^ punctuation.definition.string.begin
     96 //           ^ punctuation.definition.string.end
     97 
     98     baz="\n"
     99 //      ^^^^ string.quoted.double - constant.character.escape
    100 
    101     baz="&nbsp;&nbsp"
    102 //       ^^^^^^ constant.character.escape
    103 //       ^ punctuation.definition.entity
    104 //            ^ punctuation.definition.entity
    105 //             ^^^^^ - constant.character.escape
    106 
    107     baz={xyzzy}
    108 //      ^^^^^^^ meta.interpolation
    109 //      ^ punctuation.definition.interpolation.begin
    110 //       ^^^^^ source.js.embedded.jsx variable.other.readwrite
    111 //            ^ punctuation.definition.interpolation.end
    112 
    113     baz={{ xyzzy:42 }}
    114 //      ^^^^^^^^^^^^^^ meta.interpolation
    115 //      ^ punctuation.definition.interpolation.begin
    116 //       ^^^^^^^^^^^^ source.js.embedded.jsx meta.mapping
    117 //         ^^^^^ meta.mapping.key
    118 //              ^ punctuation.separator.key-value
    119 //               ^^ meta.number.integer.decimal.js constant.numeric.value.js
    120 //                   ^ punctuation.definition.interpolation.end
    121 
    122 
    123     {...attrs}
    124 //  ^^^^^^^^^^ meta.interpolation
    125 //   ^^^^^^^^ source.js.embedded.jsx
    126 //   ^^^ keyword.operator.spread
    127 //      ^^^^^ variable.other.readwrite
    128 
    129     {...{ xyzzy:42 }}
    130 //  ^^^^^^^^^^^^^^^^^ meta.interpolation
    131 //   ^^^^^^^^^^^^^^^ source.js.embedded.jsx
    132 //   ^^^ keyword.operator.spread
    133 //      ^^^^^^^^^^^^ meta.mapping
    134 //        ^^^^^ meta.mapping.key
    135 //             ^ punctuation.separator.key-value
    136 //              ^^ meta.number.integer.decimal.js constant.numeric.value.js
    137 //                  ^ punctuation.definition.interpolation.end
    138 
    139     // baz
    140 //  ^^^^^^ comment.line.double-slash
    141 //  ^^ punctuation.definition.comment
    142 
    143     /* baz */
    144 //  ^^^^^^^^^ comment.block
    145 //  ^^ punctuation.definition.comment
    146 //         ^^ punctuation.definition.comment
    147 
    148 />;
    149 // <- meta.jsx meta.tag punctuation.definition.tag.end
    150 
    151 <foo>
    152     // test
    153 //  ^^^^^^^^ - comment
    154 
    155     /* test */
    156 //  ^^^^^^^^^^ - comment
    157 
    158     &nbsp; &nbsp ;
    159 //  ^^^^^^ constant.character.escape
    160 //  ^ punctuation.definition.entity
    161 //       ^ punctuation.definition.entity
    162 //         ^^^^^^^ - constant.character.escape
    163 
    164     {xyzzy}
    165 //  ^^^^^^^ meta.interpolation
    166 //   ^^^^^ source.js.embedded.jsx variable.other.readwrite
    167 
    168     {{ xyzzy:42 }}
    169 //  ^^^^^^^^^^^^^^ meta.interpolation
    170 //   ^^^^^^^^^^^^ source.js.embedded.jsx
    171 //   ^^^^^^^^^^^^ meta.mapping
    172 //     ^^^^^ meta.mapping.key
    173 //          ^ punctuation.separator.key-value
    174 //           ^^ meta.number.integer.decimal.js constant.numeric.value.js
    175 //               ^ punctuation.definition.interpolation.end
    176 
    177     {//}
    178 //  ^ punctuation.definition.interpolation.begin
    179 //   ^^^ comment.line.double-slash
    180 //   ^^ punctuation.definition.comment
    181 //     ^ - punctuation
    182     }
    183 //  ^ punctuation.definition.interpolation.end
    184 
    185     {/* foo */}
    186 //  ^^^^^^^^^^^ meta.jsx meta.interpolation comment.block - source.embedded
    187 //  ^ punctuation.definition.interpolation.begin
    188 //   ^^ punctuation.definition.comment.begin
    189 //          ^^ punctuation.definition.comment.end
    190 //            ^ punctuation.definition.interpolation.end
    191 
    192     {/* foo */ bar}
    193 //  ^^^^^^^^^^^^^^^ meta.jsx meta.interpolation
    194 //   ^^^^^^^^^^^^^ source.js.embedded
    195 //  ^ punctuation.definition.interpolation.begin - comment
    196 //   ^^ punctuation.definition.comment.begin
    197 //          ^^ punctuation.definition.comment.end
    198 //            ^^^^^ - comment
    199 //             ^^^ meta.jsx meta.interpolation variable.other.readwrite
    200 //                ^ punctuation.definition.interpolation.end
    201 
    202 </foo>;
    203 
    204     <class />;
    205 //   ^^^^^ entity.name.tag