sugar-high 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.mjs +7 -0
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -218,12 +218,19 @@ function tokenize(code) {
|
|
|
218
218
|
*/
|
|
219
219
|
function classify(token) {
|
|
220
220
|
const isLineBreak = token === '\n'
|
|
221
|
+
// First checking if they're attributes values
|
|
221
222
|
if (inJsxTag() && inStringQuotes()) {
|
|
222
223
|
return T_STRING
|
|
223
224
|
}
|
|
225
|
+
// Then determine if they're jsx literals
|
|
224
226
|
const isJsxLiterals = inJsxLiterals()
|
|
225
227
|
if (isJsxLiterals) {
|
|
226
228
|
return T_JSX_LITERALS
|
|
229
|
+
|
|
230
|
+
}
|
|
231
|
+
// Determine strings first before other types
|
|
232
|
+
if (inStringQuotes()) {
|
|
233
|
+
return T_STRING
|
|
227
234
|
} else if (keywords.has(token)) {
|
|
228
235
|
return last[1] === '.' ? T_IDENTIFIER : T_KEYWORD
|
|
229
236
|
} else if (isLineBreak) {
|