@astrale-os/kernel-dsl 0.2.0-beta.24 → 0.2.0-beta.25

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.
@@ -38,10 +38,16 @@ class Builder {
38
38
  }
39
39
  if (piece.maximum === undefined)
40
40
  return this.concat(output, this.star(piece.atom));
41
+ if (piece.maximum === piece.minimum)
42
+ return output;
43
+ const end = this.state();
41
44
  for (let index = piece.minimum; index < piece.maximum; index++) {
42
- output = this.concat(output, this.optional(piece.atom));
45
+ // A shorter repetition exits the whole suffix, rather than skipping arbitrary copies.
46
+ this.epsilon(output.end, end);
47
+ output = this.concat(output, this.atom(piece.atom));
43
48
  }
44
- return output;
49
+ this.epsilon(output.end, end);
50
+ return { start: output.start, end };
45
51
  }
46
52
  atom(atom) {
47
53
  if (atom.kind === 'expression')
@@ -51,15 +57,6 @@ class Builder {
51
57
  this.states[start].transitions.push({ to: end, ranges: atom.ranges });
52
58
  return { start, end };
53
59
  }
54
- optional(atom) {
55
- const start = this.state();
56
- const end = this.state();
57
- const child = this.atom(atom);
58
- this.epsilon(start, end);
59
- this.epsilon(start, child.start);
60
- this.epsilon(child.end, end);
61
- return { start, end };
62
- }
63
60
  star(atom) {
64
61
  const start = this.state();
65
62
  const end = this.state();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrale-os/kernel-dsl",
3
- "version": "0.2.0-beta.24",
3
+ "version": "0.2.0-beta.25",
4
4
  "description": "Astrale Kernel DSL - Schema authoring, inference, and IR serialization",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {