@cardenelabs/dragon 0.11.0 → 0.12.0
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/dist/index.cjs +42 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +42 -15
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/v05/parser.ts +54 -15
package/dist/index.js
CHANGED
|
@@ -1333,22 +1333,49 @@ function writtenScaleFields(inner) {
|
|
|
1333
1333
|
return out;
|
|
1334
1334
|
}
|
|
1335
1335
|
function splitInlineFields(inner) {
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1336
|
+
const \u5F15\u7528\u7B26\u3092\u898B\u3066\u5272\u308B = (\u898B\u308B) => {
|
|
1337
|
+
let depth = 0;
|
|
1338
|
+
let \u5F15\u7528\u7B26 = null;
|
|
1339
|
+
let \u76F4\u524D = null;
|
|
1340
|
+
let buf = "";
|
|
1341
|
+
const parts = [];
|
|
1342
|
+
for (let i = 0; i < inner.length; i += 1) {
|
|
1343
|
+
const c = inner[i];
|
|
1344
|
+
if (\u898B\u308B) {
|
|
1345
|
+
if (\u5F15\u7528\u7B26 !== null) {
|
|
1346
|
+
if (\u5F15\u7528\u7B26 === '"' && c === "\\" && i + 1 < inner.length) {
|
|
1347
|
+
buf += c;
|
|
1348
|
+
i += 1;
|
|
1349
|
+
buf += inner[i];
|
|
1350
|
+
continue;
|
|
1351
|
+
}
|
|
1352
|
+
if (c === \u5F15\u7528\u7B26) \u5F15\u7528\u7B26 = null;
|
|
1353
|
+
buf += c;
|
|
1354
|
+
continue;
|
|
1355
|
+
}
|
|
1356
|
+
if ((c === '"' || c === "'") && (\u76F4\u524D === null || ":,{[".includes(\u76F4\u524D))) {
|
|
1357
|
+
\u5F15\u7528\u7B26 = c;
|
|
1358
|
+
\u76F4\u524D = c;
|
|
1359
|
+
buf += c;
|
|
1360
|
+
continue;
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
if (c === "[" || c === "{") depth += 1;
|
|
1364
|
+
else if (c === "]" || c === "}") depth -= 1;
|
|
1365
|
+
if (c === "," && depth === 0) {
|
|
1366
|
+
parts.push(buf);
|
|
1367
|
+
buf = "";
|
|
1368
|
+
\u76F4\u524D = c;
|
|
1369
|
+
continue;
|
|
1370
|
+
}
|
|
1371
|
+
buf += c;
|
|
1372
|
+
if (c !== " " && c !== " ") \u76F4\u524D = c;
|
|
1347
1373
|
}
|
|
1348
|
-
buf
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1374
|
+
if (buf.trim()) parts.push(buf);
|
|
1375
|
+
return { parts, \u9589\u3058\u305F: \u5F15\u7528\u7B26 === null };
|
|
1376
|
+
};
|
|
1377
|
+
const \u898B\u305F = \u5F15\u7528\u7B26\u3092\u898B\u3066\u5272\u308B(true);
|
|
1378
|
+
return \u898B\u305F.\u9589\u3058\u305F ? \u898B\u305F.parts : \u5F15\u7528\u7B26\u3092\u898B\u3066\u5272\u308B(false).parts;
|
|
1352
1379
|
}
|
|
1353
1380
|
function collectIndentedList(lines, start, parentIndent) {
|
|
1354
1381
|
const items = [];
|