Generate typed QX bindings and add source editing tools

This commit is contained in:
Timothy J. Aveni
2026-09-08 14:27:24 -07:00
parent ce793cc54f
commit 4e17693d82
30 changed files with 2806 additions and 1939 deletions
+13 -7
View File
@@ -724,7 +724,8 @@ const lowerDependencyPort = (
? {
id,
displayName: name,
requirement: { kind: "constructor", atomId },
requirement: { kind: "constructor", atomId,
...(context.valueType() ? { inputType: lowerValueType(state, context.valueType()) } : {}) },
}
: undefined;
};
@@ -1678,22 +1679,22 @@ const lowerWorkspace = (
};
};
const parseDocument = (
export const parseDocument = (
source: string,
fileName: string,
): { tree: DocumentContext; diagnostics: CapabilitySourceDiagnostic[] } => {
): { tree: DocumentContext; tokens: CommonTokenStream; diagnostics: CapabilitySourceDiagnostic[] } => {
const diagnostics: CapabilitySourceDiagnostic[] = [];
const listener = new SyntaxErrorListener(fileName, diagnostics);
const lexer = new QuixosCapabilityLexer(CharStream.fromString(source));
lexer.removeErrorListeners();
lexer.addErrorListener(listener);
const parser = new QuixosCapabilityParser(
new CommonTokenStream(lexer),
);
const tokens = new CommonTokenStream(lexer);
const parser = new QuixosCapabilityParser(tokens);
parser.removeErrorListeners();
parser.addErrorListener(listener);
const tree = parser.document();
return { tree, diagnostics };
tokens.fill();
return { tree, tokens, diagnostics };
};
const newLoweringState = (
@@ -1945,6 +1946,11 @@ export const compileCapabilitySource = (
}
const state = newLoweringState(fileName, diagnostics);
for (const item of workspaceContext.workspaceItem()) {
if (item.sourceImportDecl()) loweringIssue(state, item, "unresolved-source-import",
"Local imports require the workspace repository compiler");
}
if (diagnostics.length) return { ok: false, diagnostics };
const lowered = lowerWorkspace(state, workspaceContext, environment);
if (diagnostics.length > 0) {
return { ok: false, diagnostics };