@futpib/parser 1.0.3 → 1.0.6

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 (262) hide show
  1. package/.claude/settings.local.json +24 -0
  2. package/.github/workflows/main.yml +1 -0
  3. package/build/androidPackageParser.js +30 -32
  4. package/build/arbitraryDalvikBytecode.d.ts +3 -3
  5. package/build/arbitraryDalvikBytecode.js +33 -27
  6. package/build/arbitraryDalvikExecutable.js +55 -17
  7. package/build/arbitraryJava.d.ts +31 -0
  8. package/build/arbitraryJava.js +532 -0
  9. package/build/arbitraryJavaScript.d.ts +3 -0
  10. package/build/arbitraryJavaScript.js +263 -0
  11. package/build/arbitraryJavascript.d.ts +3 -0
  12. package/build/arbitraryJavascript.js +263 -0
  13. package/build/arbitraryZig.d.ts +3 -0
  14. package/build/arbitraryZig.js +240 -0
  15. package/build/arbitraryZipStream.d.ts +1 -1
  16. package/build/arrayParser.js +72 -13
  17. package/build/backsmali.d.ts +4 -3
  18. package/build/backsmali.js +26 -6
  19. package/build/bash.d.ts +89 -0
  20. package/build/bash.js +1 -0
  21. package/build/bashParser.d.ts +6 -0
  22. package/build/bashParser.js +335 -0
  23. package/build/bashParser.test.d.ts +1 -0
  24. package/build/bashParser.test.js +343 -0
  25. package/build/bashParserEdgeCases.test.d.ts +1 -0
  26. package/build/bashParserEdgeCases.test.js +117 -0
  27. package/build/dalvikBytecodeParser/addressConversion.d.ts +110 -0
  28. package/build/dalvikBytecodeParser/addressConversion.js +334 -0
  29. package/build/dalvikBytecodeParser/formatParsers.d.ts +7 -6
  30. package/build/dalvikBytecodeParser/formatParsers.js +13 -14
  31. package/build/dalvikBytecodeParser.d.ts +60 -31
  32. package/build/dalvikBytecodeParser.js +92 -35
  33. package/build/dalvikBytecodeParser.test-d.d.ts +1 -0
  34. package/build/dalvikBytecodeParser.test-d.js +268 -0
  35. package/build/dalvikBytecodeUnparser/formatUnparsers.d.ts +9 -8
  36. package/build/dalvikBytecodeUnparser/formatUnparsers.js +13 -12
  37. package/build/dalvikBytecodeUnparser.d.ts +2 -2
  38. package/build/dalvikBytecodeUnparser.js +23 -23
  39. package/build/dalvikBytecodeUnparser.test.js +7 -7
  40. package/build/dalvikExecutable.d.ts +3 -3
  41. package/build/dalvikExecutable.test-d.d.ts +1 -0
  42. package/build/dalvikExecutable.test-d.js +59 -0
  43. package/build/dalvikExecutableParser/typedNumbers.d.ts +18 -0
  44. package/build/dalvikExecutableParser/typedNumbers.js +3 -0
  45. package/build/dalvikExecutableParser.d.ts +2 -1
  46. package/build/dalvikExecutableParser.js +96 -77
  47. package/build/dalvikExecutableParser.test.js +24 -3
  48. package/build/dalvikExecutableParserAgainstSmaliParser.test.js +3 -0
  49. package/build/dalvikExecutableUnparser/poolScanners.d.ts +2 -2
  50. package/build/dalvikExecutableUnparser/sectionUnparsers.d.ts +3 -3
  51. package/build/dalvikExecutableUnparser/sectionUnparsers.js +26 -11
  52. package/build/dalvikExecutableUnparser.d.ts +2 -2
  53. package/build/dalvikExecutableUnparser.test.js +2 -1
  54. package/build/disjunctionParser.d.ts +5 -3
  55. package/build/disjunctionParser.js +79 -17
  56. package/build/disjunctionParser.test-d.d.ts +1 -0
  57. package/build/disjunctionParser.test-d.js +72 -0
  58. package/build/elementSwitchParser.d.ts +4 -0
  59. package/build/{exactElementSwitchParser.js → elementSwitchParser.js} +3 -4
  60. package/build/elementSwitchParser.test-d.d.ts +1 -0
  61. package/build/elementSwitchParser.test-d.js +44 -0
  62. package/build/exactSequenceParser.d.ts +4 -2
  63. package/build/exactSequenceParser.test-d.d.ts +1 -0
  64. package/build/exactSequenceParser.test-d.js +36 -0
  65. package/build/fetchCid.js +2 -66
  66. package/build/index.d.ts +25 -2
  67. package/build/index.js +23 -1
  68. package/build/index.test.js +16 -1
  69. package/build/inputReader.d.ts +10 -0
  70. package/build/inputReader.js +36 -0
  71. package/build/java.d.ts +502 -0
  72. package/build/java.js +2 -0
  73. package/build/javaKeyStoreParser.js +14 -17
  74. package/build/javaParser.d.ts +51 -0
  75. package/build/javaParser.js +1538 -0
  76. package/build/javaParser.test.d.ts +1 -0
  77. package/build/javaParser.test.js +1287 -0
  78. package/build/javaScript.d.ts +35 -0
  79. package/build/javaScript.js +1 -0
  80. package/build/javaScriptParser.d.ts +9 -0
  81. package/build/javaScriptParser.js +34 -0
  82. package/build/javaScriptUnparser.d.ts +3 -0
  83. package/build/javaScriptUnparser.js +4 -0
  84. package/build/javaScriptUnparser.test.d.ts +1 -0
  85. package/build/javaScriptUnparser.test.js +24 -0
  86. package/build/javaUnparser.d.ts +2 -0
  87. package/build/javaUnparser.js +519 -0
  88. package/build/javaUnparser.test.d.ts +1 -0
  89. package/build/javaUnparser.test.js +24 -0
  90. package/build/javascript.d.ts +35 -0
  91. package/build/javascript.js +1 -0
  92. package/build/javascriptParser.d.ts +9 -0
  93. package/build/javascriptParser.js +34 -0
  94. package/build/javascriptUnparser.d.ts +3 -0
  95. package/build/javascriptUnparser.js +4 -0
  96. package/build/javascriptUnparser.test.d.ts +1 -0
  97. package/build/javascriptUnparser.test.js +24 -0
  98. package/build/jsonParser.js +2 -12
  99. package/build/lazyMessageError.d.ts +3 -0
  100. package/build/lookaheadParser.js +60 -3
  101. package/build/negativeLookaheadParser.js +70 -11
  102. package/build/nonEmptyArrayParser.js +72 -13
  103. package/build/objectParser.d.ts +12 -0
  104. package/build/objectParser.js +31 -0
  105. package/build/objectParser.test-d.d.ts +1 -0
  106. package/build/objectParser.test-d.js +112 -0
  107. package/build/objectParser.test.d.ts +1 -0
  108. package/build/objectParser.test.js +55 -0
  109. package/build/optionalParser.js +69 -10
  110. package/build/parser.d.ts +4 -0
  111. package/build/parser.js +3 -1
  112. package/build/parser.test.js +114 -1
  113. package/build/parserConsumedSequenceParser.js +66 -7
  114. package/build/parserContext.d.ts +6 -0
  115. package/build/parserContext.js +20 -11
  116. package/build/parserError.d.ts +119 -27
  117. package/build/parserError.js +16 -8
  118. package/build/regexpParser.d.ts +2 -0
  119. package/build/regexpParser.js +101 -0
  120. package/build/regexpParser.test.d.ts +1 -0
  121. package/build/regexpParser.test.js +114 -0
  122. package/build/regularExpression.d.ts +63 -0
  123. package/build/regularExpression.js +1 -0
  124. package/build/regularExpressionParser.d.ts +3 -0
  125. package/build/regularExpressionParser.js +600 -0
  126. package/build/regularExpressionParser.test.d.ts +1 -0
  127. package/build/regularExpressionParser.test.js +89 -0
  128. package/build/separatedArrayParser.js +73 -14
  129. package/build/separatedNonEmptyArrayParser.js +73 -14
  130. package/build/sliceBoundedParser.js +62 -5
  131. package/build/smaliParser.d.ts +7 -7
  132. package/build/smaliParser.js +185 -268
  133. package/build/smaliParser.test.js +58 -0
  134. package/build/stringEscapes.d.ts +5 -0
  135. package/build/stringEscapes.js +244 -0
  136. package/build/symbolicExpression.d.ts +29 -0
  137. package/build/symbolicExpression.js +1 -0
  138. package/build/symbolicExpressionParser.d.ts +4 -0
  139. package/build/symbolicExpressionParser.js +123 -0
  140. package/build/symbolicExpressionParser.test.d.ts +1 -0
  141. package/build/symbolicExpressionParser.test.js +289 -0
  142. package/build/terminatedArrayParser.js +113 -38
  143. package/build/terminatedArrayParser.test.js +4 -2
  144. package/build/tupleParser.d.ts +7 -15
  145. package/build/tupleParser.js +1 -0
  146. package/build/unionParser.d.ts +5 -3
  147. package/build/unionParser.js +7 -2
  148. package/build/unionParser.test-d.d.ts +1 -0
  149. package/build/unionParser.test-d.js +72 -0
  150. package/build/unionParser.test.js +10 -11
  151. package/build/zig.d.ts +280 -0
  152. package/build/zig.js +2 -0
  153. package/build/zigParser.d.ts +3 -0
  154. package/build/zigParser.js +1119 -0
  155. package/build/zigParser.test.d.ts +1 -0
  156. package/build/zigParser.test.js +1590 -0
  157. package/build/zigUnparser.d.ts +2 -0
  158. package/build/zigUnparser.js +460 -0
  159. package/build/zigUnparser.test.d.ts +1 -0
  160. package/build/zigUnparser.test.js +24 -0
  161. package/build/zipParser.js +19 -32
  162. package/build/zipUnparser.js +19 -7
  163. package/build/zipUnparser.test.js +1 -1
  164. package/node_modules-@types/s-expression/index.d.ts +5 -0
  165. package/package.json +25 -6
  166. package/src/androidPackageParser.ts +33 -60
  167. package/src/arbitraryDalvikBytecode.ts +39 -31
  168. package/src/arbitraryDalvikExecutable.ts +65 -20
  169. package/src/arbitraryJava.ts +804 -0
  170. package/src/arbitraryJavaScript.ts +410 -0
  171. package/src/arbitraryZig.ts +380 -0
  172. package/src/arrayParser.ts +1 -3
  173. package/src/backsmali.ts +35 -4
  174. package/src/bash.ts +127 -0
  175. package/src/bashParser.test.ts +590 -0
  176. package/src/bashParser.ts +498 -0
  177. package/src/dalvikBytecodeParser/addressConversion.ts +496 -0
  178. package/src/dalvikBytecodeParser/formatParsers.ts +19 -29
  179. package/src/dalvikBytecodeParser.test-d.ts +310 -0
  180. package/src/dalvikBytecodeParser.ts +194 -69
  181. package/src/dalvikBytecodeUnparser/formatUnparsers.ts +27 -26
  182. package/src/dalvikBytecodeUnparser.test.ts +7 -7
  183. package/src/dalvikBytecodeUnparser.ts +31 -30
  184. package/src/dalvikExecutable.test-d.ts +132 -0
  185. package/src/dalvikExecutable.ts +3 -3
  186. package/src/dalvikExecutableParser/typedNumbers.ts +11 -0
  187. package/src/dalvikExecutableParser.test.ts +37 -3
  188. package/src/dalvikExecutableParser.test.ts.md +163 -2
  189. package/src/dalvikExecutableParser.test.ts.snap +0 -0
  190. package/src/dalvikExecutableParser.ts +121 -139
  191. package/src/dalvikExecutableParserAgainstSmaliParser.test.ts +4 -0
  192. package/src/dalvikExecutableUnparser/poolScanners.ts +6 -6
  193. package/src/dalvikExecutableUnparser/sectionUnparsers.ts +38 -14
  194. package/src/dalvikExecutableUnparser.test.ts +3 -2
  195. package/src/dalvikExecutableUnparser.ts +4 -4
  196. package/src/disjunctionParser.test-d.ts +105 -0
  197. package/src/disjunctionParser.ts +18 -15
  198. package/src/elementSwitchParser.test-d.ts +74 -0
  199. package/src/elementSwitchParser.ts +51 -0
  200. package/src/exactSequenceParser.test-d.ts +43 -0
  201. package/src/exactSequenceParser.ts +13 -8
  202. package/src/fetchCid.ts +2 -76
  203. package/src/index.test.ts +22 -1
  204. package/src/index.ts +119 -2
  205. package/src/inputReader.ts +53 -0
  206. package/src/java.ts +708 -0
  207. package/src/javaKeyStoreParser.ts +18 -32
  208. package/src/javaParser.test.ts +1592 -0
  209. package/src/javaParser.ts +2640 -0
  210. package/src/javaScript.ts +36 -0
  211. package/src/javaScriptParser.ts +57 -0
  212. package/src/javaScriptUnparser.test.ts +37 -0
  213. package/src/javaScriptUnparser.ts +7 -0
  214. package/src/javaUnparser.test.ts +37 -0
  215. package/src/javaUnparser.ts +640 -0
  216. package/src/jsonParser.ts +6 -27
  217. package/src/lookaheadParser.ts +2 -6
  218. package/src/negativeLookaheadParser.ts +1 -3
  219. package/src/nonEmptyArrayParser.ts +1 -3
  220. package/src/objectParser.test-d.ts +152 -0
  221. package/src/objectParser.test.ts +71 -0
  222. package/src/objectParser.ts +69 -0
  223. package/src/optionalParser.ts +1 -3
  224. package/src/parser.test.ts +151 -4
  225. package/src/parser.ts +11 -1
  226. package/src/parserConsumedSequenceParser.ts +2 -4
  227. package/src/parserContext.ts +26 -11
  228. package/src/parserError.ts +17 -3
  229. package/src/regexpParser.test.ts +264 -0
  230. package/src/regexpParser.ts +126 -0
  231. package/src/regularExpression.ts +24 -0
  232. package/src/regularExpressionParser.test.ts +102 -0
  233. package/src/regularExpressionParser.ts +920 -0
  234. package/src/separatedArrayParser.ts +1 -3
  235. package/src/separatedNonEmptyArrayParser.ts +1 -3
  236. package/src/sliceBoundedParser.test.ts +2 -2
  237. package/src/sliceBoundedParser.ts +15 -19
  238. package/src/smaliParser.test.ts +64 -0
  239. package/src/smaliParser.test.ts.md +12 -12
  240. package/src/smaliParser.test.ts.snap +0 -0
  241. package/src/smaliParser.ts +246 -534
  242. package/src/stringEscapes.ts +253 -0
  243. package/src/symbolicExpression.ts +17 -0
  244. package/src/symbolicExpressionParser.test.ts +466 -0
  245. package/src/symbolicExpressionParser.ts +190 -0
  246. package/src/terminatedArrayParser.test.ts +9 -6
  247. package/src/terminatedArrayParser.ts +25 -29
  248. package/src/tupleParser.ts +21 -18
  249. package/src/unionParser.test-d.ts +105 -0
  250. package/src/unionParser.test.ts +18 -17
  251. package/src/unionParser.ts +28 -16
  252. package/src/zig.ts +411 -0
  253. package/src/zigParser.test.ts +1693 -0
  254. package/src/zigParser.ts +1745 -0
  255. package/src/zigUnparser.test.ts +37 -0
  256. package/src/zigUnparser.ts +615 -0
  257. package/src/zipParser.ts +20 -56
  258. package/src/zipUnparser.test.ts +1 -1
  259. package/src/zipUnparser.ts +22 -7
  260. package/tsconfig.json +2 -2
  261. package/build/exactElementSwitchParser.d.ts +0 -3
  262. package/src/exactElementSwitchParser.ts +0 -41
