@spyglassmc/mcdoc 0.3.3 → 0.3.5

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.
@@ -17,9 +17,9 @@ export declare const string: InfallibleParser<StringNode>;
17
17
  export declare const identifier: InfallibleParser<IdentifierNode>;
18
18
  export declare const path: InfallibleParser<PathNode>;
19
19
  export declare const attribute: Parser<AttributeNode>;
20
- export declare const dispatchStatement: Parser<DispatchStatementNode>;
21
20
  export declare const docComment: Parser<CommentNode>;
22
21
  export declare const docComments: InfallibleParser<DocCommentsNode>;
22
+ export declare const dispatchStatement: Parser<DispatchStatementNode>;
23
23
  export declare const float: InfallibleParser<FloatNode>;
24
24
  export declare const typedNumber: InfallibleParser<TypedNumberNode>;
25
25
  export declare const enum_: Parser<EnumNode>;
@@ -328,9 +328,18 @@ const typeParamBlock = setType('mcdoc:type_param_block', syntax([
328
328
  ]),
329
329
  ]));
330
330
  const noop = () => undefined;
331
+ export const docComment = core.comment({
332
+ singleLinePrefixes: new Set(['///']),
333
+ includesEol: true,
334
+ });
335
+ export const docComments = setType('mcdoc:doc_comments', repeat(docComment, (src) => {
336
+ src.skipWhitespace();
337
+ return [];
338
+ }));
339
+ const prelim = syntax([optional(failOnEmpty(docComments)), attributes]);
331
340
  const optionalTypeParamBlock = select([{ prefix: '<', parser: typeParamBlock }, { parser: noop }]);
332
341
  export const dispatchStatement = setType('mcdoc:dispatch_statement', syntax([
333
- attributes,
342
+ prelim,
334
343
  keyword('dispatch'),
335
344
  resLoc({
336
345
  category: 'mcdoc/dispatcher',
@@ -341,15 +350,6 @@ export const dispatchStatement = setType('mcdoc:dispatch_statement', syntax([
341
350
  literal('to'),
342
351
  { get: () => type },
343
352
  ], true));
344
- export const docComment = core.comment({
345
- singleLinePrefixes: new Set(['///']),
346
- includesEol: true,
347
- });
348
- export const docComments = setType('mcdoc:doc_comments', repeat(docComment, (src) => {
349
- src.skipWhitespace();
350
- return [];
351
- }));
352
- const prelim = syntax([optional(failOnEmpty(docComments)), attributes]);
353
353
  const enumType = literal(['byte', 'short', 'int', 'long', 'string', 'float', 'double'], { colorTokenType: 'type' });
354
354
  export const float = core.float({
355
355
  pattern: /^[-+]?(?:[0-9]+(?:[eE][-+]?[0-9]+)?|[0-9]*\.[0-9]+(?:[eE][-+]?[0-9]+)?)$/,
@@ -495,7 +495,7 @@ function typeBase(type, parser) {
495
495
  syntaxRepeat(select([
496
496
  { prefix: '<', parser: typeArgBlock },
497
497
  { parser: failOnError(indexBody()) },
498
- ])),
498
+ ]), true),
499
499
  ], true));
500
500
  }
501
501
  export const anyType = typeBase('mcdoc:type/any', keyword('any', { colorTokenType: 'type' }));
@@ -566,13 +566,13 @@ export const numericType = typeBase('mcdoc:type/numeric_type', select([
566
566
  parser: syntax([
567
567
  keyword(NumericTypeFloatKinds, { colorTokenType: 'type' }),
568
568
  atFloatRange,
569
- ]),
569
+ ], true),
570
570
  },
571
571
  {
572
572
  parser: syntax([
573
573
  keyword(NumericTypeIntKinds, { colorTokenType: 'type' }),
574
574
  atIntRange,
575
- ]),
575
+ ], true),
576
576
  },
577
577
  ]));
578
578
  export const primitiveArrayType = typeBase('mcdoc:type/primitive_array', syntax([
@@ -16,7 +16,7 @@ export type NumericRange = {
16
16
  min?: number;
17
17
  max?: number;
18
18
  };
19
- export declare const StaticIndexKeywords: readonly ["fallback", "none", "unknown"];
19
+ export declare const StaticIndexKeywords: readonly ["fallback", "none", "unknown", "spawnitem"];
20
20
  export type StaticIndexKeyword = (typeof StaticIndexKeywords)[number];
21
21
  export interface StaticIndex {
22
22
  kind: 'static';
package/lib/type/index.js CHANGED
@@ -5,6 +5,7 @@ export const StaticIndexKeywords = Object.freeze([
5
5
  'fallback',
6
6
  'none',
7
7
  'unknown',
8
+ 'spawnitem',
8
9
  ]);
9
10
  export const EmptyUnion = Object.freeze({
10
11
  kind: 'union',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spyglassmc/mcdoc",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "url": "https://github.com/SpyglassMC/Spyglass/issues"
26
26
  },
27
27
  "dependencies": {
28
- "@spyglassmc/core": "0.4.2",
29
- "@spyglassmc/locales": "0.3.2"
28
+ "@spyglassmc/core": "0.4.4",
29
+ "@spyglassmc/locales": "0.3.4"
30
30
  }
31
31
  }