Add missing enum type generation

This commit is contained in:
Arthur Pacaud
2023-07-15 02:04:40 +02:00
parent 3a015f6696
commit 66ff2d5b55
2 changed files with 51 additions and 2 deletions

View File

@@ -126,9 +126,26 @@ class Parser {
}
}
const enums = [];
for (const [_, enumName, enumCode] of bindingsFile.matchAll(
/enum\s+([a-zA-Z_]+)\s+{\r?\n?([^}]*)\r?\n}/gm
)) {
const members = [];
let i = 0;
for (const enumMemberString of enumCode.split('\n')) {
const [_, memberName] = enumMemberString.match(/"[a-zA-Z]*::([a-zA-Z]*)"/);
members.push(` ${memberName} = ${i++},`);
}
enums.push(
`enum ${enumName} {
${members.join('\n')}
}`
);
}
const interfaces = [];
for (const [a, interfaceName, interfaceCode] of bindingsFile.matchAll(
/interface ([a-zA-Z]+) {\r?\n?([^}]*)\r?\n}/gm
for (const [_, interfaceName, interfaceCode] of bindingsFile.matchAll(
/interface\s+([a-zA-Z]+)\s+{\r?\n?([^}]*)\r?\n}/gm
)) {
const methods = [];
@@ -223,6 +240,8 @@ class EmscriptenObject {
destroy(): void;
}
${enums.join('\n\n')}
${interfaces.join('\n\n')}
export as namespace gd;

View File

@@ -18,6 +18,36 @@ class EmscriptenObject {
destroy(): void;
}
enum Variable_Type {
String = 0,
Number = 1,
Boolean = 2,
Structure = 3,
Array = 4,
}
enum ExpressionCompletionDescription_CompletionKind {
Object = 0,
Behavior = 1,
Expression = 2,
Variable = 3,
Text = 4,
}
enum EventsFunction_FunctionType {
Action = 0,
Condition = 1,
Expression = 2,
ExpressionAndCondition = 3,
ActionWithOperator = 4,
}
enum ParticleEmitterObject_RendererType {
Point = 0,
Line = 1,
Quad = 2,
}
export class VectorString extends EmscriptenObject {
constructor(): void;
push_back(str: string): void;