@bscotch/gml-parser 1.14.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.
Files changed (208) hide show
  1. package/LICENSE.md +29 -0
  2. package/README.md +151 -0
  3. package/assets/GmlSpec.xml +11419 -0
  4. package/dist/index.d.ts +16 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +13 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/jsdoc.d.ts +79 -0
  9. package/dist/jsdoc.d.ts.map +1 -0
  10. package/dist/jsdoc.feather.d.ts +23 -0
  11. package/dist/jsdoc.feather.d.ts.map +1 -0
  12. package/dist/jsdoc.feather.js +143 -0
  13. package/dist/jsdoc.feather.js.map +1 -0
  14. package/dist/jsdoc.js +468 -0
  15. package/dist/jsdoc.js.map +1 -0
  16. package/dist/jsdoc.test.d.ts +2 -0
  17. package/dist/jsdoc.test.d.ts.map +1 -0
  18. package/dist/jsdoc.test.js +185 -0
  19. package/dist/jsdoc.test.js.map +1 -0
  20. package/dist/lexer.d.ts +3 -0
  21. package/dist/lexer.d.ts.map +1 -0
  22. package/dist/lexer.js +14 -0
  23. package/dist/lexer.js.map +1 -0
  24. package/dist/lexer.test.d.ts +2 -0
  25. package/dist/lexer.test.d.ts.map +1 -0
  26. package/dist/lexer.test.js +78 -0
  27. package/dist/lexer.test.js.map +1 -0
  28. package/dist/lib.objects.d.ts +190 -0
  29. package/dist/lib.objects.d.ts.map +1 -0
  30. package/dist/lib.objects.js +242 -0
  31. package/dist/lib.objects.js.map +1 -0
  32. package/dist/logger.d.ts +13 -0
  33. package/dist/logger.d.ts.map +1 -0
  34. package/dist/logger.js +14 -0
  35. package/dist/logger.js.map +1 -0
  36. package/dist/modules.d.ts +19 -0
  37. package/dist/modules.d.ts.map +1 -0
  38. package/dist/modules.js +320 -0
  39. package/dist/modules.js.map +1 -0
  40. package/dist/modules.test.d.ts +2 -0
  41. package/dist/modules.test.d.ts.map +1 -0
  42. package/dist/modules.test.js +57 -0
  43. package/dist/modules.test.js.map +1 -0
  44. package/dist/modules.types.d.ts +78 -0
  45. package/dist/modules.types.d.ts.map +1 -0
  46. package/dist/modules.types.js +2 -0
  47. package/dist/modules.types.js.map +1 -0
  48. package/dist/modules.util.d.ts +5 -0
  49. package/dist/modules.util.d.ts.map +1 -0
  50. package/dist/modules.util.js +13 -0
  51. package/dist/modules.util.js.map +1 -0
  52. package/dist/parser.d.ts +121 -0
  53. package/dist/parser.d.ts.map +1 -0
  54. package/dist/parser.js +571 -0
  55. package/dist/parser.js.map +1 -0
  56. package/dist/parser.test.d.ts +2 -0
  57. package/dist/parser.test.d.ts.map +1 -0
  58. package/dist/parser.test.js +143 -0
  59. package/dist/parser.test.js.map +1 -0
  60. package/dist/parser.utility.d.ts +29 -0
  61. package/dist/parser.utility.d.ts.map +1 -0
  62. package/dist/parser.utility.js +125 -0
  63. package/dist/parser.utility.js.map +1 -0
  64. package/dist/project.asset.d.ts +115 -0
  65. package/dist/project.asset.d.ts.map +1 -0
  66. package/dist/project.asset.js +802 -0
  67. package/dist/project.asset.js.map +1 -0
  68. package/dist/project.code.d.ts +130 -0
  69. package/dist/project.code.d.ts.map +1 -0
  70. package/dist/project.code.js +570 -0
  71. package/dist/project.code.js.map +1 -0
  72. package/dist/project.d.ts +533 -0
  73. package/dist/project.d.ts.map +1 -0
  74. package/dist/project.diagnostics.d.ts +32 -0
  75. package/dist/project.diagnostics.d.ts.map +1 -0
  76. package/dist/project.diagnostics.js +23 -0
  77. package/dist/project.diagnostics.js.map +1 -0
  78. package/dist/project.js +1216 -0
  79. package/dist/project.js.map +1 -0
  80. package/dist/project.location.d.ts +133 -0
  81. package/dist/project.location.d.ts.map +1 -0
  82. package/dist/project.location.js +219 -0
  83. package/dist/project.location.js.map +1 -0
  84. package/dist/project.native.d.ts +26 -0
  85. package/dist/project.native.d.ts.map +1 -0
  86. package/dist/project.native.js +321 -0
  87. package/dist/project.native.js.map +1 -0
  88. package/dist/project.spec.d.ts +1298 -0
  89. package/dist/project.spec.d.ts.map +1 -0
  90. package/dist/project.spec.js +263 -0
  91. package/dist/project.spec.js.map +1 -0
  92. package/dist/project.test.d.ts +2 -0
  93. package/dist/project.test.d.ts.map +1 -0
  94. package/dist/project.test.js +633 -0
  95. package/dist/project.test.js.map +1 -0
  96. package/dist/shaderDefaults.d.ts +3 -0
  97. package/dist/shaderDefaults.d.ts.map +1 -0
  98. package/dist/shaderDefaults.js +32 -0
  99. package/dist/shaderDefaults.js.map +1 -0
  100. package/dist/signifiers.d.ts +54 -0
  101. package/dist/signifiers.d.ts.map +1 -0
  102. package/dist/signifiers.flags.d.ts +38 -0
  103. package/dist/signifiers.flags.d.ts.map +1 -0
  104. package/dist/signifiers.flags.js +131 -0
  105. package/dist/signifiers.flags.js.map +1 -0
  106. package/dist/signifiers.js +117 -0
  107. package/dist/signifiers.js.map +1 -0
  108. package/dist/spine.d.ts +28 -0
  109. package/dist/spine.d.ts.map +1 -0
  110. package/dist/spine.js +64 -0
  111. package/dist/spine.js.map +1 -0
  112. package/dist/spine.test.d.ts +2 -0
  113. package/dist/spine.test.d.ts.map +1 -0
  114. package/dist/spine.test.js +420 -0
  115. package/dist/spine.test.js.map +1 -0
  116. package/dist/spine.types.d.ts +89 -0
  117. package/dist/spine.types.d.ts.map +1 -0
  118. package/dist/spine.types.js +2 -0
  119. package/dist/spine.types.js.map +1 -0
  120. package/dist/test.lib.d.ts +3 -0
  121. package/dist/test.lib.d.ts.map +1 -0
  122. package/dist/test.lib.js +16 -0
  123. package/dist/test.lib.js.map +1 -0
  124. package/dist/tokens.categories.d.ts +22 -0
  125. package/dist/tokens.categories.d.ts.map +1 -0
  126. package/dist/tokens.categories.js +78 -0
  127. package/dist/tokens.categories.js.map +1 -0
  128. package/dist/tokens.code.d.ts +2 -0
  129. package/dist/tokens.code.d.ts.map +1 -0
  130. package/dist/tokens.code.js +523 -0
  131. package/dist/tokens.code.js.map +1 -0
  132. package/dist/tokens.d.ts +130 -0
  133. package/dist/tokens.d.ts.map +1 -0
  134. package/dist/tokens.js +13 -0
  135. package/dist/tokens.js.map +1 -0
  136. package/dist/tokens.lib.d.ts +15 -0
  137. package/dist/tokens.lib.d.ts.map +1 -0
  138. package/dist/tokens.lib.js +12 -0
  139. package/dist/tokens.lib.js.map +1 -0
  140. package/dist/tokens.shared.d.ts +4 -0
  141. package/dist/tokens.shared.d.ts.map +1 -0
  142. package/dist/tokens.shared.js +35 -0
  143. package/dist/tokens.shared.js.map +1 -0
  144. package/dist/tokens.strings.d.ts +5 -0
  145. package/dist/tokens.strings.d.ts.map +1 -0
  146. package/dist/tokens.strings.js +111 -0
  147. package/dist/tokens.strings.js.map +1 -0
  148. package/dist/types.checks.d.ts +50 -0
  149. package/dist/types.checks.d.ts.map +1 -0
  150. package/dist/types.checks.js +246 -0
  151. package/dist/types.checks.js.map +1 -0
  152. package/dist/types.d.ts +152 -0
  153. package/dist/types.d.ts.map +1 -0
  154. package/dist/types.feather.d.ts +21 -0
  155. package/dist/types.feather.d.ts.map +1 -0
  156. package/dist/types.feather.js +156 -0
  157. package/dist/types.feather.js.map +1 -0
  158. package/dist/types.hover.d.ts +4 -0
  159. package/dist/types.hover.d.ts.map +1 -0
  160. package/dist/types.hover.js +99 -0
  161. package/dist/types.hover.js.map +1 -0
  162. package/dist/types.js +457 -0
  163. package/dist/types.js.map +1 -0
  164. package/dist/types.primitives.d.ts +10 -0
  165. package/dist/types.primitives.d.ts.map +1 -0
  166. package/dist/types.primitives.js +88 -0
  167. package/dist/types.primitives.js.map +1 -0
  168. package/dist/types.sprites.d.ts +8 -0
  169. package/dist/types.sprites.d.ts.map +1 -0
  170. package/dist/types.sprites.js +417 -0
  171. package/dist/types.sprites.js.map +1 -0
  172. package/dist/types.test.d.ts +2 -0
  173. package/dist/types.test.d.ts.map +1 -0
  174. package/dist/types.test.js +62 -0
  175. package/dist/types.test.js.map +1 -0
  176. package/dist/util.d.ts +50 -0
  177. package/dist/util.d.ts.map +1 -0
  178. package/dist/util.js +168 -0
  179. package/dist/util.js.map +1 -0
  180. package/dist/util.test.d.ts +3 -0
  181. package/dist/util.test.d.ts.map +1 -0
  182. package/dist/util.test.js +63 -0
  183. package/dist/util.test.js.map +1 -0
  184. package/dist/visitor.assign.d.ts +24 -0
  185. package/dist/visitor.assign.d.ts.map +1 -0
  186. package/dist/visitor.assign.js +112 -0
  187. package/dist/visitor.assign.js.map +1 -0
  188. package/dist/visitor.d.ts +89 -0
  189. package/dist/visitor.d.ts.map +1 -0
  190. package/dist/visitor.functionExpression.d.ts +7 -0
  191. package/dist/visitor.functionExpression.d.ts.map +1 -0
  192. package/dist/visitor.functionExpression.js +216 -0
  193. package/dist/visitor.functionExpression.js.map +1 -0
  194. package/dist/visitor.globals.d.ts +59 -0
  195. package/dist/visitor.globals.d.ts.map +1 -0
  196. package/dist/visitor.globals.js +271 -0
  197. package/dist/visitor.globals.js.map +1 -0
  198. package/dist/visitor.identifierAccessor.d.ts +6 -0
  199. package/dist/visitor.identifierAccessor.d.ts.map +1 -0
  200. package/dist/visitor.identifierAccessor.js +381 -0
  201. package/dist/visitor.identifierAccessor.js.map +1 -0
  202. package/dist/visitor.js +605 -0
  203. package/dist/visitor.js.map +1 -0
  204. package/dist/visitor.processor.d.ts +66 -0
  205. package/dist/visitor.processor.d.ts.map +1 -0
  206. package/dist/visitor.processor.js +147 -0
  207. package/dist/visitor.processor.js.map +1 -0
  208. package/package.json +63 -0
