aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/xtext
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2023-08-23 03:36:25 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2023-08-23 03:36:25 +0200
commit0e54d399424374d497d08a8631c4761dece57ceb (patch)
treebd0873080b4bc3b81984852def5e435e51292d0d /subprojects/frontend/src/xtext
parentfix: predicate value translation (diff)
downloadrefinery-0e54d399424374d497d08a8631c4761dece57ceb.tar.gz
refinery-0e54d399424374d497d08a8631c4761dece57ceb.tar.zst
refinery-0e54d399424374d497d08a8631c4761dece57ceb.zip
feat: dot visualization
Diffstat (limited to 'subprojects/frontend/src/xtext')
-rw-r--r--subprojects/frontend/src/xtext/SemanticsService.ts12
-rw-r--r--subprojects/frontend/src/xtext/xtextServiceResults.ts17
2 files changed, 22 insertions, 7 deletions
diff --git a/subprojects/frontend/src/xtext/SemanticsService.ts b/subprojects/frontend/src/xtext/SemanticsService.ts
index 50ec371a..d68b87a9 100644
--- a/subprojects/frontend/src/xtext/SemanticsService.ts
+++ b/subprojects/frontend/src/xtext/SemanticsService.ts
@@ -17,11 +17,15 @@ export default class SemanticsService {
17 17
18 onPush(push: unknown): void { 18 onPush(push: unknown): void {
19 const result = SemanticsResult.parse(push); 19 const result = SemanticsResult.parse(push);
20 this.validationService.setSemanticsIssues(result.issues ?? []); 20 if ('issues' in result) {
21 if (result.error !== undefined) { 21 this.validationService.setSemanticsIssues(result.issues);
22 this.store.setSemanticsError(result.error);
23 } else { 22 } else {
24 this.store.setSemantics(push); 23 this.validationService.setSemanticsIssues([]);
24 if ('error' in result) {
25 this.store.setSemanticsError(result.error);
26 } else {
27 this.store.setSemantics(result);
28 }
25 } 29 }
26 this.store.analysisCompleted(); 30 this.store.analysisCompleted();
27 } 31 }
diff --git a/subprojects/frontend/src/xtext/xtextServiceResults.ts b/subprojects/frontend/src/xtext/xtextServiceResults.ts
index cae95771..12f87b26 100644
--- a/subprojects/frontend/src/xtext/xtextServiceResults.ts
+++ b/subprojects/frontend/src/xtext/xtextServiceResults.ts
@@ -126,9 +126,20 @@ export const FormattingResult = DocumentStateResult.extend({
126 126
127export type FormattingResult = z.infer<typeof FormattingResult>; 127export type FormattingResult = z.infer<typeof FormattingResult>;
128 128
129export const SemanticsResult = z.object({ 129export const SemanticsSuccessResult = z.object({
130 error: z.string().optional(), 130 nodes: z.string().nullable().array(),
131 issues: Issue.array().optional(), 131 partialInterpretation: z.record(
132 z.string(),
133 z.union([z.number(), z.string()]).array().array(),
134 ),
132}); 135});
133 136
137export type SemanticsSuccessResult = z.infer<typeof SemanticsSuccessResult>;
138
139export const SemanticsResult = z.union([
140 z.object({ error: z.string() }),
141 z.object({ issues: Issue.array() }),
142 SemanticsSuccessResult,
143]);
144
134export type SemanticsResult = z.infer<typeof SemanticsResult>; 145export type SemanticsResult = z.infer<typeof SemanticsResult>;