@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
|
@@ -27,17 +27,16 @@ test('union of union of union', async (t) => {
|
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
test('sync and async child parsers', async (t) => {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
parserContext
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
]));
|
|
30
|
+
const evenParser = async (parserContext) => {
|
|
31
|
+
parserContext.invariant(parserContext.position % 2 === 0, 'Expected an even position.');
|
|
32
|
+
return parserContext.read(0);
|
|
33
|
+
};
|
|
34
|
+
const oddParser = parserContext => {
|
|
35
|
+
parserContext.invariant(parserContext.position % 2 === 1, 'Expected an odd position.');
|
|
36
|
+
parserContext.skip(1);
|
|
37
|
+
return String.fromCodePoint('A'.codePointAt(0) + parserContext.position - 1);
|
|
38
|
+
};
|
|
39
|
+
const parser = createArrayParser(createUnionParser([evenParser, oddParser]));
|
|
41
40
|
const result = await runParser(parser, 'a?c?', stringParserInputCompanion, {
|
|
42
41
|
errorJoinMode: 'all',
|
|
43
42
|
});
|
package/build/zig.d.ts
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
export type ZigIdentifier = {
|
|
2
|
+
type: 'Identifier';
|
|
3
|
+
name: string;
|
|
4
|
+
};
|
|
5
|
+
export type ZigIntegerLiteral = {
|
|
6
|
+
type: 'IntegerLiteral';
|
|
7
|
+
value: string;
|
|
8
|
+
};
|
|
9
|
+
export type ZigFloatLiteral = {
|
|
10
|
+
type: 'FloatLiteral';
|
|
11
|
+
value: string;
|
|
12
|
+
};
|
|
13
|
+
export type ZigStringLiteral = {
|
|
14
|
+
type: 'StringLiteral';
|
|
15
|
+
value: string;
|
|
16
|
+
};
|
|
17
|
+
export type ZigMultilineStringLiteral = {
|
|
18
|
+
type: 'MultilineStringLiteral';
|
|
19
|
+
value: string;
|
|
20
|
+
};
|
|
21
|
+
export type ZigCharLiteral = {
|
|
22
|
+
type: 'CharLiteral';
|
|
23
|
+
value: string;
|
|
24
|
+
};
|
|
25
|
+
export type ZigEnumLiteral = {
|
|
26
|
+
type: 'EnumLiteral';
|
|
27
|
+
name: string;
|
|
28
|
+
};
|
|
29
|
+
export type ZigBoolLiteral = {
|
|
30
|
+
type: 'BoolLiteral';
|
|
31
|
+
value: boolean;
|
|
32
|
+
};
|
|
33
|
+
export type ZigNullLiteral = {
|
|
34
|
+
type: 'NullLiteral';
|
|
35
|
+
};
|
|
36
|
+
export type ZigUndefinedLiteral = {
|
|
37
|
+
type: 'UndefinedLiteral';
|
|
38
|
+
};
|
|
39
|
+
export type ZigLiteral = ZigIntegerLiteral | ZigFloatLiteral | ZigStringLiteral | ZigMultilineStringLiteral | ZigCharLiteral | ZigEnumLiteral | ZigBoolLiteral | ZigNullLiteral | ZigUndefinedLiteral;
|
|
40
|
+
export type ZigIdentifierType = {
|
|
41
|
+
type: 'IdentifierType';
|
|
42
|
+
name: string;
|
|
43
|
+
};
|
|
44
|
+
export type ZigPointerType = {
|
|
45
|
+
type: 'PointerType';
|
|
46
|
+
size: 'one' | 'many' | 'slice';
|
|
47
|
+
isConst: boolean;
|
|
48
|
+
sentinel?: ZigExpression;
|
|
49
|
+
child: ZigTypeExpression;
|
|
50
|
+
};
|
|
51
|
+
export type ZigArrayType = {
|
|
52
|
+
type: 'ArrayType';
|
|
53
|
+
length: ZigExpression;
|
|
54
|
+
sentinel?: ZigExpression;
|
|
55
|
+
child: ZigTypeExpression;
|
|
56
|
+
};
|
|
57
|
+
export type ZigOptionalType = {
|
|
58
|
+
type: 'OptionalType';
|
|
59
|
+
child: ZigTypeExpression;
|
|
60
|
+
};
|
|
61
|
+
export type ZigErrorUnionType = {
|
|
62
|
+
type: 'ErrorUnionType';
|
|
63
|
+
error: ZigTypeExpression;
|
|
64
|
+
payload: ZigTypeExpression;
|
|
65
|
+
};
|
|
66
|
+
export type ZigDotType = {
|
|
67
|
+
type: 'DotType';
|
|
68
|
+
operand: ZigTypeExpression;
|
|
69
|
+
member: string;
|
|
70
|
+
};
|
|
71
|
+
export type ZigBuiltinType = {
|
|
72
|
+
type: 'BuiltinType';
|
|
73
|
+
name: string;
|
|
74
|
+
};
|
|
75
|
+
export type ZigFnProtoType = {
|
|
76
|
+
type: 'FnProtoType';
|
|
77
|
+
params: ZigFnParam[];
|
|
78
|
+
returnType: ZigTypeExpression;
|
|
79
|
+
};
|
|
80
|
+
export type ZigTypeExpression = ZigIdentifierType | ZigPointerType | ZigArrayType | ZigOptionalType | ZigErrorUnionType | ZigDotType | ZigBuiltinType | ZigFnProtoType | ZigExpression;
|
|
81
|
+
export type ZigBinaryOp = '+' | '-' | '*' | '/' | '%' | '<<' | '>>' | '&' | '|' | '^' | '==' | '!=' | '<' | '>' | '<=' | '>=' | 'and' | 'or' | '++' | '**' | 'orelse' | 'catch';
|
|
82
|
+
export type ZigBinaryExpr = {
|
|
83
|
+
type: 'BinaryExpr';
|
|
84
|
+
operator: ZigBinaryOp;
|
|
85
|
+
left: ZigExpression;
|
|
86
|
+
right: ZigExpression;
|
|
87
|
+
};
|
|
88
|
+
export type ZigUnaryOp = '-' | '~' | '!' | '&';
|
|
89
|
+
export type ZigUnaryExpr = {
|
|
90
|
+
type: 'UnaryExpr';
|
|
91
|
+
operator: string;
|
|
92
|
+
operand: ZigExpression;
|
|
93
|
+
};
|
|
94
|
+
export type ZigFieldAccessExpr = {
|
|
95
|
+
type: 'FieldAccessExpr';
|
|
96
|
+
operand: ZigExpression;
|
|
97
|
+
member: string;
|
|
98
|
+
};
|
|
99
|
+
export type ZigIndexExpr = {
|
|
100
|
+
type: 'IndexExpr';
|
|
101
|
+
operand: ZigExpression;
|
|
102
|
+
index: ZigExpression;
|
|
103
|
+
};
|
|
104
|
+
export type ZigSliceExpr = {
|
|
105
|
+
type: 'SliceExpr';
|
|
106
|
+
operand: ZigExpression;
|
|
107
|
+
start: ZigExpression;
|
|
108
|
+
end?: ZigExpression;
|
|
109
|
+
sentinel?: ZigExpression;
|
|
110
|
+
};
|
|
111
|
+
export type ZigCallExpr = {
|
|
112
|
+
type: 'CallExpr';
|
|
113
|
+
callee: ZigExpression;
|
|
114
|
+
args: ZigExpression[];
|
|
115
|
+
};
|
|
116
|
+
export type ZigBuiltinCallExpr = {
|
|
117
|
+
type: 'BuiltinCallExpr';
|
|
118
|
+
name: string;
|
|
119
|
+
args: ZigExpression[];
|
|
120
|
+
};
|
|
121
|
+
export type ZigIfExpr = {
|
|
122
|
+
type: 'IfExpr';
|
|
123
|
+
condition: ZigExpression;
|
|
124
|
+
capture?: string;
|
|
125
|
+
body: ZigStatement;
|
|
126
|
+
elseCapture?: string;
|
|
127
|
+
elseBody?: ZigStatement;
|
|
128
|
+
};
|
|
129
|
+
export type ZigSwitchProng = {
|
|
130
|
+
type: 'SwitchProng';
|
|
131
|
+
cases: ZigExpression[];
|
|
132
|
+
isElse: boolean;
|
|
133
|
+
capture?: string;
|
|
134
|
+
body: ZigExpression;
|
|
135
|
+
};
|
|
136
|
+
export type ZigSwitchExpr = {
|
|
137
|
+
type: 'SwitchExpr';
|
|
138
|
+
operand: ZigExpression;
|
|
139
|
+
prongs: ZigSwitchProng[];
|
|
140
|
+
};
|
|
141
|
+
export type ZigStructInitField = {
|
|
142
|
+
type: 'StructInitField';
|
|
143
|
+
name: string;
|
|
144
|
+
value: ZigExpression;
|
|
145
|
+
};
|
|
146
|
+
export type ZigStructInitExpr = {
|
|
147
|
+
type: 'StructInitExpr';
|
|
148
|
+
operand?: ZigExpression;
|
|
149
|
+
fields: ZigStructInitField[];
|
|
150
|
+
};
|
|
151
|
+
export type ZigArrayInitExpr = {
|
|
152
|
+
type: 'ArrayInitExpr';
|
|
153
|
+
operand?: ZigExpression;
|
|
154
|
+
elements: ZigExpression[];
|
|
155
|
+
};
|
|
156
|
+
export type ZigTryExpr = {
|
|
157
|
+
type: 'TryExpr';
|
|
158
|
+
operand: ZigExpression;
|
|
159
|
+
};
|
|
160
|
+
export type ZigComptimeExpr = {
|
|
161
|
+
type: 'ComptimeExpr';
|
|
162
|
+
operand: ZigExpression;
|
|
163
|
+
};
|
|
164
|
+
export type ZigBlockExpr = {
|
|
165
|
+
type: 'BlockExpr';
|
|
166
|
+
label?: string;
|
|
167
|
+
statements: ZigStatement[];
|
|
168
|
+
};
|
|
169
|
+
export type ZigGroupedExpr = {
|
|
170
|
+
type: 'GroupedExpr';
|
|
171
|
+
inner: ZigExpression;
|
|
172
|
+
};
|
|
173
|
+
export type ZigErrorSetExpr = {
|
|
174
|
+
type: 'ErrorSetExpr';
|
|
175
|
+
names: string[];
|
|
176
|
+
};
|
|
177
|
+
export type ZigStructExpr = {
|
|
178
|
+
type: 'StructExpr';
|
|
179
|
+
members: ZigContainerMember[];
|
|
180
|
+
};
|
|
181
|
+
export type ZigExpression = ZigIdentifier | ZigLiteral | ZigBinaryExpr | ZigUnaryExpr | ZigFieldAccessExpr | ZigIndexExpr | ZigSliceExpr | ZigCallExpr | ZigBuiltinCallExpr | ZigIfExpr | ZigSwitchExpr | ZigStructInitExpr | ZigArrayInitExpr | ZigTryExpr | ZigComptimeExpr | ZigBlockExpr | ZigGroupedExpr | ZigErrorSetExpr | ZigErrorUnionType | ZigPointerType | ZigOptionalType | ZigFnProtoType | ZigStructExpr | ZigArrayType;
|
|
182
|
+
export type ZigAssignOp = '=' | '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | '>>=';
|
|
183
|
+
export type ZigAssignStmt = {
|
|
184
|
+
type: 'AssignStmt';
|
|
185
|
+
target: ZigExpression;
|
|
186
|
+
operator: ZigAssignOp;
|
|
187
|
+
value: ZigExpression;
|
|
188
|
+
};
|
|
189
|
+
export type ZigWhileStmt = {
|
|
190
|
+
type: 'WhileStmt';
|
|
191
|
+
condition: ZigExpression;
|
|
192
|
+
capture?: string;
|
|
193
|
+
continuation?: ZigExpression;
|
|
194
|
+
body: ZigStatement;
|
|
195
|
+
elseBody?: ZigStatement;
|
|
196
|
+
label?: string;
|
|
197
|
+
isInline: boolean;
|
|
198
|
+
};
|
|
199
|
+
export type ZigForStmt = {
|
|
200
|
+
type: 'ForStmt';
|
|
201
|
+
inputs: ZigExpression[];
|
|
202
|
+
captures: string[];
|
|
203
|
+
body: ZigStatement;
|
|
204
|
+
elseBody?: ZigStatement;
|
|
205
|
+
label?: string;
|
|
206
|
+
isInline: boolean;
|
|
207
|
+
};
|
|
208
|
+
export type ZigReturnStmt = {
|
|
209
|
+
type: 'ReturnStmt';
|
|
210
|
+
value?: ZigExpression;
|
|
211
|
+
};
|
|
212
|
+
export type ZigBreakStmt = {
|
|
213
|
+
type: 'BreakStmt';
|
|
214
|
+
label?: string;
|
|
215
|
+
value?: ZigExpression;
|
|
216
|
+
};
|
|
217
|
+
export type ZigContinueStmt = {
|
|
218
|
+
type: 'ContinueStmt';
|
|
219
|
+
label?: string;
|
|
220
|
+
};
|
|
221
|
+
export type ZigDeferStmt = {
|
|
222
|
+
type: 'DeferStmt';
|
|
223
|
+
isErrdefer: boolean;
|
|
224
|
+
capture?: string;
|
|
225
|
+
body: ZigStatement;
|
|
226
|
+
};
|
|
227
|
+
export type ZigStatement = ZigAssignStmt | ZigVarDecl | ZigWhileStmt | ZigForStmt | ZigReturnStmt | ZigBreakStmt | ZigContinueStmt | ZigDeferStmt | ZigExpression;
|
|
228
|
+
export type ZigFnParam = {
|
|
229
|
+
type: 'FnParam';
|
|
230
|
+
name?: string;
|
|
231
|
+
isComptime: boolean;
|
|
232
|
+
isNoalias: boolean;
|
|
233
|
+
typeExpr?: ZigTypeExpression;
|
|
234
|
+
};
|
|
235
|
+
export type ZigFnDecl = {
|
|
236
|
+
type: 'FnDecl';
|
|
237
|
+
isPub: boolean;
|
|
238
|
+
isExtern: boolean;
|
|
239
|
+
isExport: boolean;
|
|
240
|
+
isInline: boolean;
|
|
241
|
+
isComptime: boolean;
|
|
242
|
+
name: string;
|
|
243
|
+
params: ZigFnParam[];
|
|
244
|
+
returnType: ZigTypeExpression;
|
|
245
|
+
body?: ZigBlockExpr;
|
|
246
|
+
};
|
|
247
|
+
export type ZigVarDecl = {
|
|
248
|
+
type: 'VarDecl';
|
|
249
|
+
isConst: boolean;
|
|
250
|
+
isPub: boolean;
|
|
251
|
+
isExtern: boolean;
|
|
252
|
+
isComptime: boolean;
|
|
253
|
+
isThreadlocal: boolean;
|
|
254
|
+
name: string;
|
|
255
|
+
typeExpr?: ZigTypeExpression;
|
|
256
|
+
alignExpr?: ZigExpression;
|
|
257
|
+
initExpr?: ZigExpression;
|
|
258
|
+
};
|
|
259
|
+
export type ZigTestDecl = {
|
|
260
|
+
type: 'TestDecl';
|
|
261
|
+
name?: string;
|
|
262
|
+
body: ZigBlockExpr;
|
|
263
|
+
};
|
|
264
|
+
export type ZigUsingnamespaceDecl = {
|
|
265
|
+
type: 'UsingnamespaceDecl';
|
|
266
|
+
isPub: boolean;
|
|
267
|
+
expression: ZigExpression;
|
|
268
|
+
};
|
|
269
|
+
export type ZigContainerField = {
|
|
270
|
+
type: 'ContainerField';
|
|
271
|
+
name: string;
|
|
272
|
+
typeExpr?: ZigTypeExpression;
|
|
273
|
+
alignExpr?: ZigExpression;
|
|
274
|
+
defaultValue?: ZigExpression;
|
|
275
|
+
};
|
|
276
|
+
export type ZigContainerMember = ZigFnDecl | ZigVarDecl | ZigTestDecl | ZigUsingnamespaceDecl | ZigContainerField;
|
|
277
|
+
export type ZigRoot = {
|
|
278
|
+
type: 'Root';
|
|
279
|
+
members: ZigContainerMember[];
|
|
280
|
+
};
|
package/build/zig.js
ADDED