@@ -0,0 +1,88 @@
1
+ export const withableTypes = [
2
+ 'Struct',
3
+ 'Asset.GMObject',
4
+ 'Id.Instance',
5
+ ];
6
+ export const utilityTypes = [
7
+ 'InstanceType',
8
+ 'ObjectType',
9
+ 'StaticType',
10
+ ];
11
+ export const withableTypesLower = withableTypes.map((t) => t.toLowerCase());
12
+ export const baseNames = [
13
+ 'Array',
14
+ 'Bool',
15
+ 'Enum',
16
+ 'Function',
17
+ 'Pointer',
18
+ 'Real',
19
+ 'String',
20
+ 'Struct',
21
+ 'Undefined',
22
+ 'ArgumentIdentity',
23
+ ];
24
+ Object.freeze(Object.seal(baseNames));
25
+ export const primitiveNames = [
26
+ ...baseNames,
27
+ 'Any',
28
+ 'Asset.GMAnimCurve',
29
+ 'Asset.GMAudioGroup',
30
+ 'Asset.GMFont',
31
+ 'Asset.GMObject',
32
+ 'Asset.GMParticleSystem',
33
+ 'Asset.GMPath',
34
+ 'Asset.GMRoom',
35
+ 'Asset.GMScript',
36
+ 'Asset.GMSequence',
37
+ 'Asset.GMShader',
38
+ 'Asset.GMSound',
39
+ 'Asset.GMSprite',
40
+ 'Asset.GMTileSet',
41
+ 'Asset.GMTimeline',
42
+ 'Asset.Script',
43
+ 'Id.AudioEmitter',
44
+ 'Id.AudioListener',
45
+ 'Id.AudioSyncGroup',
46
+ 'Id.BackgroundElement',
47
+ 'Id.BinaryFile',
48
+ 'Id.Buffer',
49
+ 'Id.Camera',
50
+ 'Id.DsGrid',
51
+ 'Id.DsList',
52
+ 'Id.DsMap',
53
+ 'Id.DsPriority',
54
+ 'Id.DsQueue',
55
+ 'Id.DsStack',
56
+ 'Id.ExternalCall',
57
+ 'Id.Gif',
58
+ 'Id.Instance',
59
+ 'Id.Layer',
60
+ 'Id.MpGrid',
61
+ 'Id.ParticleEmitter',
62
+ 'Id.ParticleSystem',
63
+ 'Id.ParticleType',
64
+ 'Id.PhysicsIndex',
65
+ 'Id.PhysicsParticleGroup',
66
+ 'Id.Sampler',
67
+ 'Id.SequenceElement',
68
+ 'Id.Socket',
69
+ 'Id.Sound',
70
+ 'Id.SpriteElement',
71
+ 'Id.Surface',
72
+ 'Id.TextFile',
73
+ 'Id.Texture',
74
+ 'Id.TileElementId',
75
+ 'Id.TileMapElement',
76
+ 'Id.TimeSource',
77
+ 'Id.Uniform',
78
+ 'Id.VertexBuffer',
79
+ 'Id.VertexFormat',
80
+ 'Mixed',
81
+ // Custom names (not in Feather)
82
+ 'EnumMember',
83
+ 'Unknown',
84
+ 'Never', // For things that throw
85
+ ...utilityTypes,
86
+ ];
87
+ Object.freeze(Object.seal(primitiveNames));
88
+ //# sourceMappingURL=types.primitives.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.primitives.js","sourceRoot":"","sources":["../src/types.primitives.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,QAAQ;IACR,gBAAgB;IAChB,aAAa;CACL,CAAC;AAEX,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,cAAc;IACd,YAAY;IACZ,YAAY;CACJ,CAAC;AAEX,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACxD,CAAC,CAAC,WAAW,EAAE,CACsB,CAAC;AAIxC,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,OAAO;IACP,MAAM;IACN,MAAM;IACN,UAAU;IACV,SAAS;IACT,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,kBAAkB;CACV,CAAC;AACX,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;AAGtC,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,GAAG,SAAS;IACZ,KAAK;IACL,mBAAmB;IACnB,oBAAoB;IACpB,cAAc;IACd,gBAAgB;IAChB,wBAAwB;IACxB,cAAc;IACd,cAAc;IACd,gBAAgB;IAChB,kBAAkB;IAClB,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IAChB,iBAAiB;IACjB,kBAAkB;IAClB,cAAc;IACd,iBAAiB;IACjB,kBAAkB;IAClB,mBAAmB;IACnB,sBAAsB;IACtB,eAAe;IACf,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;IACX,UAAU;IACV,eAAe;IACf,YAAY;IACZ,YAAY;IACZ,iBAAiB;IACjB,QAAQ;IACR,aAAa;IACb,UAAU;IACV,WAAW;IACX,oBAAoB;IACpB,mBAAmB;IACnB,iBAAiB;IACjB,iBAAiB;IACjB,yBAAyB;IACzB,YAAY;IACZ,oBAAoB;IACpB,WAAW;IACX,UAAU;IACV,kBAAkB;IAClB,YAAY;IACZ,aAAa;IACb,YAAY;IACZ,kBAAkB;IAClB,mBAAmB;IACnB,eAAe;IACf,YAAY;IACZ,iBAAiB;IACjB,iBAAiB;IACjB,OAAO;IACP,gCAAgC;IAChC,YAAY;IACZ,SAAS;IACT,OAAO,EAAE,wBAAwB;IACjC,GAAG,YAAY;CACP,CAAC;AACX,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Type } from './types.js';
2
+ /**
3
+ * The `sprite_get_info()` native function returns a struct that is
4
+ * not defined in the spec but has documentation. This function creates
5
+ * that struct.
6
+ */
7
+ export declare function addSpriteInfoStruct(globalTypes: Map<string, Type>): void;
8
+ //# sourceMappingURL=types.sprites.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.sprites.d.ts","sourceRoot":"","sources":["../src/types.sprites.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,IAAI,EAAE,MAAM,YAAY,CAAC;AAqb9C;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,QAyBjE"}
@@ -0,0 +1,417 @@
1
+ import { Signifier } from './signifiers.js';
2
+ import { typeFromFeatherString } from './types.feather.js';
3
+ import { Type } from './types.js';
4
+ import { assert } from './util.js';
5
+ /** See {@link https://manual.yoyogames.com/GameMaker_Language/GML_Reference/Asset_Management/Sprites/Sprite_Information/sprite_get_info.htm# the Docs} */
6
+ const spriteInfoVariables = [
7
+ //#region COMMON VARIABLES
8
+ {
9
+ variable: 'width',
10
+ type: 'Real',
11
+ description: "The sprite's width (in pixels)",
12
+ },
13
+ {
14
+ variable: 'height',
15
+ type: 'Real',
16
+ description: "The sprite's height (in pixels)",
17
+ },
18
+ {
19
+ variable: 'xoffset',
20
+ type: 'Real',
21
+ description: "The sprite's X offset/origin (in pixels)",
22
+ },
23
+ {
24
+ variable: 'yoffset',
25
+ type: 'Real',
26
+ description: "The sprite's Y offset/origin (in pixels)",
27
+ },
28
+ {
29
+ variable: 'transparent',
30
+ type: 'Bool',
31
+ description: 'true if the sprite is marked as transparent, otherwise false\r\n\r\n (This can only be specified through sprite_add()\xa0or similar functions, and will be false for sprites created in the IDE)',
32
+ },
33
+ {
34
+ variable: 'smooth',
35
+ type: 'Bool',
36
+ description: 'true if the sprite is marked as smooth, otherwise false\r\n\r\n (This can only be specified through sprite_add()\xa0or similar functions, and will be false for sprites created in the IDE)',
37
+ },
38
+ {
39
+ variable: 'type',
40
+ type: 'Real',
41
+ description: 'The type of the sprite:\r\n\r\n 0 - Bitmap (Regular sprites)\r\n\r\n 1 - SWF\r\n\r\n 2 - Spine',
42
+ },
43
+ {
44
+ variable: 'bbox_left',
45
+ type: 'Real',
46
+ description: 'Position of the left edge of the bounding box (in pixels)',
47
+ },
48
+ {
49
+ variable: 'bbox_top',
50
+ type: 'Real',
51
+ description: 'Position of the top edge of the bounding box (in pixels)',
52
+ },
53
+ {
54
+ variable: 'bbox_right',
55
+ type: 'Real',
56
+ description: 'Position of the right edge of the bounding box (in pixels)',
57
+ },
58
+ {
59
+ variable: 'bbox_bottom',
60
+ type: 'Real',
61
+ description: 'Position of the bottom edge of the bounding box (in pixels)',
62
+ },
63
+ {
64
+ variable: 'name',
65
+ type: 'String',
66
+ description: 'The name of the sprite',
67
+ },
68
+ {
69
+ variable: 'num_subimages',
70
+ type: 'Real',
71
+ description: 'The number of sub-images (or frames) in the sprite',
72
+ },
73
+ {
74
+ variable: 'use_mask',
75
+ type: 'Bool',
76
+ description: 'true if this sprite uses a collision mask (either generated from a shape or the image itself), otherwise false (meaning it uses a bounding box)',
77
+ },
78
+ {
79
+ variable: 'num_masks',
80
+ type: 'Real',
81
+ description: 'The number of masks in this sprite (will be greater than 1 if the sprite uses per-frame masks)',
82
+ },
83
+ {
84
+ variable: 'nineslice',
85
+ type: 'Struct',
86
+ description: 'The Nine Slice struct for this sprite, or undefined if it has no nine slice data',
87
+ },
88
+ {
89
+ variable: 'messages',
90
+ type: 'Array',
91
+ description: 'Array of broadcast messages for this sprite, where each broadcast message is a struct containing information on the message (more information under "General Sprite Data")',
92
+ },
93
+ {
94
+ variable: 'frame_info',
95
+ type: 'Array',
96
+ description: 'Array of frames for this sprite, where each frame is a struct containing information on its timing\xa0(more information under "General Sprite Data")',
97
+ },
98
+ {
99
+ variable: 'frame_speed',
100
+ type: 'Real',
101
+ description: 'The frame speed set for the sprite (see:\xa0The Sprite Editor)',
102
+ },
103
+ {
104
+ variable: 'frame_type',
105
+ type: 'Real',
106
+ description: 'The type of speed set for the sprite, either spritespeed_framespersecond or spritespeed_framespergameframe',
107
+ },
108
+ //#endregion COMMON VARIABLES
109
+ //#region SPINE VARIABLES
110
+ {
111
+ variable: 'num_atlas',
112
+ type: 'Real',
113
+ description: 'The number of atlas textures used',
114
+ },
115
+ {
116
+ variable: 'atlas_texture',
117
+ type: 'Array<Id.Texture>',
118
+ description: 'Array of texture IDs used for the atlas',
119
+ },
120
+ {
121
+ variable: 'premultiplied',
122
+ type: 'Bool',
123
+ description: 'true if this sprite is marked as premultiplied, otherwise false',
124
+ },
125
+ {
126
+ variable: 'animation_names',
127
+ type: 'Array<String>',
128
+ description: 'Array containing the names of each animation in this sprite',
129
+ },
130
+ {
131
+ variable: 'skin_names',
132
+ type: 'Array<String>',
133
+ description: 'Array containing the names of each skin in this sprite',
134
+ },
135
+ {
136
+ variable: 'bones',
137
+ type: 'Array',
138
+ description: 'Array containing structs for each bone in this sprite',
139
+ },
140
+ {
141
+ variable: 'slots',
142
+ type: 'Array',
143
+ description: 'Array containing structs for each slot in this sprite\xa0(more information under "Spine Sprite Data")',
144
+ },
145
+ //#endregion SPINE VARIABLES
146
+ //#region MANUALLY ADDED
147
+ {
148
+ variable: 'frames',
149
+ type: 'Array',
150
+ description: 'Array of frames for this sprite, where each frame is a struct containing information on its texture',
151
+ },
152
+ //#endregion MANUALLY ADDED
153
+ ];
154
+ const frameVariables = [
155
+ {
156
+ variable: 'x',
157
+ type: 'Real',
158
+ description: 'The X position of this frame on its texture page (in pixels)',
159
+ },
160
+ {
161
+ variable: 'y',
162
+ type: 'Real',
163
+ description: 'The Y position of this frame on its texture page (in pixels)',
164
+ },
165
+ {
166
+ variable: 'w',
167
+ type: 'Real',
168
+ description: 'The logical width of the frame (in pixels) used internally',
169
+ },
170
+ {
171
+ variable: 'h',
172
+ type: 'Real',
173
+ description: 'The logical height of the frame (in pixels) used internally',
174
+ },
175
+ {
176
+ variable: 'texture',
177
+ type: 'Real',
178
+ description: 'The texture page ID for this frame',
179
+ },
180
+ {
181
+ variable: 'original_width',
182
+ type: 'Real',
183
+ description: 'The original width of the frame (in pixels)',
184
+ },
185
+ {
186
+ variable: 'original_height',
187
+ type: 'Real',
188
+ description: 'The original height of the frame (in pixels)',
189
+ },
190
+ {
191
+ variable: 'crop_width',
192
+ type: 'Real',
193
+ description: "The actual width of the frame on the texture page after cropping and scaling (since GameMaker automatically trims the empty space around an image, and also scales it down if it doesn't fit)",
194
+ },
195
+ {
196
+ variable: 'crop_height',
197
+ type: 'Real',
198
+ description: 'The actual height of the frame on the texture page after cropping and scaling',
199
+ },
200
+ {
201
+ variable: 'x_offset',
202
+ type: 'Real',
203
+ description: 'The X offset from the left edge of the original image to the left edge of the cropped section',
204
+ },
205
+ {
206
+ variable: 'y_offset',
207
+ type: 'Real',
208
+ description: 'The Y offset from the top edge of the original image to the top edge of the cropped section',
209
+ },
210
+ ];
211
+ const boneVariables = [
212
+ {
213
+ variable: 'parent',
214
+ type: 'String',
215
+ description: "The name of the parent bone, or\xa0undefined if this bone doesn't have a parent",
216
+ },
217
+ {
218
+ variable: 'name',
219
+ type: 'String',
220
+ description: 'The name of this bone',
221
+ },
222
+ {
223
+ variable: 'index',
224
+ type: 'Real',
225
+ description: 'The index of this bone',
226
+ },
227
+ {
228
+ variable: 'length',
229
+ type: 'Real',
230
+ description: 'The length of this bone',
231
+ },
232
+ {
233
+ variable: 'x',
234
+ type: 'Real',
235
+ description: 'The X position of this bone',
236
+ },
237
+ {
238
+ variable: 'y',
239
+ type: 'Real',
240
+ description: 'The Y position of this bone',
241
+ },
242
+ {
243
+ variable: 'rotation',
244
+ type: 'Real',
245
+ description: 'The rotation of this bone',
246
+ },
247
+ {
248
+ variable: 'scale_x',
249
+ type: 'Real',
250
+ description: '(Internal to Spine) Scale value on X',
251
+ },
252
+ {
253
+ variable: 'scale_y',
254
+ type: 'Real',
255
+ description: '(Internal to Spine) Scale value on Y',
256
+ },
257
+ {
258
+ variable: 'shear_x',
259
+ type: 'Real',
260
+ description: '(Internal to Spine) Shear value on X',
261
+ },
262
+ {
263
+ variable: 'shear_y',
264
+ type: 'Real',
265
+ description: '(Internal to Spine) Shear value on Y',
266
+ },
267
+ {
268
+ variable: 'transform_mode',
269
+ type: 'Real',
270
+ description: '(Internal to Spine) The transform mode',
271
+ },
272
+ ];
273
+ const slotVariables = [
274
+ {
275
+ variable: 'name',
276
+ type: 'String',
277
+ description: 'The name of the slot',
278
+ },
279
+ {
280
+ variable: 'index',
281
+ type: 'Real',
282
+ description: 'The index of the slot',
283
+ },
284
+ {
285
+ variable: 'bone',
286
+ type: 'String',
287
+ description: 'The name of the slot\'s bone, or "(none)" if there is no bone for this slot',
288
+ },
289
+ {
290
+ variable: 'attachment',
291
+ type: 'String',
292
+ description: 'Attachment name',
293
+ },
294
+ {
295
+ variable: 'red',
296
+ type: 'Real',
297
+ description: "Red component of the slot's colour (0-1)",
298
+ },
299
+ {
300
+ variable: 'green',
301
+ type: 'Real',
302
+ description: "Green component of the slot's colour (0-1)",
303
+ },
304
+ {
305
+ variable: 'blue',
306
+ type: 'Real',
307
+ description: "Blue component of the slot's colour (0-1)",
308
+ },
309
+ {
310
+ variable: 'alpha',
311
+ type: 'Real',
312
+ description: "Alpha component of the slot's colour (0-1)",
313
+ },
314
+ {
315
+ variable: 'blend_mode',
316
+ type: 'Real',
317
+ description: '(Internal to Spine) Blend mode for the slot',
318
+ },
319
+ {
320
+ variable: 'dark_red',
321
+ type: 'Real',
322
+ description: "Red component of the slot's dark colour (0-1)",
323
+ },
324
+ {
325
+ variable: 'dark_green',
326
+ type: 'Real',
327
+ description: "Green component of the slot's dark colour (0-1)",
328
+ },
329
+ {
330
+ variable: 'dark_blue',
331
+ type: 'Real',
332
+ description: "Blue component of the slot's dark colour (0-1)",
333
+ },
334
+ {
335
+ variable: 'dark_alpha',
336
+ type: 'String',
337
+ description: "Alpha component of the slot's dark colour (0-1)",
338
+ },
339
+ {
340
+ variable: 'attachments',
341
+ type: 'Array\xa0of\xa0String',
342
+ description: 'An array containing the names\xa0of all available attachments for this slot.',
343
+ },
344
+ ];
345
+ const messagesVariables = [
346
+ {
347
+ variable: 'frame',
348
+ type: 'Real',
349
+ description: 'The timing of this broadcast message from the start of the animation (in frames)',
350
+ },
351
+ {
352
+ variable: 'message',
353
+ type: 'String',
354
+ description: 'The broadcast message string',
355
+ },
356
+ ];
357
+ const frameInfoVariables = [
358
+ {
359
+ variable: 'frame',
360
+ type: 'Real',
361
+ description: 'The timing for the start of this frame (in frames)',
362
+ },
363
+ {
364
+ variable: 'duration',
365
+ type: 'Real',
366
+ description: 'The duration of this frame (in frames)',
367
+ },
368
+ {
369
+ variable: 'image_index',
370
+ type: 'Real',
371
+ description: 'The image index of this frame',
372
+ },
373
+ ];
374
+ function variablesToStruct(variables, globalTypes) {
375
+ const struct = new Type('Struct');
376
+ for (const v of variables) {
377
+ const type = typeFromFeatherString(v.type, globalTypes, false);
378
+ const newVar = new Signifier(struct, v.variable, type);
379
+ newVar.native = 'Base';
380
+ newVar.describe(v.description);
381
+ struct.addMember(newVar);
382
+ }
383
+ return struct;
384
+ }
385
+ function addArrayItemTypeToField(struct, fieldName, itemType) {
386
+ const field = struct.getMember(fieldName);
387
+ assert(field, `Field ${fieldName} not found in struct ${struct.name}`);
388
+ const arrayType = field.getTypeByKind('Array');
389
+ assert(arrayType, `Field ${fieldName} in struct ${struct.name} is not an array`);
390
+ arrayType.addItemType(itemType);
391
+ }
392
+ /**
393
+ * The `sprite_get_info()` native function returns a struct that is
394
+ * not defined in the spec but has documentation. This function creates
395
+ * that struct.
396
+ */
397
+ export function addSpriteInfoStruct(globalTypes) {
398
+ const spriteInfo = variablesToStruct(spriteInfoVariables, globalTypes);
399
+ spriteInfo.named('SpriteInfo');
400
+ // Populate the frame struct
401
+ const frameStruct = variablesToStruct(frameVariables, globalTypes);
402
+ addArrayItemTypeToField(spriteInfo, 'frames', frameStruct);
403
+ // Populate the bones struct
404
+ const boneStruct = variablesToStruct(boneVariables, globalTypes);
405
+ addArrayItemTypeToField(spriteInfo, 'bones', boneStruct);
406
+ // Populate the slots struct
407
+ const slotStruct = variablesToStruct(slotVariables, globalTypes);
408
+ addArrayItemTypeToField(spriteInfo, 'slots', slotStruct);
409
+ // Populate the messages struct
410
+ const messageStruct = variablesToStruct(messagesVariables, globalTypes);
411
+ addArrayItemTypeToField(spriteInfo, 'messages', messageStruct);
412
+ // Populate the frame_info struct
413
+ const frameInfoStruct = variablesToStruct(frameInfoVariables, globalTypes);
414
+ addArrayItemTypeToField(spriteInfo, 'frame_info', frameInfoStruct);
415
+ globalTypes.set('Struct.SpriteInfo', spriteInfo);
416
+ }
417
+ //# sourceMappingURL=types.sprites.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.sprites.js","sourceRoot":"","sources":["../src/types.sprites.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAc,IAAI,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAQnC,0JAA0J;AAC1J,MAAM,mBAAmB,GAAG;IAC1B,0BAA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;IACvE,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAE/B,4BAA4B;IAC5B,MAAM,WAAW,GAAG,iBAAiB,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;IACnE,uBAAuB,CAAC,UAAU,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;IAE3D,4BAA4B;IAC5B,MAAM,UAAU,GAAG,iBAAiB,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;IACjE,uBAAuB,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAEzD,4BAA4B;IAC5B,MAAM,UAAU,GAAG,iBAAiB,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;IACjE,uBAAuB,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAEzD,+BAA+B;IAC/B,MAAM,aAAa,GAAG,iBAAiB,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;IACxE,uBAAuB,CAAC,UAAU,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;IAE/D,iCAAiC;IACjC,MAAM,eAAe,GAAG,iBAAiB,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;IAC3E,uBAAuB,CAAC,UAAU,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC;IAEnE,WAAW,CAAC,GAAG,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;AACnD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.test.d.ts","sourceRoot":"","sources":["../src/types.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,62 @@
1
+ import { expect } from 'chai';
2
+ import { replaceGenerics, updateGenericsMap } from './types.checks.js';
3
+ import { typeFromFeatherString } from './types.feather.js';
4
+ import { Type, TypeStore } from './types.js';
5
+ describe('Types', function () {
6
+ it('can resursively resolve generic types', function () {
7
+ const genericType = new Type('Any').named('T').genericize();
8
+ const generics = [{ T: [genericType] }];
9
+ const toType = (s) => typeFromFeatherString(s, generics, false);
10
+ const knownTypes = new Map();
11
+ let resolved = updateGenericsMap(genericType, new Type('String'), knownTypes);
12
+ expect(resolved.get('T').type[0].kind).to.equal('String');
13
+ resolved = updateGenericsMap(toType('Array<T>'), new Type('String'), knownTypes);
14
+ expect(resolved.get('T')).to.be.undefined;
15
+ resolved = updateGenericsMap(toType('Array<T>'), toType('Array<String>'), knownTypes);
16
+ expect(resolved.get('T').type[0].kind).to.equal('String');
17
+ resolved = updateGenericsMap(toType('Array<T>'), toType('Array<Struct<String>>'), knownTypes);
18
+ expect(resolved.get('T').type[0].kind).to.equal('Struct');
19
+ expect(resolved.get('T').type[0].items.type[0].kind).to.equal('String');
20
+ // For cases with mixed types, this should still all work!
21
+ resolved = updateGenericsMap(toType('Real|Array<T>|Struct<Array<T>>'), toType('Real|Struct<String>|Array<Id.DsMap>|Struct<Array<Id.Instance>>'), knownTypes);
22
+ const resolvedTypes = resolved.get('T').type;
23
+ expect(resolvedTypes.length).to.equal(2);
24
+ expect(resolvedTypes[0].kind).to.equal('Id.DsMap');
25
+ expect(resolvedTypes[1].kind).to.equal('Id.Instance');
26
+ // Make sure we can substitue generics
27
+ const replaced = replaceGenerics(toType('Real|Array<T>|Struct<Array<T>>|ObjectType<Id.Instance>'), knownTypes, resolved);
28
+ expect(replaced.type[0].kind).to.equal('Real');
29
+ expect(replaced.type[1].kind).to.equal('Array');
30
+ expect(replaced.type[1].items.type[0].kind).to.equal('Id.DsMap');
31
+ expect(replaced.type[1].items.type[1].kind).to.equal('Id.Instance');
32
+ expect(replaced.type[2].kind).to.equal('Struct');
33
+ expect(replaced.type[2].items.type[0].kind).to.equal('Array');
34
+ expect(replaced.type[2].items.type[0].items.type[0].kind).to.equal('Id.DsMap');
35
+ expect(replaced.type[2].items.type[0].items.type[1].kind).to.equal('Id.Instance');
36
+ });
37
+ it('can check whether one simple type satisfies another', function () {
38
+ const string = new Type('String');
39
+ expect(string.narrows(new Type('String'))).to.be.true;
40
+ expect(string.narrows(new Type('Real'))).to.be.false;
41
+ const union = new TypeStore();
42
+ union.type = [new Type('String'), new Type('Real')];
43
+ expect(string.narrows(union)).to.be.true;
44
+ expect(union.narrows(string)).to.be.false;
45
+ });
46
+ it('can check whether one struct type satisfies another', function () {
47
+ const broadStruct = new Type('Struct');
48
+ const narrowStruct = new Type('Struct');
49
+ for (const struct of [broadStruct, narrowStruct]) {
50
+ struct.addMember('name', { type: new Type('String') });
51
+ struct.addMember('id', { type: new Type('Real') });
52
+ }
53
+ // They are the same at the moment, so should be true both ways
54
+ expect(narrowStruct.narrows(broadStruct)).to.be.true;
55
+ expect(broadStruct.narrows(narrowStruct)).to.be.true;
56
+ // Now making the narrow struct more specific
57
+ narrowStruct.addMember('specialty', { type: new Type('String') });
58
+ expect(narrowStruct.narrows(broadStruct)).to.be.true;
59
+ expect(broadStruct.narrows(narrowStruct)).to.be.false;
60
+ });
61
+ });
62
+ //# sourceMappingURL=types.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.test.js","sourceRoot":"","sources":["../src/types.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAiB,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE7C,QAAQ,CAAC,OAAO,EAAE;IAChB,EAAE,CAAC,uCAAuC,EAAE;QAC1C,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC;QAC5D,MAAM,QAAQ,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QACxC,MAAM,MAAM,GAAG,CA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CAAC,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;IACxD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/dist/util.d.ts ADDED
@@ -0,0 +1,50 @@
1
+ import { Pathy } from '@bscotch/pathy';
2
+ import type { IRange, LinePosition } from './project.location.js';
3
+ export declare class StitchParserError extends Error {
4
+ constructor(message?: string, assertion?: Function);
5
+ }
6
+ export type Defined<T> = Exclude<T, undefined>;
7
+ export type Values<T> = T[keyof T];
8
+ export type Constructor<T = {}> = new (...args: any[]) => T;
9
+ export declare const runningInVscode: boolean;
10
+ export interface Logger {
11
+ (...args: unknown[]): void;
12
+ enabled: boolean;
13
+ }
14
+ export declare const log: Logger;
15
+ export declare function throwError(message?: string, asserter?: Function): never;
16
+ export declare function assert(condition: any, message?: string): asserts condition;
17
+ /** @alias assert */
18
+ export declare const ok: typeof assert;
19
+ export declare function stringify(obj: unknown): string;
20
+ /**
21
+ * There are multiple ways that Feather/GameMaker accept types to
22
+ * be encoded in strings. To simplify parsing on our end, we normalize
23
+ * them all to a single format. */
24
+ export declare function normalizeTypeString(typeString: string): string;
25
+ export declare function isInRange(range: IRange, offset: number | LinePosition): boolean;
26
+ export declare function isBeforeRange(range: IRange, offset: number | LinePosition): boolean;
27
+ export declare function isArray<T>(value: unknown): value is T[] | readonly T[];
28
+ export declare function isValidIdentifier(name: string): boolean;
29
+ export declare function assertIsValidIdentifier(name: string): void;
30
+ /**
31
+ * Depending on the origin, an asset group path could look like
32
+ * a regular path (`my/path`) or like the path from a config file
33
+ * (`folders/my/path.yy`).
34
+ *
35
+ * This function returns the POSIX-style path (`my/path`) given
36
+ * one of those inputs/
37
+ */
38
+ export declare function groupPathToPosix(path: string): string;
39
+ export declare function xor(a: any, b: any): any;
40
+ export declare function neither(a: any, b: any): boolean;
41
+ export declare function findYyFile(dir: Pathy): Promise<Pathy>;
42
+ /**
43
+ * Given the path to an image file, read just enough bytes to
44
+ * ensure it's a PNG and to get its width and height
45
+ */
46
+ export declare function getPngSize(path: string | Pathy): Promise<{
47
+ width: number;
48
+ height: number;
49
+ }>;
50
+ //# sourceMappingURL=util.d.ts.map