@futpib/parser 1.0.2 → 1.0.4

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 (311) hide show
  1. package/.github/copilot-instructions.md +149 -0
  2. package/.github/workflows/copilot-setup-steps.yml +18 -0
  3. package/.github/workflows/main.yml +29 -8
  4. package/.yarn/releases/yarn-4.9.4.cjs +942 -0
  5. package/.yarnrc.yml +1 -1
  6. package/build/allSettledStream.js +1 -1
  7. package/build/allSettledStream.test.js +2 -2
  8. package/build/androidPackageParser.d.ts +1 -1
  9. package/build/androidPackageParser.js +5 -3
  10. package/build/androidPackageParser.test.js +7 -7
  11. package/build/androidPackageUnparser.d.ts +2 -2
  12. package/build/androidPackageUnparser.js +18 -14
  13. package/build/androidPackageUnparser.test.js +7 -7
  14. package/build/arbitrarilySlicedAsyncInterator.js +2 -1
  15. package/build/arbitraryDalvikBytecode.d.ts +4 -0
  16. package/build/arbitraryDalvikBytecode.js +640 -0
  17. package/build/arbitraryDalvikExecutable.d.ts +3 -0
  18. package/build/arbitraryDalvikExecutable.js +282 -0
  19. package/build/arbitraryDosDateTime.js +1 -0
  20. package/build/arbitraryZipStream.js +1 -1
  21. package/build/arrayParser.js +2 -2
  22. package/build/arrayUnparser.d.ts +1 -1
  23. package/build/backsmali.d.ts +3 -1
  24. package/build/backsmali.js +31 -3
  25. package/build/bash.d.ts +84 -0
  26. package/build/bash.js +1 -0
  27. package/build/bashParser.d.ts +6 -0
  28. package/build/bashParser.js +294 -0
  29. package/build/bashParser.test.d.ts +1 -0
  30. package/build/bashParser.test.js +181 -0
  31. package/build/customInvariant.d.ts +2 -1
  32. package/build/customInvariant.js +4 -6
  33. package/build/dalvikBytecodeParser/formatParsers.d.ts +76 -2
  34. package/build/dalvikBytecodeParser/formatParsers.js +146 -11
  35. package/build/dalvikBytecodeParser/formatSizes.d.ts +34 -0
  36. package/build/dalvikBytecodeParser/formatSizes.js +34 -0
  37. package/build/dalvikBytecodeParser/operationFormats.d.ts +225 -0
  38. package/build/dalvikBytecodeParser/operationFormats.js +225 -0
  39. package/build/dalvikBytecodeParser.d.ts +1105 -5
  40. package/build/dalvikBytecodeParser.js +658 -205
  41. package/build/dalvikBytecodeUnparser/formatUnparsers.d.ts +152 -0
  42. package/build/dalvikBytecodeUnparser/formatUnparsers.js +225 -0
  43. package/build/dalvikBytecodeUnparser.d.ts +3 -0
  44. package/build/dalvikBytecodeUnparser.js +642 -0
  45. package/build/dalvikBytecodeUnparser.test.d.ts +1 -0
  46. package/build/dalvikBytecodeUnparser.test.js +25 -0
  47. package/build/dalvikExecutable.d.ts +65 -8
  48. package/build/dalvikExecutable.js +36 -0
  49. package/build/dalvikExecutableParser/stringSyntaxParser.d.ts +1 -1
  50. package/build/dalvikExecutableParser/stringSyntaxParser.js +17 -17
  51. package/build/dalvikExecutableParser/typeParsers.d.ts +2 -1
  52. package/build/dalvikExecutableParser/typeParsers.js +16 -11
  53. package/build/dalvikExecutableParser/typedNumbers.d.ts +85 -69
  54. package/build/dalvikExecutableParser/typedNumbers.js +0 -1
  55. package/build/dalvikExecutableParser.d.ts +2 -2
  56. package/build/dalvikExecutableParser.js +655 -337
  57. package/build/dalvikExecutableParser.test.js +24 -22
  58. package/build/dalvikExecutableParserAgainstSmaliParser.test.js +223 -246
  59. package/build/dalvikExecutableUnparser/annotationUnparsers.d.ts +14 -0
  60. package/build/dalvikExecutableUnparser/annotationUnparsers.js +97 -0
  61. package/build/dalvikExecutableUnparser/poolBuilders.d.ts +49 -0
  62. package/build/dalvikExecutableUnparser/poolBuilders.js +140 -0
  63. package/build/dalvikExecutableUnparser/poolScanners.d.ts +4 -0
  64. package/build/dalvikExecutableUnparser/poolScanners.js +220 -0
  65. package/build/dalvikExecutableUnparser/sectionUnparsers.d.ts +25 -0
  66. package/build/dalvikExecutableUnparser/sectionUnparsers.js +581 -0
  67. package/build/dalvikExecutableUnparser/utils.d.ts +10 -0
  68. package/build/dalvikExecutableUnparser/utils.js +108 -0
  69. package/build/dalvikExecutableUnparser.d.ts +4 -0
  70. package/build/dalvikExecutableUnparser.js +406 -0
  71. package/build/dalvikExecutableUnparser.test.d.ts +1 -0
  72. package/build/dalvikExecutableUnparser.test.js +31 -0
  73. package/build/debugLogInputParser.js +1 -1
  74. package/build/disjunctionParser.d.ts +2 -2
  75. package/build/disjunctionParser.js +2 -2
  76. package/build/elementTerminatedArrayParser.d.ts +2 -2
  77. package/build/elementTerminatedArrayParser.js +1 -1
  78. package/build/elementTerminatedArrayParser.test.js +5 -5
  79. package/build/elementTerminatedSequenceArrayParser.d.ts +2 -2
  80. package/build/elementTerminatedSequenceArrayParser.js +1 -1
  81. package/build/elementTerminatedSequenceArrayParser.test.js +2 -2
  82. package/build/elementTerminatedSequenceParser.d.ts +2 -2
  83. package/build/elementTerminatedSequenceParser.js +1 -1
  84. package/build/elementTerminatedSequenceParser.test.js +2 -2
  85. package/build/endOfInputParser.d.ts +1 -1
  86. package/build/exactElementSwitchParser.d.ts +3 -0
  87. package/build/exactElementSwitchParser.js +22 -0
  88. package/build/fetchCid.js +2 -6
  89. package/build/fetchCid.test.d.ts +1 -0
  90. package/build/fetchCid.test.js +16 -0
  91. package/build/fixedLengthSequenceParser.test.js +2 -2
  92. package/build/hasExecutable.js +2 -2
  93. package/build/highResolutionTimer.js +1 -1
  94. package/build/index.d.ts +24 -2
  95. package/build/index.js +22 -1
  96. package/build/inputReader.d.ts +1 -1
  97. package/build/inputReader.test.js +33 -45
  98. package/build/javaKeyStoreParser.test.js +6 -6
  99. package/build/jsonParser.js +8 -8
  100. package/build/lazyMessageError.d.ts +48 -0
  101. package/build/lazyMessageError.js +53 -0
  102. package/build/lazyMessageError.test.d.ts +1 -0
  103. package/build/lazyMessageError.test.js +15 -0
  104. package/build/leb128Parser.d.ts +1 -1
  105. package/build/leb128Parser.js +10 -10
  106. package/build/leb128Parser.test.js +7 -7
  107. package/build/negativeLookaheadParser.js +2 -2
  108. package/build/negativeLookaheadParser.test.js +4 -4
  109. package/build/noStackCaptureOverheadError.d.ts +4 -0
  110. package/build/noStackCaptureOverheadError.js +9 -0
  111. package/build/noStackCaptureOverheadError.test.d.ts +1 -0
  112. package/build/noStackCaptureOverheadError.test.js +15 -0
  113. package/build/nonEmptyArrayParser.js +2 -2
  114. package/build/nonEmptyArrayParser.test.js +2 -1
  115. package/build/optionalParser.js +2 -2
  116. package/build/parser.d.ts +2 -1
  117. package/build/parser.js +23 -8
  118. package/build/parser.test.js +78 -29
  119. package/build/parserConsumedSequenceParser.d.ts +1 -1
  120. package/build/parserConsumedSequenceParser.js +2 -2
  121. package/build/parserContext.d.ts +8 -6
  122. package/build/parserContext.js +60 -33
  123. package/build/parserContext.test.js +7 -3
  124. package/build/parserError.d.ts +603 -44
  125. package/build/parserError.js +98 -53
  126. package/build/parserImplementationInvariant.d.ts +1 -1
  127. package/build/parserImplementationInvariant.js +2 -2
  128. package/build/parserInputCompanion.js +2 -2
  129. package/build/promiseCompose.js +1 -2
  130. package/build/regexpParser.d.ts +2 -0
  131. package/build/regexpParser.js +71 -0
  132. package/build/regexpParser.test.d.ts +1 -0
  133. package/build/regexpParser.test.js +83 -0
  134. package/build/regularExpression.d.ts +63 -0
  135. package/build/regularExpression.js +1 -0
  136. package/build/regularExpressionParser.d.ts +3 -0
  137. package/build/regularExpressionParser.js +580 -0
  138. package/build/regularExpressionParser.test.d.ts +1 -0
  139. package/build/regularExpressionParser.test.js +89 -0
  140. package/build/separatedArrayParser.js +2 -2
  141. package/build/separatedNonEmptyArrayParser.d.ts +2 -0
  142. package/build/separatedNonEmptyArrayParser.js +40 -0
  143. package/build/separatedNonEmptyArrayParser.test.d.ts +1 -0
  144. package/build/separatedNonEmptyArrayParser.test.js +66 -0
  145. package/build/sequenceBuffer.js +1 -1
  146. package/build/sequenceTerminatedSequenceParser.d.ts +2 -2
  147. package/build/sequenceTerminatedSequenceParser.js +3 -3
  148. package/build/sequenceTerminatedSequenceParser.test.js +1 -1
  149. package/build/sequenceUnparser.d.ts +1 -1
  150. package/build/skipToParser.d.ts +1 -1
  151. package/build/skipToParser.js +2 -2
  152. package/build/sliceBoundedParser.test.js +4 -9
  153. package/build/smali.d.ts +1 -1
  154. package/build/smali.js +6 -2
  155. package/build/smaliParser.d.ts +62 -6
  156. package/build/smaliParser.js +1721 -296
  157. package/build/smaliParser.test.js +338 -43
  158. package/build/stringFromAsyncIterable.d.ts +1 -0
  159. package/build/stringFromAsyncIterable.js +7 -0
  160. package/build/terminatedArrayParser.js +4 -4
  161. package/build/terminatedArrayParser.test.js +7 -7
  162. package/build/toAsyncIterator.js +4 -4
  163. package/build/unionParser.d.ts +1 -1
  164. package/build/unionParser.js +2 -2
  165. package/build/unionParser.test.js +3 -3
  166. package/build/unparser.d.ts +3 -3
  167. package/build/unparser.js +6 -4
  168. package/build/unparser.test.js +7 -19
  169. package/build/unparserContext.d.ts +2 -2
  170. package/build/unparserContext.js +2 -3
  171. package/build/unparserError.d.ts +2 -1
  172. package/build/unparserError.js +2 -1
  173. package/build/unparserImplementationInvariant.d.ts +1 -1
  174. package/build/unparserOutputCompanion.d.ts +1 -1
  175. package/build/unparserOutputCompanion.js +1 -1
  176. package/build/zipParser.js +1 -1
  177. package/build/zipUnparser.d.ts +3 -3
  178. package/build/zipUnparser.js +9 -19
  179. package/build/zipUnparser.test.js +1 -1
  180. package/package.json +20 -26
  181. package/src/allSettledStream.test.ts +2 -2
  182. package/src/allSettledStream.ts +3 -3
  183. package/src/androidPackageParser.test.ts +17 -19
  184. package/src/androidPackageParser.ts +129 -171
  185. package/src/androidPackageUnparser.test.ts +19 -21
  186. package/src/androidPackageUnparser.ts +23 -17
  187. package/src/arbitrarilySlicedAsyncInterable.ts +1 -1
  188. package/src/arbitrarilySlicedAsyncInterator.ts +4 -4
  189. package/src/arbitraryDalvikBytecode.ts +992 -0
  190. package/src/arbitraryDalvikExecutable.ts +434 -0
  191. package/src/arbitraryDosDateTime.ts +1 -0
  192. package/src/arbitraryZipStream.ts +1 -1
  193. package/src/arrayParser.ts +2 -2
  194. package/src/arrayUnparser.ts +2 -2
  195. package/src/backsmali.ts +48 -4
  196. package/src/bash.ts +120 -0
  197. package/src/bashParser.test.ts +332 -0
  198. package/src/bashParser.ts +461 -0
  199. package/src/bsonParser.test.ts +12 -14
  200. package/src/customInvariant.ts +8 -12
  201. package/src/dalvikBytecodeParser/formatParsers.ts +376 -17
  202. package/src/dalvikBytecodeParser/formatSizes.ts +35 -0
  203. package/src/dalvikBytecodeParser/operationFormats.ts +226 -0
  204. package/src/dalvikBytecodeParser.ts +1042 -243
  205. package/src/dalvikBytecodeUnparser/formatUnparsers.ts +442 -0
  206. package/src/dalvikBytecodeUnparser.test.ts +44 -0
  207. package/src/dalvikBytecodeUnparser.ts +758 -0
  208. package/src/dalvikExecutable.ts +110 -48
  209. package/src/dalvikExecutableParser/stringSyntaxParser.ts +33 -33
  210. package/src/dalvikExecutableParser/typeParsers.ts +23 -14
  211. package/src/dalvikExecutableParser/typedNumbers.ts +19 -19
  212. package/src/dalvikExecutableParser.test.ts +60 -60
  213. package/src/dalvikExecutableParser.test.ts.md +6 -6
  214. package/src/dalvikExecutableParser.test.ts.snap +0 -0
  215. package/src/dalvikExecutableParser.ts +911 -434
  216. package/src/dalvikExecutableParserAgainstSmaliParser.test.ts +256 -239
  217. package/src/dalvikExecutableUnparser/annotationUnparsers.ts +135 -0
  218. package/src/dalvikExecutableUnparser/poolBuilders.ts +189 -0
  219. package/src/dalvikExecutableUnparser/poolScanners.ts +297 -0
  220. package/src/dalvikExecutableUnparser/sectionUnparsers.ts +683 -0
  221. package/src/dalvikExecutableUnparser/utils.ts +149 -0
  222. package/src/dalvikExecutableUnparser.test.ts +57 -0
  223. package/src/dalvikExecutableUnparser.ts +581 -0
  224. package/src/debugLogInputParser.ts +1 -1
  225. package/src/disjunctionParser.ts +5 -5
  226. package/src/elementTerminatedArrayParser.test.ts +8 -8
  227. package/src/elementTerminatedArrayParser.ts +2 -2
  228. package/src/elementTerminatedSequenceArrayParser.test.ts +4 -6
  229. package/src/elementTerminatedSequenceArrayParser.ts +2 -2
  230. package/src/elementTerminatedSequenceParser.test.ts +4 -6
  231. package/src/elementTerminatedSequenceParser.ts +2 -2
  232. package/src/endOfInputParser.ts +1 -1
  233. package/src/exactElementSwitchParser.ts +41 -0
  234. package/src/fetchCid.test.ts +20 -0
  235. package/src/fetchCid.ts +3 -7
  236. package/src/fixedLengthSequenceParser.test.ts +10 -12
  237. package/src/hasExecutable.ts +2 -2
  238. package/src/highResolutionTimer.ts +1 -1
  239. package/src/index.ts +113 -2
  240. package/src/inputReader.test.ts +39 -52
  241. package/src/inputReader.ts +2 -4
  242. package/src/inputReaderState.ts +1 -1
  243. package/src/inspect.ts +1 -1
  244. package/src/javaKeyStoreParser.test.ts +12 -14
  245. package/src/javaKeyStoreParser.ts +2 -6
  246. package/src/jsonParser.test.ts +2 -4
  247. package/src/jsonParser.ts +34 -38
  248. package/src/lazyMessageError.test.ts +21 -0
  249. package/src/lazyMessageError.ts +88 -0
  250. package/src/leb128Parser.test.ts +25 -23
  251. package/src/leb128Parser.ts +19 -19
  252. package/src/negativeLookaheadParser.test.ts +7 -11
  253. package/src/negativeLookaheadParser.ts +2 -2
  254. package/src/noStackCaptureOverheadError.test.ts +17 -0
  255. package/src/noStackCaptureOverheadError.ts +12 -0
  256. package/src/nonEmptyArrayParser.test.ts +3 -2
  257. package/src/nonEmptyArrayParser.ts +2 -2
  258. package/src/optionalParser.ts +2 -2
  259. package/src/parser.test.ts +96 -43
  260. package/src/parser.test.ts.md +13 -6
  261. package/src/parser.test.ts.snap +0 -0
  262. package/src/parser.ts +35 -12
  263. package/src/parserAccessorParser.ts +1 -1
  264. package/src/parserConsumedSequenceParser.ts +3 -3
  265. package/src/parserContext.test.ts +7 -3
  266. package/src/parserContext.ts +82 -48
  267. package/src/parserError.ts +143 -63
  268. package/src/parserImplementationInvariant.ts +3 -3
  269. package/src/parserInputCompanion.ts +2 -2
  270. package/src/promiseCompose.ts +2 -2
  271. package/src/regexpParser.test.ts +186 -0
  272. package/src/regexpParser.ts +94 -0
  273. package/src/regularExpression.ts +24 -0
  274. package/src/regularExpressionParser.test.ts +102 -0
  275. package/src/regularExpressionParser.ts +921 -0
  276. package/src/separatedArrayParser.ts +3 -3
  277. package/src/separatedNonEmptyArrayParser.test.ts +117 -0
  278. package/src/separatedNonEmptyArrayParser.ts +61 -0
  279. package/src/sequenceBuffer.test.ts +9 -9
  280. package/src/sequenceBuffer.ts +4 -4
  281. package/src/sequenceTerminatedSequenceParser.test.ts +3 -5
  282. package/src/sequenceTerminatedSequenceParser.ts +4 -4
  283. package/src/sequenceUnparser.ts +2 -2
  284. package/src/skipToParser.ts +2 -2
  285. package/src/sliceBoundedParser.test.ts +4 -12
  286. package/src/sliceBoundedParser.ts +2 -2
  287. package/src/smali.ts +8 -3
  288. package/src/smaliParser.test.ts +377 -66
  289. package/src/smaliParser.test.ts.md +1635 -48
  290. package/src/smaliParser.test.ts.snap +0 -0
  291. package/src/smaliParser.ts +2751 -569
  292. package/src/stringFromAsyncIterable.ts +9 -0
  293. package/src/terminatedArrayParser.test.ts +11 -11
  294. package/src/terminatedArrayParser.ts +5 -7
  295. package/src/toAsyncIterator.ts +8 -8
  296. package/src/uint8Array.ts +2 -3
  297. package/src/unionParser.test.ts +22 -23
  298. package/src/unionParser.ts +6 -8
  299. package/src/unparser.test.ts +18 -34
  300. package/src/unparser.ts +13 -9
  301. package/src/unparserContext.ts +9 -13
  302. package/src/unparserError.ts +2 -1
  303. package/src/unparserImplementationInvariant.ts +1 -1
  304. package/src/unparserOutputCompanion.ts +1 -1
  305. package/src/zip.ts +2 -6
  306. package/src/zipParser.ts +10 -18
  307. package/src/zipUnparser.test.ts +1 -1
  308. package/src/zipUnparser.ts +52 -64
  309. package/tsconfig.json +7 -1
  310. package/xo.config.ts +15 -0
  311. package/.yarn/releases/yarn-4.5.3.cjs +0 -934
