@mylasertools/kerfscript 0.4.0 → 0.6.0

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +125 -1
  2. package/LANGUAGE.md +26 -11
  3. package/README.md +79 -5
  4. package/dist/ast.d.cts +13 -1
  5. package/dist/ast.d.ts +13 -1
  6. package/dist/cli.js +7509 -1629
  7. package/dist/diagnostics.d.cts +6 -0
  8. package/dist/diagnostics.d.ts +6 -0
  9. package/dist/evaluator.d.cts +12 -0
  10. package/dist/evaluator.d.ts +12 -0
  11. package/dist/format.d.cts +4 -0
  12. package/dist/format.d.ts +4 -0
  13. package/dist/highlight.cjs +151 -0
  14. package/dist/highlight.d.cts +13 -0
  15. package/dist/highlight.d.ts +13 -0
  16. package/dist/highlight.js +131 -0
  17. package/dist/import/dbg.d.cts +1 -0
  18. package/dist/import/dbg.d.ts +1 -0
  19. package/dist/import/index.d.cts +16 -0
  20. package/dist/import/index.d.ts +16 -0
  21. package/dist/import/shapes.d.cts +76 -0
  22. package/dist/import/shapes.d.ts +76 -0
  23. package/dist/import/svg.d.cts +48 -0
  24. package/dist/import/svg.d.ts +48 -0
  25. package/dist/import/xml.d.cts +12 -0
  26. package/dist/import/xml.d.ts +12 -0
  27. package/dist/index.cjs +391 -13
  28. package/dist/index.d.cts +7 -3
  29. package/dist/index.d.ts +7 -3
  30. package/dist/index.js +391 -13
  31. package/dist/language.cjs +417 -0
  32. package/dist/language.d.cts +143 -0
  33. package/dist/language.d.ts +143 -0
  34. package/dist/language.js +417 -0
  35. package/dist/lexer.d.cts +17 -0
  36. package/dist/lexer.d.ts +17 -0
  37. package/dist/libraries.cjs +380 -0
  38. package/dist/libraries.d.cts +112 -0
  39. package/dist/libraries.d.ts +112 -0
  40. package/dist/libraries.js +380 -0
  41. package/dist/lsp.d.cts +12 -0
  42. package/dist/lsp.d.ts +12 -0
  43. package/dist/paths.d.cts +1 -1
  44. package/dist/paths.d.ts +1 -1
  45. package/dist/signatures.cjs +675 -0
  46. package/dist/signatures.d.cts +20 -0
  47. package/dist/signatures.d.ts +20 -0
  48. package/dist/signatures.js +655 -0
  49. package/docs/cli.md +54 -2
  50. package/docs/desktop.md +5 -0
  51. package/docs/editors.md +121 -0
  52. package/docs/import.md +149 -0
  53. package/docs/javascript.md +177 -10
  54. package/docs/kerf.md +10 -0
  55. package/docs/library/box.svg +11 -0
  56. package/docs/library/calibration.svg +11 -0
  57. package/docs/library/dividers.svg +11 -0
  58. package/docs/library/enclosure.svg +11 -0
  59. package/docs/library/hanging.svg +11 -0
  60. package/docs/library/hinge.svg +11 -0
  61. package/docs/library/tabs.svg +11 -0
  62. package/docs/library.md +339 -0
  63. package/docs/mcp.md +88 -0
  64. package/docs/openscad.md +1 -1
  65. package/docs/shared-libraries.md +229 -0
  66. package/docs/specification.md +529 -0
  67. package/docs/versions.md +2 -2
  68. package/package.json +52 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,129 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.0 (2026-11-02)
