pacc 8.8.0 → 8.9.1

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 CHANGED
@@ -464,6 +464,8 @@ Type: [AttributeDefinition](#attributedefinition)
464
464
 
465
465
  ## duration\_attribute
466
466
 
467
+ Duration in seconds.
468
+
467
469
  Type: [AttributeDefinition](#attributedefinition)
468
470
 
469
471
  ## duration\_attribute\_writable
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacc",
3
- "version": "8.8.0",
3
+ "version": "8.9.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -397,6 +397,7 @@ export const priority_attribute = {
397
397
  };
398
398
 
399
399
  /**
400
+ * Duration in seconds.
400
401
  * @type {AttributeDefinition}
401
402
  */
402
403
  export const duration_attribute = {
@@ -43,9 +43,18 @@ export function parseOnly(input, context = {}) {
43
43
  const nud = (last, left) => {
44
44
  switch (last) {
45
45
  case OPEN_ROUND: {
46
- const node = expression(0);
46
+ const sequence = [];
47
+
48
+ while (token !== CLOSE_ROUND) {
49
+ sequence.push(expression(0));
50
+ if (token === COMMA) {
51
+ advance();
52
+ }
53
+ }
47
54
  expect(CLOSE_ROUND);
48
- return node;
55
+
56
+ // TODO always a sequence ?
57
+ return sequence.length > 1 ? sequence : sequence[0];
49
58
  }
50
59
  case OPEN_BRACKET: {
51
60
  if (token === CLOSE_BRACKET) {
@@ -171,6 +180,7 @@ export const globals = {
171
180
  decodeURI: decodeURI,
172
181
  encodeURIComponent: encodeURIComponent,
173
182
  decodeURIComponent: decodeURIComponent,
183
+ trim: a => a.trim(),
174
184
  uppercase: a => a.toUpperCase(),
175
185
  lowercase: a => a.toLowerCase(),
176
186
  substring: (s, a, b) => s.substring(a, b),
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
  "-",
@@ -203,6 +203,7 @@ export const title_attribute_writable: AttributeDefinition;
203
203
  */
204
204
  export const priority_attribute: AttributeDefinition;
205
205
  /**
206
+ * Duration in seconds.
206
207
  * @type {AttributeDefinition}
207
208
  */
208
209
  export const duration_attribute: AttributeDefinition;
@@ -12,6 +12,7 @@ export namespace globals {
12
12
  export let decodeURI: typeof globalThis.decodeURI;
13
13
  export let encodeURIComponent: typeof globalThis.encodeURIComponent;
14
14
  export let decodeURIComponent: typeof globalThis.decodeURIComponent;
15
+ export function trim(a: any): any;
15
16
  export function uppercase(a: any): any;
16
17
  export function lowercase(a: any): any;
17
18
  export function substring(s: any, a: any, b: any): any;