@@ -0,0 +1,294 @@
1
+ import { setParserName } from './parser.js';
2
+ import { createExactSequenceParser } from './exactSequenceParser.js';
3
+ import { promiseCompose } from './promiseCompose.js';
4
+ import { createTupleParser } from './tupleParser.js';
5
+ import { createDisjunctionParser } from './disjunctionParser.js';
6
+ import { createArrayParser } from './arrayParser.js';
7
+ import { createParserAccessorParser } from './parserAccessorParser.js';
8
+ import { createOptionalParser } from './optionalParser.js';
9
+ import { createRegExpParser } from './regexpParser.js';
10
+ import { createNonEmptyArrayParser } from './nonEmptyArrayParser.js';
11
+ import { createSeparatedNonEmptyArrayParser } from './separatedNonEmptyArrayParser.js';
12
+ // Whitespace (spaces and tabs, not newlines - those are significant)
13
+ const bashInlineWhitespaceParser = promiseCompose(createRegExpParser(/[ \t]+/), match => match[0]);
14
+ const bashOptionalInlineWhitespaceParser = promiseCompose(createRegExpParser(/[ \t]*/), match => match[0]);
15
+ // Newline
16
+ const bashNewlineParser = promiseCompose(createRegExpParser(/\n/), match => match[0]);
17
+ // Word characters (unquoted, no special chars)
18
+ // Note: {} are excluded so brace groups are parsed correctly
19
+ const bashUnquotedWordCharsParser = promiseCompose(createRegExpParser(/[^\s\n|&;<>(){}$`"'\\#]+/), match => match[0]);
20
+ // Single quoted string: '...'
21
+ const bashSingleQuotedParser = promiseCompose(createTupleParser([
22
+ createExactSequenceParser("'"),
23
+ promiseCompose(createRegExpParser(/[^']*/), match => match[0]),
24
+ createExactSequenceParser("'"),
25
+ ]), ([, value]) => ({
26
+ type: 'singleQuoted',
27
+ value,
28
+ }));
29
+ // Variable name
30
+ const bashVariableNameParser = promiseCompose(createRegExpParser(/[a-zA-Z_][a-zA-Z0-9_]*|[0-9]+|[@*#?$!-]/), match => match[0]);
31
+ // Simple variable: $var
32
+ const bashSimpleVariableParser = promiseCompose(createTupleParser([
33
+ createExactSequenceParser('$'),
34
+ bashVariableNameParser,
35
+ ]), ([, name]) => ({
36
+ type: 'variable',
37
+ name,
38
+ }));
39
+ // Command substitution: $(...)
40
+ const bashCommandSubstitutionParser = promiseCompose(createTupleParser([
41
+ createExactSequenceParser('$('),
42
+ bashOptionalInlineWhitespaceParser,
43
+ createParserAccessorParser(() => bashCommandParser),
44
+ bashOptionalInlineWhitespaceParser,
45
+ createExactSequenceParser(')'),
46
+ ]), ([, , command]) => ({
47
+ type: 'commandSubstitution',
48
+ command,
49
+ }));
50
+ // Backtick substitution: `...`
51
+ const bashBacktickSubstitutionParser = promiseCompose(createTupleParser([
52
+ createExactSequenceParser('`'),
53
+ createParserAccessorParser(() => bashCommandParser),
54
+ createExactSequenceParser('`'),
55
+ ]), ([, command]) => ({
56
+ type: 'backtickSubstitution',
57
+ command,
58
+ }));
59
+ // Double quoted string parts (inside "...")
60
+ const bashDoubleQuotedPartParser = createDisjunctionParser([
61
+ bashSimpleVariableParser,
62
+ bashCommandSubstitutionParser,
63
+ bashBacktickSubstitutionParser,
64
+ // Escape sequences in double quotes
65
+ promiseCompose(createRegExpParser(/\\[\\$`"!\n]/), match => ({
66
+ type: 'literal',
67
+ value: match[0].slice(1),
68
+ })),
69
+ // Literal text (no special chars)
70
+ promiseCompose(createRegExpParser(/[^$`"\\]+/), match => ({
71
+ type: 'literal',
72
+ value: match[0],
73
+ })),
74
+ ]);
75
+ // Double quoted string: "..."
76
+ const bashDoubleQuotedParser = promiseCompose(createTupleParser([
77
+ createExactSequenceParser('"'),
78
+ createArrayParser(bashDoubleQuotedPartParser),
79
+ createExactSequenceParser('"'),
80
+ ]), ([, parts]) => ({
81
+ type: 'doubleQuoted',
82
+ parts,
83
+ }));
84
+ // Literal word part (unquoted)
85
+ const bashLiteralWordPartParser = promiseCompose(bashUnquotedWordCharsParser, value => ({
86
+ type: 'literal',
87
+ value,
88
+ }));
89
+ // Escape sequence outside quotes
90
+ const bashEscapeParser = promiseCompose(createRegExpParser(/\\./), match => ({
91
+ type: 'literal',
92
+ value: match[0].slice(1),
93
+ }));
94
+ // Word part (any part of a word)
95
+ const bashWordPartParser = createDisjunctionParser([
96
+ bashSingleQuotedParser,
97
+ bashDoubleQuotedParser,
98
+ bashCommandSubstitutionParser,
99
+ bashBacktickSubstitutionParser,
100
+ bashSimpleVariableParser,
101
+ bashEscapeParser,
102
+ bashLiteralWordPartParser,
103
+ ]);
104
+ // Word (sequence of word parts)
105
+ export const bashWordParser = promiseCompose(createNonEmptyArrayParser(bashWordPartParser), parts => ({ parts }));
106
+ setParserName(bashWordParser, 'bashWordParser');
107
+ // Assignment: NAME=value or NAME=
108
+ const bashAssignmentParser = promiseCompose(createTupleParser([
109
+ promiseCompose(createRegExpParser(/[a-zA-Z_][a-zA-Z0-9_]*=/), match => match[0].slice(0, -1)),
110
+ createOptionalParser(bashWordParser),
111
+ ]), ([name, value]) => ({
112
+ name,
113
+ value: value ?? undefined,
114
+ }));
115
+ // Redirect operators
116
+ const bashRedirectOperatorParser = createDisjunctionParser([
117
+ promiseCompose(createExactSequenceParser('>>'), () => '>>'),
118
+ promiseCompose(createExactSequenceParser('>&'), () => '>&'),
119
+ promiseCompose(createExactSequenceParser('>|'), () => '>|'),
120
+ promiseCompose(createExactSequenceParser('>'), () => '>'),
121
+ promiseCompose(createExactSequenceParser('<<<'), () => '<<<'),
122
+ promiseCompose(createExactSequenceParser('<<'), () => '<<'),
123
+ promiseCompose(createExactSequenceParser('<&'), () => '<&'),
124
+ promiseCompose(createExactSequenceParser('<'), () => '<'),
125
+ ]);
126
+ // Redirect: [n]op word
127
+ const bashRedirectParser = promiseCompose(createTupleParser([
128
+ createOptionalParser(promiseCompose(createRegExpParser(/[0-9]+/), match => Number.parseInt(match[0], 10))),
129
+ bashRedirectOperatorParser,
130
+ bashOptionalInlineWhitespaceParser,
131
+ bashWordParser,
132
+ ]), ([fd, operator, , target]) => ({
133
+ fd: fd ?? undefined,
134
+ operator,
135
+ target,
136
+ }));
137
+ // Word with optional trailing whitespace - for use in arrays
138
+ const bashWordWithWhitespaceParser = promiseCompose(createTupleParser([
139
+ bashWordParser,
140
+ bashOptionalInlineWhitespaceParser,
141
+ ]), ([word]) => word);
142
+ // Redirect with optional trailing whitespace
143
+ const bashRedirectWithWhitespaceParser = promiseCompose(createTupleParser([
144
+ bashRedirectParser,
145
+ bashOptionalInlineWhitespaceParser,
146
+ ]), ([redirect]) => redirect);
147
+ // Word or redirect - for interleaved parsing in simple commands
148
+ const bashWordOrRedirectParser = createDisjunctionParser([
149
+ promiseCompose(bashRedirectWithWhitespaceParser, redirect => ({ type: 'redirect', redirect })),
150
+ promiseCompose(bashWordWithWhitespaceParser, word => ({ type: 'word', word })),
151
+ ]);
152
+ // Simple command: [assignments] [name] [args] [redirects]
153
+ export const bashSimpleCommandParser = promiseCompose(createTupleParser([
154
+ // Assignments at the start
155
+ createArrayParser(promiseCompose(createTupleParser([
156
+ bashAssignmentParser,
157
+ bashOptionalInlineWhitespaceParser,
158
+ ]), ([assignment]) => assignment)),
159
+ // Command name, args, and redirects (interleaved)
160
+ createArrayParser(bashWordOrRedirectParser),
161
+ ]), ([assignments, items]) => {
162
+ const words = [];
163
+ const redirects = [];
164
+ for (const item of items) {
165
+ if (item.type === 'word') {
166
+ words.push(item.word);
167
+ }
168
+ else {
169
+ redirects.push(item.redirect);
170
+ }
171
+ }
172
+ const [name, ...args] = words;
173
+ return {
174
+ type: 'simple',
175
+ name,
176
+ args,
177
+ redirects,
178
+ assignments,
179
+ };
180
+ });
181
+ setParserName(bashSimpleCommandParser, 'bashSimpleCommandParser');
182
+ // Subshell: ( command )
183
+ const bashSubshellParser = promiseCompose(createTupleParser([
184
+ createExactSequenceParser('('),
185
+ bashOptionalInlineWhitespaceParser,
186
+ createParserAccessorParser(() => bashCommandParser),
187
+ bashOptionalInlineWhitespaceParser,
188
+ createExactSequenceParser(')'),
189
+ ]), ([, , body]) => ({
190
+ type: 'subshell',
191
+ body,
192
+ }));
193
+ setParserName(bashSubshellParser, 'bashSubshellParser');
194
+ // Brace group: { command; }
195
+ const bashBraceGroupParser = promiseCompose(createTupleParser([
196
+ createExactSequenceParser('{'),
197
+ bashInlineWhitespaceParser,
198
+ createParserAccessorParser(() => bashCommandParser),
199
+ bashOptionalInlineWhitespaceParser,
200
+ createOptionalParser(createExactSequenceParser(';')),
201
+ bashOptionalInlineWhitespaceParser,
202
+ createExactSequenceParser('}'),
203
+ ]), ([, , body]) => ({
204
+ type: 'braceGroup',
205
+ body,
206
+ }));
207
+ setParserName(bashBraceGroupParser, 'bashBraceGroupParser');
208
+ // Command unit: simple command, subshell, or brace group
209
+ const bashCommandUnitParser = createDisjunctionParser([
210
+ bashSubshellParser,
211
+ bashBraceGroupParser,
212
+ bashSimpleCommandParser,
213
+ ]);
214
+ setParserName(bashCommandUnitParser, 'bashCommandUnitParser');
215
+ // Single pipe (not ||) - matches | only when not followed by another |
216
+ const bashSinglePipeParser = promiseCompose(createRegExpParser(/\|(?!\|)/), match => match[0]);
217
+ // Pipeline: [!] cmd [| cmd]...
218
+ const bashPipelineParser = promiseCompose(createTupleParser([
219
+ createOptionalParser(promiseCompose(createTupleParser([
220
+ createExactSequenceParser('!'),
221
+ bashInlineWhitespaceParser,
222
+ ]), () => true)),
223
+ createSeparatedNonEmptyArrayParser(bashCommandUnitParser, createTupleParser([
224
+ bashOptionalInlineWhitespaceParser,
225
+ bashSinglePipeParser,
226
+ bashOptionalInlineWhitespaceParser,
227
+ ])),
228
+ ]), ([negated, commands]) => ({
229
+ type: 'pipeline',
230
+ negated: negated ?? false,
231
+ commands,
232
+ }));
233
+ setParserName(bashPipelineParser, 'bashPipelineParser');
234
+ // Command list separator
235
+ const bashListSeparatorParser = createDisjunctionParser([
236
+ promiseCompose(createExactSequenceParser('&&'), () => '&&'),
237
+ promiseCompose(createExactSequenceParser('||'), () => '||'),
238
+ promiseCompose(createExactSequenceParser(';'), () => ';'),
239
+ promiseCompose(createExactSequenceParser('&'), () => '&'),
240
+ promiseCompose(bashNewlineParser, () => '\n'),
241
+ ]);
242
+ // Command list: pipeline [sep pipeline]...
243
+ const bashCommandListParser = promiseCompose(createTupleParser([
244
+ bashPipelineParser,
245
+ createArrayParser(promiseCompose(createTupleParser([
246
+ bashOptionalInlineWhitespaceParser,
247
+ bashListSeparatorParser,
248
+ bashOptionalInlineWhitespaceParser,
249
+ bashPipelineParser,
250
+ ]), ([, separator, , pipeline]) => ({ separator, pipeline }))),
251
+ createOptionalParser(promiseCompose(createTupleParser([
252
+ bashOptionalInlineWhitespaceParser,
253
+ bashListSeparatorParser,
254
+ ]), ([, separator]) => separator)),
255
+ ]), ([firstPipeline, rest, trailingSeparator]) => {
256
+ const entries = [];
257
+ if (rest.length === 0) {
258
+ entries.push({
259
+ pipeline: firstPipeline,
260
+ separator: trailingSeparator ?? undefined,
261
+ });
262
+ }
263
+ else {
264
+ entries.push({
265
+ pipeline: firstPipeline,
266
+ separator: rest[0].separator,
267
+ });
268
+ for (let i = 0; i < rest.length - 1; i++) {
269
+ entries.push({
270
+ pipeline: rest[i].pipeline,
271
+ separator: rest[i + 1].separator,
272
+ });
273
+ }
274
+ entries.push({
275
+ pipeline: rest[rest.length - 1].pipeline,
276
+ separator: trailingSeparator ?? undefined,
277
+ });
278
+ }
279
+ return {
280
+ type: 'list',
281
+ entries,
282
+ };
283
+ });
284
+ setParserName(bashCommandListParser, 'bashCommandListParser');
285
+ // Top-level command parser
286
+ export const bashCommandParser = bashCommandListParser;
287
+ setParserName(bashCommandParser, 'bashCommandParser');
288
+ // Script parser (handles leading/trailing whitespace)
289
+ export const bashScriptParser = promiseCompose(createTupleParser([
290
+ bashOptionalInlineWhitespaceParser,
291
+ bashCommandParser,
292
+ bashOptionalInlineWhitespaceParser,
293
+ ]), ([, command]) => command);
294
+ setParserName(bashScriptParser, 'bashScriptParser');
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,181 @@
1
+ import test from 'ava';
2
+ import { runParser } from './parser.js';
3
+ import { stringParserInputCompanion } from './parserInputCompanion.js';
4
+ import { bashScriptParser, bashWordParser, bashSimpleCommandParser } from './bashParser.js';
5
+ test('simple command parser - single word', async (t) => {
6
+ const result = await runParser(bashSimpleCommandParser, 'cmd', stringParserInputCompanion, { errorStack: true });
7
+ t.is(result.type, 'simple');
8
+ t.deepEqual(result.name, { parts: [{ type: 'literal', value: 'cmd' }] });
9
+ });
10
+ test('simple command parser - two words', async (t) => {
11
+ const result = await runParser(bashSimpleCommandParser, 'echo hello', stringParserInputCompanion);
12
+ t.is(result.type, 'simple');
13
+ t.deepEqual(result.name, { parts: [{ type: 'literal', value: 'echo' }] });
14
+ t.is(result.args.length, 1);
15
+ });
16
+ test('word parser - simple literal', async (t) => {
17
+ const result = await runParser(bashWordParser, 'hello', stringParserInputCompanion);
18
+ t.deepEqual(result, {
19
+ parts: [{ type: 'literal', value: 'hello' }],
20
+ });
21
+ });
22
+ test('word parser - variable', async (t) => {
23
+ const result = await runParser(bashWordParser, '$HOME', stringParserInputCompanion);
24
+ t.deepEqual(result, {
25
+ parts: [{ type: 'variable', name: 'HOME' }],
26
+ });
27
+ });
28
+ test('simple command', async (t) => {
29
+ const result = await runParser(bashScriptParser, 'echo hello', stringParserInputCompanion);
30
+ t.deepEqual(result, {
31
+ type: 'list',
32
+ entries: [{
33
+ pipeline: {
34
+ type: 'pipeline',
35
+ negated: false,
36
+ commands: [{
37
+ type: 'simple',
38
+ name: { parts: [{ type: 'literal', value: 'echo' }] },
39
+ args: [{ parts: [{ type: 'literal', value: 'hello' }] }],
40
+ redirects: [],
41
+ assignments: [],
42
+ }],
43
+ },
44
+ separator: undefined,
45
+ }],
46
+ });
47
+ });
48
+ test('simple command with multiple args', async (t) => {
49
+ const result = await runParser(bashScriptParser, 'echo hello world', stringParserInputCompanion);
50
+ t.is(result.entries[0].pipeline.commands[0].type, 'simple');
51
+ const cmd = result.entries[0].pipeline.commands[0];
52
+ if (cmd.type === 'simple') {
53
+ t.is(cmd.args.length, 2);
54
+ }
55
+ });
56
+ test('pipeline', async (t) => {
57
+ const result = await runParser(bashScriptParser, 'cat file | grep pattern', stringParserInputCompanion);
58
+ t.is(result.entries[0].pipeline.commands.length, 2);
59
+ });
60
+ test('redirect output', async (t) => {
61
+ const result = await runParser(bashScriptParser, 'echo foo > file', stringParserInputCompanion);
62
+ const cmd = result.entries[0].pipeline.commands[0];
63
+ if (cmd.type === 'simple') {
64
+ t.is(cmd.redirects.length, 1);
65
+ t.is(cmd.redirects[0].operator, '>');
66
+ }
67
+ });
68
+ test('redirect with fd', async (t) => {
69
+ const result = await runParser(bashScriptParser, 'cmd 2>&1', stringParserInputCompanion);
70
+ const cmd = result.entries[0].pipeline.commands[0];
71
+ if (cmd.type === 'simple') {
72
+ t.is(cmd.redirects.length, 1);
73
+ t.is(cmd.redirects[0].fd, 2);
74
+ t.is(cmd.redirects[0].operator, '>&');
75
+ }
76
+ });
77
+ test('single quoted string', async (t) => {
78
+ const result = await runParser(bashScriptParser, "echo 'hello world'", stringParserInputCompanion);
79
+ const cmd = result.entries[0].pipeline.commands[0];
80
+ if (cmd.type === 'simple') {
81
+ t.deepEqual(cmd.args[0], {
82
+ parts: [{ type: 'singleQuoted', value: 'hello world' }],
83
+ });
84
+ }
85
+ });
86
+ test('double quoted string with variable', async (t) => {
87
+ const result = await runParser(bashScriptParser, 'echo "hello $name"', stringParserInputCompanion);
88
+ const cmd = result.entries[0].pipeline.commands[0];
89
+ if (cmd.type === 'simple') {
90
+ t.deepEqual(cmd.args[0], {
91
+ parts: [{
92
+ type: 'doubleQuoted',
93
+ parts: [
94
+ { type: 'literal', value: 'hello ' },
95
+ { type: 'variable', name: 'name' },
96
+ ],
97
+ }],
98
+ });
99
+ }
100
+ });
101
+ test('simple variable', async (t) => {
102
+ const result = await runParser(bashScriptParser, 'echo $HOME', stringParserInputCompanion);
103
+ const cmd = result.entries[0].pipeline.commands[0];
104
+ if (cmd.type === 'simple') {
105
+ t.deepEqual(cmd.args[0], {
106
+ parts: [{ type: 'variable', name: 'HOME' }],
107
+ });
108
+ }
109
+ });
110
+ test('command substitution', async (t) => {
111
+ const result = await runParser(bashScriptParser, 'echo $(pwd)', stringParserInputCompanion);
112
+ const cmd = result.entries[0].pipeline.commands[0];
113
+ if (cmd.type === 'simple') {
114
+ t.is(cmd.args[0].parts[0].type, 'commandSubstitution');
115
+ }
116
+ });
117
+ test('backtick substitution', async (t) => {
118
+ const result = await runParser(bashScriptParser, 'echo `pwd`', stringParserInputCompanion);
119
+ const cmd = result.entries[0].pipeline.commands[0];
120
+ if (cmd.type === 'simple') {
121
+ t.is(cmd.args[0].parts[0].type, 'backtickSubstitution');
122
+ }
123
+ });
124
+ test('subshell', async (t) => {
125
+ const result = await runParser(bashScriptParser, '(cd dir; pwd)', stringParserInputCompanion);
126
+ t.is(result.entries[0].pipeline.commands[0].type, 'subshell');
127
+ });
128
+ test('brace group', async (t) => {
129
+ const result = await runParser(bashScriptParser, '{ echo hello; }', stringParserInputCompanion);
130
+ t.is(result.entries[0].pipeline.commands[0].type, 'braceGroup');
131
+ });
132
+ test('command list with &&', async (t) => {
133
+ const result = await runParser(bashScriptParser, 'cmd1 && cmd2', stringParserInputCompanion);
134
+ t.is(result.entries.length, 2);
135
+ t.is(result.entries[0].separator, '&&');
136
+ });
137
+ test('command list with ||', async (t) => {
138
+ const result = await runParser(bashScriptParser, 'cmd1 || cmd2', stringParserInputCompanion);
139
+ t.is(result.entries.length, 2);
140
+ t.is(result.entries[0].separator, '||');
141
+ });
142
+ test('command list with ;', async (t) => {
143
+ const result = await runParser(bashScriptParser, 'cmd1; cmd2', stringParserInputCompanion);
144
+ t.is(result.entries.length, 2);
145
+ t.is(result.entries[0].separator, ';');
146
+ });
147
+ test('background command', async (t) => {
148
+ const result = await runParser(bashScriptParser, 'cmd &', stringParserInputCompanion);
149
+ t.is(result.entries[0].separator, '&');
150
+ });
151
+ test('assignment', async (t) => {
152
+ const result = await runParser(bashScriptParser, 'VAR=value cmd', stringParserInputCompanion);
153
+ const cmd = result.entries[0].pipeline.commands[0];
154
+ if (cmd.type === 'simple') {
155
+ t.is(cmd.assignments.length, 1);
156
+ t.is(cmd.assignments[0].name, 'VAR');
157
+ }
158
+ });
159
+ test('negated pipeline', async (t) => {
160
+ const result = await runParser(bashScriptParser, '! cmd', stringParserInputCompanion);
161
+ t.is(result.entries[0].pipeline.negated, true);
162
+ });
163
+ test('complex pipeline with redirects', async (t) => {
164
+ const result = await runParser(bashScriptParser, 'cat file 2>/dev/null | grep pattern | sort > output', stringParserInputCompanion);
165
+ t.is(result.entries[0].pipeline.commands.length, 3);
166
+ });
167
+ test('[[ treated as command name', async (t) => {
168
+ const result = await runParser(bashScriptParser, '[[ -f file ]]', stringParserInputCompanion);
169
+ const cmd = result.entries[0].pipeline.commands[0];
170
+ if (cmd.type === 'simple') {
171
+ t.deepEqual(cmd.name, { parts: [{ type: 'literal', value: '[[' }] });
172
+ t.is(cmd.args.length, 3); // -f, file, ]]
173
+ }
174
+ });
175
+ test('if treated as command name', async (t) => {
176
+ const result = await runParser(bashScriptParser, 'if true', stringParserInputCompanion);
177
+ const cmd = result.entries[0].pipeline.commands[0];
178
+ if (cmd.type === 'simple') {
179
+ t.deepEqual(cmd.name, { parts: [{ type: 'literal', value: 'if' }] });
180
+ }
181
+ });
@@ -1,4 +1,5 @@
1
1
  import { type Constructor } from 'type-fest';
