@spyglassmc/mcdoc 0.1.0 → 0.1.1
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/parser/index.js +6 -3
- package/package.json +1 -1
package/lib/parser/index.js
CHANGED
|
@@ -236,9 +236,9 @@ const attributeTreeNamedValues = (0, core_1.setType)('mcdoc:attribute/tree/named
|
|
|
236
236
|
syntaxRepeat(syntax([marker(','), (0, core_1.failOnEmpty)(attributeNamedValue)], true), true),
|
|
237
237
|
], true));
|
|
238
238
|
const treeBody = (0, core_1.any)([
|
|
239
|
-
syntax([attributeTreePosValues, (0, core_1.optional)(marker(','))]),
|
|
240
239
|
syntax([attributeTreeNamedValues, (0, core_1.optional)(marker(','))]),
|
|
241
240
|
syntax([attributeTreePosValues, punctuation(','), attributeTreeNamedValues, (0, core_1.optional)(marker(','))]),
|
|
241
|
+
syntax([attributeTreePosValues, (0, core_1.optional)(marker(','))]),
|
|
242
242
|
]);
|
|
243
243
|
const AttributeTreeClosure = Object.freeze({
|
|
244
244
|
'(': ')',
|
|
@@ -246,7 +246,10 @@ const AttributeTreeClosure = Object.freeze({
|
|
|
246
246
|
'{': '}',
|
|
247
247
|
});
|
|
248
248
|
const attributeTree = (src, ctx) => {
|
|
249
|
-
const delim = src.trySkip('(') ? '(' : (src.trySkip('[') ? '[' : '{');
|
|
249
|
+
const delim = src.trySkip('(') ? '(' : (src.trySkip('[') ? '[' : (src.trySkip('{') ? '{' : undefined));
|
|
250
|
+
if (!delim) {
|
|
251
|
+
return core_1.Failure;
|
|
252
|
+
}
|
|
250
253
|
const res = treeBody(src, ctx);
|
|
251
254
|
const ans = {
|
|
252
255
|
type: 'mcdoc:attribute/tree',
|
|
@@ -460,7 +463,7 @@ exports.useStatement = (0, core_1.setType)('mcdoc:use_statement', syntax([
|
|
|
460
463
|
{ prefix: 'as', parser: syntax([literal('as'), exports.identifier]) },
|
|
461
464
|
{ parser: noop },
|
|
462
465
|
]),
|
|
463
|
-
]));
|
|
466
|
+
], true));
|
|
464
467
|
const topLevel = (0, core_1.any)([
|
|
465
468
|
exports.comment,
|
|
466
469
|
exports.dispatchStatement,
|