4
+
5
+ Language version 0.2, as in 0.5.0: programs run as before.
6
+
7
+ - Twenty-nine parametric examples, including a tea dispenser,
8
+ jewellery box, drawer cabinet, workshop holders, miniature furniture,
9
+ radial shade, sliding puzzle, game insert, cable chain, cantilever case,
10
+ beam balance, tilting stand, screw press, wheel calendar and laced mat.
11
+ Each has an animated preview in the gallery.
12
+ - `kerf import` and `importSvg()` turn an SVG drawing into a program. They
13
+ write circles, rectangles, polygons, tabs, slots, finger joints, hanger
14
+ holes, keyholes and hanging loops as the modules that make them, and
15
+ repeated holes as loops. Each part is checked against the drawing and
16
+ written as drawn when it does not match. Colours and group names become
17
+ layers, joint depth becomes `$thickness`, and outlines offset for a kerf
18
+ are moved back with `$kerf` set. A path with bad data is read up to the
19
+ error, as browsers draw it. `kerf import` does not replace a program
20
+ already next to the drawing unless it is named with `-o`. See
21
+ [Importing SVG drawings](docs/import.md).
22
+ - The playground imports SVG drawings: choose **Import SVG** or drop a file
23
+ on the editor.
24
+ - Lines are clipped to a part reliably. Scoring or cutting a closed
25
+ polyline inside a part could add lines that were not drawn, or stop with
26
+ an out of memory error; lines along a part's edge are now always left
27
+ out, where before some were kept (`topo-island` scores 34 mm less).
28
+ - Outlines with a spike drawn out and back, or points in a straight line
29
+ with their neighbours, no longer make rendering run out of memory.
30
+
31
+ ## 0.5.0 (2026-10-31)
32
+
33
+ Language version 0.2. Programs for 0.1 run as before, except where noted
34
+ below: `echo()` keeps the order of its arguments, built-in modules warn
35
+ about arguments they do not take, and `[(for ...)]` parses. The six new
36
+ standard libraries need 0.2, so a shared library that uses them can say so
37
+ with `"language": "0.2"` in its `kerf.json`.
38
+
39
+ - `@mylasertools/kerfscript/highlight`: syntax colouring as its own small
40
+ module (4 KB), for editors and pages that show KerfScript code. The site,
41
+ the playground and the desktop app use it. It also colours module and
42
+ function names where they are defined, layer modules, `true`, `false`,
43
+ `undef` and `PI`, the `* # %` modifiers, and customizer group headers
44
+ and controls.
45
+ - The playground keeps a block comment coloured across all its lines.
46
+ - [Specification](docs/specification.md): the formal grammar and the exact
47
+ rules for values, operators, scope, calls, libraries and errors.
48
+ - A conformance suite in `conformance/`: 92 small programs with their
49
+ expected output, errors, parts and layers. Every example's output is also
50
+ stored, so a change that alters a saved design fails a test.
51
+ - A library that uses or includes itself, directly or through others, is an
52
+ error naming the loop, where it used to fail with "Recursion too deep".
53
+ - A comprehension in parentheses can be the first item of a list:
54
+ `[(for (i = [0:2]) i)]`.
55
+ - `SIGNATURES` (also `@mylasertools/kerfscript/signatures`): every built-in
56
+ module and function with its parameters, defaults and a line of
57
+ documentation, for editors and help text. Tests keep it in step with the
58
+ interpreter, the highlighter, the VS Code grammar and the reference.
59
+ - Built-in modules and `assert`, `text_width`, `text_metrics` and
60
+ `finger_count` warn about named arguments they do not take, as user
61
+ modules and functions already did: `rect(10, radius = 2)` warns that
62
+ `radius` is unknown.
63
+ - [integrations/](integrations): four working laser-cutting generators, a
64
+ batch script, a web service, a web page and a Python script, each run by
65
+ the tests.
66
+ - Errors show where they are: `formatError()` and the command line print
67
+ the source line with the problem underlined, the module and function calls
68
+ it happened inside, and what a built-in takes when it was given an
69
+ unusable argument. The playground and the desktop app show the same.
70
+ `KerfError` has `reason`, `trace` and `call` for applications that show
71
+ errors their own way.
72
+ - Unknown variables, functions, modules and named arguments suggest a close
73
+ known name: `Unknown variable "widht". Did you mean "width"?`
74
+ - A function that calls itself without end reports the call and its line
75
+ instead of a message with no position.
76
+ - Positional arguments past a module's or function's parameters, built-in or
77
+ not, give a warning; they used to be dropped silently.
78
+ - `echo()` writes named and positional arguments in the order they are
79
+ given; named ones used to come last.
80
+ - Errors in calls point at the name called, and a missing comma says what
81
+ else could come next: `Expected "," or ")"`.
82
+ - `kerf fmt` and `format()`: the official formatter. It sets indentation,
83
+ spacing, blank lines and line endings, keeps line breaks and every comment
84
+ where it is, and checks that its output has the same tokens as the input.
85
+ `kerf fmt --check` lists unformatted files for CI, and `kerf fmt -` reads
86
+ standard input for editors. The examples and the standard library are
87
+ formatted with it; their output is unchanged.
88
+ - A VS Code extension in `editors/vscode` with a TextMate grammar, snippets
89
+ and file icons. A test checks that it colours every example the same way
90
+ as the highlighter.
91
+ - `kerf lsp`, the KerfScript language server, for VS Code (the extension
92
+ bundles it) and any editor with a Language Server Protocol client:
93
+ problems while you type, hover, completion, parameter hints, go to
94
+ definition, find references, rename, outline, links on library paths and
95
+ formatting. Designs run in a worker thread and stop after 10 seconds. See
96
+ [Editors](docs/editors.md).
97
+ - `@mylasertools/kerfscript/language`: the language server's answers as
98
+ functions, for editors in a browser or your own tools.
99
+ - `KerfError` has `warnings`, the warnings before the error.
100
+ - Standard library: six new libraries, each with a picture, an example and
101
+ tests, described in [Standard library](docs/library.md). `kerf/tabs`:
102
+ tab and slot joints. `kerf/hinge`: living hinge panels, `bend_length()`
103
+ and `flex_box()`, a box with round corners. `kerf/dividers`: egg-crate
104
+ dividers. `kerf/hanging`: keyholes, holes and hanging loops.
105
+ `kerf/enclosure`: boxes with a lid held by screws and nuts, with cutouts
106
+ and vents. `kerf/calibration`: a kerf gauge, a slot gauge and finger
107
+ joint test pairs.
108
+ - New examples built on them: a spice shelf, a flex box, a wall sign, a
109
+ project enclosure and a calibration set. The drawer organizer, the kerf
110
+ test and the hinge card now use the libraries; their output is unchanged,
111
+ except that the drawer organizer's dividers are named `long divider` and
112
+ `cross divider`.
113
+ - The editors colour the new library modules like `box()` and `divider()`.
114
+ - [Shared libraries](docs/shared-libraries.md): `kerf add`, `kerf remove`,
115
+ `kerf install` and `kerf pack`. A project's `kerf.json` names the
116
+ libraries it uses, from a GitHub tag, an https `.tar.gz` or a folder;
117
+ `kerf install` copies them into `kerf_libraries/` and pins each in
118
+ `kerf.lock` by its commit and a sha256 hash of its files. `--frozen`
119
+ and `--check` keep CI to exactly what is pinned. Designs load them with
120
+ `use <name/file>` in `kerf render`, the desktop app and the language
121
+ server, which also completes their paths. `kerf pack` checks a library's
122
+ files and `use` paths before it is published.
123
+ - `@mylasertools/kerfscript/libraries`: the same for Node.js, including
124
+ `resolver(file)`, a `resolve` option that finds libraries as the command
125
+ line does.
126
+
3
127
  ## 0.4.0 (2026-10-30)
4
128
 
5
129
  - Assembly: `part()` takes `at` and `rotate` to place a part in 3D, rotated
@@ -64,7 +188,7 @@
64
188
  desktop app), a Docker image, a snap, and Homebrew,
65
189
  Scoop, winget and AUR manifests, all built by the release workflow with
66
190
  SHA-256, SHA-512 and GPG signatures. Nightly builds go to a rolling
67
- `nightly` prerelease. See RELEASING.md.
191
+ `nightly` prerelease.
68
192
  - A `kerf(1)` man page and a `text/x-kerfscript` MIME type for `*.kerf` files
69
193
  in the Linux packages.
70
194
  - The command line and `kerfscript.wasm` have a font built in, Atkinson
package/LANGUAGE.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # KerfScript language reference
2
2
 
3
- Language version 0.1. Copyright (c) 2026 MyLaserTools. This document is
3
+ Language version 0.2. Copyright (c) 2026 MyLaserTools. This document is
4
4
  licensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
5
5
  "KerfScript" is a trademark of MyLaserTools, see [TRADEMARKS.md](TRADEMARKS.md).
6
6
 
7
7
  This reference covers KerfScript syntax, built-in modules and functions.
8
- For a first project, follow [Getting started](docs/getting-started.md).
8
+ For a first project, follow [Getting started](docs/getting-started.md). The
9
+ [specification](docs/specification.md) gives the formal grammar and the
10
+ exact rules for scope, evaluation, libraries and errors.
9
11
 