2
+ import { LazyMessage, LazyMessageError } from './lazyMessageError.js';
2
3
  export type Falsy = '' | 0 | false | undefined;
3
4
  export type ValueOrAccessor<T> = T | (() => T);
4
- export declare function customInvariant<T>(ErrorConstructor: Constructor<Error, [message: string]> | ((message: string) => Error), value: T, formatOrFormatLines: ValueOrAccessor<string | string[]>, ...formatArguments: (unknown | (() => unknown))[]): Exclude<T, Falsy>;
5
+ export declare function customInvariant<T>(ErrorConstructor: Constructor<LazyMessageError, [LazyMessage]> | ((lazyMessage: LazyMessage) => LazyMessageError), value: T, formatOrFormatLines: ValueOrAccessor<string | string[]>, ...formatArguments: Array<unknown | (() => unknown)>): Exclude<T, Falsy>;
@@ -2,10 +2,8 @@ export function customInvariant(ErrorConstructor, value, formatOrFormatLines, ..
2
2
  if (value) {
3
3
  return value;
4
4
  }
5
- let format = typeof formatOrFormatLines === 'function' ? formatOrFormatLines() : formatOrFormatLines;
6
- format = Array.isArray(format) ? format.join('\n') : format;
7
- throw new ErrorConstructor(format.replaceAll('%s', () => {
8
- const argumentOrAccessor = formatArguments.shift();
9
- return typeof argumentOrAccessor === 'function' ? argumentOrAccessor() : argumentOrAccessor;
10
- }));
5
+ throw new ErrorConstructor([
6
+ formatOrFormatLines,
7
+ ...formatArguments,
8
+ ]);
11
9
  }
