pacc 8.9.0 → 8.9.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacc",
3
- "version": "8.9.0",
3
+ "version": "8.9.2",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -18,7 +18,7 @@ export function parseOnly(input, context = {}) {
18
18
 
19
19
  let node, token, value;
20
20
 
21
- const advance = () => {
21
+ function advance() {
22
22
  const next = input.next();
23
23
  if (next.done) {
24
24
  token = EOF;
@@ -28,9 +28,9 @@ export function parseOnly(input, context = {}) {
28
28
  value = next.value[1];
29
29
  }
30
30
  }
31
- };
31
+ }
32
32
 
33
- const expect = expected => {
33
+ function expect(expected) {
34
34
  if (token !== expected) {
35
35
  throw new Error(
36
36
  `unexpected '${token?.str || token}' expecting '${expected.str}'`,
@@ -38,12 +38,11 @@ export function parseOnly(input, context = {}) {
38
38
  );
39
39
  }
40
40
  advance();
41
- };
41
+ }
42
42
 
43
- const nud = (last, left) => {
43
+ function nud(last, left) {
44
44
  switch (last) {
45
45
  case OPEN_ROUND: {
46
-
47
46
  const sequence = [];
48
47
 
49
48
  while (token !== CLOSE_ROUND) {
@@ -87,9 +86,9 @@ export function parseOnly(input, context = {}) {
87
86
  }
88
87
 
89
88
  return last;
90
- };
89
+ }
91
90
 
92
- const led = (last, left) => {
91
+ function led(last, left) {
93
92
  switch (last.type) {
94
93
  case "infixr":
95
94
  return ASTBinop(last, left, expression(last.precedence - 1));
@@ -135,9 +134,9 @@ export function parseOnly(input, context = {}) {
135
134
  }
136
135
 
137
136
  return { token };
138
- };
137
+ }
139
138
 
140
- const expression = precedence => {
139
+ function expression(precedence) {
141
140
  const last = token;
142
141
  advance();
143
142
  node = nud(last, node);
@@ -149,7 +148,7 @@ export function parseOnly(input, context = {}) {
149
148
  }
150
149
 
151
150
  return node;
152
- };
151
+ }
153
152
 
154
153
  advance();
155
154
 
package/src/tokens.mjs CHANGED
@@ -29,7 +29,14 @@ export /** @type {Token} */ const PLUS = createToken(
29
29
  "+",
30
30
  50,
31
31
  "infix",
32
- (left, right) => left + right
32
+ (left, right) => {
33
+ if (Array.isArray(left)) {
34
+ if (Array.isArray(right)) {
35
+ return [...left, ...right];
36
+ }
37
+ }
38
+ return left + right;
39
+ }
33
40
  );
34
41
  export /** @type {Token} */ const MINUS = createToken(
35
42
  "-",