basedpl 0.1.72 → 0.1.74
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/basedpl_wasm.js +14 -9
- package/basedpl_wasm_bg.wasm +0 -0
- package/bpl.tmLanguage.json +9 -5
- package/hpl.tmLanguage.json +3 -3
- package/input.js +10 -8
- package/layout.json +5 -5
- package/package.json +1 -1
package/basedpl_wasm.js
CHANGED
|
@@ -69,17 +69,18 @@ export function configure(base, panic) {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
73
|
-
* @param {
|
|
72
|
+
* Time named BPL source files, supplied as `[{name, text}]`. Results retain full code and single-line log labels.
|
|
73
|
+
* @param {any} files
|
|
74
74
|
* @param {string[] | null} [cases]
|
|
75
|
+
* @param {string | null} [prefs]
|
|
75
76
|
* @returns {any}
|
|
76
77
|
*/
|
|
77
|
-
export function costs(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
var ptr1 = isLikeNone(
|
|
78
|
+
export function costs(files, cases, prefs) {
|
|
79
|
+
var ptr0 = isLikeNone(cases) ? 0 : passArrayJsValueToWasm0(cases, wasm.__wbindgen_malloc);
|
|
80
|
+
var len0 = WASM_VECTOR_LEN;
|
|
81
|
+
var ptr1 = isLikeNone(prefs) ? 0 : passStringToWasm0(prefs, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
81
82
|
var len1 = WASM_VECTOR_LEN;
|
|
82
|
-
const ret = wasm.costs(ptr0, len0, ptr1, len1);
|
|
83
|
+
const ret = wasm.costs(files, ptr0, len0, ptr1, len1);
|
|
83
84
|
if (ret[2]) {
|
|
84
85
|
throw takeFromExternrefTable0(ret[1]);
|
|
85
86
|
}
|
|
@@ -241,7 +242,7 @@ function __wbg_get_imports() {
|
|
|
241
242
|
__wbg_getRandomValues_436a51d0629d84e1: function() { return handleError(function (arg0, arg1) {
|
|
242
243
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
243
244
|
}, arguments); },
|
|
244
|
-
|
|
245
|
+
__wbg_getRandomValues_869eb80731672410: function() { return handleError(function (arg0, arg1) {
|
|
245
246
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
246
247
|
}, arguments); },
|
|
247
248
|
__wbg_getTime_f5a55efff2585d5d: function(arg0) {
|
|
@@ -561,7 +562,7 @@ function __wbg_get_imports() {
|
|
|
561
562
|
const ret = arg0.normalize(getStringFromWasm0(arg1, arg2));
|
|
562
563
|
return ret;
|
|
563
564
|
},
|
|
564
|
-
|
|
565
|
+
__wbg_now_a699dcfc451fcecf: function() { return handleError(function () {
|
|
565
566
|
const ret = Date.now();
|
|
566
567
|
return ret;
|
|
567
568
|
}, arguments); },
|
|
@@ -668,6 +669,10 @@ function __wbg_get_imports() {
|
|
|
668
669
|
const ret = arg0.status;
|
|
669
670
|
return ret;
|
|
670
671
|
}, arguments); },
|
|
672
|
+
__wbg_stringify_52ff602c1cc4fbb6: function() { return handleError(function (arg0) {
|
|
673
|
+
const ret = JSON.stringify(arg0);
|
|
674
|
+
return ret;
|
|
675
|
+
}, arguments); },
|
|
671
676
|
__wbg_value_f3c585ee8f5ba40c: function(arg0) {
|
|
672
677
|
const ret = arg0.value;
|
|
673
678
|
return ret;
|
package/basedpl_wasm_bg.wasm
CHANGED
|
Binary file
|
package/bpl.tmLanguage.json
CHANGED
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"name": "string.quoted.single.bpl"
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
"match": "(?:_\\d+|_\\S|_|[^\\s\\p{Cc}0-9
|
|
48
|
+
"match": "(?:_\\d+|_\\S|_|[^\\s\\p{Cc}0-9←⎕•⍺⍵⍶⍹∇⍢⍝⋄\\?¯∞⍬\\+\\-×÷⌈⌊\\|\\*⍟○π√!∧∨⊼⊽\\~=≠<≤>≥⍳↦:⍴≢≡,⍪⊂⊃⊆∊∪∩⍋⍒↑↓⌽⊖⍉⊤⊥⍎⍕⌷⌹\\#↕⍭⨸⌻⍸⍷⊢⊣¿¨ᵇ⍨↣⍤∘⍠⍥↢\\.⊗⌸⍣⇄⊘@∂⍚⌺/⌿\\\\⍀⁰¹²³⁴⁵⁶⁷⁸⁹⁻ᵀᵘₓ₀₁₂₃₄₅₆₇₈₉₋ₓ₁ₓ₂ₓ₄ₓ₈ₓₕₛₚ\\(\\)\\[\\]\\{\\}'\";\\$_ₑⱼᵣ])+",
|
|
49
49
|
"name": "variable.other.bpl"
|
|
50
50
|
},
|
|
51
51
|
{
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"name": "support.function.bpl"
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
|
-
"match": "[¯]?[∞]|[¯]?(\\d+([.]\\d+)?|[.]\\d+)([eEₑ][¯]?\\d+)?([jJⱼ][¯]?(\\d+([.]\\d+)?|[.]\\d+)([eEₑ][¯]?\\d+)
|
|
56
|
+
"match": "(?:[¯]?[∞]|[¯]?(\\d+([.]\\d+)?|[.]\\d+)([eEₑ][¯]?\\d+)?([jJⱼ][¯]?(\\d+([.]\\d+)?|[.]\\d+)([eEₑ][¯]?\\d+)?|[rᵣ][¯]?\\d+)?)(?:ₓ₁|ₓ₂|ₓ₄|ₓ₈|ₓ|ₕ|ₛ|ₚ)?|[ₑⱼᵣ]",
|
|
57
57
|
"name": "constant.numeric.bpl"
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
|
-
"match": "[⍬]
|
|
60
|
+
"match": "[⍬](?:ₓ₁|ₓ₂|ₓ₄|ₓ₈|ₓ|ₕ|ₛ|ₚ)?",
|
|
61
61
|
"name": "constant.numeric.bpl"
|
|
62
62
|
},
|
|
63
63
|
{
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
"name": "string.quoted.double.bpl"
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
|
-
"begin": "[\\])](
|
|
72
|
+
"begin": "[\\])](?=(?:ₓ₁|ₓ₂|ₓ₄|ₓ₈|ₓ|ₕ|ₛ|ₚ))",
|
|
73
73
|
"beginCaptures": {
|
|
74
74
|
"0": {
|
|
75
75
|
"name": "source.bpl"
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
|
-
"end": "
|
|
78
|
+
"end": "(?:ₓ₁|ₓ₂|ₓ₄|ₓ₈|ₓ|ₕ|ₛ|ₚ)|$",
|
|
79
79
|
"contentName": "constant.numeric.bpl",
|
|
80
80
|
"patterns": [],
|
|
81
81
|
"applyEndPatternLast": true,
|
|
@@ -89,6 +89,10 @@
|
|
|
89
89
|
"match": "[\\+\\-×÷⌈⌊\\|\\*⍟○π√!∧∨⊼⊽\\~=≠<≤>≥⍳↦:⍴≢≡,⍪⊂⊃⊆∊∪∩⍋⍒↑↓⌽⊖⍉⊤⊥⍎⍕⌷⌹\\#↕⍭⨸⌻⍸⍷⊢⊣¿]",
|
|
90
90
|
"name": "support.function.bpl"
|
|
91
91
|
},
|
|
92
|
+
{
|
|
93
|
+
"match": "(?:ₓ₁|ₓ₂|ₓ₄|ₓ₈|ₓ|ₕ|ₛ|ₚ)",
|
|
94
|
+
"name": "keyword.operator.monadic.bpl"
|
|
95
|
+
},
|
|
92
96
|
{
|
|
93
97
|
"match": "[¨ᵇ⍨⊗⌸⇄∂/⌿\\\\⍀⁰¹²³⁴⁵⁶⁷⁸⁹⁻ᵀᵘₓ]",
|
|
94
98
|
"name": "keyword.operator.monadic.bpl"
|
package/hpl.tmLanguage.json
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"applyEndPatternLast": true
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
|
-
"match": "(?:_\\d+|_\\S|_|[^\\s\\p{Cc}0-9
|
|
22
|
+
"match": "(?:_\\d+|_\\S|_|[^\\s\\p{Cc}0-9←是⎕出入•系⍺甲⍵乙⍶丙⍹丁∇递遞⍢循⍝注⋄句\\?若¯负負∞永⍬空\\+加\\-减減×乘号號÷除⌈上⌊下\\|绝余絕餘\\*幂冪⍟对對○圆圓π周√根!阶拣階揀∧极且極∨析或⊼方否⊽双莫雙\\~非无無=等≠别初別<小≤限退>大≥达进達進⍳位↦至:键卸鍵⍴形≢数异數異≡同深,连連⍪接矩⊂包⊃选合選⊆巢段∊属展屬∪并独併獨∩交重⍋升⍒降↑取↓去拆⌽转轉⊖纵縱⍉翻⊤编編⊥译譯⍎行⍕文⌷索⌹解逆\\#复複↕窗⍭素⨸因⌻零值⍸处间處間⍷寻群尋⊢右⊣左¿掷抽擲¨遍ᵇ按⍨己换換↣先⍤秩∘承⍠轴軸⍥经經↢后後\\.内內⊗表⌸组組⍣次止⇄优優⊘兼@于於∂导梯導⍚择擇⌺邻鄰/总總⌿汇匯\\\\累⍀续續⁰¹²³⁴⁵⁶⁷⁸⁹⁻ᵀᵘₓ₀₁₂₃₄₅₆₇₈₉₋ₓ₁ₓ₂ₓ₄ₓ₈ₓₕₛₚ\\(\\)\\[\\]\\{\\}'\";\\$_ₑⱼᵣ])+",
|
|
23
23
|
"name": "variable.other.bpl"
|
|
24
24
|
},
|
|
25
25
|
{
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"name": "support.function.bpl"
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
"match": "[¯负負]?[∞永]|[¯负負]?(\\d+([.内內]\\d+)?|[.内內]\\d+)([eEₑ][¯负負]?\\d+)?([jJⱼ][¯负負]?(\\d+([.内內]\\d+)?|[.内內]\\d+)([eEₑ][¯负負]?\\d+)
|
|
30
|
+
"match": "(?:[¯负負]?[∞永]|[¯负負]?(\\d+([.内內]\\d+)?|[.内內]\\d+)([eEₑ][¯负負]?\\d+)?([jJⱼ][¯负負]?(\\d+([.内內]\\d+)?|[.内內]\\d+)([eEₑ][¯负負]?\\d+)?|[rᵣ][¯负負]?\\d+)?)(?:ₓ₁|ₓ₂|ₓ₄|ₓ₈|ₓ|ₕ|ₛ|ₚ)?|[ₑⱼᵣ]",
|
|
31
31
|
"name": "constant.numeric.bpl"
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
|
-
"match": "[⍬空]
|
|
34
|
+
"match": "[⍬空](?:ₓ₁|ₓ₂|ₓ₄|ₓ₈|ₓ|ₕ|ₛ|ₚ)?",
|
|
35
35
|
"name": "constant.numeric.bpl"
|
|
36
36
|
},
|
|
37
37
|
{
|
package/input.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
function usKey({code, shiftKey}) {
|
|
7
7
|
if (/^Key[A-Z]$/.test(code)) return shiftKey ? code.slice(3) : code.slice(3).toLowerCase();
|
|
8
8
|
if (/^Digit[0-9]$/.test(code)) return shiftKey ? ')!@#$%^&*('[Number(code[5])] : code[5];
|
|
9
|
+
if (code === 'Space') return ' ';
|
|
9
10
|
return punctuation[code]?.[Number(shiftKey)];
|
|
10
11
|
}
|
|
11
12
|
|
|
@@ -16,21 +17,22 @@
|
|
|
16
17
|
// What a key types: `{text, stop}`, where `stop` means the key itself does nothing more, or nothing for an ordinary key.
|
|
17
18
|
// `option` is whether an Option chord counts here.
|
|
18
19
|
function press(ev, option) {
|
|
19
|
-
const key = usKey(ev)
|
|
20
|
-
// Native Option can hide the alias character; accept its US physical chord too.
|
|
21
|
-
const action = option && ev.altKey && !ev.ctrlKey && !ev.metaKey
|
|
22
|
-
? layout.alt_aliases[ev.key] ?? (Object.values(layout.alt_aliases).includes(key) ? key : layout.option[key]) : null;
|
|
20
|
+
const key = usKey(ev);
|
|
23
21
|
if (pending) {
|
|
24
|
-
const state = layout.states[
|
|
22
|
+
const name = pending, state = layout.states[name];
|
|
25
23
|
pending = null;
|
|
26
|
-
if (repeated) return {text: state.terminator, stop: true};
|
|
27
|
-
if (plain && ev.key === ' ') return {text: state.terminator, stop: true};
|
|
28
24
|
if (ev.key === 'Backspace' || ev.key === 'Escape') return {text: '', stop: true};
|
|
29
|
-
if (
|
|
25
|
+
if (!ev.ctrlKey && !ev.metaKey) {
|
|
26
|
+
if (key in state.keys) return {text: act(state.keys[key]), stop: true};
|
|
27
|
+
if (key === ' ' || layout.option[key]?.state === name) return {text: state.terminator, stop: true};
|
|
28
|
+
}
|
|
30
29
|
// Any other key types the terminator, then acts as if nothing were pending.
|
|
31
30
|
const rest = press(ev, option);
|
|
32
31
|
return {text: state.terminator + (rest?.text ?? ''), stop: rest?.stop ?? false};
|
|
33
32
|
}
|
|
33
|
+
// Native Option can hide the alias character; accept its US physical chord too.
|
|
34
|
+
const action = option && ev.altKey && !ev.ctrlKey && !ev.metaKey
|
|
35
|
+
? layout.alt_aliases[ev.key] ?? (Object.values(layout.alt_aliases).includes(key) ? key : layout.option[key]) : null;
|
|
34
36
|
if (action) return {text: act(action), stop: true};
|
|
35
37
|
}
|
|
36
38
|
const reset = () => { pending = null; };
|
package/layout.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"alt_aliases": {"£": "#"},
|
|
3
|
-
"unshifted": {"*": "8", "~": "`", "_": "-", "|": "\\", ":": ";"},
|
|
3
|
+
"unshifted": {"!": "1", "@": "2", "#": "3", "$": "4", "%": "5", "^": "6", "&": "7", "*": "8", "(": "9", ")": "0", "~": "`", "_": "-", "|": "\\", ":": ";"},
|
|
4
4
|
"optional_shift": {"!": "1", "@": "2", "#": "3", "$": "4", "%": "5", "^": "6", "&": "7", "*": "8", "(": "9", "_": "-"},
|
|
5
5
|
"option": {
|
|
6
6
|
"`": "⋄",
|
|
@@ -67,10 +67,10 @@
|
|
|
67
67
|
},
|
|
68
68
|
"states": {
|
|
69
69
|
"diaeresis": {"terminator": "¨", "keys": {"t": "⍤", "o": "⍥", "*": "⍣", "~": "⍨", "g": "⍢", "8": "⍣", "`": "⍨"}},
|
|
70
|
-
"superscript": {"terminator": "
|
|
71
|
-
"superscript-minus": {"terminator": "⁻", "keys": {"0": "⁻⁰", "1": "⁻¹", "2": "⁻²", "3": "⁻³", "4": "⁻⁴", "5": "⁻⁵", "6": "⁻⁶", "7": "⁻⁷", "8": "⁻⁸", "9": "⁻⁹"}},
|
|
72
|
-
"subscript": {"terminator": "
|
|
73
|
-
"subscript-minus": {"terminator": "₋", "keys": {"0": "₋₀", "1": "₋₁", "2": "₋₂", "3": "₋₃", "4": "₋₄", "5": "₋₅", "6": "₋₆", "7": "₋₇", "8": "₋₈", "9": "₋₉"}},
|
|
70
|
+
"superscript": {"terminator": "⁶", "keys": {"0": "⁰", "1": "¹", "2": "²", "3": "³", "4": "⁴", "5": "⁵", "6": "⁶", "7": "⁷", "8": "⁸", "9": "⁹", ")": "⁰", "!": "¹", "@": "²", "#": "³", "$": "⁴", "%": "⁵", "^": "⁶", "&": "⁷", "*": "⁸", "(": "⁹", "-": {"state": "superscript-minus"}, "b": "ᵇ", "t": "ᵀ", "u": "ᵘ"}},
|
|
71
|
+
"superscript-minus": {"terminator": "⁻", "keys": {"0": "⁻⁰", "1": "⁻¹", "2": "⁻²", "3": "⁻³", "4": "⁻⁴", "5": "⁻⁵", "6": "⁻⁶", "7": "⁻⁷", "8": "⁻⁸", "9": "⁻⁹", ")": "⁻⁰", "!": "⁻¹", "@": "⁻²", "#": "⁻³", "$": "⁻⁴", "%": "⁻⁵", "^": "⁻⁶", "&": "⁻⁷", "*": "⁻⁸", "(": "⁻⁹"}},
|
|
72
|
+
"subscript": {"terminator": "₅", "keys": {"0": "₀", "1": "₁", "2": "₂", "3": "₃", "4": "₄", "5": "₅", "6": "₆", "7": "₇", "8": "₈", "9": "₉", ")": "₀", "!": "₁", "@": "₂", "#": "₃", "$": "₄", "%": "₅", "^": "₆", "&": "₇", "*": "₈", "(": "₉", "x": "ₓ", "j": "ⱼ", "e": "ₑ", "r": "ᵣ", "h": "ₕ", "s": "ₛ", "p": "ₚ", "-": {"state": "subscript-minus"}}},
|
|
73
|
+
"subscript-minus": {"terminator": "₋", "keys": {"0": "₋₀", "1": "₋₁", "2": "₋₂", "3": "₋₃", "4": "₋₄", "5": "₋₅", "6": "₋₆", "7": "₋₇", "8": "₋₈", "9": "₋₉", ")": "₋₀", "!": "₋₁", "@": "₋₂", "#": "₋₃", "$": "₋₄", "%": "₋₅", "^": "₋₆", "&": "₋₇", "*": "₋₈", "(": "₋₉"}},
|
|
74
74
|
"bar": {"terminator": "¯", "keys": {",": "⍪", "\\": "⍀", "/": "⌿", "a": "⍶", "w": "⍹", "7": "⍙", "`": "⍚", "0": "⊼", "9": "⊽", "e": "⍷", "i": "⍸", "z": "⊆"}},
|
|
75
75
|
"quad": {"terminator": "⎕", "keys": {"t": "⌻", ":": "⍠", "=": "⌸", "u": "⌹", "|": "⌷", "`": "⌺", ";": "⍠", "\\": "⌷"}},
|
|
76
76
|
"circle": {"terminator": "○", "keys": {"-": "⊖", "\\": "⍉", "/": "⊘", "*": "⍟", "m": "⊗", "u": "⨸", "8": "⍟", "c": "⍝", "b": "⍎", "n": "⍕"}},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "basedpl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.74",
|
|
4
4
|
"description": "BasedPL, the Based-array Programming Language, is an APL-derived array language, borrowing ideas from J and BQN, with an emphasis on simple, consistent notation.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|