@@ -1,5 +1,5 @@
1
- import { Iso } from "monocle-ts";
2
- import { Parser } from "../parser.js";
1
+ import { type Iso } from 'monocle-ts';
2
+ import { type Parser } from '../parser.js';
3
3
  export declare const nibblesParser: Parser<[number, number], Uint8Array>;
4
4
  type DalvikBytecodeFormat10t = {
5
5
  branchOffset: number;
@@ -11,6 +11,11 @@ type DalvikBytecodeFormat11x = {
11
11
  registers: number[];
12
12
  };
13
13
  export declare const dalvikBytecodeFormat11xParser: Parser<DalvikBytecodeFormat11x, Uint8Array>;
14
+ type DalvikBytecodeFormat11n = {
15
+ value: number;
16
+ registers: number[];
17
+ };
18
+ export declare const dalvikBytecodeFormat11nParser: Parser<DalvikBytecodeFormat11n, Uint8Array>;
14
19
  type DalvikBytecodeFormat12x = {
15
20
  registers: number[];
16
21
  };
@@ -71,11 +76,27 @@ type DalvikBytecodeFormat23x = {
71
76
  registers: number[];
72
77
  };
73
78
  export declare const dalvikBytecodeFormat23xParser: Parser<DalvikBytecodeFormat23x, Uint8Array>;
79
+ type DalvikBytecodeFormat30t = {
80
+ branchOffset: number;
81
+ };
82
+ export declare const dalvikBytecodeFormat30tParser: Parser<DalvikBytecodeFormat30t, Uint8Array>;
74
83
  type DalvikBytecodeFormat31i = {
75
84
  value: number;
76
85
  registers: number[];
77
86
  };
78
87
  export declare const dalvikBytecodeFormat31iParser: Parser<DalvikBytecodeFormat31i, Uint8Array>;
88
+ type DalvikBytecodeFormat31c<Index> = {
89
+ index: Index;
90
+ registers: number[];
91
+ };
92
+ export declare const createDalvikBytecodeFormat31cParser: <Index>({ isoIndex, }: {
93
+ isoIndex: Iso<Index, number>;
94
+ }) => Parser<DalvikBytecodeFormat31c<Index>, Uint8Array>;
95
+ type DalvikBytecodeFormat31t = {
96
+ branchOffset: number;
97
+ registers: number[];
98
+ };
99
+ export declare const dalvikBytecodeFormat31tParser: Parser<DalvikBytecodeFormat31t, Uint8Array>;
79
100
  type DalvikBytecodeFormat32x = {
80
101
  registers: number[];
81
102
  };
@@ -94,4 +115,57 @@ type DalvikBytecodeFormat3rc<Index> = {
94
115
  export declare const createDalvikBytecodeFormat3rcParser: <Index>({ isoIndex, }: {
95
116
  isoIndex: Iso<Index, number>;
96
117
  }) => Parser<DalvikBytecodeFormat3rc<Index>, Uint8Array>;
118
+ type DalvikBytecodeFormat51l = {
119
+ value: bigint;
120
+ registers: number[];
121
+ };
122
+ export declare const dalvikBytecodeFormat51lParser: Parser<DalvikBytecodeFormat51l, Uint8Array>;
123
+ type DalvikBytecodeFormat20bc = {
124
+ kind: number;
125
+ index: number;
126
+ };
127
+ export declare const dalvikBytecodeFormat20bcParser: Parser<DalvikBytecodeFormat20bc, Uint8Array>;
128
+ type DalvikBytecodeFormat22cs = {
129
+ registers: number[];
130
+ fieldOffset: number;
131
+ };
132
+ export declare const dalvikBytecodeFormat22csParser: Parser<DalvikBytecodeFormat22cs, Uint8Array>;
133
+ type DalvikBytecodeFormat35mi = {
134
+ inlineIndex: number;
135
+ registers: number[];
136
+ };
137
+ export declare const dalvikBytecodeFormat35miParser: Parser<DalvikBytecodeFormat35mi, Uint8Array>;
138
+ type DalvikBytecodeFormat35ms = {
139
+ vtableOffset: number;
140
+ registers: number[];
141
+ };
142
+ export declare const dalvikBytecodeFormat35msParser: Parser<DalvikBytecodeFormat35ms, Uint8Array>;
143
+ type DalvikBytecodeFormat3rmi = {
144
+ inlineIndex: number;
145
+ registers: number[];
146
+ };
147
+ export declare const dalvikBytecodeFormat3rmiParser: Parser<DalvikBytecodeFormat3rmi, Uint8Array>;
148
+ type DalvikBytecodeFormat3rms = {
149
+ vtableOffset: number;
150
+ registers: number[];
151
+ };
152
+ export declare const dalvikBytecodeFormat3rmsParser: Parser<DalvikBytecodeFormat3rms, Uint8Array>;
153
+ type DalvikBytecodeFormat45cc<MethodIndex, ProtoIndex> = {
154
+ methodIndex: MethodIndex;
155
+ protoIndex: ProtoIndex;
156
+ registers: number[];
157
+ };
158
+ export declare const createDalvikBytecodeFormat45ccParser: <MethodIndex, ProtoIndex>({ isoMethodIndex, isoProtoIndex, }: {
159
+ isoMethodIndex: Iso<MethodIndex, number>;
160
+ isoProtoIndex: Iso<ProtoIndex, number>;
161
+ }) => Parser<DalvikBytecodeFormat45cc<MethodIndex, ProtoIndex>, Uint8Array>;
162
+ type DalvikBytecodeFormat4rcc<MethodIndex, ProtoIndex> = {
163
+ methodIndex: MethodIndex;
164
+ protoIndex: ProtoIndex;
165
+ registers: number[];
166
+ };
167
+ export declare const createDalvikBytecodeFormat4rccParser: <MethodIndex, ProtoIndex>({ isoMethodIndex, isoProtoIndex, }: {
168
+ isoMethodIndex: Iso<MethodIndex, number>;
169
+ isoProtoIndex: Iso<ProtoIndex, number>;
170
+ }) => Parser<DalvikBytecodeFormat4rcc<MethodIndex, ProtoIndex>, Uint8Array>;
97
171
  export {};