10
12
  Programs build 2D shapes, assign them to cut, score or engrave layers, and
11
13
  group them into parts. Rendering applies kerf compensation, arranges the
@@ -64,7 +66,7 @@ to change the order of evaluation.
64
66
  | `<` `<=` `>` `>=` | compare numbers or strings |
65
67
  | `+` `-` | add or subtract numbers or equal length lists; `+` joins strings |
66
68
  | `*` `/` `%` | multiply, divide, remainder; list times number scales; list times list is the dot product; matrix times vector |
67
- | `-x` `!x` | negate, not |
69
+ | `-x` `+x` `!x` | negate, same, not |
68
70
  | `a ^ b` | power, right associative and tighter than unary minus |
69
71
  | `f(x)` `a[i]` `a.x` | call, index, member |
70
72
 
@@ -126,12 +128,12 @@ Arguments can be positional or named: `rect([20, 10], r = 2)`.
126
128
 
127
129
  Place `*` before a module call to disable it. Use `#` or `%` to move its
128
130
  geometry to the guide layer. Guides are included only when requested in
129
- the render options.
131
+ the render options. `!` is accepted for OpenSCAD files and has no effect.
130
132
 
131
133
  ### children()
132
134
 
133
135
  Inside a module, `children()` renders all child statements passed by the
134
- caller. `children(i)` selects one child, using a zero-based index.
136
+ caller. `children(index)` selects one child by its position from 0, or several with a list of positions.
135
137
  `$children` is the number of children.
136
138
 
