@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.
- package/.claude/settings.local.json +24 -0
- package/.github/workflows/main.yml +1 -0
- package/build/androidPackageParser.js +30 -32
- package/build/arbitraryDalvikBytecode.d.ts +3 -3
- package/build/arbitraryDalvikBytecode.js +33 -27
- package/build/arbitraryDalvikExecutable.js +55 -17
- package/build/arbitraryJava.d.ts +31 -0
- package/build/arbitraryJava.js +532 -0
- package/build/arbitraryJavaScript.d.ts +3 -0
- package/build/arbitraryJavaScript.js +263 -0
- package/build/arbitraryJavascript.d.ts +3 -0
- package/build/arbitraryJavascript.js +263 -0
- package/build/arbitraryZig.d.ts +3 -0
- package/build/arbitraryZig.js +240 -0
- package/build/arbitraryZipStream.d.ts +1 -1
- package/build/arrayParser.js +72 -13
- package/build/backsmali.d.ts +4 -3
- package/build/backsmali.js +26 -6
- package/build/bash.d.ts +89 -0
- package/build/bash.js +1 -0
- package/build/bashParser.d.ts +6 -0
- package/build/bashParser.js +335 -0
- package/build/bashParser.test.d.ts +1 -0
- package/build/bashParser.test.js +343 -0
- package/build/bashParserEdgeCases.test.d.ts +1 -0
- package/build/bashParserEdgeCases.test.js +117 -0
- package/build/dalvikBytecodeParser/addressConversion.d.ts +110 -0
- package/build/dalvikBytecodeParser/addressConversion.js +334 -0
- package/build/dalvikBytecodeParser/formatParsers.d.ts +7 -6
- package/build/dalvikBytecodeParser/formatParsers.js +13 -14
- package/build/dalvikBytecodeParser.d.ts +60 -31
- package/build/dalvikBytecodeParser.js +92 -35
- package/build/dalvikBytecodeParser.test-d.d.ts +1 -0
- package/build/dalvikBytecodeParser.test-d.js +268 -0
- package/build/dalvikBytecodeUnparser/formatUnparsers.d.ts +9 -8
- package/build/dalvikBytecodeUnparser/formatUnparsers.js +13 -12
- package/build/dalvikBytecodeUnparser.d.ts +2 -2
- package/build/dalvikBytecodeUnparser.js +23 -23
- package/build/dalvikBytecodeUnparser.test.js +7 -7
- package/build/dalvikExecutable.d.ts +3 -3
- package/build/dalvikExecutable.test-d.d.ts +1 -0
- package/build/dalvikExecutable.test-d.js +59 -0
- package/build/dalvikExecutableParser/typedNumbers.d.ts +18 -0
- package/build/dalvikExecutableParser/typedNumbers.js +3 -0
- package/build/dalvikExecutableParser.d.ts +2 -1
- package/build/dalvikExecutableParser.js +96 -77
- package/build/dalvikExecutableParser.test.js +24 -3
- package/build/dalvikExecutableParserAgainstSmaliParser.test.js +3 -0
- package/build/dalvikExecutableUnparser/poolScanners.d.ts +2 -2
- package/build/dalvikExecutableUnparser/sectionUnparsers.d.ts +3 -3
- package/build/dalvikExecutableUnparser/sectionUnparsers.js +26 -11
- package/build/dalvikExecutableUnparser.d.ts +2 -2
- package/build/dalvikExecutableUnparser.test.js +2 -1
- package/build/disjunctionParser.d.ts +5 -3
- package/build/disjunctionParser.js +79 -17
- package/build/disjunctionParser.test-d.d.ts +1 -0
- package/build/disjunctionParser.test-d.js +72 -0
- package/build/elementSwitchParser.d.ts +4 -0
- package/build/{exactElementSwitchParser.js → elementSwitchParser.js} +3 -4
- package/build/elementSwitchParser.test-d.d.ts +1 -0
- package/build/elementSwitchParser.test-d.js +44 -0
- package/build/exactSequenceParser.d.ts +4 -2
- package/build/exactSequenceParser.test-d.d.ts +1 -0
- package/build/exactSequenceParser.test-d.js +36 -0
- package/build/fetchCid.js +2 -66
- package/build/index.d.ts +25 -2
- package/build/index.js +23 -1
- package/build/index.test.js +16 -1
- package/build/inputReader.d.ts +10 -0
- package/build/inputReader.js +36 -0
- package/build/java.d.ts +502 -0
- package/build/java.js +2 -0
- package/build/javaKeyStoreParser.js +14 -17
- package/build/javaParser.d.ts +51 -0
- package/build/javaParser.js +1538 -0
- package/build/javaParser.test.d.ts +1 -0
- package/build/javaParser.test.js +1287 -0
- package/build/javaScript.d.ts +35 -0
- package/build/javaScript.js +1 -0
- package/build/javaScriptParser.d.ts +9 -0
- package/build/javaScriptParser.js +34 -0
- package/build/javaScriptUnparser.d.ts +3 -0
- package/build/javaScriptUnparser.js +4 -0
- package/build/javaScriptUnparser.test.d.ts +1 -0
- package/build/javaScriptUnparser.test.js +24 -0
- package/build/javaUnparser.d.ts +2 -0
- package/build/javaUnparser.js +519 -0
- package/build/javaUnparser.test.d.ts +1 -0
- package/build/javaUnparser.test.js +24 -0
- package/build/javascript.d.ts +35 -0
- package/build/javascript.js +1 -0
- package/build/javascriptParser.d.ts +9 -0
- package/build/javascriptParser.js +34 -0
- package/build/javascriptUnparser.d.ts +3 -0
- package/build/javascriptUnparser.js +4 -0
- package/build/javascriptUnparser.test.d.ts +1 -0
- package/build/javascriptUnparser.test.js +24 -0
- package/build/jsonParser.js +2 -12
- package/build/lazyMessageError.d.ts +3 -0
- package/build/lookaheadParser.js +60 -3
- package/build/negativeLookaheadParser.js +70 -11
- package/build/nonEmptyArrayParser.js +72 -13
- package/build/objectParser.d.ts +12 -0
- package/build/objectParser.js +31 -0
- package/build/objectParser.test-d.d.ts +1 -0
- package/build/objectParser.test-d.js +112 -0
- package/build/objectParser.test.d.ts +1 -0
- package/build/objectParser.test.js +55 -0
- package/build/optionalParser.js +69 -10
- package/build/parser.d.ts +4 -0
- package/build/parser.js +3 -1
- package/build/parser.test.js +114 -1
- package/build/parserConsumedSequenceParser.js +66 -7
- package/build/parserContext.d.ts +6 -0
- package/build/parserContext.js +20 -11
- package/build/parserError.d.ts +119 -27
- package/build/parserError.js +16 -8
- package/build/regexpParser.d.ts +2 -0
- package/build/regexpParser.js +101 -0
- package/build/regexpParser.test.d.ts +1 -0
- package/build/regexpParser.test.js +114 -0
- package/build/regularExpression.d.ts +63 -0
- package/build/regularExpression.js +1 -0
- package/build/regularExpressionParser.d.ts +3 -0
- package/build/regularExpressionParser.js +600 -0
- package/build/regularExpressionParser.test.d.ts +1 -0
- package/build/regularExpressionParser.test.js +89 -0
- package/build/separatedArrayParser.js +73 -14
- package/build/separatedNonEmptyArrayParser.js +73 -14
- package/build/sliceBoundedParser.js +62 -5
- package/build/smaliParser.d.ts +7 -7
- package/build/smaliParser.js +185 -268
- package/build/smaliParser.test.js +58 -0
- package/build/stringEscapes.d.ts +5 -0
- package/build/stringEscapes.js +244 -0
- package/build/symbolicExpression.d.ts +29 -0
- package/build/symbolicExpression.js +1 -0
- package/build/symbolicExpressionParser.d.ts +4 -0
- package/build/symbolicExpressionParser.js +123 -0
- package/build/symbolicExpressionParser.test.d.ts +1 -0
- package/build/symbolicExpressionParser.test.js +289 -0
- package/build/terminatedArrayParser.js +113 -38
- package/build/terminatedArrayParser.test.js +4 -2
- package/build/tupleParser.d.ts +7 -15
- package/build/tupleParser.js +1 -0
- package/build/unionParser.d.ts +5 -3
- package/build/unionParser.js +7 -2
- package/build/unionParser.test-d.d.ts +1 -0
- package/build/unionParser.test-d.js +72 -0
- package/build/unionParser.test.js +10 -11
- package/build/zig.d.ts +280 -0
- package/build/zig.js +2 -0
- package/build/zigParser.d.ts +3 -0
- package/build/zigParser.js +1119 -0
- package/build/zigParser.test.d.ts +1 -0
- package/build/zigParser.test.js +1590 -0
- package/build/zigUnparser.d.ts +2 -0
- package/build/zigUnparser.js +460 -0
- package/build/zigUnparser.test.d.ts +1 -0
- package/build/zigUnparser.test.js +24 -0
- package/build/zipParser.js +19 -32
- package/build/zipUnparser.js +19 -7
- package/build/zipUnparser.test.js +1 -1
- package/node_modules-@types/s-expression/index.d.ts +5 -0
- package/package.json +25 -6
- package/src/androidPackageParser.ts +33 -60
- package/src/arbitraryDalvikBytecode.ts +39 -31
- package/src/arbitraryDalvikExecutable.ts +65 -20
- package/src/arbitraryJava.ts +804 -0
- package/src/arbitraryJavaScript.ts +410 -0
- package/src/arbitraryZig.ts +380 -0
- package/src/arrayParser.ts +1 -3
- package/src/backsmali.ts +35 -4
- package/src/bash.ts +127 -0
- package/src/bashParser.test.ts +590 -0
- package/src/bashParser.ts +498 -0
- package/src/dalvikBytecodeParser/addressConversion.ts +496 -0
- package/src/dalvikBytecodeParser/formatParsers.ts +19 -29
- package/src/dalvikBytecodeParser.test-d.ts +310 -0
- package/src/dalvikBytecodeParser.ts +194 -69
- package/src/dalvikBytecodeUnparser/formatUnparsers.ts +27 -26
- package/src/dalvikBytecodeUnparser.test.ts +7 -7
- package/src/dalvikBytecodeUnparser.ts +31 -30
- package/src/dalvikExecutable.test-d.ts +132 -0
- package/src/dalvikExecutable.ts +3 -3
- package/src/dalvikExecutableParser/typedNumbers.ts +11 -0
- package/src/dalvikExecutableParser.test.ts +37 -3
- package/src/dalvikExecutableParser.test.ts.md +163 -2
- package/src/dalvikExecutableParser.test.ts.snap +0 -0
- package/src/dalvikExecutableParser.ts +121 -139
- package/src/dalvikExecutableParserAgainstSmaliParser.test.ts +4 -0
- package/src/dalvikExecutableUnparser/poolScanners.ts +6 -6
- package/src/dalvikExecutableUnparser/sectionUnparsers.ts +38 -14
- package/src/dalvikExecutableUnparser.test.ts +3 -2
- package/src/dalvikExecutableUnparser.ts +4 -4
- package/src/disjunctionParser.test-d.ts +105 -0
- package/src/disjunctionParser.ts +18 -15
- package/src/elementSwitchParser.test-d.ts +74 -0
- package/src/elementSwitchParser.ts +51 -0
- package/src/exactSequenceParser.test-d.ts +43 -0
- package/src/exactSequenceParser.ts +13 -8
- package/src/fetchCid.ts +2 -76
- package/src/index.test.ts +22 -1
- package/src/index.ts +119 -2
- package/src/inputReader.ts +53 -0
- package/src/java.ts +708 -0
- package/src/javaKeyStoreParser.ts +18 -32
- package/src/javaParser.test.ts +1592 -0
- package/src/javaParser.ts +2640 -0
- package/src/javaScript.ts +36 -0
- package/src/javaScriptParser.ts +57 -0
- package/src/javaScriptUnparser.test.ts +37 -0
- package/src/javaScriptUnparser.ts +7 -0
- package/src/javaUnparser.test.ts +37 -0
- package/src/javaUnparser.ts +640 -0
- package/src/jsonParser.ts +6 -27
- package/src/lookaheadParser.ts +2 -6
- package/src/negativeLookaheadParser.ts +1 -3
- package/src/nonEmptyArrayParser.ts +1 -3
- package/src/objectParser.test-d.ts +152 -0
- package/src/objectParser.test.ts +71 -0
- package/src/objectParser.ts +69 -0
- package/src/optionalParser.ts +1 -3
- package/src/parser.test.ts +151 -4
- package/src/parser.ts +11 -1
- package/src/parserConsumedSequenceParser.ts +2 -4
- package/src/parserContext.ts +26 -11
- package/src/parserError.ts +17 -3
- package/src/regexpParser.test.ts +264 -0
- package/src/regexpParser.ts +126 -0
- package/src/regularExpression.ts +24 -0
- package/src/regularExpressionParser.test.ts +102 -0
- package/src/regularExpressionParser.ts +920 -0
- package/src/separatedArrayParser.ts +1 -3
- package/src/separatedNonEmptyArrayParser.ts +1 -3
- package/src/sliceBoundedParser.test.ts +2 -2
- package/src/sliceBoundedParser.ts +15 -19
- package/src/smaliParser.test.ts +64 -0
- package/src/smaliParser.test.ts.md +12 -12
- package/src/smaliParser.test.ts.snap +0 -0
- package/src/smaliParser.ts +246 -534
- package/src/stringEscapes.ts +253 -0
- package/src/symbolicExpression.ts +17 -0
- package/src/symbolicExpressionParser.test.ts +466 -0
- package/src/symbolicExpressionParser.ts +190 -0
- package/src/terminatedArrayParser.test.ts +9 -6
- package/src/terminatedArrayParser.ts +25 -29
- package/src/tupleParser.ts +21 -18
- package/src/unionParser.test-d.ts +105 -0
- package/src/unionParser.test.ts +18 -17
- package/src/unionParser.ts +28 -16
- package/src/zig.ts +411 -0
- package/src/zigParser.test.ts +1693 -0
- package/src/zigParser.ts +1745 -0
- package/src/zigUnparser.test.ts +37 -0
- package/src/zigUnparser.ts +615 -0
- package/src/zipParser.ts +20 -56
- package/src/zipUnparser.test.ts +1 -1
- package/src/zipUnparser.ts +22 -7
- package/tsconfig.json +2 -2
- package/build/exactElementSwitchParser.d.ts +0 -3
- package/src/exactElementSwitchParser.ts +0 -41
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type * as estree from 'estree';
|
|
2
|
+
import { type StripMeta } from './javaScriptParser.js';
|
|
3
|
+
|
|
4
|
+
export type JavaScriptProgram = StripMeta<estree.Program>;
|
|
5
|
+
export type JavaScriptStatement = StripMeta<estree.Statement>;
|
|
6
|
+
export type JavaScriptExpression = StripMeta<estree.Expression>;
|
|
7
|
+
export type JavaScriptIdentifier = StripMeta<estree.Identifier>;
|
|
8
|
+
export type JavaScriptLiteral = StripMeta<estree.Literal>;
|
|
9
|
+
export type JavaScriptBlockStatement = StripMeta<estree.BlockStatement>;
|
|
10
|
+
export type JavaScriptExpressionStatement = StripMeta<estree.ExpressionStatement>;
|
|
11
|
+
export type JavaScriptVariableDeclaration = StripMeta<estree.VariableDeclaration>;
|
|
12
|
+
export type JavaScriptVariableDeclarator = StripMeta<estree.VariableDeclarator>;
|
|
13
|
+
export type JavaScriptIfStatement = StripMeta<estree.IfStatement>;
|
|
14
|
+
export type JavaScriptWhileStatement = StripMeta<estree.WhileStatement>;
|
|
15
|
+
export type JavaScriptForStatement = StripMeta<estree.ForStatement>;
|
|
16
|
+
export type JavaScriptReturnStatement = StripMeta<estree.ReturnStatement>;
|
|
17
|
+
export type JavaScriptThrowStatement = StripMeta<estree.ThrowStatement>;
|
|
18
|
+
export type JavaScriptTryStatement = StripMeta<estree.TryStatement>;
|
|
19
|
+
export type JavaScriptCatchClause = StripMeta<estree.CatchClause>;
|
|
20
|
+
export type JavaScriptEmptyStatement = StripMeta<estree.EmptyStatement>;
|
|
21
|
+
export type JavaScriptFunctionDeclaration = StripMeta<estree.FunctionDeclaration>;
|
|
22
|
+
export type JavaScriptFunctionExpression = StripMeta<estree.FunctionExpression>;
|
|
23
|
+
export type JavaScriptArrowFunctionExpression = StripMeta<estree.ArrowFunctionExpression>;
|
|
24
|
+
export type JavaScriptBinaryExpression = StripMeta<estree.BinaryExpression>;
|
|
25
|
+
export type JavaScriptLogicalExpression = StripMeta<estree.LogicalExpression>;
|
|
26
|
+
export type JavaScriptUnaryExpression = StripMeta<estree.UnaryExpression>;
|
|
27
|
+
export type JavaScriptUpdateExpression = StripMeta<estree.UpdateExpression>;
|
|
28
|
+
export type JavaScriptAssignmentExpression = StripMeta<estree.AssignmentExpression>;
|
|
29
|
+
export type JavaScriptConditionalExpression = StripMeta<estree.ConditionalExpression>;
|
|
30
|
+
export type JavaScriptCallExpression = StripMeta<estree.SimpleCallExpression>;
|
|
31
|
+
export type JavaScriptNewExpression = StripMeta<estree.NewExpression>;
|
|
32
|
+
export type JavaScriptMemberExpression = StripMeta<estree.MemberExpression>;
|
|
33
|
+
export type JavaScriptArrayExpression = StripMeta<estree.ArrayExpression>;
|
|
34
|
+
export type JavaScriptObjectExpression = StripMeta<estree.ObjectExpression>;
|
|
35
|
+
export type JavaScriptProperty = StripMeta<estree.Property>;
|
|
36
|
+
export type JavaScriptThisExpression = StripMeta<estree.ThisExpression>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type * as estree from 'estree';
|
|
2
|
+
import * as acorn from 'acorn';
|
|
3
|
+
import { type Parser } from './parser.js';
|
|
4
|
+
import { promiseCompose } from './promiseCompose.js';
|
|
5
|
+
import { createRegExpParser } from './regexpParser.js';
|
|
6
|
+
|
|
7
|
+
type PositionalFields = 'loc' | 'range' | 'start' | 'end' | 'leadingComments' | 'trailingComments' | 'comments' | 'innerComments';
|
|
8
|
+
|
|
9
|
+
export type StripMeta<T> =
|
|
10
|
+
T extends Array<infer U> ? Array<StripMeta<U>> :
|
|
11
|
+
T extends object ? { [K in Exclude<keyof T, PositionalFields>]: StripMeta<T[K]> } :
|
|
12
|
+
T;
|
|
13
|
+
|
|
14
|
+
export type JavaScriptProgram = StripMeta<estree.Program>;
|
|
15
|
+
|
|
16
|
+
function stripMeta(node: unknown): unknown {
|
|
17
|
+
if (node === null || node === undefined) {
|
|
18
|
+
return node;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (typeof node !== 'object') {
|
|
22
|
+
return node;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (Array.isArray(node)) {
|
|
26
|
+
return node.map(element => stripMeta(element));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const result: Record<string, unknown> = {};
|
|
30
|
+
for (const [key, value] of Object.entries(node)) {
|
|
31
|
+
if (
|
|
32
|
+
key === 'loc'
|
|
33
|
+
|| key === 'range'
|
|
34
|
+
|| key === 'start'
|
|
35
|
+
|| key === 'end'
|
|
36
|
+
|| key === 'raw'
|
|
37
|
+
|| key === 'leadingComments'
|
|
38
|
+
|| key === 'trailingComments'
|
|
39
|
+
|| key === 'comments'
|
|
40
|
+
|| key === 'innerComments'
|
|
41
|
+
) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
result[key] = stripMeta(value);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const javaScriptProgramParser: Parser<JavaScriptProgram, string> = promiseCompose(
|
|
52
|
+
createRegExpParser(/[\s\S]*/),
|
|
53
|
+
match => {
|
|
54
|
+
const ast = acorn.parse(match[0], { ecmaVersion: 'latest', sourceType: 'script' });
|
|
55
|
+
return stripMeta(ast) as JavaScriptProgram;
|
|
56
|
+
},
|
|
57
|
+
);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { testProp } from '@fast-check/ava';
|
|
2
|
+
import { arbitraryJavaScriptProgram } from './arbitraryJavaScript.js';
|
|
3
|
+
import { javaScriptProgramUnparser } from './javaScriptUnparser.js';
|
|
4
|
+
import { javaScriptProgramParser } from './javaScriptParser.js';
|
|
5
|
+
import { runParser } from './parser.js';
|
|
6
|
+
import { runUnparser } from './unparser.js';
|
|
7
|
+
import { stringParserInputCompanion } from './parserInputCompanion.js';
|
|
8
|
+
import { stringUnparserOutputCompanion } from './unparserOutputCompanion.js';
|
|
9
|
+
|
|
10
|
+
const seed = process.env.SEED ? Number(process.env.SEED) : undefined;
|
|
11
|
+
|
|
12
|
+
async function collectString(asyncIterable: AsyncIterable<string>): Promise<string> {
|
|
13
|
+
let result = '';
|
|
14
|
+
for await (const chunk of asyncIterable) {
|
|
15
|
+
result += chunk;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
testProp(
|
|
22
|
+
'javaScript roundtrip',
|
|
23
|
+
[arbitraryJavaScriptProgram],
|
|
24
|
+
async (t, program) => {
|
|
25
|
+
const source = await collectString(runUnparser(
|
|
26
|
+
javaScriptProgramUnparser, program, stringUnparserOutputCompanion));
|
|
27
|
+
|
|
28
|
+
const reparsed = await runParser(
|
|
29
|
+
javaScriptProgramParser, source, stringParserInputCompanion);
|
|
30
|
+
|
|
31
|
+
t.deepEqual(reparsed, program);
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
verbose: true,
|
|
35
|
+
seed,
|
|
36
|
+
},
|
|
37
|
+
);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { generate } from 'astring';
|
|
2
|
+
import { type Unparser } from './unparser.js';
|
|
3
|
+
import { type JavaScriptProgram } from './javaScriptParser.js';
|
|
4
|
+
|
|
5
|
+
export const javaScriptProgramUnparser: Unparser<JavaScriptProgram, string> = async function * (program) {
|
|
6
|
+
yield generate(program);
|
|
7
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { testProp } from '@fast-check/ava';
|
|
2
|
+
import { arbitraryJavaCompilationUnit } from './arbitraryJava.js';
|
|
3
|
+
import { javaCompilationUnitUnparser } from './javaUnparser.js';
|
|
4
|
+
import { javaCompilationUnitParser } from './javaParser.js';
|
|
5
|
+
import { runParser } from './parser.js';
|
|
6
|
+
import { runUnparser } from './unparser.js';
|
|
7
|
+
import { stringParserInputCompanion } from './parserInputCompanion.js';
|
|
8
|
+
import { stringUnparserOutputCompanion } from './unparserOutputCompanion.js';
|
|
9
|
+
|
|
10
|
+
const seed = process.env.SEED ? Number(process.env.SEED) : undefined;
|
|
11
|
+
|
|
12
|
+
async function collectString(asyncIterable: AsyncIterable<string>): Promise<string> {
|
|
13
|
+
let result = '';
|
|
14
|
+
for await (const chunk of asyncIterable) {
|
|
15
|
+
result += chunk;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
testProp(
|
|
22
|
+
'javaUnparser roundtrip',
|
|
23
|
+
[arbitraryJavaCompilationUnit],
|
|
24
|
+
async (t, compilationUnit) => {
|
|
25
|
+
const source = await collectString(runUnparser(
|
|
26
|
+
javaCompilationUnitUnparser, compilationUnit, stringUnparserOutputCompanion));
|
|
27
|
+
|
|
28
|
+
const reparsed = await runParser(
|
|
29
|
+
javaCompilationUnitParser, source, stringParserInputCompanion);
|
|
30
|
+
|
|
31
|
+
t.deepEqual(reparsed, compilationUnit);
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
verbose: true,
|
|
35
|
+
seed,
|
|
36
|
+
},
|
|
37
|
+
);
|