package/src/zig.ts ADDED
@@ -0,0 +1,411 @@
1
+ // Zig AST type definitions
2
+
3
+ // Identifier
4
+ export type ZigIdentifier = {
5
+ type: 'Identifier';
6
+ name: string;
7
+ };
8
+
9
+ // Literals
10
+ export type ZigIntegerLiteral = {
11
+ type: 'IntegerLiteral';
12
+ value: string;
13
+ };
14
+
15
+ export type ZigFloatLiteral = {
16
+ type: 'FloatLiteral';
17
+ value: string;
18
+ };
19
+
20
+ export type ZigStringLiteral = {
21
+ type: 'StringLiteral';
22
+ value: string;
23
+ };
24
+
25
+ export type ZigMultilineStringLiteral = {
26
+ type: 'MultilineStringLiteral';
27
+ value: string;
28
+ };
29
+
30
+ export type ZigCharLiteral = {
31
+ type: 'CharLiteral';
32
+ value: string;
33
+ };
34
+
35
+ export type ZigEnumLiteral = {
36
+ type: 'EnumLiteral';
37
+ name: string;
38
+ };
39
+
40
+ export type ZigBoolLiteral = {
41
+ type: 'BoolLiteral';
42
+ value: boolean;
43
+ };
44
+
45
+ export type ZigNullLiteral = {
46
+ type: 'NullLiteral';
47
+ };
48
+
49
+ export type ZigUndefinedLiteral = {
50
+ type: 'UndefinedLiteral';
51
+ };
52
+
53
+ export type ZigLiteral =
54
+ | ZigIntegerLiteral
55
+ | ZigFloatLiteral
56
+ | ZigStringLiteral
57
+ | ZigMultilineStringLiteral
58
+ | ZigCharLiteral
59
+ | ZigEnumLiteral
60
+ | ZigBoolLiteral
61
+ | ZigNullLiteral
62
+ | ZigUndefinedLiteral;
63
+
64
+ // Type expressions
65
+ export type ZigIdentifierType = {
66
+ type: 'IdentifierType';
67
+ name: string;
68
+ };
69
+
70
+ export type ZigPointerType = {
71
+ type: 'PointerType';
72
+ size: 'one' | 'many' | 'slice';
73
+ isConst: boolean;
74
+ sentinel?: ZigExpression;
75
+ child: ZigTypeExpression;
76
+ };
77
+
78
+ export type ZigArrayType = {
79
+ type: 'ArrayType';
80
+ length: ZigExpression;
81
+ sentinel?: ZigExpression;
82
+ child: ZigTypeExpression;
83
+ };
84
+
85
+ export type ZigOptionalType = {
86
+ type: 'OptionalType';
87
+ child: ZigTypeExpression;
88
+ };
89
+
90
+ export type ZigErrorUnionType = {
91
+ type: 'ErrorUnionType';
92
+ error: ZigTypeExpression;
93
+ payload: ZigTypeExpression;
94
+ };
95
+
96
+ export type ZigDotType = {
97
+ type: 'DotType';
98
+ operand: ZigTypeExpression;
99
+ member: string;
100
+ };
101
+
102
+ export type ZigBuiltinType = {
103
+ type: 'BuiltinType';
104
+ name: string;
105
+ };
106
+
107
+ export type ZigFnProtoType = {
108
+ type: 'FnProtoType';
109
+ params: ZigFnParam[];
110
+ returnType: ZigTypeExpression;
111
+ };
112
+
113
+ export type ZigTypeExpression =
114
+ | ZigIdentifierType
115
+ | ZigPointerType
116
+ | ZigArrayType
117
+ | ZigOptionalType
118
+ | ZigErrorUnionType
119
+ | ZigDotType
120
+ | ZigBuiltinType
121
+ | ZigFnProtoType
122
+ | ZigExpression;
123
+
124
+ // Expressions
125
+ export type ZigBinaryOp =
126
+ | '+' | '-' | '*' | '/' | '%'
127
+ | '<<' | '>>'
128
+ | '&' | '|' | '^'
129
+ | '==' | '!=' | '<' | '>' | '<=' | '>='
130
+ | 'and' | 'or'
131
+ | '++' | '**'
132
+ | 'orelse' | 'catch';
133
+
134
+ export type ZigBinaryExpr = {
135
+ type: 'BinaryExpr';
136
+ operator: ZigBinaryOp;
137
+ left: ZigExpression;
138
+ right: ZigExpression;
139
+ };
140
+
141
+ export type ZigUnaryOp = '-' | '~' | '!' | '&';
142
+
143
+ export type ZigUnaryExpr = {
144
+ type: 'UnaryExpr';
145
+ operator: string;
146
+ operand: ZigExpression;
147
+ };
148
+
149
+ export type ZigFieldAccessExpr = {
150
+ type: 'FieldAccessExpr';
151
+ operand: ZigExpression;
152
+ member: string;
153
+ };
154
+
155
+ export type ZigIndexExpr = {
156
+ type: 'IndexExpr';
157
+ operand: ZigExpression;
158
+ index: ZigExpression;
159
+ };
160
+
161
+ export type ZigSliceExpr = {
162
+ type: 'SliceExpr';
163
+ operand: ZigExpression;
164
+ start: ZigExpression;
165
+ end?: ZigExpression;
166
+ sentinel?: ZigExpression;
167
+ };
168
+
169
+ export type ZigCallExpr = {
170
+ type: 'CallExpr';
171
+ callee: ZigExpression;
172
+ args: ZigExpression[];
173
+ };
174
+
175
+ export type ZigBuiltinCallExpr = {
176
+ type: 'BuiltinCallExpr';
177
+ name: string;
178
+ args: ZigExpression[];
179
+ };
180
+
181
+ export type ZigIfExpr = {
182
+ type: 'IfExpr';
183
+ condition: ZigExpression;
184
+ capture?: string;
185
+ body: ZigStatement;
186
+ elseCapture?: string;
187
+ elseBody?: ZigStatement;
188
+ };
189
+
190
+ export type ZigSwitchProng = {
191
+ type: 'SwitchProng';
192
+ cases: ZigExpression[];
193
+ isElse: boolean;
194
+ capture?: string;
195
+ body: ZigExpression;
196
+ };
197
+
198
+ export type ZigSwitchExpr = {
199
+ type: 'SwitchExpr';
200
+ operand: ZigExpression;
201
+ prongs: ZigSwitchProng[];
202
+ };
203
+
204
+ export type ZigStructInitField = {
205
+ type: 'StructInitField';
206
+ name: string;
207
+ value: ZigExpression;
208
+ };
209
+
210
+ export type ZigStructInitExpr = {
211
+ type: 'StructInitExpr';
212
+ operand?: ZigExpression;
213
+ fields: ZigStructInitField[];
214
+ };
215
+
216
+ export type ZigArrayInitExpr = {
217
+ type: 'ArrayInitExpr';
218
+ operand?: ZigExpression;
219
+ elements: ZigExpression[];
220
+ };
221
+
222
+ export type ZigTryExpr = {
223
+ type: 'TryExpr';
224
+ operand: ZigExpression;
225
+ };
226
+
227
+ export type ZigComptimeExpr = {
228
+ type: 'ComptimeExpr';
229
+ operand: ZigExpression;
230
+ };
231
+
232
+ export type ZigBlockExpr = {
233
+ type: 'BlockExpr';
234
+ label?: string;
235
+ statements: ZigStatement[];
236
+ };
237
+
238
+ export type ZigGroupedExpr = {
239
+ type: 'GroupedExpr';
240
+ inner: ZigExpression;
241
+ };
242
+
243
+ export type ZigErrorSetExpr = {
244
+ type: 'ErrorSetExpr';
245
+ names: string[];
246
+ };
247
+
248
+ export type ZigStructExpr = {
249
+ type: 'StructExpr';
250
+ members: ZigContainerMember[];
251
+ };
252
+
253
+ export type ZigExpression =
254
+ | ZigIdentifier
255
+ | ZigLiteral
256
+ | ZigBinaryExpr
257
+ | ZigUnaryExpr
258
+ | ZigFieldAccessExpr
259
+ | ZigIndexExpr
260
+ | ZigSliceExpr
261
+ | ZigCallExpr
262
+ | ZigBuiltinCallExpr
263
+ | ZigIfExpr
264
+ | ZigSwitchExpr
265
+ | ZigStructInitExpr
266
+ | ZigArrayInitExpr
267
+ | ZigTryExpr
268
+ | ZigComptimeExpr
269
+ | ZigBlockExpr
270
+ | ZigGroupedExpr
271
+ | ZigErrorSetExpr
272
+ | ZigErrorUnionType
273
+ | ZigPointerType
274
+ | ZigOptionalType
275
+ | ZigFnProtoType
276
+ | ZigStructExpr
277
+ | ZigArrayType;
278
+
279
+ // Statements
280
+ export type ZigAssignOp = '=' | '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | '>>=';
281
+
282
+ export type ZigAssignStmt = {
283
+ type: 'AssignStmt';
284
+ target: ZigExpression;
285
+ operator: ZigAssignOp;
286
+ value: ZigExpression;
287
+ };
288
+
289
+ export type ZigWhileStmt = {
290
+ type: 'WhileStmt';
291
+ condition: ZigExpression;
292
+ capture?: string;
293
+ continuation?: ZigExpression;
294
+ body: ZigStatement;
295
+ elseBody?: ZigStatement;
296
+ label?: string;
297
+ isInline: boolean;
298
+ };
299
+
300
+ export type ZigForStmt = {
301
+ type: 'ForStmt';
302
+ inputs: ZigExpression[];
303
+ captures: string[];
304
+ body: ZigStatement;
305
+ elseBody?: ZigStatement;
306
+ label?: string;
307
+ isInline: boolean;
308
+ };
309
+
310
+ export type ZigReturnStmt = {
311
+ type: 'ReturnStmt';
312
+ value?: ZigExpression;
313
+ };
314
+
315
+ export type ZigBreakStmt = {
316
+ type: 'BreakStmt';
317
+ label?: string;
318
+ value?: ZigExpression;
319
+ };
320
+
321
+ export type ZigContinueStmt = {
322
+ type: 'ContinueStmt';
323
+ label?: string;
324
+ };
325
+
326
+ export type ZigDeferStmt = {
327
+ type: 'DeferStmt';
328
+ isErrdefer: boolean;
329
+ capture?: string;
330
+ body: ZigStatement;
331
+ };
332
+
333
+ export type ZigStatement =
334
+ | ZigAssignStmt
335
+ | ZigVarDecl
336
+ | ZigWhileStmt
337
+ | ZigForStmt
338
+ | ZigReturnStmt
339
+ | ZigBreakStmt
340
+ | ZigContinueStmt
341
+ | ZigDeferStmt
342
+ | ZigExpression;
343
+
344
+ // Function parameters
345
+ export type ZigFnParam = {
346
+ type: 'FnParam';
347
+ name?: string;
348
+ isComptime: boolean;
349
+ isNoalias: boolean;
350
+ typeExpr?: ZigTypeExpression;
351
+ };
352
+
353
+ // Top-level declarations
354
+ export type ZigFnDecl = {
355
+ type: 'FnDecl';
356
+ isPub: boolean;
357
+ isExtern: boolean;
358
+ isExport: boolean;
359
+ isInline: boolean;
360
+ isComptime: boolean;
361
+ name: string;
362
+ params: ZigFnParam[];
363
+ returnType: ZigTypeExpression;
364
+ body?: ZigBlockExpr;
365
+ };
366
+
367
+ export type ZigVarDecl = {
368
+ type: 'VarDecl';
369
+ isConst: boolean;
370
+ isPub: boolean;
371
+ isExtern: boolean;
372
+ isComptime: boolean;
373
+ isThreadlocal: boolean;
374
+ name: string;
375
+ typeExpr?: ZigTypeExpression;
376
+ alignExpr?: ZigExpression;
377
+ initExpr?: ZigExpression;
378
+ };
379
+
380
+ export type ZigTestDecl = {
381
+ type: 'TestDecl';
382
+ name?: string;
383
+ body: ZigBlockExpr;
384
+ };
385
+
386
+ export type ZigUsingnamespaceDecl = {
387
+ type: 'UsingnamespaceDecl';
388
+ isPub: boolean;
389
+ expression: ZigExpression;
390
+ };
391
+
392
+ export type ZigContainerField = {
393
+ type: 'ContainerField';
394
+ name: string;
395
+ typeExpr?: ZigTypeExpression;
396
+ alignExpr?: ZigExpression;
397
+ defaultValue?: ZigExpression;
398
+ };
399
+
400
+ export type ZigContainerMember =
401
+ | ZigFnDecl
402
+ | ZigVarDecl
403
+ | ZigTestDecl
404
+ | ZigUsingnamespaceDecl
405
+ | ZigContainerField;
406
+
407
+ // Root node
408
+ export type ZigRoot = {
409
+ type: 'Root';
410
+ members: ZigContainerMember[];
411
+ };