kumi 0.0.26 → 0.0.28
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/CLAUDE.md +4 -0
- data/README.md +36 -12
- data/data/functions/core/arithmetic.yaml +28 -8
- data/data/functions/core/boolean.yaml +8 -3
- data/data/functions/core/comparison.yaml +12 -4
- data/data/functions/core/conversion.yaml +32 -0
- data/data/kernels/javascript/core/arithmetic.yaml +6 -2
- data/data/kernels/javascript/core/coercion.yaml +20 -0
- data/data/kernels/ruby/core/arithmetic.yaml +7 -2
- data/data/kernels/ruby/core/coercion.yaml +20 -0
- data/docs/ARCHITECTURE.md +277 -0
- data/docs/DEVELOPMENT.md +62 -0
- data/docs/FUNCTIONS.md +955 -0
- data/docs/SYNTAX.md +8 -0
- data/docs/VSCODE_EXTENSION.md +114 -0
- data/docs/functions-reference.json +1821 -0
- data/golden/array_element/expected/schema_ruby.rb +1 -1
- data/golden/array_index/expected/lir_00_unoptimized.txt +2 -2
- data/golden/array_index/expected/lir_01_hoist_scalar_references.txt +2 -2
- data/golden/array_index/expected/lir_02_inlined.txt +2 -2
- data/golden/array_index/expected/lir_03_cse.txt +2 -2
- data/golden/array_index/expected/lir_04_1_loop_fusion.txt +2 -2
- data/golden/array_index/expected/lir_04_loop_invcm.txt +2 -2
- data/golden/array_index/expected/lir_06_const_prop.txt +2 -2
- data/golden/array_index/expected/schema_ruby.rb +1 -1
- data/golden/array_index/expected/snast.txt +2 -2
- data/golden/array_operations/expected/lir_00_unoptimized.txt +2 -2
- data/golden/array_operations/expected/lir_01_hoist_scalar_references.txt +2 -2
- data/golden/array_operations/expected/lir_02_inlined.txt +2 -2
- data/golden/array_operations/expected/lir_03_cse.txt +2 -2
- data/golden/array_operations/expected/lir_04_1_loop_fusion.txt +2 -2
- data/golden/array_operations/expected/lir_04_loop_invcm.txt +2 -2
- data/golden/array_operations/expected/lir_06_const_prop.txt +2 -2
- data/golden/array_operations/expected/schema_ruby.rb +1 -1
- data/golden/array_operations/expected/snast.txt +2 -2
- data/golden/cascade_logic/expected/schema_ruby.rb +1 -1
- data/golden/chained_fusion/expected/schema_ruby.rb +1 -1
- data/golden/decimal_explicit/expected/ast.txt +38 -0
- data/golden/decimal_explicit/expected/input_plan.txt +3 -0
- data/golden/decimal_explicit/expected/lir_00_unoptimized.txt +30 -0
- data/golden/decimal_explicit/expected/lir_01_hoist_scalar_references.txt +30 -0
- data/golden/decimal_explicit/expected/lir_02_inlined.txt +44 -0
- data/golden/decimal_explicit/expected/lir_03_cse.txt +40 -0
- data/golden/decimal_explicit/expected/lir_04_1_loop_fusion.txt +40 -0
- data/golden/decimal_explicit/expected/lir_04_loop_invcm.txt +40 -0
- data/golden/decimal_explicit/expected/lir_06_const_prop.txt +40 -0
- data/golden/decimal_explicit/expected/nast.txt +30 -0
- data/golden/decimal_explicit/expected/schema_javascript.mjs +31 -0
- data/golden/decimal_explicit/expected/schema_ruby.rb +57 -0
- data/golden/decimal_explicit/expected/snast.txt +30 -0
- data/golden/decimal_explicit/expected.json +1 -0
- data/golden/decimal_explicit/input.json +5 -0
- data/golden/decimal_explicit/schema.kumi +14 -0
- data/golden/element_arrays/expected/schema_ruby.rb +1 -1
- data/golden/empty_and_null_inputs/expected/schema_ruby.rb +1 -1
- data/golden/function_overload/expected/schema_ruby.rb +1 -1
- data/golden/game_of_life/expected/schema_ruby.rb +1 -1
- data/golden/hash_keys/expected/schema_ruby.rb +1 -1
- data/golden/hash_value/expected/schema_ruby.rb +1 -1
- data/golden/hierarchical_complex/expected/lir_00_unoptimized.txt +3 -3
- data/golden/hierarchical_complex/expected/lir_01_hoist_scalar_references.txt +3 -3
- data/golden/hierarchical_complex/expected/lir_02_inlined.txt +3 -3
- data/golden/hierarchical_complex/expected/lir_03_cse.txt +3 -3
- data/golden/hierarchical_complex/expected/lir_04_1_loop_fusion.txt +3 -3
- data/golden/hierarchical_complex/expected/lir_04_loop_invcm.txt +3 -3
- data/golden/hierarchical_complex/expected/lir_06_const_prop.txt +3 -3
- data/golden/hierarchical_complex/expected/schema_ruby.rb +1 -1
- data/golden/hierarchical_complex/expected/snast.txt +3 -3
- data/golden/inline_rename_scope_leak/expected/schema_ruby.rb +1 -1
- data/golden/input_reference/expected/schema_ruby.rb +1 -1
- data/golden/interleaved_fusion/expected/lir_00_unoptimized.txt +1 -1
- data/golden/interleaved_fusion/expected/lir_01_hoist_scalar_references.txt +1 -1
- data/golden/interleaved_fusion/expected/lir_02_inlined.txt +2 -2
- data/golden/interleaved_fusion/expected/lir_03_cse.txt +2 -2
- data/golden/interleaved_fusion/expected/lir_04_1_loop_fusion.txt +2 -2
- data/golden/interleaved_fusion/expected/lir_04_loop_invcm.txt +2 -2
- data/golden/interleaved_fusion/expected/lir_06_const_prop.txt +2 -2
- data/golden/interleaved_fusion/expected/schema_ruby.rb +1 -1
- data/golden/interleaved_fusion/expected/snast.txt +1 -1
- data/golden/let_inline/expected/lir_00_unoptimized.txt +2 -2
- data/golden/let_inline/expected/lir_01_hoist_scalar_references.txt +2 -2
- data/golden/let_inline/expected/lir_02_inlined.txt +6 -6
- data/golden/let_inline/expected/lir_03_cse.txt +6 -6
- data/golden/let_inline/expected/lir_04_1_loop_fusion.txt +6 -6
- data/golden/let_inline/expected/lir_04_loop_invcm.txt +6 -6
- data/golden/let_inline/expected/lir_06_const_prop.txt +6 -6
- data/golden/let_inline/expected/schema_ruby.rb +1 -1
- data/golden/let_inline/expected/snast.txt +2 -2
- data/golden/loop_fusion/expected/schema_ruby.rb +1 -1
- data/golden/min_reduce_scope/expected/schema_ruby.rb +1 -1
- data/golden/mixed_dimensions/expected/schema_ruby.rb +1 -1
- data/golden/multirank_hoisting/expected/lir_00_unoptimized.txt +2 -2
- data/golden/multirank_hoisting/expected/lir_01_hoist_scalar_references.txt +2 -2
- data/golden/multirank_hoisting/expected/lir_02_inlined.txt +7 -7
- data/golden/multirank_hoisting/expected/lir_03_cse.txt +7 -7
- data/golden/multirank_hoisting/expected/lir_04_1_loop_fusion.txt +7 -7
- data/golden/multirank_hoisting/expected/lir_04_loop_invcm.txt +7 -7
- data/golden/multirank_hoisting/expected/lir_06_const_prop.txt +7 -7
- data/golden/multirank_hoisting/expected/schema_ruby.rb +1 -1
- data/golden/multirank_hoisting/expected/snast.txt +2 -2
- data/golden/nested_hash/expected/lir_00_unoptimized.txt +1 -1
- data/golden/nested_hash/expected/lir_01_hoist_scalar_references.txt +1 -1
- data/golden/nested_hash/expected/lir_02_inlined.txt +1 -1
- data/golden/nested_hash/expected/lir_03_cse.txt +1 -1
- data/golden/nested_hash/expected/lir_04_1_loop_fusion.txt +1 -1
- data/golden/nested_hash/expected/lir_04_loop_invcm.txt +1 -1
- data/golden/nested_hash/expected/lir_06_const_prop.txt +1 -1
- data/golden/nested_hash/expected/schema_ruby.rb +1 -1
- data/golden/nested_hash/expected/snast.txt +1 -1
- data/golden/reduction_broadcast/expected/schema_ruby.rb +1 -1
- data/golden/roll/expected/schema_ruby.rb +1 -1
- data/golden/shift/expected/schema_ruby.rb +1 -1
- data/golden/shift_2d/expected/schema_ruby.rb +1 -1
- data/golden/simple_math/expected/lir_00_unoptimized.txt +2 -2
- data/golden/simple_math/expected/lir_01_hoist_scalar_references.txt +2 -2
- data/golden/simple_math/expected/lir_02_inlined.txt +2 -2
- data/golden/simple_math/expected/lir_03_cse.txt +2 -2
- data/golden/simple_math/expected/lir_04_1_loop_fusion.txt +2 -2
- data/golden/simple_math/expected/lir_04_loop_invcm.txt +2 -2
- data/golden/simple_math/expected/lir_06_const_prop.txt +2 -2
- data/golden/simple_math/expected/schema_ruby.rb +1 -1
- data/golden/simple_math/expected/snast.txt +2 -2
- data/golden/streaming_basics/expected/lir_00_unoptimized.txt +3 -3
- data/golden/streaming_basics/expected/lir_01_hoist_scalar_references.txt +3 -3
- data/golden/streaming_basics/expected/lir_02_inlined.txt +9 -9
- data/golden/streaming_basics/expected/lir_03_cse.txt +7 -7
- data/golden/streaming_basics/expected/lir_04_1_loop_fusion.txt +7 -7
- data/golden/streaming_basics/expected/lir_04_loop_invcm.txt +7 -7
- data/golden/streaming_basics/expected/lir_06_const_prop.txt +7 -7
- data/golden/streaming_basics/expected/schema_ruby.rb +1 -1
- data/golden/streaming_basics/expected/snast.txt +3 -3
- data/golden/tuples/expected/schema_ruby.rb +1 -1
- data/golden/tuples_and_arrays/expected/schema_ruby.rb +1 -1
- data/golden/us_tax_2024/expected/lir_00_unoptimized.txt +6 -6
- data/golden/us_tax_2024/expected/lir_01_hoist_scalar_references.txt +6 -6
- data/golden/us_tax_2024/expected/lir_02_inlined.txt +71 -71
- data/golden/us_tax_2024/expected/lir_03_cse.txt +43 -43
- data/golden/us_tax_2024/expected/lir_04_1_loop_fusion.txt +48 -48
- data/golden/us_tax_2024/expected/lir_04_loop_invcm.txt +43 -43
- data/golden/us_tax_2024/expected/lir_06_const_prop.txt +43 -43
- data/golden/us_tax_2024/expected/schema_ruby.rb +1 -1
- data/golden/us_tax_2024/expected/snast.txt +6 -6
- data/golden/with_constants/expected/schema_ruby.rb +1 -1
- data/lib/kumi/configuration.rb +6 -0
- data/lib/kumi/core/analyzer/passes/nast_dimensional_analyzer_pass.rb +1 -1
- data/lib/kumi/core/error_reporter.rb +1 -1
- data/lib/kumi/core/errors.rb +1 -1
- data/lib/kumi/core/functions/overload_resolver.rb +57 -11
- data/lib/kumi/core/functions/type_categories.rb +44 -0
- data/lib/kumi/core/input/type_matcher.rb +8 -1
- data/lib/kumi/core/ruby_parser/input_builder.rb +2 -2
- data/lib/kumi/core/types/normalizer.rb +1 -0
- data/lib/kumi/core/types/validator.rb +2 -2
- data/lib/kumi/core/types.rb +2 -2
- data/lib/kumi/dev/golden/reporter.rb +9 -0
- data/lib/kumi/dev/golden/result.rb +3 -1
- data/lib/kumi/dev/golden/runtime_test.rb +25 -0
- data/lib/kumi/dev/golden/suite.rb +4 -4
- data/lib/kumi/dev/golden/value_normalizer.rb +80 -0
- data/lib/kumi/dev/golden.rb +21 -12
- data/lib/kumi/doc_generator/formatters/json.rb +39 -0
- data/lib/kumi/doc_generator/formatters/markdown.rb +175 -0
- data/lib/kumi/doc_generator/loader.rb +37 -0
- data/lib/kumi/doc_generator/merger.rb +54 -0
- data/lib/kumi/doc_generator.rb +4 -0
- data/lib/kumi/frontends/text.rb +33 -5
- data/lib/kumi/syntax/location.rb +5 -1
- data/lib/kumi/version.rb +1 -1
- data/vscode-extension/.gitignore +4 -0
- data/vscode-extension/README.md +59 -0
- data/vscode-extension/TESTING.md +151 -0
- data/vscode-extension/package.json +51 -0
- data/vscode-extension/src/extension.ts +295 -0
- data/vscode-extension/tsconfig.json +15 -0
- metadata +38 -1
@@ -0,0 +1,295 @@
|
|
1
|
+
import * as vscode from 'vscode';
|
2
|
+
import * as fs from 'fs';
|
3
|
+
import * as path from 'path';
|
4
|
+
|
5
|
+
interface FunctionDef {
|
6
|
+
id: string;
|
7
|
+
arity: number;
|
8
|
+
params: Array<{ name: string }>;
|
9
|
+
dtype: any;
|
10
|
+
kernels: Record<string, string>;
|
11
|
+
aliases: string[];
|
12
|
+
kind?: string;
|
13
|
+
}
|
14
|
+
|
15
|
+
let functionsData: Record<string, FunctionDef> = {};
|
16
|
+
|
17
|
+
export function activate(context: vscode.ExtensionContext) {
|
18
|
+
// Load functions reference JSON from kumi/docs/
|
19
|
+
const refPath = path.join(
|
20
|
+
context.extensionPath,
|
21
|
+
'..',
|
22
|
+
'..',
|
23
|
+
'docs',
|
24
|
+
'functions-reference.json'
|
25
|
+
);
|
26
|
+
|
27
|
+
try {
|
28
|
+
if (fs.existsSync(refPath)) {
|
29
|
+
const content = fs.readFileSync(refPath, 'utf-8');
|
30
|
+
functionsData = JSON.parse(content);
|
31
|
+
console.log('Kumi functions reference loaded');
|
32
|
+
} else {
|
33
|
+
vscode.window.showWarningMessage(
|
34
|
+
'Kumi: functions-reference.json not found. Run "bin/kumi-doc-gen" to generate it.'
|
35
|
+
);
|
36
|
+
}
|
37
|
+
} catch (e) {
|
38
|
+
console.error('Failed to load functions reference:', e);
|
39
|
+
vscode.window.showErrorMessage(
|
40
|
+
'Kumi: Error loading functions reference: ' + String(e)
|
41
|
+
);
|
42
|
+
}
|
43
|
+
|
44
|
+
// Register completion provider for both Ruby and Kumi files
|
45
|
+
const completionProvider = vscode.languages.registerCompletionItemProvider(
|
46
|
+
[
|
47
|
+
{ language: 'ruby', scheme: 'file' },
|
48
|
+
{ language: 'kumi', scheme: 'file' }
|
49
|
+
],
|
50
|
+
new FunctionCompletionProvider(),
|
51
|
+
':' // trigger on ':'
|
52
|
+
);
|
53
|
+
|
54
|
+
// Register hover provider for both Ruby and Kumi files
|
55
|
+
const hoverProvider = vscode.languages.registerHoverProvider(
|
56
|
+
[
|
57
|
+
{ language: 'ruby', scheme: 'file' },
|
58
|
+
{ language: 'kumi', scheme: 'file' }
|
59
|
+
],
|
60
|
+
new FunctionHoverProvider()
|
61
|
+
);
|
62
|
+
|
63
|
+
context.subscriptions.push(completionProvider, hoverProvider);
|
64
|
+
}
|
65
|
+
|
66
|
+
class FunctionCompletionProvider implements vscode.CompletionItemProvider {
|
67
|
+
provideCompletionItems(
|
68
|
+
document: vscode.TextDocument,
|
69
|
+
position: vscode.Position,
|
70
|
+
token: vscode.CancellationToken,
|
71
|
+
context: vscode.CompletionContext
|
72
|
+
): vscode.CompletionItem[] {
|
73
|
+
// Check if we're in an fn(:...) context
|
74
|
+
const lineText = document.lineAt(position).text;
|
75
|
+
const beforeCursor = lineText.substring(0, position.character);
|
76
|
+
|
77
|
+
if (!beforeCursor.match(/fn\(\s*:\s*$/)) {
|
78
|
+
return [];
|
79
|
+
}
|
80
|
+
|
81
|
+
// For Ruby files, check if we're inside a schema block
|
82
|
+
if (document.languageId === 'ruby') {
|
83
|
+
if (!this.isInSchemaBlock(document, position)) {
|
84
|
+
return [];
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
const completions: vscode.CompletionItem[] = [];
|
89
|
+
|
90
|
+
for (const [alias, funcDef] of Object.entries(functionsData)) {
|
91
|
+
const item = new vscode.CompletionItem(
|
92
|
+
alias,
|
93
|
+
vscode.CompletionItemKind.Function
|
94
|
+
);
|
95
|
+
|
96
|
+
item.detail = `${funcDef.id} (arity: ${funcDef.arity})`;
|
97
|
+
item.documentation = new vscode.MarkdownString(
|
98
|
+
this.getDocumentation(funcDef)
|
99
|
+
);
|
100
|
+
item.sortText = alias;
|
101
|
+
|
102
|
+
completions.push(item);
|
103
|
+
}
|
104
|
+
|
105
|
+
return completions;
|
106
|
+
}
|
107
|
+
|
108
|
+
private getDocumentation(funcDef: FunctionDef): string {
|
109
|
+
const lines: string[] = [
|
110
|
+
`**${funcDef.id}**`,
|
111
|
+
'',
|
112
|
+
`**Arity:** ${funcDef.arity}`,
|
113
|
+
];
|
114
|
+
|
115
|
+
if (funcDef.params && funcDef.params.length > 0) {
|
116
|
+
lines.push('**Parameters:**');
|
117
|
+
funcDef.params.forEach((p) => {
|
118
|
+
lines.push(`- \`${p.name}\``);
|
119
|
+
});
|
120
|
+
}
|
121
|
+
|
122
|
+
if (funcDef.dtype) {
|
123
|
+
lines.push(`**Type:** ${this.formatType(funcDef.dtype)}`);
|
124
|
+
}
|
125
|
+
|
126
|
+
if (funcDef.kernels && Object.keys(funcDef.kernels).length > 0) {
|
127
|
+
lines.push('**Kernels:**');
|
128
|
+
Object.entries(funcDef.kernels).forEach(([target, id]) => {
|
129
|
+
lines.push(`- ${target}: \`${id}\``);
|
130
|
+
});
|
131
|
+
}
|
132
|
+
|
133
|
+
return lines.join('\n');
|
134
|
+
}
|
135
|
+
|
136
|
+
private formatType(dtype: any): string {
|
137
|
+
if (!dtype) return 'unknown';
|
138
|
+
|
139
|
+
switch (dtype.rule) {
|
140
|
+
case 'same_as':
|
141
|
+
return `same as \`${dtype.param}\``;
|
142
|
+
case 'scalar':
|
143
|
+
return dtype.kind || 'scalar';
|
144
|
+
case 'promote':
|
145
|
+
return `promoted from ${dtype.params.map((p: string) => `\`${p}\``).join(', ')}`;
|
146
|
+
case 'element_of':
|
147
|
+
return `element of \`${dtype.param}\``;
|
148
|
+
default:
|
149
|
+
return dtype.rule;
|
150
|
+
}
|
151
|
+
}
|
152
|
+
|
153
|
+
private isInSchemaBlock(document: vscode.TextDocument, position: vscode.Position): boolean {
|
154
|
+
let braceCount = 0;
|
155
|
+
let schemaFound = false;
|
156
|
+
|
157
|
+
// Search backwards from current position to find schema block
|
158
|
+
for (let i = position.line; i >= 0; i--) {
|
159
|
+
const line = document.lineAt(i).text;
|
160
|
+
|
161
|
+
// Count braces from end of line backwards
|
162
|
+
if (i === position.line) {
|
163
|
+
// Only count braces before cursor
|
164
|
+
for (let j = position.character - 1; j >= 0; j--) {
|
165
|
+
if (line[j] === '}') braceCount++;
|
166
|
+
if (line[j] === '{') braceCount--;
|
167
|
+
}
|
168
|
+
} else {
|
169
|
+
// Count all braces in the line (right to left)
|
170
|
+
for (let j = line.length - 1; j >= 0; j--) {
|
171
|
+
if (line[j] === '}') braceCount++;
|
172
|
+
if (line[j] === '{') braceCount--;
|
173
|
+
}
|
174
|
+
}
|
175
|
+
|
176
|
+
// Look for 'schema do' or 'schema {'
|
177
|
+
if (line.match(/\bschema\s+(do|{)/)) {
|
178
|
+
schemaFound = braceCount <= 0;
|
179
|
+
break;
|
180
|
+
}
|
181
|
+
}
|
182
|
+
|
183
|
+
return schemaFound;
|
184
|
+
}
|
185
|
+
}
|
186
|
+
|
187
|
+
class FunctionHoverProvider implements vscode.HoverProvider {
|
188
|
+
provideHover(
|
189
|
+
document: vscode.TextDocument,
|
190
|
+
position: vscode.Position,
|
191
|
+
token: vscode.CancellationToken
|
192
|
+
): vscode.ProviderResult<vscode.Hover> {
|
193
|
+
const range = document.getWordRangeAtPosition(position);
|
194
|
+
if (!range) return null;
|
195
|
+
|
196
|
+
const word = document.getText(range);
|
197
|
+
|
198
|
+
// Check if we're in fn(:word, ...)
|
199
|
+
const lineText = document.lineAt(position).text;
|
200
|
+
if (!lineText.match(/fn\s*\(\s*:/)) {
|
201
|
+
return null;
|
202
|
+
}
|
203
|
+
|
204
|
+
// For Ruby files, check if we're inside a schema block
|
205
|
+
if (document.languageId === 'ruby') {
|
206
|
+
if (!this.isInSchemaBlock(document, position)) {
|
207
|
+
return null;
|
208
|
+
}
|
209
|
+
}
|
210
|
+
|
211
|
+
const funcDef = functionsData[word];
|
212
|
+
if (!funcDef) {
|
213
|
+
return null;
|
214
|
+
}
|
215
|
+
|
216
|
+
const markdown = new vscode.MarkdownString();
|
217
|
+
markdown.appendMarkdown(`### \`${funcDef.id}\`\n\n`);
|
218
|
+
|
219
|
+
if (funcDef.aliases && funcDef.aliases.length > 0) {
|
220
|
+
markdown.appendMarkdown(
|
221
|
+
`**Aliases:** ${funcDef.aliases.map((a) => `\`${a}\``).join(', ')}\n\n`
|
222
|
+
);
|
223
|
+
}
|
224
|
+
|
225
|
+
markdown.appendMarkdown(`**Arity:** ${funcDef.arity}\n\n`);
|
226
|
+
|
227
|
+
if (funcDef.dtype) {
|
228
|
+
markdown.appendMarkdown(`**Type:** ${this.formatType(funcDef.dtype)}\n\n`);
|
229
|
+
}
|
230
|
+
|
231
|
+
if (funcDef.params && funcDef.params.length > 0) {
|
232
|
+
markdown.appendMarkdown('**Parameters:**\n\n');
|
233
|
+
funcDef.params.forEach((p) => {
|
234
|
+
markdown.appendMarkdown(`- \`${p.name}\`\n`);
|
235
|
+
});
|
236
|
+
markdown.appendMarkdown('\n');
|
237
|
+
}
|
238
|
+
|
239
|
+
return new vscode.Hover(markdown);
|
240
|
+
}
|
241
|
+
|
242
|
+
private formatType(dtype: any): string {
|
243
|
+
if (!dtype) return 'unknown';
|
244
|
+
|
245
|
+
switch (dtype.rule) {
|
246
|
+
case 'same_as':
|
247
|
+
return `same as \`${dtype.param}\``;
|
248
|
+
case 'scalar':
|
249
|
+
return dtype.kind || 'scalar';
|
250
|
+
case 'promote':
|
251
|
+
return `promoted from ${dtype.params
|
252
|
+
.map((p: string) => `\`${p}\``)
|
253
|
+
.join(', ')}`;
|
254
|
+
case 'element_of':
|
255
|
+
return `element of \`${dtype.param}\``;
|
256
|
+
default:
|
257
|
+
return dtype.rule;
|
258
|
+
}
|
259
|
+
}
|
260
|
+
|
261
|
+
private isInSchemaBlock(document: vscode.TextDocument, position: vscode.Position): boolean {
|
262
|
+
let braceCount = 0;
|
263
|
+
let schemaFound = false;
|
264
|
+
|
265
|
+
// Search backwards from current position to find schema block
|
266
|
+
for (let i = position.line; i >= 0; i--) {
|
267
|
+
const line = document.lineAt(i).text;
|
268
|
+
|
269
|
+
// Count braces from end of line backwards
|
270
|
+
if (i === position.line) {
|
271
|
+
// Only count braces before cursor
|
272
|
+
for (let j = position.character - 1; j >= 0; j--) {
|
273
|
+
if (line[j] === '}') braceCount++;
|
274
|
+
if (line[j] === '{') braceCount--;
|
275
|
+
}
|
276
|
+
} else {
|
277
|
+
// Count all braces in the line (right to left)
|
278
|
+
for (let j = line.length - 1; j >= 0; j--) {
|
279
|
+
if (line[j] === '}') braceCount++;
|
280
|
+
if (line[j] === '{') braceCount--;
|
281
|
+
}
|
282
|
+
}
|
283
|
+
|
284
|
+
// Look for 'schema do' or 'schema {'
|
285
|
+
if (line.match(/\bschema\s+(do|{)/)) {
|
286
|
+
schemaFound = braceCount <= 0;
|
287
|
+
break;
|
288
|
+
}
|
289
|
+
}
|
290
|
+
|
291
|
+
return schemaFound;
|
292
|
+
}
|
293
|
+
}
|
294
|
+
|
295
|
+
export function deactivate() {}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
"module": "commonjs",
|
4
|
+
"target": "ES2020",
|
5
|
+
"lib": ["ES2020"],
|
6
|
+
"outDir": "./out",
|
7
|
+
"rootDir": "./src",
|
8
|
+
"strict": true,
|
9
|
+
"esModuleInterop": true,
|
10
|
+
"skipLibCheck": true,
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
12
|
+
"resolveJsonModule": true
|
13
|
+
},
|
14
|
+
"exclude": ["node_modules", ".vscode-test"]
|
15
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kumi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- André Muta
|
@@ -58,6 +58,7 @@ files:
|
|
58
58
|
- data/functions/core/boolean.yaml
|
59
59
|
- data/functions/core/comparison.yaml
|
60
60
|
- data/functions/core/constructor.yaml
|
61
|
+
- data/functions/core/conversion.yaml
|
61
62
|
- data/functions/core/select.yaml
|
62
63
|
- data/functions/core/stencil.yaml
|
63
64
|
- data/functions/core/string.yaml
|
@@ -66,6 +67,7 @@ files:
|
|
66
67
|
- data/kernels/javascript/agg/string.yaml
|
67
68
|
- data/kernels/javascript/core/arithmetic.yaml
|
68
69
|
- data/kernels/javascript/core/boolean.yaml
|
70
|
+
- data/kernels/javascript/core/coercion.yaml
|
69
71
|
- data/kernels/javascript/core/comparison.yaml
|
70
72
|
- data/kernels/javascript/core/constructor.yaml
|
71
73
|
- data/kernels/javascript/core/select.yaml
|
@@ -75,15 +77,21 @@ files:
|
|
75
77
|
- data/kernels/ruby/agg/string.yaml
|
76
78
|
- data/kernels/ruby/core/arithmetic.yaml
|
77
79
|
- data/kernels/ruby/core/boolean.yaml
|
80
|
+
- data/kernels/ruby/core/coercion.yaml
|
78
81
|
- data/kernels/ruby/core/comparison.yaml
|
79
82
|
- data/kernels/ruby/core/constructor.yaml
|
80
83
|
- data/kernels/ruby/core/select.yaml
|
81
84
|
- data/kernels/ruby/core/string.yaml
|
82
85
|
- debug_ordering.rb
|
86
|
+
- docs/ARCHITECTURE.md
|
87
|
+
- docs/DEVELOPMENT.md
|
83
88
|
- docs/FORM_SCHEMA.md
|
89
|
+
- docs/FUNCTIONS.md
|
84
90
|
- docs/OUTPUT_SCHEMA.md
|
85
91
|
- docs/SYNTAX.md
|
86
92
|
- docs/UNSAT_DETECTION.md
|
93
|
+
- docs/VSCODE_EXTENSION.md
|
94
|
+
- docs/functions-reference.json
|
87
95
|
- examples/deep_schema_compilation_and_evaluation_benchmark.rb
|
88
96
|
- examples/federal_tax_calculator_2024.rb
|
89
97
|
- examples/game_of_life.rb
|
@@ -170,6 +178,22 @@ files:
|
|
170
178
|
- golden/chained_fusion/expected/snast.txt
|
171
179
|
- golden/chained_fusion/input.json
|
172
180
|
- golden/chained_fusion/schema.kumi
|
181
|
+
- golden/decimal_explicit/expected.json
|
182
|
+
- golden/decimal_explicit/expected/ast.txt
|
183
|
+
- golden/decimal_explicit/expected/input_plan.txt
|
184
|
+
- golden/decimal_explicit/expected/lir_00_unoptimized.txt
|
185
|
+
- golden/decimal_explicit/expected/lir_01_hoist_scalar_references.txt
|
186
|
+
- golden/decimal_explicit/expected/lir_02_inlined.txt
|
187
|
+
- golden/decimal_explicit/expected/lir_03_cse.txt
|
188
|
+
- golden/decimal_explicit/expected/lir_04_1_loop_fusion.txt
|
189
|
+
- golden/decimal_explicit/expected/lir_04_loop_invcm.txt
|
190
|
+
- golden/decimal_explicit/expected/lir_06_const_prop.txt
|
191
|
+
- golden/decimal_explicit/expected/nast.txt
|
192
|
+
- golden/decimal_explicit/expected/schema_javascript.mjs
|
193
|
+
- golden/decimal_explicit/expected/schema_ruby.rb
|
194
|
+
- golden/decimal_explicit/expected/snast.txt
|
195
|
+
- golden/decimal_explicit/input.json
|
196
|
+
- golden/decimal_explicit/schema.kumi
|
173
197
|
- golden/element_arrays/expected.json
|
174
198
|
- golden/element_arrays/expected/ast.txt
|
175
199
|
- golden/element_arrays/expected/input_plan.txt
|
@@ -677,6 +701,7 @@ files:
|
|
677
701
|
- lib/kumi/core/functions/function_spec.rb
|
678
702
|
- lib/kumi/core/functions/loader.rb
|
679
703
|
- lib/kumi/core/functions/overload_resolver.rb
|
704
|
+
- lib/kumi/core/functions/type_categories.rb
|
680
705
|
- lib/kumi/core/functions/type_error_reporter.rb
|
681
706
|
- lib/kumi/core/functions/type_rules.rb
|
682
707
|
- lib/kumi/core/input/type_matcher.rb
|
@@ -734,6 +759,7 @@ files:
|
|
734
759
|
- lib/kumi/dev/golden/result.rb
|
735
760
|
- lib/kumi/dev/golden/runtime_test.rb
|
736
761
|
- lib/kumi/dev/golden/suite.rb
|
762
|
+
- lib/kumi/dev/golden/value_normalizer.rb
|
737
763
|
- lib/kumi/dev/golden/verifier.rb
|
738
764
|
- lib/kumi/dev/ir.rb
|
739
765
|
- lib/kumi/dev/parse.rb
|
@@ -744,6 +770,11 @@ files:
|
|
744
770
|
- lib/kumi/dev/profile_runner.rb
|
745
771
|
- lib/kumi/dev/runner.rb
|
746
772
|
- lib/kumi/dev/support/kumi_runner.mjs
|
773
|
+
- lib/kumi/doc_generator.rb
|
774
|
+
- lib/kumi/doc_generator/formatters/json.rb
|
775
|
+
- lib/kumi/doc_generator/formatters/markdown.rb
|
776
|
+
- lib/kumi/doc_generator/loader.rb
|
777
|
+
- lib/kumi/doc_generator/merger.rb
|
747
778
|
- lib/kumi/errors.rb
|
748
779
|
- lib/kumi/frontends.rb
|
749
780
|
- lib/kumi/frontends/ruby.rb
|
@@ -776,6 +807,12 @@ files:
|
|
776
807
|
- lib/kumi/syntax/trait_declaration.rb
|
777
808
|
- lib/kumi/syntax/value_declaration.rb
|
778
809
|
- lib/kumi/version.rb
|
810
|
+
- vscode-extension/.gitignore
|
811
|
+
- vscode-extension/README.md
|
812
|
+
- vscode-extension/TESTING.md
|
813
|
+
- vscode-extension/package.json
|
814
|
+
- vscode-extension/src/extension.ts
|
815
|
+
- vscode-extension/tsconfig.json
|
779
816
|
homepage: https://github.com/amuta/kumi
|
780
817
|
licenses:
|
781
818
|
- MIT
|