137
139
  ```kerf
@@ -380,12 +382,25 @@ to inspect the settings in a file.
380
382
 
381
383
  ## Standard library
382
384
 
383
- Load the box modules with `use <kerf/box>`:
384
-
385
- - `box([w, d, h], lid = false, finger)` makes the six (or five) panels of a
386
- finger-jointed box as parts `bottom`, `lid`, `front`, `back`, `left`,
387
- `right`. Sizes are outer sizes.
388
- - `divider([w, h], finger)` makes a divider with finger tabs on both sides.
385
+ Every renderer has these libraries built in. Load one with `use`, as
386
+ `use <kerf/box>`; [Standard library](docs/library.md) describes each
387
+ module and its parameters. Libraries others publish are installed with
388
+ `kerf add` and loaded by their name, as `use <feet/feet>`; see
389
+ [Shared libraries](docs/shared-libraries.md).
390
+
391
+ | Library | Modules and functions |
392
+ | ------------------ | --------------------------------------------------------------------------- |
393
+ | `kerf/box` | `box([w, d, h], lid = false, finger)`, `divider([w, h], finger)` |
394
+ | `kerf/tabs` | `tabs()`, `slots()`, `tab_rect()`, `tab_positions()`: tab and slot joints |
395
+ | `kerf/hinge` | `flex_rect()`, `flex_box()`, `flex_panel()`, `bend_length()`: living hinges |
396
+ | `kerf/dividers` | `grid_dividers()`, `slotted_divider()`: egg-crate dividers |
397
+ | `kerf/hanging` | `keyhole()`, `keyholes()`, `hanging_hole()`, `hanging_loop()` |
398
+ | `kerf/enclosure` | `enclosure()`, `enclosure_cutouts()`, `vents()`: boxes with a screwed lid |
399
+ | `kerf/calibration` | `kerf_gauge()`, `slot_gauge()`, `joint_test()`: test pieces |
400
+
401
+ `box()` makes the six (or five) panels of a finger-jointed box as parts
402
+ `bottom`, `lid`, `front`, `back`, `left`, `right`, from the outer size.
403
+ `divider()` makes a divider with finger tabs on both sides.
389
404
 
390
405
  ## Output
391
406
 
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  <p align="center">
6
6
  <a href="https://www.npmjs.com/package/@mylasertools/kerfscript"><img src="https://img.shields.io/npm/v/@mylasertools/kerfscript?color=d8361f&label=npm" alt="npm version"></a>
7
7
  <a href="COMMERCIAL-LICENSE.md"><img src="https://img.shields.io/badge/licence-AGPL--3.0%20or%20free%20commercial-1f1a17" alt="Licence: AGPL-3.0 or free commercial"></a>
8
- <a href="LANGUAGE.md"><img src="https://img.shields.io/badge/language-0.1-e3c69a" alt="Language version 0.1"></a>
8
+ <a href="LANGUAGE.md"><img src="https://img.shields.io/badge/language-0.2-e3c69a" alt="Language version 0.2"></a>
9
9
  <a href="https://kerfscript.mylasertools.com/playground/"><img src="https://img.shields.io/badge/try%20it-playground-5a3519" alt="Try it in the playground"></a>
10
10
  </p>
11
11
 
@@ -22,6 +22,13 @@ is to laser cutters what OpenSCAD is to 3D printers, except it was designed for
22
22
  flat parts from the start: cut, score and engrave layers, kerf compensation,
23
23
  finger joints, living hinges, parts and sheets are part of the language.
24
24
 
25
+ It is also a library for building **laser-cutting generators**: a web page,
26
+ web service, app or script that takes a few settings (a size, a name, a number
27
+ of slots) and returns SVG or DXF files ready to cut. The design is a `.kerf`
28
+ file; your code passes settings in and takes cut files out, in Node.js, the
29
+ browser, or any language that runs WebAssembly. See
30
+ [Build a generator](#build-a-generator).
31
+
25
32
  <p align="center">
26
33
  <a href="https://kerfscript.mylasertools.com/playground/?model=fractal-tree"><img src=".github/readme/playground.gif" alt="Moving a slider in the playground changes the number in the code and redraws the fractal tree" width="840"></a>
27
34
  <br><sub>The <a href="https://kerfscript.mylasertools.com/playground/">playground</a> runs the interpreter in your browser. A comment after a number turns it into a slider.</sub>
@@ -65,6 +72,59 @@ millimetre SVG with one layer per operation. Output is checked automatically
65
72
  in Inkscape; see [docs/compatibility.md](docs/compatibility.md) for what has
66
73
  and has not been tested in other laser software.
67
74
 
75
+ `kerf/box` is one of the libraries in the
76
+ [standard library](docs/library.md), built into every renderer:
77
+ [tabs and slots](docs/library.md#tabs-and-slots),
78
+ [living hinges](docs/library.md#living-hinges) and a box with round corners,
79
+ [egg-crate dividers](docs/library.md#dividers),
80
+ [keyholes and hanging loops](docs/library.md#hanging),
81
+ [enclosures](docs/library.md#enclosures) with a screwed-on lid, and
82
+ [test pieces](docs/library.md#calibration) that measure your laser's
83
+ kerf and how your sheet fits.
84
+
85
+ ## Build a generator
86
+
87
+ `parameters()` reads a design's settings, with their captions, ranges and
88
+ choices, so you can build a form or an API from them. `render()` turns
89
+ settings into cut files:
90
+
91
+ ```js
92
+ import { readFile } from 'node:fs/promises';
93
+ import { parameters, render } from '@mylasertools/kerfscript';
94
+
95
+ const design = await readFile('box.kerf', 'utf8'); // integrations/http-api/box.kerf
96
+ parameters(design).parameters; // width: number from 40 to 400, lid: boolean, ...
97
+
98
+ const { sheets, parts, warnings } = render(design, { params: { width: 200, lid: false } });
99
+ sheets[0].svg; // or sheets[0].dxf, one per sheet of material
100
+ parts; // [{ name: 'bottom', width: 200, height: 80, cutLength: 740, ... }]
101
+ ```
102
+
103
+ Working generators, each tested on every change, are in
104
+ [integrations/](integrations):
105
+
106
+ | Example | What it makes |
107
+ | ------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
108
+ | [Batch in Node.js](integrations/node-batch) | A name tag for every name in a list, as SVG and DXF, and all of them packed on one sheet |
109
+ | [Web service](integrations/http-api) | A box generator over HTTP: settings as JSON, cut files by URL, each render in a worker with a time limit |
110
+ | [Web page](integrations/browser) | A form built from the design's settings, a live preview and downloads, with no build step |
111
+ | [Python](integrations/python) | Boxes in several sizes from Python through `kerfscript.wasm`, without Node.js |
112
+
113
+ The [playground](https://kerfscript.mylasertools.com/playground/), the
114
+ [desktop app](docs/desktop.md) and the
115
+ [KerfScript Playground on MyLaserTools](https://www.mylasertools.com/kerfscript-playground)
116
+ are generators built the same way. Programs written by other people should
117
+ run in a worker you can stop; see
118
+ [Running untrusted code](docs/javascript.md#running-untrusted-code).
119
+
120
+ ## AI assistants
121
+
122
+ The KerfScript MCP server lets Claude, Cursor, VS Code and other assistants
123
+ read the docs and examples and render designs to check them. Add
124
+ `https://mcp.mylasertools.com/mcp`, which needs no account, or run it locally
125
+ with `npx -y @mylasertools/kerfscript-mcp`. See
126
+ [AI assistants](docs/mcp.md).
127
+
68
128
  ## Made with KerfScript
69
129
 
70
130
  Every model is a file in [examples/](examples). Open one on the website to
@@ -136,8 +196,15 @@ kerf render design.kerf -D width=200 -D 'label="Oak"' --font Inter.ttf
136
196
  kerf render design.kerf --sheet 400x300 --kerf 0.1 --split
137
197
  kerf params design.kerf # customizer parameters as JSON
138
198
  kerf check design.kerf # parts, sizes, cut length, warnings
199
+ kerf fmt designs/ # format .kerf files; --check for CI
200
+ kerf lsp # language server for editors
139
201
  ```
140
202
 
203
+ The VS Code extension in [editors/vscode](editors/vscode) underlines
204
+ problems as you type and has hover, completion, parameter hints, go to
205
+ definition, references, rename and formatting on save. Other editors run
206
+ `kerf lsp`: see [Editors](docs/editors.md).
207
+
141
208
  ## Library
142
209
 
143
210
  ```js
@@ -166,19 +233,26 @@ Errors are thrown as `KerfError` with `line` and `col`.
166
233
  [layers](docs/layers.md), [kerf](docs/kerf.md),
167
234
  [parts and sheets](docs/parts-and-sheets.md), [settings](docs/customizer.md),
168
235
  the [desktop app](docs/desktop.md), the [command line](docs/cli.md), the
169
- [JavaScript API](docs/javascript.md)
170
- and [WebAssembly](docs/webassembly.md) for other languages
236
+ [JavaScript API](docs/javascript.md),
237
+ [WebAssembly](docs/webassembly.md) for other languages and
238
+ [AI assistants](docs/mcp.md)
239
+ - [Standard library](docs/library.md): joints, hinges, dividers, hanging
240
+ holes, enclosures and test pieces, with a picture and an example of each
241
+ - [Shared libraries](docs/shared-libraries.md): use and publish `.kerf`
242
+ libraries, pinned in `kerf.lock` so a design cuts the same everywhere
243
+ - [Importing SVG drawings](docs/import.md): turn a drawing into a program,
244
+ with its circles, tabs, slots, finger joints and hanger holes found
171
245
  - [Coming from OpenSCAD](docs/openscad.md): what is the same and what is not
172
246
  - [LANGUAGE.md](LANGUAGE.md): the full language reference
173
247
  - [Versions](docs/versions.md): language and package versions, and what stays
174
248
  stable before 1.0
175
249
  - [examples/](examples): every model on the website, including a
176
- calibration square and a kerf test
250
+ calibration set, a calibration square and a kerf test
177
251
 
178
252
  ## Community
179
253
 
180
254
  Bug reports, cut reports and ideas are welcome; see
181
- [CONTRIBUTING.md](CONTRIBUTING.md), the [roadmap](ROADMAP.md),
255
+ [CONTRIBUTING.md](CONTRIBUTING.md),
182
256
  [SECURITY.md](SECURITY.md) and the [code of conduct](CODE_OF_CONDUCT.md).
183
257
 
184
258
  ## Licence
package/dist/ast.d.cts CHANGED
@@ -65,11 +65,13 @@ export type Expr = {
65
65
  params: Param[];
66
66
  body: Expr;
67
67
  pos: Pos;
68
+ end?: number;
68
69
  } | {
69
70
  kind: 'let';
70
71
  assigns: Assign[];
71
72
  body: Expr;
72
73
  pos: Pos;
74
+ end?: number;
73
75
  };
