trebol 0.1.1 → 0.2.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.
- package/README.md +12 -1
- package/dist/cli.js +17097 -12238
- package/dist/fonts/OFL.txt +93 -0
- package/dist/fonts/inter-cyrillic-ext.woff2 +0 -0
- package/dist/fonts/inter-cyrillic.woff2 +0 -0
- package/dist/fonts/inter-greek-ext.woff2 +0 -0
- package/dist/fonts/inter-greek.woff2 +0 -0
- package/dist/fonts/inter-latin-ext.woff2 +0 -0
- package/dist/fonts/inter-latin.woff2 +0 -0
- package/dist/fonts/inter-vietnamese.woff2 +0 -0
- package/dist/lib/core/boot.js +12 -8
- package/dist/lib/core/eval.js +2 -2
- package/dist/lib/core/func.d.ts +4 -0
- package/dist/lib/core/machine/checks.d.ts +1 -0
- package/dist/lib/core/machine/checks.js +250 -0
- package/dist/lib/core/machine/events.d.ts +1 -0
- package/dist/lib/core/machine/events.js +365 -0
- package/dist/lib/core/machine/running.d.ts +1 -0
- package/dist/lib/core/machine/running.js +180 -0
- package/dist/lib/core/machine/shared.d.ts +1 -0
- package/dist/lib/core/machine/shared.js +123 -0
- package/dist/lib/core/machine/snapshot.d.ts +1 -0
- package/dist/lib/core/machine/snapshot.js +244 -0
- package/dist/lib/core/machine/spec.d.ts +1 -0
- package/dist/lib/core/machine/spec.js +274 -0
- package/dist/lib/core/machine/words.d.ts +1 -0
- package/dist/lib/core/machine/words.js +98 -0
- package/dist/lib/core/machine.d.ts +1 -0
- package/dist/lib/core/machine.js +17 -0
- package/dist/lib/core/mezz.js +31 -0
- package/dist/lib/core/natives/control.js +2 -2
- package/dist/lib/core/natives/data.js +6 -1
- package/dist/lib/core/natives/series.js +59 -9
- package/dist/lib/core/natives/text.js +3 -1
- package/dist/lib/host/browser/calendar.d.ts +34 -0
- package/dist/lib/host/browser/calendar.js +268 -0
- package/dist/lib/host/browser/count.d.ts +15 -0
- package/dist/lib/host/browser/count.js +48 -0
- package/dist/lib/host/browser/dialogs.d.ts +39 -0
- package/dist/lib/host/browser/dialogs.js +443 -0
- package/dist/lib/host/browser/drag.d.ts +70 -0
- package/dist/lib/host/browser/drag.js +268 -0
- package/dist/lib/host/browser/drawings.d.ts +30 -0
- package/dist/lib/host/browser/drawings.js +176 -0
- package/dist/lib/host/browser/events.d.ts +16 -0
- package/dist/lib/host/browser/events.js +125 -0
- package/dist/lib/host/browser/faces.d.ts +35 -0
- package/dist/lib/host/browser/faces.js +131 -0
- package/dist/lib/host/browser/fields.d.ts +16 -0
- package/dist/lib/host/browser/fields.js +322 -0
- package/dist/lib/host/browser/keys.d.ts +29 -0
- package/dist/lib/host/browser/keys.js +151 -0
- package/dist/lib/host/browser/lookup.d.ts +25 -0
- package/dist/lib/host/browser/lookup.js +275 -0
- package/dist/lib/host/browser/menus.d.ts +20 -0
- package/dist/lib/host/browser/menus.js +149 -0
- package/dist/lib/host/browser/mount.d.ts +92 -0
- package/dist/lib/host/browser/mount.js +448 -0
- package/dist/lib/host/browser/orbits.d.ts +90 -0
- package/dist/lib/host/browser/orbits.js +379 -0
- package/dist/lib/host/browser/page.d.ts +13 -0
- package/dist/lib/host/browser/page.js +35 -0
- package/dist/lib/host/browser/richtext.d.ts +19 -0
- package/dist/lib/host/browser/richtext.js +379 -0
- package/dist/lib/host/browser/row-faces.d.ts +5 -0
- package/dist/lib/host/browser/row-faces.js +74 -0
- package/dist/lib/host/browser/screens.d.ts +37 -0
- package/dist/lib/host/browser/screens.js +140 -0
- package/dist/lib/host/browser/swipe.d.ts +31 -0
- package/dist/lib/host/browser/swipe.js +178 -0
- package/dist/lib/host/browser/sync.d.ts +24 -0
- package/dist/lib/host/browser/sync.js +450 -0
- package/dist/lib/host/browser/tables.d.ts +65 -0
- package/dist/lib/host/browser/tables.js +505 -0
- package/dist/lib/host/browser/times.d.ts +14 -0
- package/dist/lib/host/browser/times.js +114 -0
- package/dist/lib/host/browser/toolbars.d.ts +17 -0
- package/dist/lib/host/browser/toolbars.js +129 -0
- package/dist/lib/host/browser/trees.d.ts +20 -0
- package/dist/lib/host/browser/trees.js +235 -0
- package/dist/lib/host/browser/uploads.d.ts +29 -0
- package/dist/lib/host/browser/uploads.js +370 -0
- package/dist/lib/host/browser/widget.d.ts +13 -0
- package/dist/lib/host/browser/widget.js +105 -0
- package/dist/lib/host/browser.d.ts +25 -0
- package/dist/lib/host/browser.js +129 -3964
- package/dist/lib/host/devlog.d.ts +11 -0
- package/dist/lib/host/devlog.js +13 -0
- package/dist/lib/host/devtools/console.d.ts +9 -0
- package/dist/lib/host/devtools/console.js +104 -0
- package/dist/lib/host/devtools/faces.d.ts +25 -0
- package/dist/lib/host/devtools/faces.js +169 -0
- package/dist/lib/host/devtools/log.d.ts +3 -0
- package/dist/lib/host/devtools/log.js +32 -0
- package/dist/lib/host/devtools/machines.d.ts +34 -0
- package/dist/lib/host/devtools/machines.js +212 -0
- package/dist/lib/host/devtools/read.d.ts +13 -0
- package/dist/lib/host/devtools/read.js +52 -0
- package/dist/lib/host/devtools/state.d.ts +90 -0
- package/dist/lib/host/devtools/state.js +123 -0
- package/dist/lib/host/devtools.d.ts +19 -0
- package/dist/lib/host/devtools.js +238 -0
- package/dist/lib/host/fonts/OFL.txt +93 -0
- package/dist/lib/host/fonts/inter-cyrillic-ext.woff2 +0 -0
- package/dist/lib/host/fonts/inter-cyrillic.woff2 +0 -0
- package/dist/lib/host/fonts/inter-greek-ext.woff2 +0 -0
- package/dist/lib/host/fonts/inter-greek.woff2 +0 -0
- package/dist/lib/host/fonts/inter-latin-ext.woff2 +0 -0
- package/dist/lib/host/fonts/inter-latin.woff2 +0 -0
- package/dist/lib/host/fonts/inter-vietnamese.woff2 +0 -0
- package/dist/lib/host/fonts.d.ts +11 -0
- package/dist/lib/host/fonts.js +30 -0
- package/dist/lib/host/icons.js +4 -0
- package/dist/lib/host/index.d.ts +5 -1
- package/dist/lib/host/index.js +110 -5
- package/dist/lib/host/js.d.ts +5 -0
- package/dist/lib/host/js.js +130 -0
- package/dist/lib/host/locale.d.ts +18 -0
- package/dist/lib/host/locale.js +75 -5
- package/dist/lib/host/markdown.d.ts +6 -0
- package/dist/lib/host/markdown.js +18 -0
- package/dist/lib/host/modules.d.ts +4 -0
- package/dist/lib/host/modules.js +157 -20
- package/dist/lib/host/motion.d.ts +32 -0
- package/dist/lib/host/motion.js +190 -0
- package/dist/lib/host/net.js +14 -3
- package/dist/lib/host/orbit.d.ts +121 -0
- package/dist/lib/host/orbit.js +374 -0
- package/dist/lib/host/palette.d.ts +17 -0
- package/dist/lib/host/palette.js +131 -0
- package/dist/lib/host/rows.d.ts +14 -0
- package/dist/lib/host/rows.js +29 -0
- package/dist/lib/host/scheduler.d.ts +8 -0
- package/dist/lib/host/scheduler.js +64 -36
- package/dist/lib/host/share.d.ts +31 -0
- package/dist/lib/host/share.js +134 -0
- package/dist/lib/host/theme/classic.d.ts +1 -0
- package/dist/lib/host/theme/classic.js +120 -0
- package/dist/lib/host/theme/cupertino.d.ts +1 -0
- package/dist/lib/host/theme/cupertino.js +65 -0
- package/dist/lib/host/theme/data.d.ts +1 -0
- package/dist/lib/host/theme/data.js +109 -0
- package/dist/lib/host/theme/devtools.d.ts +1 -0
- package/dist/lib/host/theme/devtools.js +166 -0
- package/dist/lib/host/theme/dialogs.d.ts +1 -0
- package/dist/lib/host/theme/dialogs.js +63 -0
- package/dist/lib/host/theme/fluent.d.ts +1 -0
- package/dist/lib/host/theme/fluent.js +64 -0
- package/dist/lib/host/theme/forms.d.ts +1 -0
- package/dist/lib/host/theme/forms.js +239 -0
- package/dist/lib/host/theme/fusion.d.ts +1 -0
- package/dist/lib/host/theme/fusion.js +66 -0
- package/dist/lib/host/theme/layout.d.ts +1 -0
- package/dist/lib/host/theme/layout.js +166 -0
- package/dist/lib/host/theme/media.d.ts +1 -0
- package/dist/lib/host/theme/media.js +106 -0
- package/dist/lib/host/theme/navigation.d.ts +1 -0
- package/dist/lib/host/theme/navigation.js +36 -0
- package/dist/lib/host/theme/panes.d.ts +1 -0
- package/dist/lib/host/theme/panes.js +99 -0
- package/dist/lib/host/theme/popups.d.ts +1 -0
- package/dist/lib/host/theme/popups.js +149 -0
- package/dist/lib/host/theme/responsive.d.ts +1 -0
- package/dist/lib/host/theme/responsive.js +103 -0
- package/dist/lib/host/theme/toasts.d.ts +1 -0
- package/dist/lib/host/theme/toasts.js +62 -0
- package/dist/lib/host/theme.js +19 -1179
- package/dist/lib/ui/dialect/events.trb +276 -0
- package/dist/lib/ui/dialect/faces.trb +135 -0
- package/dist/lib/ui/dialect/layout.trb +283 -0
- package/dist/lib/ui/dialect/palette.trb +87 -0
- package/dist/lib/ui/dialect/problems.trb +174 -0
- package/dist/lib/ui/dialect/reactions.trb +198 -0
- package/dist/lib/ui/dialect/rows.trb +208 -0
- package/dist/lib/ui/dialect/screens.trb +293 -0
- package/dist/lib/ui/dialect/steps.trb +203 -0
- package/dist/lib/ui/dialect/validation.trb +137 -0
- package/dist/lib/ui/dialect/view.trb +110 -0
- package/dist/lib/ui/dialect/walking.trb +98 -0
- package/dist/lib/ui/dialect/words.trb +70 -0
- package/dist/lib/ui/i18n.trb +23 -0
- package/dist/lib/ui/test.trb +12 -0
- package/dist/lib/ui/testing/actions.trb +421 -0
- package/dist/lib/ui/testing/faces.trb +148 -0
- package/dist/lib/ui/testing/server.trb +73 -0
- package/dist/lib/ui/ui.trb +25 -1234
- package/dist/trebol.js +4882 -1088
- package/editors/vscode/README.md +15 -0
- package/editors/vscode/language-configuration.json +28 -0
- package/editors/vscode/package.json +42 -0
- package/editors/vscode/syntaxes/trebol.tmLanguage.json +237 -0
- package/package.json +7 -3
- package/src/core/boot.ts +10 -7
- package/src/core/eval.ts +2 -2
- package/src/core/func.ts +4 -0
- package/src/core/machine/checks.ts +251 -0
- package/src/core/machine/events.ts +366 -0
- package/src/core/machine/running.ts +181 -0
- package/src/core/machine/shared.ts +124 -0
- package/src/core/machine/snapshot.ts +245 -0
- package/src/core/machine/spec.ts +275 -0
- package/src/core/machine/words.ts +99 -0
- package/src/core/machine.ts +20 -0
- package/src/core/mezz.ts +31 -0
- package/src/core/natives/control.ts +2 -2
- package/src/core/natives/data.ts +6 -1
- package/src/core/natives/parse.ts +1 -1
- package/src/core/natives/series.ts +55 -11
- package/src/core/natives/text.ts +2 -1
- package/src/host/browser/calendar.ts +264 -0
- package/src/host/browser/count.ts +48 -0
- package/src/host/browser/dialogs.ts +439 -0
- package/src/host/browser/drag.ts +278 -0
- package/src/host/browser/drawings.ts +178 -0
- package/src/host/browser/events.ts +117 -0
- package/src/host/browser/faces.ts +143 -0
- package/src/host/browser/fields.ts +315 -0
- package/src/host/browser/keys.ts +145 -0
- package/src/host/browser/lookup.ts +262 -0
- package/src/host/browser/menus.ts +146 -0
- package/src/host/browser/mount.ts +420 -0
- package/src/host/browser/orbits.ts +418 -0
- package/src/host/browser/page.ts +43 -0
- package/src/host/browser/richtext.ts +346 -0
- package/src/host/browser/row-faces.ts +75 -0
- package/src/host/browser/screens.ts +142 -0
- package/src/host/browser/swipe.ts +168 -0
- package/src/host/browser/sync.ts +354 -0
- package/src/host/browser/tables.ts +461 -0
- package/src/host/browser/times.ts +115 -0
- package/src/host/browser/toolbars.ts +126 -0
- package/src/host/browser/trees.ts +205 -0
- package/src/host/browser/uploads.ts +367 -0
- package/src/host/browser/widget.ts +103 -0
- package/src/host/browser.ts +128 -3747
- package/src/host/devlog.ts +16 -0
- package/src/host/devtools/console.ts +102 -0
- package/src/host/devtools/faces.ts +160 -0
- package/src/host/devtools/log.ts +34 -0
- package/src/host/devtools/machines.ts +208 -0
- package/src/host/devtools/read.ts +58 -0
- package/src/host/devtools/state.ts +148 -0
- package/src/host/devtools.ts +238 -0
- package/src/host/fonts/OFL.txt +93 -0
- package/src/host/fonts/inter-cyrillic-ext.woff2 +0 -0
- package/src/host/fonts/inter-cyrillic.woff2 +0 -0
- package/src/host/fonts/inter-greek-ext.woff2 +0 -0
- package/src/host/fonts/inter-greek.woff2 +0 -0
- package/src/host/fonts/inter-latin-ext.woff2 +0 -0
- package/src/host/fonts/inter-latin.woff2 +0 -0
- package/src/host/fonts/inter-vietnamese.woff2 +0 -0
- package/src/host/fonts.ts +40 -0
- package/src/host/icons.ts +4 -0
- package/src/host/index.ts +110 -5
- package/src/host/js.ts +127 -0
- package/src/host/locale.ts +71 -5
- package/src/host/markdown.ts +18 -0
- package/src/host/modules.ts +150 -22
- package/src/host/motion.ts +204 -0
- package/src/host/net.ts +13 -3
- package/src/host/orbit.ts +432 -0
- package/src/host/palette.ts +139 -0
- package/src/host/rows.ts +30 -0
- package/src/host/scheduler.ts +67 -36
- package/src/host/share.ts +168 -0
- package/src/host/theme/classic.ts +121 -0
- package/src/host/theme/cupertino.ts +66 -0
- package/src/host/theme/data.ts +110 -0
- package/src/host/theme/devtools.ts +167 -0
- package/src/host/theme/dialogs.ts +64 -0
- package/src/host/theme/fluent.ts +65 -0
- package/src/host/theme/forms.ts +240 -0
- package/src/host/theme/fusion.ts +67 -0
- package/src/host/theme/layout.ts +167 -0
- package/src/host/theme/media.ts +107 -0
- package/src/host/theme/navigation.ts +37 -0
- package/src/host/theme/panes.ts +100 -0
- package/src/host/theme/popups.ts +150 -0
- package/src/host/theme/responsive.ts +104 -0
- package/src/host/theme/toasts.ts +63 -0
- package/src/host/theme.ts +19 -1179
- package/src/ui/dialect/events.trb +276 -0
- package/src/ui/dialect/faces.trb +135 -0
- package/src/ui/dialect/layout.trb +283 -0
- package/src/ui/dialect/palette.trb +87 -0
- package/src/ui/dialect/problems.trb +174 -0
- package/src/ui/dialect/reactions.trb +198 -0
- package/src/ui/dialect/rows.trb +208 -0
- package/src/ui/dialect/screens.trb +293 -0
- package/src/ui/dialect/steps.trb +203 -0
- package/src/ui/dialect/validation.trb +137 -0
- package/src/ui/dialect/view.trb +110 -0
- package/src/ui/dialect/walking.trb +98 -0
- package/src/ui/dialect/words.trb +70 -0
- package/src/ui/i18n.trb +23 -0
- package/src/ui/test.trb +12 -0
- package/src/ui/testing/actions.trb +421 -0
- package/src/ui/testing/faces.trb +148 -0
- package/src/ui/testing/server.trb +73 -0
- package/src/ui/ui.trb +25 -1234
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Trebol for Visual Studio Code
|
|
2
|
+
|
|
3
|
+
Colors for [Trebol](https://github.com/acasadom/trebol) `.trb` files: comments, strings and escapes, every
|
|
4
|
+
literal datatype (numbers, money, dates, times, pairs, tuples, files, urls, emails, tags, binaries), set-words,
|
|
5
|
+
get-words, lit-words, refinements, datatypes, and the words of control flow. `;` comments a line out, and
|
|
6
|
+
brackets close and indent themselves.
|
|
7
|
+
|
|
8
|
+
To install it, copy this folder into VS Code's extensions folder and restart VS Code:
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
cp -R node_modules/trebol/editors/vscode ~/.vscode/extensions/trebol
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The grammar is written by `tools/grammar.ts` (`npm run grammar`) from the rules of Trebol's lexer;
|
|
15
|
+
`test/grammar.test.ts` checks it colors every `.trb` file of the repository the way `load` reads it.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"comments": {
|
|
3
|
+
"lineComment": ";"
|
|
4
|
+
},
|
|
5
|
+
"brackets": [
|
|
6
|
+
["[", "]"],
|
|
7
|
+
["(", ")"],
|
|
8
|
+
["{", "}"]
|
|
9
|
+
],
|
|
10
|
+
"autoClosingPairs": [
|
|
11
|
+
{ "open": "[", "close": "]" },
|
|
12
|
+
{ "open": "(", "close": ")" },
|
|
13
|
+
{ "open": "{", "close": "}" },
|
|
14
|
+
{ "open": "\"", "close": "\"", "notIn": ["string", "comment"] }
|
|
15
|
+
],
|
|
16
|
+
"surroundingPairs": [
|
|
17
|
+
["[", "]"],
|
|
18
|
+
["(", ")"],
|
|
19
|
+
["{", "}"],
|
|
20
|
+
["\"", "\""],
|
|
21
|
+
["<", ">"]
|
|
22
|
+
],
|
|
23
|
+
"wordPattern": "[^\\s@#$%^,:'/\\\\\"()\\[\\]{};]+",
|
|
24
|
+
"indentationRules": {
|
|
25
|
+
"increaseIndentPattern": "[\\[(]\\s*(;.*)?$",
|
|
26
|
+
"decreaseIndentPattern": "^\\s*[\\])]"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "trebol",
|
|
3
|
+
"displayName": "Trebol",
|
|
4
|
+
"description": "Syntax highlighting for Trebol (.trb files)",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"publisher": "acasadom",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"homepage": "https://github.com/acasadom/trebol",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/acasadom/trebol.git",
|
|
12
|
+
"directory": "editors/vscode"
|
|
13
|
+
},
|
|
14
|
+
"engines": {
|
|
15
|
+
"vscode": "^1.75.0"
|
|
16
|
+
},
|
|
17
|
+
"categories": [
|
|
18
|
+
"Programming Languages"
|
|
19
|
+
],
|
|
20
|
+
"contributes": {
|
|
21
|
+
"languages": [
|
|
22
|
+
{
|
|
23
|
+
"id": "trebol",
|
|
24
|
+
"aliases": [
|
|
25
|
+
"Trebol",
|
|
26
|
+
"trebol"
|
|
27
|
+
],
|
|
28
|
+
"extensions": [
|
|
29
|
+
".trb"
|
|
30
|
+
],
|
|
31
|
+
"configuration": "./language-configuration.json"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"grammars": [
|
|
35
|
+
{
|
|
36
|
+
"language": "trebol",
|
|
37
|
+
"scopeName": "source.trebol",
|
|
38
|
+
"path": "./syntaxes/trebol.tmLanguage.json"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
|
3
|
+
"name": "Trebol",
|
|
4
|
+
"scopeName": "source.trebol",
|
|
5
|
+
"fileTypes": [
|
|
6
|
+
"trb"
|
|
7
|
+
],
|
|
8
|
+
"patterns": [
|
|
9
|
+
{
|
|
10
|
+
"include": "#value"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"repository": {
|
|
14
|
+
"value": {
|
|
15
|
+
"patterns": [
|
|
16
|
+
{
|
|
17
|
+
"include": "#comment"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"include": "#string"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"include": "#braced"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"include": "#hash"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"include": "#tag"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"include": "#file"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"include": "#scalar"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"include": "#word"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"include": "#path"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"include": "#bracket"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"comment": {
|
|
49
|
+
"match": ";.*$",
|
|
50
|
+
"name": "comment.line.semicolon.trebol"
|
|
51
|
+
},
|
|
52
|
+
"escape": {
|
|
53
|
+
"match": "\\^(?:\\([^)]*\\)|.)",
|
|
54
|
+
"name": "constant.character.escape.trebol"
|
|
55
|
+
},
|
|
56
|
+
"string": {
|
|
57
|
+
"begin": "\"",
|
|
58
|
+
"end": "\"|$",
|
|
59
|
+
"name": "string.quoted.double.trebol",
|
|
60
|
+
"patterns": [
|
|
61
|
+
{
|
|
62
|
+
"include": "#escape"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
"braced": {
|
|
67
|
+
"begin": "\\{",
|
|
68
|
+
"end": "\\}",
|
|
69
|
+
"name": "string.quoted.other.braces.trebol",
|
|
70
|
+
"patterns": [
|
|
71
|
+
{
|
|
72
|
+
"include": "#escape"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"include": "#braced-inner"
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
"braced-inner": {
|
|
80
|
+
"begin": "\\{",
|
|
81
|
+
"end": "\\}",
|
|
82
|
+
"patterns": [
|
|
83
|
+
{
|
|
84
|
+
"include": "#escape"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"include": "#braced-inner"
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
"hash": {
|
|
92
|
+
"patterns": [
|
|
93
|
+
{
|
|
94
|
+
"match": "#\"(?:\\^(?:\\([^)]*\\)|.)|[^\"])\"",
|
|
95
|
+
"name": "constant.character.trebol"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"begin": "(?<![^\\s\\[\\](){}\"])(?:2|16|64)?#\\{",
|
|
99
|
+
"end": "\\}",
|
|
100
|
+
"name": "constant.other.binary.trebol"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"match": "#[\\[(]",
|
|
104
|
+
"name": "punctuation.definition.construction.trebol"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?:#[^\\s\\[\\](){}\";]+)(?=[\\s\\[\\](){}\";]|$)",
|
|
108
|
+
"name": "constant.other.issue.trebol"
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
"tag": {
|
|
113
|
+
"begin": "<(?=[A-Za-z/!?])",
|
|
114
|
+
"end": ">",
|
|
115
|
+
"name": "entity.name.tag.trebol",
|
|
116
|
+
"patterns": [
|
|
117
|
+
{
|
|
118
|
+
"begin": "\"",
|
|
119
|
+
"end": "\""
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"begin": "'",
|
|
123
|
+
"end": "'"
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
"file": {
|
|
128
|
+
"patterns": [
|
|
129
|
+
{
|
|
130
|
+
"begin": "%\"",
|
|
131
|
+
"end": "\"|$",
|
|
132
|
+
"name": "string.quoted.double.file.trebol"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?:%(?!%?:?(?:[\\s\\[\\](){}\";]|$))[^\\s\\[\\](){}\";]+)(?=[\\s\\[\\](){}\";]|$)",
|
|
136
|
+
"name": "string.unquoted.file.trebol"
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
"scalar": {
|
|
141
|
+
"patterns": [
|
|
142
|
+
{
|
|
143
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?:[A-Za-z][A-Za-z0-9+.\\-]*:[^\\s\\[\\](){}\";]+)(?=[\\s\\[\\](){}\";]|$)",
|
|
144
|
+
"name": "markup.underline.link.url.trebol"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?:[^@/\\s\\[\\](){}\";][^@\\s\\[\\](){}\";]*@[^@\\s\\[\\](){}\";]*)(?=[\\s\\[\\](){}\";]|$)",
|
|
148
|
+
"name": "string.unquoted.email.trebol"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?:[+-]?(?:[A-Za-z]{3})?\\$[+-]?(?:\\d[\\d']*(?:[.,]\\d*)?|[.,]\\d+))(?=[\\s\\[\\](){}\";]|$)",
|
|
152
|
+
"name": "constant.numeric.money.trebol"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?:\\d+([-/])(?:[A-Za-z]+|\\d+)\\1\\d+(?:[/T][^\\s\\[\\](){}\";]+)?)(?=[\\s\\[\\](){}\";]|$)",
|
|
156
|
+
"name": "constant.numeric.date.trebol"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?:[+-]?\\d+:\\d+(?::\\d+(?:[.,]\\d+)?)?)(?=[\\s\\[\\](){}\";]|$)",
|
|
160
|
+
"name": "constant.numeric.time.trebol"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?:\\d+(?:\\.\\d+){2,11})(?=[\\s\\[\\](){}\";]|$)",
|
|
164
|
+
"name": "constant.numeric.tuple.trebol"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?:[+-]?(?:\\d[\\d']*(?:[.,]\\d*)?|[.,]\\d+)(?:[eE][+-]?\\d+)?[xX][+-]?(?:\\d[\\d']*(?:[.,]\\d*)?|[.,]\\d+)(?:[eE][+-]?\\d+)?)(?=[\\s\\[\\](){}\";]|$)",
|
|
168
|
+
"name": "constant.numeric.pair.trebol"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?:[+-]?(?:\\d[\\d']*(?:[.,]\\d*)?|[.,]\\d+)(?:[eE][+-]?\\d+)?%)(?=[\\s\\[\\](){}\";]|$)",
|
|
172
|
+
"name": "constant.numeric.percent.trebol"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?:[+-]?\\d[\\d']*)(?=[\\s\\[\\](){}\";]|$)",
|
|
176
|
+
"name": "constant.numeric.integer.trebol"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?:[+-]?(?:\\d[\\d']*(?:[.,]\\d*)?|[.,]\\d+)(?:[eE][+-]?\\d+)?)(?=[\\s\\[\\](){}\";]|$)",
|
|
180
|
+
"name": "constant.numeric.decimal.trebol"
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
"word": {
|
|
185
|
+
"patterns": [
|
|
186
|
+
{
|
|
187
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?:(?![+-]?\\.?\\d)[^\\s@#$%^,:'/\\\\\"()\\[\\]{};]+(?:/[^\\s\\[\\](){}\";/]+)*:)(?=[\\s\\[\\](){}\";]|$)",
|
|
188
|
+
"name": "entity.name.variable.set-word.trebol"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?::(?![+-]?\\.?\\d)[^\\s@#$%^,:'/\\\\\"()\\[\\]{};]+(?:/[^\\s\\[\\](){}\";/]+)*)(?=[\\s\\[\\](){}\";]|$)",
|
|
192
|
+
"name": "variable.other.get-word.trebol"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?:'(?![+-]?\\.?\\d)[^\\s@#$%^,:'/\\\\\"()\\[\\]{};]+(?:/[^\\s\\[\\](){}\";/]+)*)(?=[\\s\\[\\](){}\";]|$)",
|
|
196
|
+
"name": "constant.other.symbol.lit-word.trebol"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?:(?:\\+|-|\\*|\\*\\*|\\/|\\/\\/|%|%%|=|==|<>|!=|<|>|<=|>=|=\\?|and|or|xor))(?=[\\s\\[\\](){}\";]|$)",
|
|
200
|
+
"name": "keyword.operator.trebol"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?:/(?![+-]?\\.?\\d)[^\\s@#$%^,:'/\\\\\"()\\[\\]{};]+)(?=[\\s\\[\\](){}\";]|$)",
|
|
204
|
+
"name": "variable.parameter.refinement.trebol"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?:(?![+-]?\\.?\\d)[^\\s@#$%^,:'/\\\\\"()\\[\\]{};]+!)(?=[\\s\\[\\](){}\";/]|$)",
|
|
208
|
+
"name": "support.type.datatype.trebol"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?:(?i:true|false|none|yes|no|on|off))(?=[\\s\\[\\](){}\";/]|$)",
|
|
212
|
+
"name": "constant.language.trebol"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"match": "(?<![^\\s\\[\\](){}\"])(?:(?i:if|either|unless|case|switch|while|until|loop|repeat|foreach|forall|forskip|forever|break|continue|return|exit|throw|catch|try|attempt|do|func|function|does|has|closure))(?=[\\s\\[\\](){}\";/]|$)",
|
|
216
|
+
"name": "keyword.control.trebol"
|
|
217
|
+
}
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
"path": {
|
|
221
|
+
"match": "(?<=[^\\s\\[\\](){}\";]|\\))/",
|
|
222
|
+
"name": "punctuation.separator.path.trebol"
|
|
223
|
+
},
|
|
224
|
+
"bracket": {
|
|
225
|
+
"patterns": [
|
|
226
|
+
{
|
|
227
|
+
"match": "[\\[\\]]",
|
|
228
|
+
"name": "punctuation.section.block.trebol"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"match": "[()]",
|
|
232
|
+
"name": "punctuation.section.paren.trebol"
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trebol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Trebol: a Rebol-derived language for building beautiful web UIs without HTML or CSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rebol",
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
"dist",
|
|
41
41
|
"src",
|
|
42
42
|
"LICENSE",
|
|
43
|
-
"README.md"
|
|
43
|
+
"README.md",
|
|
44
|
+
"editors/vscode"
|
|
44
45
|
],
|
|
45
46
|
"engines": {
|
|
46
47
|
"node": ">=22.18"
|
|
@@ -59,13 +60,16 @@
|
|
|
59
60
|
"r3check": "node --disable-warning=ExperimentalWarning tools/r3check.ts",
|
|
60
61
|
"supplier": "node --disable-warning=ExperimentalWarning tools/cli.ts supplier",
|
|
61
62
|
"docs:serve": "npm run docs && node --disable-warning=ExperimentalWarning tools/cli.ts dev docs/_build/html --port 8000",
|
|
62
|
-
"docs": "uv run --quiet --no-project --with-requirements docs/requirements.txt sphinx-build -q -E -b html docs docs/_build/html"
|
|
63
|
+
"docs": "uv run --quiet --no-project --with-requirements docs/requirements.txt sphinx-build -q -E -b html docs docs/_build/html",
|
|
64
|
+
"grammar": "node --disable-warning=ExperimentalWarning tools/grammar.ts"
|
|
63
65
|
},
|
|
64
66
|
"devDependencies": {
|
|
65
67
|
"@types/node": "^22.15.0",
|
|
66
68
|
"@types/ws": "^8.18.2",
|
|
67
69
|
"esbuild": "^0.28.2",
|
|
68
70
|
"typescript": "^5.9.0",
|
|
71
|
+
"vscode-oniguruma": "^2.0.1",
|
|
72
|
+
"vscode-textmate": "^9.3.2",
|
|
69
73
|
"ws": "^8.23.0"
|
|
70
74
|
}
|
|
71
75
|
}
|
package/src/core/boot.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// `makeRuntime`; every registered native ends up in lib.
|
|
6
6
|
|
|
7
7
|
import { K, KIND_NAMES, TYPESETS, type Kind } from './kinds.ts';
|
|
8
|
-
import { intern
|
|
8
|
+
import { intern } from './symbols.ts';
|
|
9
9
|
import { NONE, TRUE, FALSE, datatype, typeset, context, type Cell, type BlockCell } from './values.ts';
|
|
10
10
|
import { ctxAdd, ctxFind, bindSeries } from './ctx.ts';
|
|
11
11
|
import { load } from './lexer.ts';
|
|
@@ -25,6 +25,7 @@ import './natives/csv.ts';
|
|
|
25
25
|
import './natives/xml.ts';
|
|
26
26
|
import './natives/parse.ts';
|
|
27
27
|
import { MEZZANINES } from './mezz.ts';
|
|
28
|
+
import { MACHINE } from './machine.ts';
|
|
28
29
|
|
|
29
30
|
export function makeRuntime(): Runtime {
|
|
30
31
|
const lib = context();
|
|
@@ -38,18 +39,20 @@ export function makeRuntime(): Runtime {
|
|
|
38
39
|
['off', FALSE], ['yes', TRUE], ['no', FALSE]] as const) set(name, v);
|
|
39
40
|
KIND_NAMES.forEach((name, k) => set(name, datatype(k as Kind)));
|
|
40
41
|
for (const [name, bits] of Object.entries(TYPESETS)) set(name, typeset(bits));
|
|
41
|
-
for (const def of registeredNatives()) set(def.name, { t: K.Native, p: def });
|
|
42
|
+
for (const def of registeredNatives()) if (def.hidden !== true) set(def.name, { t: K.Native, p: def });
|
|
42
43
|
for (const [name, fn] of OPS) {
|
|
43
44
|
const i = ctxFind(lib, intern(fn));
|
|
44
45
|
if (i < 0) throw new Error(`operator ${name} refers to unknown native ${fn}`);
|
|
45
46
|
set(name, { t: K.Op, p: { fn: lib.vals[i]! } });
|
|
46
47
|
}
|
|
47
48
|
const rt: Runtime = { lib, user: context([], [], lib) };
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
for (const [file, src] of [['mezzanines', MEZZANINES], ['machine', MACHINE]] as const) {
|
|
50
|
+
const code = load(src, { file });
|
|
51
|
+
bindSeries(code.s, lib, true);
|
|
52
|
+
const r = runSync(rt, code);
|
|
53
|
+
// Mezzanines failing to load is a bug in Trebol itself.
|
|
54
|
+
if (r.k === 'error') throw new Error(`${file} failed: ${errorMessage(r.e)}`);
|
|
55
|
+
}
|
|
53
56
|
return rt;
|
|
54
57
|
}
|
|
55
58
|
|
package/src/core/eval.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// Errors, `break`, `return` and `throw` travel as a `Thrown` that unwinds
|
|
15
15
|
// frames until a native that traps it, or a function call for `return`.
|
|
16
16
|
|
|
17
|
-
import { K, kindName
|
|
17
|
+
import { K, kindName } from './kinds.ts';
|
|
18
18
|
import { spell, canon, type Sym } from './symbols.ts';
|
|
19
19
|
import {
|
|
20
20
|
NONE, UNSET, TRUE, string, blockOf,
|
|
@@ -71,7 +71,7 @@ export type Step =
|
|
|
71
71
|
* reports where the program called into the library, not the library's
|
|
72
72
|
* insides: `fetch`, not the native it calls.
|
|
73
73
|
*/
|
|
74
|
-
export const LIBRARY_FILES = new Set<string>(['mezzanines']);
|
|
74
|
+
export const LIBRARY_FILES = new Set<string>(['mezzanines', 'machine']);
|
|
75
75
|
|
|
76
76
|
const inLibrary = (s: Series<Cell>): boolean => s.file !== undefined && LIBRARY_FILES.has(s.file);
|
|
77
77
|
|
package/src/core/func.ts
CHANGED
|
@@ -73,6 +73,10 @@ export interface NativeDef {
|
|
|
73
73
|
readonly specBlock: BlockCell;
|
|
74
74
|
readonly id: number;
|
|
75
75
|
readonly name: string;
|
|
76
|
+
/** Explicit data for natives the host makes after boot, such as which JavaScript function a call runs. */
|
|
77
|
+
readonly data?: number;
|
|
78
|
+
/** Kept out of lib: only the host hands out natives built on it. */
|
|
79
|
+
readonly hidden?: boolean;
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
/** The payload of an op! cell: the two-argument function it calls. */
|