novac 2.2.0 → 2.2.2
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/LICENSE +0 -0
- package/README.md +0 -0
- package/bin/novac +6 -3
- package/bin/nvc +0 -0
- package/bin/nvml +0 -0
- package/demo.nv +0 -0
- package/demo_builtins.nv +0 -0
- package/demo_http.nv +0 -0
- package/examples/bf.nv +5 -13
- package/examples/math.nv +2 -2
- package/kits/kitffmpeg/kitdef.js +1174 -0
- package/kits/libos/kitdef.js +3135 -0
- package/kits/libtasker/kitdef.js +125 -0
- package/package.json +1 -1
- package/scripts/update-bin.js +0 -0
- package/src/core/executor.js +7 -4
- package/src/core/lexer.js +2 -2
- package/src/index.js +0 -0
- package/novac/LICENSE +0 -21
- package/novac/README.md +0 -1823
- package/novac/bin/novac +0 -950
- package/novac/bin/nvc +0 -522
- package/novac/bin/nvml +0 -542
- package/novac/demo.nv +0 -245
- package/novac/demo_builtins.nv +0 -209
- package/novac/demo_http.nv +0 -62
- package/novac/examples/bf.nv +0 -69
- package/novac/examples/math.nv +0 -21
- package/novac/kits/kitai/kitdef.js +0 -2185
- package/novac/kits/kitansi/kitdef.js +0 -1402
- package/novac/kits/kitformat/kitdef.js +0 -1485
- package/novac/kits/kitgps/kitdef.js +0 -1862
- package/novac/kits/kitlibfs/kitdef.js +0 -231
- package/novac/kits/kitlibproc/kitdef.js +0 -78
- package/novac/kits/kitmatrix/ex.js +0 -19
- package/novac/kits/kitmatrix/kitdef.js +0 -960
- package/novac/kits/kitmpatch/kitdef.js +0 -906
- package/novac/kits/kitnovacweb/README.md +0 -1572
- package/novac/kits/kitnovacweb/demo.nv +0 -12
- package/novac/kits/kitnovacweb/demo.nvml +0 -71
- package/novac/kits/kitnovacweb/index.nova +0 -12
- package/novac/kits/kitnovacweb/kitdef.js +0 -692
- package/novac/kits/kitnovacweb/nova.kit.json +0 -8
- package/novac/kits/kitnovacweb/nvml/executor.js +0 -739
- package/novac/kits/kitnovacweb/nvml/index.js +0 -67
- package/novac/kits/kitnovacweb/nvml/lexer.js +0 -263
- package/novac/kits/kitnovacweb/nvml/parser.js +0 -508
- package/novac/kits/kitnovacweb/nvml/renderer.js +0 -924
- package/novac/kits/kitparse/kitdef.js +0 -1688
- package/novac/kits/kitregex++/kitdef.js +0 -1353
- package/novac/kits/kitrequire/kitdef.js +0 -1599
- package/novac/kits/kitx11/kitdef.js +0 -1
- package/novac/kits/kitx11/kitx11.js +0 -2472
- package/novac/kits/kitx11/kitx11_conn.js +0 -948
- package/novac/kits/kitx11/kitx11_worker.js +0 -121
- package/novac/kits/libtea/tf.js +0 -2691
- package/novac/kits/libterm/ex.js +0 -285
- package/novac/kits/libterm/kitdef.js +0 -1927
- package/novac/node_modules/chalk/license +0 -9
- package/novac/node_modules/chalk/package.json +0 -83
- package/novac/node_modules/chalk/readme.md +0 -297
- package/novac/node_modules/chalk/source/index.d.ts +0 -325
- package/novac/node_modules/chalk/source/index.js +0 -225
- package/novac/node_modules/chalk/source/utilities.js +0 -33
- package/novac/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +0 -236
- package/novac/node_modules/chalk/source/vendor/ansi-styles/index.js +0 -223
- package/novac/node_modules/chalk/source/vendor/supports-color/browser.d.ts +0 -1
- package/novac/node_modules/chalk/source/vendor/supports-color/browser.js +0 -34
- package/novac/node_modules/chalk/source/vendor/supports-color/index.d.ts +0 -55
- package/novac/node_modules/chalk/source/vendor/supports-color/index.js +0 -190
- package/novac/node_modules/commander/LICENSE +0 -22
- package/novac/node_modules/commander/Readme.md +0 -1176
- package/novac/node_modules/commander/esm.mjs +0 -16
- package/novac/node_modules/commander/index.js +0 -24
- package/novac/node_modules/commander/lib/argument.js +0 -150
- package/novac/node_modules/commander/lib/command.js +0 -2777
- package/novac/node_modules/commander/lib/error.js +0 -39
- package/novac/node_modules/commander/lib/help.js +0 -747
- package/novac/node_modules/commander/lib/option.js +0 -380
- package/novac/node_modules/commander/lib/suggestSimilar.js +0 -101
- package/novac/node_modules/commander/package-support.json +0 -19
- package/novac/node_modules/commander/package.json +0 -82
- package/novac/node_modules/commander/typings/esm.d.mts +0 -3
- package/novac/node_modules/commander/typings/index.d.ts +0 -1113
- package/novac/node_modules/node-addon-api/LICENSE.md +0 -9
- package/novac/node_modules/node-addon-api/README.md +0 -95
- package/novac/node_modules/node-addon-api/common.gypi +0 -21
- package/novac/node_modules/node-addon-api/except.gypi +0 -25
- package/novac/node_modules/node-addon-api/index.js +0 -14
- package/novac/node_modules/node-addon-api/napi-inl.deprecated.h +0 -186
- package/novac/node_modules/node-addon-api/napi-inl.h +0 -7165
- package/novac/node_modules/node-addon-api/napi.h +0 -3364
- package/novac/node_modules/node-addon-api/node_addon_api.gyp +0 -42
- package/novac/node_modules/node-addon-api/node_api.gyp +0 -9
- package/novac/node_modules/node-addon-api/noexcept.gypi +0 -26
- package/novac/node_modules/node-addon-api/nothing.c +0 -0
- package/novac/node_modules/node-addon-api/package-support.json +0 -21
- package/novac/node_modules/node-addon-api/package.json +0 -480
- package/novac/node_modules/node-addon-api/tools/README.md +0 -73
- package/novac/node_modules/node-addon-api/tools/check-napi.js +0 -99
- package/novac/node_modules/node-addon-api/tools/clang-format.js +0 -71
- package/novac/node_modules/node-addon-api/tools/conversion.js +0 -301
- package/novac/node_modules/serialize-javascript/LICENSE +0 -27
- package/novac/node_modules/serialize-javascript/README.md +0 -149
- package/novac/node_modules/serialize-javascript/index.js +0 -297
- package/novac/node_modules/serialize-javascript/package.json +0 -33
- package/novac/package.json +0 -27
- package/novac/scripts/update-bin.js +0 -24
- package/novac/src/core/bstd.js +0 -1035
- package/novac/src/core/config.js +0 -155
- package/novac/src/core/describe.js +0 -187
- package/novac/src/core/emitter.js +0 -499
- package/novac/src/core/error.js +0 -86
- package/novac/src/core/executor.js +0 -5606
- package/novac/src/core/formatter.js +0 -686
- package/novac/src/core/lexer.js +0 -1026
- package/novac/src/core/nova_builtins.js +0 -717
- package/novac/src/core/nova_thread_worker.js +0 -166
- package/novac/src/core/parser.js +0 -2181
- package/novac/src/core/types.js +0 -112
- package/novac/src/index.js +0 -28
- package/novac/src/runtime/stdlib.js +0 -244
package/novac/src/core/config.js
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const os = require('os');
|
|
4
|
-
const { ConfigFile, Shema, ShemaType } = require('./bstd');
|
|
5
|
-
|
|
6
|
-
// Define the Nova config schema
|
|
7
|
-
const novaConfigSchema = new Shema({
|
|
8
|
-
name: new ShemaType('String', val => typeof val === 'string'),
|
|
9
|
-
version: new ShemaType('String', val => typeof val === 'string'),
|
|
10
|
-
author: new ShemaType('String', val => typeof val === 'string'),
|
|
11
|
-
description: new ShemaType('String', val => typeof val === 'string'),
|
|
12
|
-
main: new ShemaType('String', val => typeof val === 'string'),
|
|
13
|
-
license: new ShemaType('String', val => typeof val === 'string'),
|
|
14
|
-
scripts: new ShemaType('Object', val => typeof val === 'object' && val !== null),
|
|
15
|
-
dependencies: new ShemaType('Object', val => typeof val === 'object' && val !== null),
|
|
16
|
-
devDependencies: new ShemaType('Object', val => typeof val === 'object' && val !== null),
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
// Initialize or load the global Nova config
|
|
20
|
-
function initializeConfig() {
|
|
21
|
-
const configPath = path.join(os.homedir(), '.novac', 'nvconfig.json');
|
|
22
|
-
const configDir = path.dirname(configPath);
|
|
23
|
-
|
|
24
|
-
// Create config directory if it doesn't exist
|
|
25
|
-
if (!fs.existsSync(configDir)) {
|
|
26
|
-
fs.mkdirSync(configDir, { recursive: true });
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Create config file if it doesn't exist
|
|
30
|
-
if (!fs.existsSync(configPath)) {
|
|
31
|
-
const defaultConfig = {
|
|
32
|
-
name: 'nova-project',
|
|
33
|
-
version: '1.0.0',
|
|
34
|
-
author: '',
|
|
35
|
-
description: '',
|
|
36
|
-
main: 'src/main.nova',
|
|
37
|
-
license: 'MIT',
|
|
38
|
-
scripts: {},
|
|
39
|
-
dependencies: {},
|
|
40
|
-
devDependencies: {},
|
|
41
|
-
};
|
|
42
|
-
fs.writeFileSync(configPath, JSON.stringify(defaultConfig, null, 2));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return configPath;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Get config value
|
|
49
|
-
function getConfig(keyPath) {
|
|
50
|
-
const configPath = initializeConfig();
|
|
51
|
-
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
52
|
-
|
|
53
|
-
if (!keyPath) {
|
|
54
|
-
return config;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Parse key path like "scripts.build" or "dependencies.lodash"
|
|
58
|
-
const keys = keyPath.split('.');
|
|
59
|
-
let current = config;
|
|
60
|
-
|
|
61
|
-
for (const key of keys) {
|
|
62
|
-
if (current && typeof current === 'object' && key in current) {
|
|
63
|
-
current = current[key];
|
|
64
|
-
} else {
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return current;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Set config value
|
|
73
|
-
function setConfig(keyPath, value) {
|
|
74
|
-
const configPath = initializeConfig();
|
|
75
|
-
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
76
|
-
|
|
77
|
-
const keys = keyPath.split('.');
|
|
78
|
-
let current = config;
|
|
79
|
-
|
|
80
|
-
// Navigate to the parent object
|
|
81
|
-
for (let i = 0; i < keys.length - 1; i++) {
|
|
82
|
-
const key = keys[i];
|
|
83
|
-
if (!(key in current) || typeof current[key] !== 'object') {
|
|
84
|
-
current[key] = {};
|
|
85
|
-
}
|
|
86
|
-
current = current[key];
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Set the value
|
|
90
|
-
current[keys[keys.length - 1]] = parseValue(value);
|
|
91
|
-
|
|
92
|
-
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// Parse string value to appropriate type
|
|
96
|
-
function parseValue(value) {
|
|
97
|
-
if (value === 'true') return true;
|
|
98
|
-
if (value === 'false') return false;
|
|
99
|
-
if (value === 'null') return null;
|
|
100
|
-
if (value === 'undefined') return undefined;
|
|
101
|
-
if (!isNaN(value) && value !== '') return Number(value);
|
|
102
|
-
try {
|
|
103
|
-
return JSON.parse(value);
|
|
104
|
-
} catch {
|
|
105
|
-
return value;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Interactive setup for config
|
|
110
|
-
function interactiveSetup() {
|
|
111
|
-
const configPath = initializeConfig();
|
|
112
|
-
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
113
|
-
|
|
114
|
-
const questions = [
|
|
115
|
-
{ key: 'name', default: config.name || 'nova-project' },
|
|
116
|
-
{ key: 'version', default: config.version || '1.0.0' },
|
|
117
|
-
{ key: 'author', default: config.author || '' },
|
|
118
|
-
{ key: 'description', default: config.description || '' },
|
|
119
|
-
{ key: 'main', default: config.main || 'src/main.nova' },
|
|
120
|
-
{ key: 'license', default: config.license || 'MIT' },
|
|
121
|
-
];
|
|
122
|
-
|
|
123
|
-
const readline = require('readline');
|
|
124
|
-
const rl = readline.createInterface({
|
|
125
|
-
input: process.stdin,
|
|
126
|
-
output: process.stdout,
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
let questionIndex = 0;
|
|
130
|
-
|
|
131
|
-
const askQuestion = () => {
|
|
132
|
-
if (questionIndex >= questions.length) {
|
|
133
|
-
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
134
|
-
console.log('Config saved successfully!');
|
|
135
|
-
rl.close();
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const question = questions[questionIndex];
|
|
140
|
-
rl.question(`${question.key} (${question.default}): `, (answer) => {
|
|
141
|
-
config[question.key] = answer.trim() === '' ? question.default : answer.trim();
|
|
142
|
-
questionIndex++;
|
|
143
|
-
askQuestion();
|
|
144
|
-
});
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
askQuestion();
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
module.exports = {
|
|
151
|
-
initializeConfig,
|
|
152
|
-
getConfig,
|
|
153
|
-
setConfig,
|
|
154
|
-
interactiveSetup,
|
|
155
|
-
};
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* describe.js
|
|
3
|
-
* Converts Nova Air AST into natural-language explanations.
|
|
4
|
-
* Style: clear, rhythmic, and human — with natural punctuation.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
function describe(node, depth = 0) {
|
|
8
|
-
const indent = " ".repeat(depth);
|
|
9
|
-
if (!node) return "";
|
|
10
|
-
if (Array.isArray(node))
|
|
11
|
-
return node.map(n => describe(n, depth)).join("\n");
|
|
12
|
-
|
|
13
|
-
switch (node.kind) {
|
|
14
|
-
// ─────────── ROOT ───────────
|
|
15
|
-
case "program":
|
|
16
|
-
return node.nodes.map(n => describe(n, depth)).join("\n");
|
|
17
|
-
|
|
18
|
-
// ─────────── DECLARATION ───────────
|
|
19
|
-
case "declare": {
|
|
20
|
-
const kind = node.isConst ? "constant" : "variable";
|
|
21
|
-
const pointer = node.isPointer ? "pointer to " : "";
|
|
22
|
-
if (node.destructure)
|
|
23
|
-
return `${indent}Create a ${kind} pattern: unpack into { ${node.destructure.props
|
|
24
|
-
.map(p => p.alias)
|
|
25
|
-
.join(", ")} }${node.value ? `, using ${describe(node.value)}` : ""}.`;
|
|
26
|
-
if (node.value)
|
|
27
|
-
return `${indent}Declare ${kind}: ${pointer}${node.name}, and set it to ${describe(node.value)}.`;
|
|
28
|
-
return `${indent}Declare ${kind}: ${pointer}${node.name}.`;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// ─────────── ASSIGNMENT ───────────
|
|
32
|
-
case "assign":
|
|
33
|
-
return `${indent}Set ${describe(node.name)} to ${describe(node.value)}.`;
|
|
34
|
-
|
|
35
|
-
// ─────────── REFERENCES ───────────
|
|
36
|
-
case "ref":
|
|
37
|
-
return node.name;
|
|
38
|
-
|
|
39
|
-
// ─────────── VALUES ───────────
|
|
40
|
-
case "value":
|
|
41
|
-
return JSON.stringify(node.value);
|
|
42
|
-
|
|
43
|
-
// ─────────── FUNCTIONS ───────────
|
|
44
|
-
case "function": {
|
|
45
|
-
const args = node.args.length
|
|
46
|
-
? node.args.map(a => describe(a)).join(", ")
|
|
47
|
-
: "no arguments";
|
|
48
|
-
return `${indent}${node.isAsync ? "Async " : ""}function '${node.name}': takes (${args}), and ${summarizeBody(node.body)}.`;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
case "arrowfunc": {
|
|
52
|
-
const args = node.args.length
|
|
53
|
-
? node.args.map(a => describe(a)).join(", ")
|
|
54
|
-
: "no arguments";
|
|
55
|
-
return `${indent}Arrow function: takes (${args}), and ${summarizeBody(node.body)}.`;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// ─────────── RETURN ───────────
|
|
59
|
-
case "return":
|
|
60
|
-
return `${indent}Return ${node.value ? describe(node.value) : "nothing"}${node.terminate ? ", immediately" : ""}.`;
|
|
61
|
-
|
|
62
|
-
// ─────────── CLASS ───────────
|
|
63
|
-
case "class":
|
|
64
|
-
return `${indent}Define a class '${node.name}'${node.superClass ? `, extending ${describe(node.superClass)}` : ""}: \n${node.members
|
|
65
|
-
.map(m => describe(m, depth + 1))
|
|
66
|
-
.join("\n")}`;
|
|
67
|
-
|
|
68
|
-
// ─────────── BRANCHING ───────────
|
|
69
|
-
case "branch": {
|
|
70
|
-
const base = `${indent}${capitalize(node.type)} statement: ${
|
|
71
|
-
node.args ? `when (${describe(node.args)})` : ""
|
|
72
|
-
}, then:\n${describe(node.body, depth + 1)}`;
|
|
73
|
-
const next = node.next
|
|
74
|
-
? `\n${indent}else:\n${describe(node.next.body, depth + 1)}`
|
|
75
|
-
: "";
|
|
76
|
-
return base + next;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// ─────────── LOOPS ───────────
|
|
80
|
-
case "while":
|
|
81
|
-
case "repeat":
|
|
82
|
-
case "for":
|
|
83
|
-
case "do":
|
|
84
|
-
case "until":
|
|
85
|
-
return `${indent}${capitalize(node.kind)} loop: ${
|
|
86
|
-
node.args ? `condition is ${describe(node.args)},` : ""
|
|
87
|
-
} running:\n${describe(node.body, depth + 1)}`;
|
|
88
|
-
|
|
89
|
-
// ─────────── CALLS ───────────
|
|
90
|
-
case "call": {
|
|
91
|
-
const name = typeof node.name === "string" ? node.name : describe(node.name);
|
|
92
|
-
const args = node.args.length
|
|
93
|
-
? `, with arguments: ${node.args.map(a => describe(a)).join(", ")}`
|
|
94
|
-
: "";
|
|
95
|
-
return `${indent}Call ${name}${args}.`;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// ─────────── PROPERTY ACCESS ───────────
|
|
99
|
-
case "prop":
|
|
100
|
-
return `${describe(node.object)}.${node.name}`;
|
|
101
|
-
|
|
102
|
-
// ─────────── INDEX ACCESS ───────────
|
|
103
|
-
case "subscript":
|
|
104
|
-
return `${describe(node.object)}[${describe(node.index)}]`;
|
|
105
|
-
|
|
106
|
-
// ─────────── ASYNC / AWAIT ───────────
|
|
107
|
-
case "await":
|
|
108
|
-
return `${indent}Await: wait for ${describe(node.operand)} to complete.`;
|
|
109
|
-
|
|
110
|
-
// ─────────── ERROR HANDLING ───────────
|
|
111
|
-
case "throw":
|
|
112
|
-
return `${indent}Throw ${describe(node.value)}.`;
|
|
113
|
-
|
|
114
|
-
case "try":
|
|
115
|
-
return `${indent}Try block:\n${describe(node.tryBody, depth + 1)}${
|
|
116
|
-
node.catchBody
|
|
117
|
-
? `\n${indent}If an error occurs: catch it as '${node.catchName}', then:\n${describe(node.catchBody, depth + 1)}`
|
|
118
|
-
: ""
|
|
119
|
-
}${node.finallyBody ? `\n${indent}Finally: always run\n${describe(node.finallyBody, depth + 1)}` : ""}`;
|
|
120
|
-
|
|
121
|
-
// ─────────── EXPRESSIONS ───────────
|
|
122
|
-
case "binary":
|
|
123
|
-
return `${describe(node.left)} ${node.operator} ${describe(node.right)}.`;
|
|
124
|
-
|
|
125
|
-
case "unary":
|
|
126
|
-
return `${node.operator}${describe(node.operand)}.`;
|
|
127
|
-
|
|
128
|
-
case "postfix":
|
|
129
|
-
return `${describe(node.operand)}${node.operator}.`;
|
|
130
|
-
|
|
131
|
-
// ─────────── MEMORY / POINTERS ───────────
|
|
132
|
-
case "deref":
|
|
133
|
-
return `the value pointed to by ${describe(node.operand)}.`;
|
|
134
|
-
|
|
135
|
-
case "currency":
|
|
136
|
-
return `${describe(node.operand)} (in ${node.name}).`;
|
|
137
|
-
|
|
138
|
-
// ─────────── STRUCTURES ───────────
|
|
139
|
-
case "object":
|
|
140
|
-
return `object: { ${Object.entries(node.props)
|
|
141
|
-
.map(([k, v]) => `${k}: ${describe(v)}`)
|
|
142
|
-
.join(", ")} }.`;
|
|
143
|
-
|
|
144
|
-
case "array":
|
|
145
|
-
return `array: [${node.elements.map(e => describe(e)).join(", ")}].`;
|
|
146
|
-
|
|
147
|
-
// ─────────── PATTERNS ───────────
|
|
148
|
-
case "objpattern":
|
|
149
|
-
return `{ ${node.props
|
|
150
|
-
.map(p => `${p.key}${p.key !== p.alias ? ` as ${p.alias}` : ""}`)
|
|
151
|
-
.join(", ")} }`;
|
|
152
|
-
|
|
153
|
-
case "arrpattern":
|
|
154
|
-
return `[${node.elements.map(e => describe(e)).join(", ")}]`;
|
|
155
|
-
|
|
156
|
-
// ─────────── TEMPLATES ───────────
|
|
157
|
-
case "template":
|
|
158
|
-
return node.parts.map(p => describe(p)).join("");
|
|
159
|
-
|
|
160
|
-
// ─────────── EXECUTION ───────────
|
|
161
|
-
case "exec":
|
|
162
|
-
return `${indent}Execute: ${describe(node.expr)}.`;
|
|
163
|
-
|
|
164
|
-
// ─────────── FALLBACK ───────────
|
|
165
|
-
case "EOF":
|
|
166
|
-
return "";
|
|
167
|
-
default:
|
|
168
|
-
return `${indent}(Unknown node type: '${node.kind}')`;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// ─────────── HELPERS ───────────
|
|
173
|
-
function summarizeBody(body) {
|
|
174
|
-
if (!body || !body.length) return "does nothing";
|
|
175
|
-
const first = describe(body[0]);
|
|
176
|
-
if (body.length === 1) {
|
|
177
|
-
if (first.startsWith("Return")) return `returns ${first.replace(/^Return /, "").trim()}`;
|
|
178
|
-
return `does: ${first.toLowerCase()}`;
|
|
179
|
-
}
|
|
180
|
-
return "runs several steps in order";
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function capitalize(str) {
|
|
184
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
module.exports = { describe };
|