basedpl 0.1.46 → 0.1.48
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_bg.wasm +0 -0
- package/bpl.tmLanguage.json +9 -9
- package/input.js +9 -7
- package/layout.json +1 -1
- package/lb.js +2 -2
- package/package.json +1 -1
package/basedpl_wasm_bg.wasm
CHANGED
|
Binary file
|
package/bpl.tmLanguage.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
],
|
|
7
7
|
"patterns": [
|
|
8
8
|
{
|
|
9
|
-
"begin": "
|
|
9
|
+
"begin": "[⍝注]",
|
|
10
10
|
"beginCaptures": {
|
|
11
11
|
"0": {
|
|
12
12
|
"name": "comment.line.bpl"
|
|
@@ -48,15 +48,15 @@
|
|
|
48
48
|
"name": "source.bpl"
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
|
-
"match": "
|
|
51
|
+
"match": "[•系][A-Za-z_∆⍙][A-Za-z0-9_∆⍙]*",
|
|
52
52
|
"name": "support.function.system.bpl"
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
|
-
"match": "
|
|
55
|
+
"match": "[¯负負]?[∞永]|[¯负負]?(\\d+([.内內]\\d+)?|[.内內]\\d+)([eEₑ][¯负負]?\\d+)?([jJⱼ][¯负負]?(\\d+([.内內]\\d+)?|[.内內]\\d+)([eEₑ][¯负負]?\\d+)?|ₓ|[rᵣ][¯负負]?\\d+)?",
|
|
56
56
|
"name": "constant.numeric.bpl"
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
|
-
"match": "
|
|
59
|
+
"match": "[⍬空]ₓ?",
|
|
60
60
|
"name": "constant.numeric.bpl"
|
|
61
61
|
},
|
|
62
62
|
{
|
|
@@ -85,23 +85,23 @@
|
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
|
-
"match": "[
|
|
88
|
+
"match": "[\\+加\\-减減×乘号號÷除⌈上⌊下\\|绝余絕餘\\*幂冪⍟对對○圆圓π周√根!阶拣階揀∧极且極∨析或⊼方否⊽双莫雙\\~非无無=等≠别初別<小≤限退>大≥达进達進⍳位↦至:键卸鍵⍴形≢数异數異≡同深,连連⍪接矩⊂包⊃选合選⊆巢段∊属展屬∪并独併獨∩交重⍋升⍒降↑取↓去拆⌽转轉⊖纵縱⍉翻⊤编編⊥译譯⍎行⍕文⌷索⌹解逆\\#复複↕窗⍭素⨸因⌻零值⍸处间處間⍷寻群尋⊢右⊣左¿掷抽擲]",
|
|
89
89
|
"name": "support.function.bpl"
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
|
-
"match": "[
|
|
92
|
+
"match": "[¨遍⍨己换換⊗表⌸组組⇄优優∂导梯導/总總⌿汇匯\\\\累⍀续續⁰¹²³⁴⁵⁶⁷⁸⁹⁻ᵀᵘ]",
|
|
93
93
|
"name": "keyword.operator.monadic.bpl"
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
|
-
"match": "[
|
|
96
|
+
"match": "[↣先⍤秩∘承⍠轴軸⍥经經↢后後\\.内內⍣次止⊘兼@于於⍚择擇⌺邻鄰]",
|
|
97
97
|
"name": "keyword.operator.dyadic.bpl"
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
|
-
"match": "[
|
|
100
|
+
"match": "[⍺甲⍵乙⍶丙⍹丁∇递遞⍢循]",
|
|
101
101
|
"name": "variable.parameter.bpl"
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
|
-
"match": "[
|
|
104
|
+
"match": "[←是⎕出入⋄句\\?若₀₁₂₃₄₅₆₇₈₉₋]",
|
|
105
105
|
"name": "keyword.control.bpl"
|
|
106
106
|
}
|
|
107
107
|
]
|
package/input.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
((symbols, layout) => {
|
|
2
|
+
const comments = new Set(symbols.filter(s => s.kind === 'comment').flatMap(s => [...s.glyph, ...s.hanzi.join('')]));
|
|
2
3
|
// US physical keys, before macOS Option or another layout transforms event.key.
|
|
3
4
|
const punctuation = {Backquote: '`~', Minus: '-_', Equal: '=+', BracketLeft: '[{', BracketRight: ']}',
|
|
4
5
|
Backslash: '\\|', Semicolon: ';:', Quote: "'\"", Comma: ',<', Period: '.>', Slash: '/?'};
|
|
@@ -34,14 +35,15 @@
|
|
|
34
35
|
}
|
|
35
36
|
const reset = () => { pending = null; };
|
|
36
37
|
|
|
37
|
-
//
|
|
38
|
+
// Every name ranks alike at each level: exact, prefix, then prefixes of hyphen-separated parts. Each match carries the name it
|
|
39
|
+
// matched by, the glyph name where several of a glyph's names match equally, as in `matches` in `symbols.rs`.
|
|
38
40
|
function matches(query) {
|
|
39
41
|
query = query.toLowerCase();
|
|
40
42
|
const letters = word => word.replaceAll('-', '');
|
|
41
43
|
let best = Infinity, found = [];
|
|
42
|
-
for (const {glyph, name, monad, dyad
|
|
43
|
-
let rank = Infinity;
|
|
44
|
-
[name, monad, dyad
|
|
44
|
+
for (const {glyph, name, monad, dyad} of symbols) {
|
|
45
|
+
let rank = Infinity, matched;
|
|
46
|
+
[name, monad, dyad].filter(Boolean).forEach(word => {
|
|
45
47
|
const level = letters(word) === query ? 0 : letters(word).startsWith(query) ? 1 : 2;
|
|
46
48
|
if (level === 2) {
|
|
47
49
|
let rest = query;
|
|
@@ -54,10 +56,10 @@
|
|
|
54
56
|
}
|
|
55
57
|
if (rest) return;
|
|
56
58
|
}
|
|
57
|
-
rank
|
|
59
|
+
if (level < rank) { rank = level; matched = word; }
|
|
58
60
|
});
|
|
59
61
|
if (rank < best) { best = rank; found = []; }
|
|
60
|
-
if (rank < Infinity && rank === best) found.push([glyph,
|
|
62
|
+
if (rank < Infinity && rank === best) found.push([glyph, matched]);
|
|
61
63
|
}
|
|
62
64
|
// A name that is a prefix of every other match wins: `om gives omega, `omu gives omega-underbar.
|
|
63
65
|
const shortest = found.find(([, a]) => found.every(([, b]) => letters(b).startsWith(letters(a))));
|
|
@@ -81,7 +83,7 @@
|
|
|
81
83
|
} else if (c === "'" || c === '"') {
|
|
82
84
|
quote = python && text.startsWith(c.repeat(3), i) ? c.repeat(3) : c;
|
|
83
85
|
i += quote.length - 1;
|
|
84
|
-
} else if (c ===
|
|
86
|
+
} else if (python ? c === '#' : comments.has(c)) comment = true;
|
|
85
87
|
}
|
|
86
88
|
return !quote && !comment;
|
|
87
89
|
}
|
package/layout.json
CHANGED
package/lb.js
CHANGED
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
toggle.textContent = overlay ? '▼' : '▲';
|
|
95
95
|
d.body.style.paddingTop = overlay || bar.hidden ? originalPadding : `${bar.offsetHeight}px`;
|
|
96
96
|
}
|
|
97
|
-
const names = new Map(symbols.map(({glyph, name, monad, dyad
|
|
98
|
-
[glyph, [
|
|
97
|
+
const names = new Map(symbols.map(({glyph, name, monad, dyad}) =>
|
|
98
|
+
[glyph, [name, monad, dyad].filter(Boolean).join(' ')]));
|
|
99
99
|
function stateGlyphs(state) {
|
|
100
100
|
const {terminator, keys} = layout.states[state];
|
|
101
101
|
return [terminator, ...Object.values(keys).flatMap(value => typeof value === 'string' ? [value] : stateGlyphs(value.state))];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "basedpl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.48",
|
|
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": {
|