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