74
76
  export type ListItem = {
75
77
  kind: 'item';
@@ -81,6 +83,8 @@ export type ListItem = {
81
83
  kind: 'for';
82
84
  assigns: Assign[];
83
85
  body: ListItem;
86
+ pos?: Pos;
87
+ end?: number;
84
88
  } | {
85
89
  kind: 'if';
86
90
  cond: Expr;
@@ -90,21 +94,25 @@ export type ListItem = {
90
94
  kind: 'let';
91
95
  assigns: Assign[];
92
96
  body: ListItem;
97
+ pos?: Pos;
98
+ end?: number;
93
99
  };
94
100
  export interface Arg {
95
101
  name: string | null;
96
102
  value: Expr;
103
+ pos?: Pos;
97
104
  }
98
105
  export interface Param {
99
106
  name: string;
100
107
  default: Expr | null;
108
+ pos?: Pos;
101
109
  }
102
110
  export interface Assign {
103
111
  name: string;
104
112
  value: Expr;
105
113
  pos: Pos;
106
114
  }
107
- export type Stmt = {
115
+ export type Stmt = ({
108
116
  kind: 'assign';
109
117
  name: string;
110
118
  value: Expr;
@@ -116,12 +124,14 @@ export type Stmt = {
116
124
  params: Param[];
117
125
  body: Stmt[];
118
126
  pos: Pos;
127
+ namePos?: Pos;
119
128
  } | {
120
129
  kind: 'function';
121
130
  name: string;
122
131
  params: Param[];
123
132
  body: Expr;
124
133
  pos: Pos;
134
+ namePos?: Pos;
125
135
  } | {
126
136
  kind: 'call';
127
137
  name: string;
@@ -154,6 +164,8 @@ export type Stmt = {
154
164
  path: string;
155
165
  include: boolean;
156
166
  pos: Pos;
167
+ }) & {
168
+ end?: number;
157
169
  };
158
170
  export interface Program {
159
171
  body: Stmt[];
package/dist/ast.d.ts CHANGED
@@ -65,11 +65,13 @@ export type Expr = {
65
65
  params: Param[];
66
66
  body: Expr;
67
67
  pos: Pos;
68
+ end?: number;
68
69
  } | {
69
70
  kind: 'let';
70
71
  assigns: Assign[];
71
72
  body: Expr;
72
73
  pos: Pos;
74
+ end?: number;
73
75
  };
74
76
  export type ListItem = {
75
77
  kind: 'item';
@@ -81,6 +83,8 @@ export type ListItem = {
81
83
  kind: 'for';
82
84
  assigns: Assign[];
83
85
  body: ListItem;
86
+ pos?: Pos;
87
+ end?: number;
84
88
  } | {
85
89
  kind: 'if';
86
90
  cond: Expr;
@@ -90,21 +94,25 @@ export type ListItem = {
90
94
  kind: 'let';
91
95
  assigns: Assign[];
92
96
  body: ListItem;
97
+ pos?: Pos;
98
+ end?: number;
93
99
  };
94
100
  export interface Arg {
95
101
  name: string | null;
96
102
  value: Expr;
103
+ pos?: Pos;
97
104
  }
98
105
  export interface Param {
99
106
  name: string;
100
107
  default: Expr | null;
108
+ pos?: Pos;
101
109
  }
102
110
  export interface Assign {
103
111
  name: string;
104
112
  value: Expr;
105
113
  pos: Pos;
106
114
  }
107
- export type Stmt = {
115
+ export type Stmt = ({
108
116
  kind: 'assign';
109
117
  name: string;
110
118
  value: Expr;
@@ -116,12 +124,14 @@ export type Stmt = {
116
124
  params: Param[];
117
125
  body: Stmt[];
118
126
  pos: Pos;
127
+ namePos?: Pos;
119
128
  } | {
120
129
  kind: 'function';
121
130
  name: string;
122
131
  params: Param[];
123
132
  body: Expr;
124
133
  pos: Pos;
134
+ namePos?: Pos;
125
135
  } | {
126
136
  kind: 'call';
127
137
  name: string;
@@ -154,6 +164,8 @@ export type Stmt = {
154
164
  path: string;
155
165
  include: boolean;
156
166
  pos: Pos;
167
+ }) & {
168
+ end?: number;
157
169
  };
158
170
  export interface Program {
159
171
  body: Stmt[];