basedpl 0.1.47 → 0.1.49

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.
Binary file
@@ -89,11 +89,11 @@
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
  {
package/input.js CHANGED
@@ -35,14 +35,15 @@
35
35
  }
36
36
  const reset = () => { pending = null; };
37
37
 
38
- // At each level (exact, prefix, prefixes of hyphen-separated parts) a name outranks a search word, as in `matches` in `symbols.rs`.
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`.
39
40
  function matches(query) {
40
41
  query = query.toLowerCase();
41
42
  const letters = word => word.replaceAll('-', '');
42
43
  let best = Infinity, found = [];
43
- for (const {glyph, name, monad, dyad, aliases} of symbols) {
44
- let rank = Infinity;
45
- [name, monad, dyad, ...aliases.split(' ')].filter(Boolean).forEach((word, i) => {
44
+ for (const {glyph, name, monad, dyad} of symbols) {
45
+ let rank = Infinity, matched;
46
+ [name, monad, dyad].filter(Boolean).forEach(word => {
46
47
  const level = letters(word) === query ? 0 : letters(word).startsWith(query) ? 1 : 2;
47
48
  if (level === 2) {
48
49
  let rest = query;
@@ -55,10 +56,10 @@
55
56
  }
56
57
  if (rest) return;
57
58
  }
58
- rank = Math.min(rank, 2 * level + (i > 0));
59
+ if (level < rank) { rank = level; matched = word; }
59
60
  });
60
61
  if (rank < best) { best = rank; found = []; }
61
- if (rank < Infinity && rank === best) found.push([glyph, name]);
62
+ if (rank < Infinity && rank === best) found.push([glyph, matched]);
62
63
  }
63
64
  // A name that is a prefix of every other match wins: `om gives omega, `omu gives omega-underbar.
64
65
  const shortest = found.find(([, a]) => found.every(([, b]) => letters(b).startsWith(letters(a))));
package/layout.json CHANGED
@@ -5,6 +5,7 @@
5
5
  "option": {
6
6
  "`": "⋄",
7
7
  "1": {"state": "diaeresis"},
8
+ "2": "⌽",
8
9
  "3": "√",
9
10
  "4": "⇄",
10
11
  "5": {"state": "subscript"},
@@ -60,7 +61,6 @@
60
61
  ".": "↣",
61
62
  "<": "≤",
62
63
  ">": "≥",
63
- "|": "⌽",
64
64
  "/": "¿"
65
65
  },
66
66
  "states": {
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, aliases}) =>
98
- [glyph, [...new Set([name, monad, dyad, aliases].join(' ').split(' ').filter(Boolean))].join(' ')]));
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.47",
3
+ "version": "0.1.49",
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": {