@lezer/common 1.0.1 → 1.0.3

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (C) 2018 by Marijn Haverbeke <marijnh@gmail.com> and others
3
+ Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/index.cjs CHANGED
@@ -116,8 +116,8 @@ class NodeType {
116
116
  /// Define a node type.
117
117
  static define(spec) {
118
118
  let props = spec.props && spec.props.length ? Object.create(null) : noProps;
119
- let flags = (spec.top ? 1 /* Top */ : 0) | (spec.skipped ? 2 /* Skipped */ : 0) |
120
- (spec.error ? 4 /* Error */ : 0) | (spec.name == null ? 8 /* Anonymous */ : 0);
119
+ let flags = (spec.top ? 1 /* NodeFlag.Top */ : 0) | (spec.skipped ? 2 /* NodeFlag.Skipped */ : 0) |
120
+ (spec.error ? 4 /* NodeFlag.Error */ : 0) | (spec.name == null ? 8 /* NodeFlag.Anonymous */ : 0);
121
121
  let type = new NodeType(spec.name || "", props, spec.id, flags);
122
122
  if (spec.props)
123
123
  for (let src of spec.props) {
@@ -135,14 +135,14 @@ class NodeType {
135
135
  /// the prop isn't present on this node.
136
136
  prop(prop) { return this.props[prop.id]; }
137
137
  /// True when this is the top node of a grammar.
138
- get isTop() { return (this.flags & 1 /* Top */) > 0; }
138
+ get isTop() { return (this.flags & 1 /* NodeFlag.Top */) > 0; }
139
139
  /// True when this node is produced by a skip rule.
140
- get isSkipped() { return (this.flags & 2 /* Skipped */) > 0; }
140
+ get isSkipped() { return (this.flags & 2 /* NodeFlag.Skipped */) > 0; }
141
141
  /// Indicates whether this is an error node.
142
- get isError() { return (this.flags & 4 /* Error */) > 0; }
142
+ get isError() { return (this.flags & 4 /* NodeFlag.Error */) > 0; }
143
143
  /// When true, this node type doesn't correspond to a user-declared
144
144
  /// named node, for example because it is used to cache repetition.
145
- get isAnonymous() { return (this.flags & 8 /* Anonymous */) > 0; }
145
+ get isAnonymous() { return (this.flags & 8 /* NodeFlag.Anonymous */) > 0; }
146
146
  /// Returns true when this node's name or one of its
147
147
  /// [groups](#common.NodeProp^group) matches the given string.
148
148
  is(name) {
@@ -175,7 +175,7 @@ class NodeType {
175
175
  }
176
176
  }
177
177
  /// An empty dummy node type to use when no actual type is available.
178
- NodeType.none = new NodeType("", Object.create(null), 0, 8 /* Anonymous */);
178
+ NodeType.none = new NodeType("", Object.create(null), 0, 8 /* NodeFlag.Anonymous */);
179
179
  /// A node set holds a collection of node types. It is used to
180
180
  /// compactly represent trees by storing their type ids, rather than a
181
181
  /// full pointer to the type object, in a numeric array. Each parser
@@ -347,15 +347,16 @@ class Tree {
347
347
  /// not have its children iterated over (or `leave` called).
348
348
  iterate(spec) {
349
349
  let { enter, leave, from = 0, to = this.length } = spec;
350
- for (let c = this.cursor((spec.mode || 0) | exports.IterMode.IncludeAnonymous);;) {
350
+ let mode = spec.mode || 0, anon = (mode & exports.IterMode.IncludeAnonymous) > 0;
351
+ for (let c = this.cursor(mode | exports.IterMode.IncludeAnonymous);;) {
351
352
  let entered = false;
352
- if (c.from <= to && c.to >= from && (c.type.isAnonymous || enter(c) !== false)) {
353
+ if (c.from <= to && c.to >= from && (!anon && c.type.isAnonymous || enter(c) !== false)) {
353
354
  if (c.firstChild())
354
355
  continue;
355
356
  entered = true;
356
357
  }
357
358
  for (;;) {
358
- if (entered && leave && !c.type.isAnonymous)
359
+ if (entered && leave && (anon || !c.type.isAnonymous))
359
360
  leave(c);
360
361
  if (c.nextSibling())
361
362
  break;
@@ -384,7 +385,7 @@ class Tree {
384
385
  /// which may have children grouped into subtrees with type
385
386
  /// [`NodeType.none`](#common.NodeType^none).
386
387
  balance(config = {}) {
387
- return this.children.length <= 8 /* BranchFactor */ ? this :
388
+ return this.children.length <= 8 /* Balance.BranchFactor */ ? this :
388
389
  balanceRange(NodeType.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length) => new Tree(this.type, children, positions, length, this.propValues), config.makeTree || ((children, positions, length) => new Tree(NodeType.none, children, positions, length)));
389
390
  }
390
391
  /// Build a tree from a postfix-ordered buffer of node information,
@@ -463,26 +464,27 @@ class TreeBuffer {
463
464
  return pick;
464
465
  }
465
466
  /// @internal
466
- slice(startI, endI, from, to) {
467
+ slice(startI, endI, from) {
467
468
  let b = this.buffer;
468
- let copy = new Uint16Array(endI - startI);
469
+ let copy = new Uint16Array(endI - startI), len = 0;
469
470
  for (let i = startI, j = 0; i < endI;) {
470
471
  copy[j++] = b[i++];
471
472
  copy[j++] = b[i++] - from;
472
- copy[j++] = b[i++] - from;
473
+ let to = copy[j++] = b[i++] - from;
473
474
  copy[j++] = b[i++] - startI;
475
+ len = Math.max(len, to);
474
476
  }
475
- return new TreeBuffer(copy, to - from, this.set);
477
+ return new TreeBuffer(copy, len, this.set);
476
478
  }
477
479
  }
478
480
  function checkSide(side, pos, from, to) {
479
481
  switch (side) {
480
- case -2 /* Before */: return from < pos;
481
- case -1 /* AtOrBefore */: return to >= pos && from < pos;
482
- case 0 /* Around */: return from < pos && to > pos;
483
- case 1 /* AtOrAfter */: return from <= pos && to > pos;
484
- case 2 /* After */: return to > pos;
485
- case 4 /* DontCare */: return true;
482
+ case -2 /* Side.Before */: return from < pos;
483
+ case -1 /* Side.AtOrBefore */: return to >= pos && from < pos;
484
+ case 0 /* Side.Around */: return from < pos && to > pos;
485
+ case 1 /* Side.AtOrAfter */: return from <= pos && to > pos;
486
+ case 2 /* Side.After */: return to > pos;
487
+ case 4 /* Side.DontCare */: return true;
486
488
  }
487
489
  }
488
490
  function enterUnfinishedNodesBefore(node, pos) {
@@ -572,10 +574,10 @@ class TreeNode {
572
574
  return null;
573
575
  }
574
576
  }
575
- get firstChild() { return this.nextChild(0, 1, 0, 4 /* DontCare */); }
576
- get lastChild() { return this.nextChild(this._tree.children.length - 1, -1, 0, 4 /* DontCare */); }
577
- childAfter(pos) { return this.nextChild(0, 1, pos, 2 /* After */); }
578
- childBefore(pos) { return this.nextChild(this._tree.children.length - 1, -1, pos, -2 /* Before */); }
577
+ get firstChild() { return this.nextChild(0, 1, 0, 4 /* Side.DontCare */); }
578
+ get lastChild() { return this.nextChild(this._tree.children.length - 1, -1, 0, 4 /* Side.DontCare */); }
579
+ childAfter(pos) { return this.nextChild(0, 1, pos, 2 /* Side.After */); }
580
+ childBefore(pos) { return this.nextChild(this._tree.children.length - 1, -1, pos, -2 /* Side.Before */); }
579
581
  enter(pos, side, mode = 0) {
580
582
  let mounted;
581
583
  if (!(mode & exports.IterMode.IgnoreOverlays) && (mounted = this._tree.prop(NodeProp.mounted)) && mounted.overlay) {
@@ -598,10 +600,10 @@ class TreeNode {
598
600
  return this._parent ? this._parent.nextSignificantParent() : null;
599
601
  }
600
602
  get nextSibling() {
601
- return this._parent && this.index >= 0 ? this._parent.nextChild(this.index + 1, 1, 0, 4 /* DontCare */) : null;
603
+ return this._parent && this.index >= 0 ? this._parent.nextChild(this.index + 1, 1, 0, 4 /* Side.DontCare */) : null;
602
604
  }
603
605
  get prevSibling() {
604
- return this._parent && this.index >= 0 ? this._parent.nextChild(this.index - 1, -1, 0, 4 /* DontCare */) : null;
606
+ return this._parent && this.index >= 0 ? this._parent.nextChild(this.index - 1, -1, 0, 4 /* Side.DontCare */) : null;
605
607
  }
606
608
  cursor(mode = 0) { return new TreeCursor(this, mode); }
607
609
  get tree() { return this._tree; }
@@ -663,24 +665,24 @@ class BufferContext {
663
665
  }
664
666
  }
665
667
  class BufferNode {
668
+ get name() { return this.type.name; }
669
+ get from() { return this.context.start + this.context.buffer.buffer[this.index + 1]; }
670
+ get to() { return this.context.start + this.context.buffer.buffer[this.index + 2]; }
666
671
  constructor(context, _parent, index) {
667
672
  this.context = context;
668
673
  this._parent = _parent;
669
674
  this.index = index;
670
675
  this.type = context.buffer.set.types[context.buffer.buffer[index]];
671
676
  }
672
- get name() { return this.type.name; }
673
- get from() { return this.context.start + this.context.buffer.buffer[this.index + 1]; }
674
- get to() { return this.context.start + this.context.buffer.buffer[this.index + 2]; }
675
677
  child(dir, pos, side) {
676
678
  let { buffer } = this.context;
677
679
  let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side);
678
680
  return index < 0 ? null : new BufferNode(this.context, this, index);
679
681
  }
680
- get firstChild() { return this.child(1, 0, 4 /* DontCare */); }
681
- get lastChild() { return this.child(-1, 0, 4 /* DontCare */); }
682
- childAfter(pos) { return this.child(1, pos, 2 /* After */); }
683
- childBefore(pos) { return this.child(-1, pos, -2 /* Before */); }
682
+ get firstChild() { return this.child(1, 0, 4 /* Side.DontCare */); }
683
+ get lastChild() { return this.child(-1, 0, 4 /* Side.DontCare */); }
684
+ childAfter(pos) { return this.child(1, pos, 2 /* Side.After */); }
685
+ childBefore(pos) { return this.child(-1, pos, -2 /* Side.Before */); }
684
686
  enter(pos, side, mode = 0) {
685
687
  if (mode & exports.IterMode.ExcludeBuffers)
686
688
  return null;
@@ -692,7 +694,7 @@ class BufferNode {
692
694
  return this._parent || this.context.parent.nextSignificantParent();
693
695
  }
694
696
  externalSibling(dir) {
695
- return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4 /* DontCare */);
697
+ return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4 /* Side.DontCare */);
696
698
  }
697
699
  get nextSibling() {
698
700
  let { buffer } = this.context;
@@ -706,7 +708,7 @@ class BufferNode {
706
708
  let parentStart = this._parent ? this._parent.index + 4 : 0;
707
709
  if (this.index == parentStart)
708
710
  return this.externalSibling(-1);
709
- return new BufferNode(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4 /* DontCare */));
711
+ return new BufferNode(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4 /* Side.DontCare */));
710
712
  }
711
713
  cursor(mode = 0) { return new TreeCursor(this, mode); }
712
714
  get tree() { return null; }
@@ -715,8 +717,8 @@ class BufferNode {
715
717
  let { buffer } = this.context;
716
718
  let startI = this.index + 4, endI = buffer.buffer[this.index + 3];
717
719
  if (endI > startI) {
718
- let from = buffer.buffer[this.index + 1], to = buffer.buffer[this.index + 2];
719
- children.push(buffer.slice(startI, endI, from, to));
720
+ let from = buffer.buffer[this.index + 1];
721
+ children.push(buffer.slice(startI, endI, from));
720
722
  positions.push(0);
721
723
  }
722
724
  return new Tree(this.type, children, positions, this.to - this.from);
@@ -743,6 +745,8 @@ class BufferNode {
743
745
  /// A tree cursor object focuses on a given node in a syntax tree, and
744
746
  /// allows you to move to adjacent nodes.
745
747
  class TreeCursor {
748
+ /// Shorthand for `.type.name`.
749
+ get name() { return this.type.name; }
746
750
  /// @internal
747
751
  constructor(node,
748
752
  /// @internal
@@ -766,8 +770,6 @@ class TreeCursor {
766
770
  this.yieldBuf(node.index);
767
771
  }
768
772
  }
769
- /// Shorthand for `.type.name`.
770
- get name() { return this.type.name; }
771
773
  yieldNode(node) {
772
774
  if (!node)
773
775
  return false;
@@ -812,13 +814,13 @@ class TreeCursor {
812
814
  }
813
815
  /// Move the cursor to this node's first child. When this returns
814
816
  /// false, the node has no child, and the cursor has not been moved.
815
- firstChild() { return this.enterChild(1, 0, 4 /* DontCare */); }
817
+ firstChild() { return this.enterChild(1, 0, 4 /* Side.DontCare */); }
816
818
  /// Move the cursor to this node's last child.
817
- lastChild() { return this.enterChild(-1, 0, 4 /* DontCare */); }
819
+ lastChild() { return this.enterChild(-1, 0, 4 /* Side.DontCare */); }
818
820
  /// Move the cursor to the first child that ends after `pos`.
819
- childAfter(pos) { return this.enterChild(1, pos, 2 /* After */); }
821
+ childAfter(pos) { return this.enterChild(1, pos, 2 /* Side.After */); }
820
822
  /// Move to the last child that starts before `pos`.
821
- childBefore(pos) { return this.enterChild(-1, pos, -2 /* Before */); }
823
+ childBefore(pos) { return this.enterChild(-1, pos, -2 /* Side.Before */); }
822
824
  /// Move the cursor to the child around `pos`. If side is -1 the
823
825
  /// child may end at that position, when 1 it may start there. This
824
826
  /// will also enter [overlaid](#common.MountedTree.overlay)
@@ -844,19 +846,19 @@ class TreeCursor {
844
846
  if (!this.buffer)
845
847
  return !this._tree._parent ? false
846
848
  : this.yield(this._tree.index < 0 ? null
847
- : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4 /* DontCare */, this.mode));
849
+ : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4 /* Side.DontCare */, this.mode));
848
850
  let { buffer } = this.buffer, d = this.stack.length - 1;
849
851
  if (dir < 0) {
850
852
  let parentStart = d < 0 ? 0 : this.stack[d] + 4;
851
853
  if (this.index != parentStart)
852
- return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4 /* DontCare */));
854
+ return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4 /* Side.DontCare */));
853
855
  }
854
856
  else {
855
857
  let after = buffer.buffer[this.index + 3];
856
858
  if (after < (d < 0 ? buffer.buffer.length : buffer.buffer[this.stack[d] + 3]))
857
859
  return this.yieldBuf(after);
858
860
  }
859
- return d < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4 /* DontCare */, this.mode)) : false;
861
+ return d < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4 /* Side.DontCare */, this.mode)) : false;
860
862
  }
861
863
  /// Move to this node's next sibling, if any.
862
864
  nextSibling() { return this.sibling(1); }
@@ -893,7 +895,7 @@ class TreeCursor {
893
895
  return true;
894
896
  }
895
897
  move(dir, enter) {
896
- if (enter && this.enterChild(dir, 0, 4 /* DontCare */))
898
+ if (enter && this.enterChild(dir, 0, 4 /* Side.DontCare */))
897
899
  return true;
898
900
  for (;;) {
899
901
  if (this.sibling(dir))
@@ -903,7 +905,7 @@ class TreeCursor {
903
905
  }
904
906
  }
905
907
  /// Move to the next node in a
906
- /// [pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order_(NLR))
908
+ /// [pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order,_NLR)
907
909
  /// traversal, going from a node to its first child or, if the
908
910
  /// current node is empty or `enter` is false, its next sibling or
909
911
  /// the next sibling of the first parent node that has one.
@@ -1019,17 +1021,17 @@ function buildTree(data) {
1019
1021
  let lookAheadAtStart = lookAhead;
1020
1022
  while (size < 0) {
1021
1023
  cursor.next();
1022
- if (size == -1 /* Reuse */) {
1024
+ if (size == -1 /* SpecialRecord.Reuse */) {
1023
1025
  let node = reused[id];
1024
1026
  children.push(node);
1025
1027
  positions.push(start - parentStart);
1026
1028
  return;
1027
1029
  }
1028
- else if (size == -3 /* ContextChange */) { // Context change
1030
+ else if (size == -3 /* SpecialRecord.ContextChange */) { // Context change
1029
1031
  contextHash = id;
1030
1032
  return;
1031
1033
  }
1032
- else if (size == -4 /* LookAhead */) {
1034
+ else if (size == -4 /* SpecialRecord.LookAhead */) {
1033
1035
  lookAhead = id;
1034
1036
  return;
1035
1037
  }
@@ -1146,7 +1148,7 @@ function buildTree(data) {
1146
1148
  fork.next();
1147
1149
  while (fork.pos > startPos) {
1148
1150
  if (fork.size < 0) {
1149
- if (fork.size == -3 /* ContextChange */)
1151
+ if (fork.size == -3 /* SpecialRecord.ContextChange */)
1150
1152
  localSkipped += 4;
1151
1153
  else
1152
1154
  break scan;
@@ -1182,10 +1184,10 @@ function buildTree(data) {
1182
1184
  buffer[--index] = start - bufferStart;
1183
1185
  buffer[--index] = id;
1184
1186
  }
1185
- else if (size == -3 /* ContextChange */) {
1187
+ else if (size == -3 /* SpecialRecord.ContextChange */) {
1186
1188
  contextHash = id;
1187
1189
  }
1188
- else if (size == -4 /* LookAhead */) {
1190
+ else if (size == -4 /* SpecialRecord.LookAhead */) {
1189
1191
  lookAhead = id;
1190
1192
  }
1191
1193
  return index;
@@ -1232,7 +1234,7 @@ mkTree) {
1232
1234
  let total = 0;
1233
1235
  for (let i = from; i < to; i++)
1234
1236
  total += nodeSize(balanceType, children[i]);
1235
- let maxChild = Math.ceil((total * 1.5) / 8 /* BranchFactor */);
1237
+ let maxChild = Math.ceil((total * 1.5) / 8 /* Balance.BranchFactor */);
1236
1238
  let localChildren = [], localPositions = [];
1237
1239
  function divide(children, positions, from, to, offset) {
1238
1240
  for (let i = from; i < to;) {
@@ -1335,16 +1337,16 @@ class TreeFragment {
1335
1337
  this.to = to;
1336
1338
  this.tree = tree;
1337
1339
  this.offset = offset;
1338
- this.open = (openStart ? 1 /* Start */ : 0) | (openEnd ? 2 /* End */ : 0);
1340
+ this.open = (openStart ? 1 /* Open.Start */ : 0) | (openEnd ? 2 /* Open.End */ : 0);
1339
1341
  }
1340
1342
  /// Whether the start of the fragment represents the start of a
1341
1343
  /// parse, or the end of a change. (In the second case, it may not
1342
1344
  /// be safe to reuse some nodes at the start, depending on the
1343
1345
  /// parsing algorithm.)
1344
- get openStart() { return (this.open & 1 /* Start */) > 0; }
1346
+ get openStart() { return (this.open & 1 /* Open.Start */) > 0; }
1345
1347
  /// Whether the end of the fragment represents the end of a
1346
1348
  /// full-document parse, or the start of a change.
1347
- get openEnd() { return (this.open & 2 /* End */) > 0; }
1349
+ get openEnd() { return (this.open & 2 /* Open.End */) > 0; }
1348
1350
  /// Create a set of fragments from a freshly parsed tree, or update
1349
1351
  /// an existing set of fragments by replacing the ones that overlap
1350
1352
  /// with a tree with content from the new tree. When `partial` is
@@ -1441,6 +1443,8 @@ class InnerParse {
1441
1443
  this.overlay = overlay;
1442
1444
  this.target = target;
1443
1445
  this.ranges = ranges;
1446
+ if (!ranges.length || ranges.some(r => r.from >= r.to))
1447
+ throw new RangeError("Invalid inner parse ranges given: " + JSON.stringify(ranges));
1444
1448
  }
1445
1449
  }
1446
1450
  class ActiveOverlay {
@@ -1538,7 +1542,7 @@ class MixedParse {
1538
1542
  enter = false;
1539
1543
  }
1540
1544
  else if (covered && (isCovered = checkCover(covered.ranges, cursor.from, cursor.to))) {
1541
- enter = isCovered != 2 /* Full */;
1545
+ enter = isCovered != 2 /* Cover.Full */;
1542
1546
  }
1543
1547
  else if (!cursor.type.isAnonymous && cursor.from < cursor.to && (nest = this.nest(cursor, this.input))) {
1544
1548
  if (!cursor.tree)
@@ -1593,16 +1597,16 @@ function checkCover(covered, from, to) {
1593
1597
  if (range.from >= to)
1594
1598
  break;
1595
1599
  if (range.to > from)
1596
- return range.from <= from && range.to >= to ? 2 /* Full */ : 1 /* Partial */;
1600
+ return range.from <= from && range.to >= to ? 2 /* Cover.Full */ : 1 /* Cover.Partial */;
1597
1601
  }
1598
- return 0 /* None */;
1602
+ return 0 /* Cover.None */;
1599
1603
  }
1600
1604
  // Take a piece of buffer and convert it into a stand-alone
1601
1605
  // TreeBuffer.
1602
1606
  function sliceBuf(buf, startI, endI, nodes, positions, off) {
1603
1607
  if (startI < endI) {
1604
- let from = buf.buffer[startI + 1], to = buf.buffer[endI - 2];
1605
- nodes.push(buf.slice(startI, endI, from, to));
1608
+ let from = buf.buffer[startI + 1];
1609
+ nodes.push(buf.slice(startI, endI, from));
1606
1610
  positions.push(from - off);
1607
1611
  }
1608
1612
  }
package/dist/index.js CHANGED
@@ -112,8 +112,8 @@ class NodeType {
112
112
  /// Define a node type.
113
113
  static define(spec) {
114
114
  let props = spec.props && spec.props.length ? Object.create(null) : noProps;
115
- let flags = (spec.top ? 1 /* Top */ : 0) | (spec.skipped ? 2 /* Skipped */ : 0) |
116
- (spec.error ? 4 /* Error */ : 0) | (spec.name == null ? 8 /* Anonymous */ : 0);
115
+ let flags = (spec.top ? 1 /* NodeFlag.Top */ : 0) | (spec.skipped ? 2 /* NodeFlag.Skipped */ : 0) |
116
+ (spec.error ? 4 /* NodeFlag.Error */ : 0) | (spec.name == null ? 8 /* NodeFlag.Anonymous */ : 0);
117
117
  let type = new NodeType(spec.name || "", props, spec.id, flags);
118
118
  if (spec.props)
119
119
  for (let src of spec.props) {
@@ -131,14 +131,14 @@ class NodeType {
131
131
  /// the prop isn't present on this node.
132
132
  prop(prop) { return this.props[prop.id]; }
133
133
  /// True when this is the top node of a grammar.
134
- get isTop() { return (this.flags & 1 /* Top */) > 0; }
134
+ get isTop() { return (this.flags & 1 /* NodeFlag.Top */) > 0; }
135
135
  /// True when this node is produced by a skip rule.
136
- get isSkipped() { return (this.flags & 2 /* Skipped */) > 0; }
136
+ get isSkipped() { return (this.flags & 2 /* NodeFlag.Skipped */) > 0; }
137
137
  /// Indicates whether this is an error node.
138
- get isError() { return (this.flags & 4 /* Error */) > 0; }
138
+ get isError() { return (this.flags & 4 /* NodeFlag.Error */) > 0; }
139
139
  /// When true, this node type doesn't correspond to a user-declared
140
140
  /// named node, for example because it is used to cache repetition.
141
- get isAnonymous() { return (this.flags & 8 /* Anonymous */) > 0; }
141
+ get isAnonymous() { return (this.flags & 8 /* NodeFlag.Anonymous */) > 0; }
142
142
  /// Returns true when this node's name or one of its
143
143
  /// [groups](#common.NodeProp^group) matches the given string.
144
144
  is(name) {
@@ -171,7 +171,7 @@ class NodeType {
171
171
  }
172
172
  }
173
173
  /// An empty dummy node type to use when no actual type is available.
174
- NodeType.none = new NodeType("", Object.create(null), 0, 8 /* Anonymous */);
174
+ NodeType.none = new NodeType("", Object.create(null), 0, 8 /* NodeFlag.Anonymous */);
175
175
  /// A node set holds a collection of node types. It is used to
176
176
  /// compactly represent trees by storing their type ids, rather than a
177
177
  /// full pointer to the type object, in a numeric array. Each parser
@@ -343,15 +343,16 @@ class Tree {
343
343
  /// not have its children iterated over (or `leave` called).
344
344
  iterate(spec) {
345
345
  let { enter, leave, from = 0, to = this.length } = spec;
346
- for (let c = this.cursor((spec.mode || 0) | IterMode.IncludeAnonymous);;) {
346
+ let mode = spec.mode || 0, anon = (mode & IterMode.IncludeAnonymous) > 0;
347
+ for (let c = this.cursor(mode | IterMode.IncludeAnonymous);;) {
347
348
  let entered = false;
348
- if (c.from <= to && c.to >= from && (c.type.isAnonymous || enter(c) !== false)) {
349
+ if (c.from <= to && c.to >= from && (!anon && c.type.isAnonymous || enter(c) !== false)) {
349
350
  if (c.firstChild())
350
351
  continue;
351
352
  entered = true;
352
353
  }
353
354
  for (;;) {
354
- if (entered && leave && !c.type.isAnonymous)
355
+ if (entered && leave && (anon || !c.type.isAnonymous))
355
356
  leave(c);
356
357
  if (c.nextSibling())
357
358
  break;
@@ -380,7 +381,7 @@ class Tree {
380
381
  /// which may have children grouped into subtrees with type
381
382
  /// [`NodeType.none`](#common.NodeType^none).
382
383
  balance(config = {}) {
383
- return this.children.length <= 8 /* BranchFactor */ ? this :
384
+ return this.children.length <= 8 /* Balance.BranchFactor */ ? this :
384
385
  balanceRange(NodeType.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length) => new Tree(this.type, children, positions, length, this.propValues), config.makeTree || ((children, positions, length) => new Tree(NodeType.none, children, positions, length)));
385
386
  }
386
387
  /// Build a tree from a postfix-ordered buffer of node information,
@@ -459,26 +460,27 @@ class TreeBuffer {
459
460
  return pick;
460
461
  }
461
462
  /// @internal
462
- slice(startI, endI, from, to) {
463
+ slice(startI, endI, from) {
463
464
  let b = this.buffer;
464
- let copy = new Uint16Array(endI - startI);
465
+ let copy = new Uint16Array(endI - startI), len = 0;
465
466
  for (let i = startI, j = 0; i < endI;) {
466
467
  copy[j++] = b[i++];
467
468
  copy[j++] = b[i++] - from;
468
- copy[j++] = b[i++] - from;
469
+ let to = copy[j++] = b[i++] - from;
469
470
  copy[j++] = b[i++] - startI;
471
+ len = Math.max(len, to);
470
472
  }
471
- return new TreeBuffer(copy, to - from, this.set);
473
+ return new TreeBuffer(copy, len, this.set);
472
474
  }
473
475
  }
474
476
  function checkSide(side, pos, from, to) {
475
477
  switch (side) {
476
- case -2 /* Before */: return from < pos;
477
- case -1 /* AtOrBefore */: return to >= pos && from < pos;
478
- case 0 /* Around */: return from < pos && to > pos;
479
- case 1 /* AtOrAfter */: return from <= pos && to > pos;
480
- case 2 /* After */: return to > pos;
481
- case 4 /* DontCare */: return true;
478
+ case -2 /* Side.Before */: return from < pos;
479
+ case -1 /* Side.AtOrBefore */: return to >= pos && from < pos;
480
+ case 0 /* Side.Around */: return from < pos && to > pos;
481
+ case 1 /* Side.AtOrAfter */: return from <= pos && to > pos;
482
+ case 2 /* Side.After */: return to > pos;
483
+ case 4 /* Side.DontCare */: return true;
482
484
  }
483
485
  }
484
486
  function enterUnfinishedNodesBefore(node, pos) {
@@ -568,10 +570,10 @@ class TreeNode {
568
570
  return null;
569
571
  }
570
572
  }
571
- get firstChild() { return this.nextChild(0, 1, 0, 4 /* DontCare */); }
572
- get lastChild() { return this.nextChild(this._tree.children.length - 1, -1, 0, 4 /* DontCare */); }
573
- childAfter(pos) { return this.nextChild(0, 1, pos, 2 /* After */); }
574
- childBefore(pos) { return this.nextChild(this._tree.children.length - 1, -1, pos, -2 /* Before */); }
573
+ get firstChild() { return this.nextChild(0, 1, 0, 4 /* Side.DontCare */); }
574
+ get lastChild() { return this.nextChild(this._tree.children.length - 1, -1, 0, 4 /* Side.DontCare */); }
575
+ childAfter(pos) { return this.nextChild(0, 1, pos, 2 /* Side.After */); }
576
+ childBefore(pos) { return this.nextChild(this._tree.children.length - 1, -1, pos, -2 /* Side.Before */); }
575
577
  enter(pos, side, mode = 0) {
576
578
  let mounted;
577
579
  if (!(mode & IterMode.IgnoreOverlays) && (mounted = this._tree.prop(NodeProp.mounted)) && mounted.overlay) {
@@ -594,10 +596,10 @@ class TreeNode {
594
596
  return this._parent ? this._parent.nextSignificantParent() : null;
595
597
  }
596
598
  get nextSibling() {
597
- return this._parent && this.index >= 0 ? this._parent.nextChild(this.index + 1, 1, 0, 4 /* DontCare */) : null;
599
+ return this._parent && this.index >= 0 ? this._parent.nextChild(this.index + 1, 1, 0, 4 /* Side.DontCare */) : null;
598
600
  }
599
601
  get prevSibling() {
600
- return this._parent && this.index >= 0 ? this._parent.nextChild(this.index - 1, -1, 0, 4 /* DontCare */) : null;
602
+ return this._parent && this.index >= 0 ? this._parent.nextChild(this.index - 1, -1, 0, 4 /* Side.DontCare */) : null;
601
603
  }
602
604
  cursor(mode = 0) { return new TreeCursor(this, mode); }
603
605
  get tree() { return this._tree; }
@@ -659,24 +661,24 @@ class BufferContext {
659
661
  }
660
662
  }
661
663
  class BufferNode {
664
+ get name() { return this.type.name; }
665
+ get from() { return this.context.start + this.context.buffer.buffer[this.index + 1]; }
666
+ get to() { return this.context.start + this.context.buffer.buffer[this.index + 2]; }
662
667
  constructor(context, _parent, index) {
663
668
  this.context = context;
664
669
  this._parent = _parent;
665
670
  this.index = index;
666
671
  this.type = context.buffer.set.types[context.buffer.buffer[index]];
667
672
  }
668
- get name() { return this.type.name; }
669
- get from() { return this.context.start + this.context.buffer.buffer[this.index + 1]; }
670
- get to() { return this.context.start + this.context.buffer.buffer[this.index + 2]; }
671
673
  child(dir, pos, side) {
672
674
  let { buffer } = this.context;
673
675
  let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side);
674
676
  return index < 0 ? null : new BufferNode(this.context, this, index);
675
677
  }
676
- get firstChild() { return this.child(1, 0, 4 /* DontCare */); }
677
- get lastChild() { return this.child(-1, 0, 4 /* DontCare */); }
678
- childAfter(pos) { return this.child(1, pos, 2 /* After */); }
679
- childBefore(pos) { return this.child(-1, pos, -2 /* Before */); }
678
+ get firstChild() { return this.child(1, 0, 4 /* Side.DontCare */); }
679
+ get lastChild() { return this.child(-1, 0, 4 /* Side.DontCare */); }
680
+ childAfter(pos) { return this.child(1, pos, 2 /* Side.After */); }
681
+ childBefore(pos) { return this.child(-1, pos, -2 /* Side.Before */); }
680
682
  enter(pos, side, mode = 0) {
681
683
  if (mode & IterMode.ExcludeBuffers)
682
684
  return null;
@@ -688,7 +690,7 @@ class BufferNode {
688
690
  return this._parent || this.context.parent.nextSignificantParent();
689
691
  }
690
692
  externalSibling(dir) {
691
- return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4 /* DontCare */);
693
+ return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4 /* Side.DontCare */);
692
694
  }
693
695
  get nextSibling() {
694
696
  let { buffer } = this.context;
@@ -702,7 +704,7 @@ class BufferNode {
702
704
  let parentStart = this._parent ? this._parent.index + 4 : 0;
703
705
  if (this.index == parentStart)
704
706
  return this.externalSibling(-1);
705
- return new BufferNode(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4 /* DontCare */));
707
+ return new BufferNode(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4 /* Side.DontCare */));
706
708
  }
707
709
  cursor(mode = 0) { return new TreeCursor(this, mode); }
708
710
  get tree() { return null; }
@@ -711,8 +713,8 @@ class BufferNode {
711
713
  let { buffer } = this.context;
712
714
  let startI = this.index + 4, endI = buffer.buffer[this.index + 3];
713
715
  if (endI > startI) {
714
- let from = buffer.buffer[this.index + 1], to = buffer.buffer[this.index + 2];
715
- children.push(buffer.slice(startI, endI, from, to));
716
+ let from = buffer.buffer[this.index + 1];
717
+ children.push(buffer.slice(startI, endI, from));
716
718
  positions.push(0);
717
719
  }
718
720
  return new Tree(this.type, children, positions, this.to - this.from);
@@ -739,6 +741,8 @@ class BufferNode {
739
741
  /// A tree cursor object focuses on a given node in a syntax tree, and
740
742
  /// allows you to move to adjacent nodes.
741
743
  class TreeCursor {
744
+ /// Shorthand for `.type.name`.
745
+ get name() { return this.type.name; }
742
746
  /// @internal
743
747
  constructor(node,
744
748
  /// @internal
@@ -762,8 +766,6 @@ class TreeCursor {
762
766
  this.yieldBuf(node.index);
763
767
  }
764
768
  }
765
- /// Shorthand for `.type.name`.
766
- get name() { return this.type.name; }
767
769
  yieldNode(node) {
768
770
  if (!node)
769
771
  return false;
@@ -808,13 +810,13 @@ class TreeCursor {
808
810
  }
809
811
  /// Move the cursor to this node's first child. When this returns
810
812
  /// false, the node has no child, and the cursor has not been moved.
811
- firstChild() { return this.enterChild(1, 0, 4 /* DontCare */); }
813
+ firstChild() { return this.enterChild(1, 0, 4 /* Side.DontCare */); }
812
814
  /// Move the cursor to this node's last child.
813
- lastChild() { return this.enterChild(-1, 0, 4 /* DontCare */); }
815
+ lastChild() { return this.enterChild(-1, 0, 4 /* Side.DontCare */); }
814
816
  /// Move the cursor to the first child that ends after `pos`.
815
- childAfter(pos) { return this.enterChild(1, pos, 2 /* After */); }
817
+ childAfter(pos) { return this.enterChild(1, pos, 2 /* Side.After */); }
816
818
  /// Move to the last child that starts before `pos`.
817
- childBefore(pos) { return this.enterChild(-1, pos, -2 /* Before */); }
819
+ childBefore(pos) { return this.enterChild(-1, pos, -2 /* Side.Before */); }
818
820
  /// Move the cursor to the child around `pos`. If side is -1 the
819
821
  /// child may end at that position, when 1 it may start there. This
820
822
  /// will also enter [overlaid](#common.MountedTree.overlay)
@@ -840,19 +842,19 @@ class TreeCursor {
840
842
  if (!this.buffer)
841
843
  return !this._tree._parent ? false
842
844
  : this.yield(this._tree.index < 0 ? null
843
- : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4 /* DontCare */, this.mode));
845
+ : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4 /* Side.DontCare */, this.mode));
844
846
  let { buffer } = this.buffer, d = this.stack.length - 1;
845
847
  if (dir < 0) {
846
848
  let parentStart = d < 0 ? 0 : this.stack[d] + 4;
847
849
  if (this.index != parentStart)
848
- return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4 /* DontCare */));
850
+ return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4 /* Side.DontCare */));
849
851
  }
850
852
  else {
851
853
  let after = buffer.buffer[this.index + 3];
852
854
  if (after < (d < 0 ? buffer.buffer.length : buffer.buffer[this.stack[d] + 3]))
853
855
  return this.yieldBuf(after);
854
856
  }
855
- return d < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4 /* DontCare */, this.mode)) : false;
857
+ return d < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4 /* Side.DontCare */, this.mode)) : false;
856
858
  }
857
859
  /// Move to this node's next sibling, if any.
858
860
  nextSibling() { return this.sibling(1); }
@@ -889,7 +891,7 @@ class TreeCursor {
889
891
  return true;
890
892
  }
891
893
  move(dir, enter) {
892
- if (enter && this.enterChild(dir, 0, 4 /* DontCare */))
894
+ if (enter && this.enterChild(dir, 0, 4 /* Side.DontCare */))
893
895
  return true;
894
896
  for (;;) {
895
897
  if (this.sibling(dir))
@@ -899,7 +901,7 @@ class TreeCursor {
899
901
  }
900
902
  }
901
903
  /// Move to the next node in a
902
- /// [pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order_(NLR))
904
+ /// [pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order,_NLR)
903
905
  /// traversal, going from a node to its first child or, if the
904
906
  /// current node is empty or `enter` is false, its next sibling or
905
907
  /// the next sibling of the first parent node that has one.
@@ -1015,17 +1017,17 @@ function buildTree(data) {
1015
1017
  let lookAheadAtStart = lookAhead;
1016
1018
  while (size < 0) {
1017
1019
  cursor.next();
1018
- if (size == -1 /* Reuse */) {
1020
+ if (size == -1 /* SpecialRecord.Reuse */) {
1019
1021
  let node = reused[id];
1020
1022
  children.push(node);
1021
1023
  positions.push(start - parentStart);
1022
1024
  return;
1023
1025
  }
1024
- else if (size == -3 /* ContextChange */) { // Context change
1026
+ else if (size == -3 /* SpecialRecord.ContextChange */) { // Context change
1025
1027
  contextHash = id;
1026
1028
  return;
1027
1029
  }
1028
- else if (size == -4 /* LookAhead */) {
1030
+ else if (size == -4 /* SpecialRecord.LookAhead */) {
1029
1031
  lookAhead = id;
1030
1032
  return;
1031
1033
  }
@@ -1142,7 +1144,7 @@ function buildTree(data) {
1142
1144
  fork.next();
1143
1145
  while (fork.pos > startPos) {
1144
1146
  if (fork.size < 0) {
1145
- if (fork.size == -3 /* ContextChange */)
1147
+ if (fork.size == -3 /* SpecialRecord.ContextChange */)
1146
1148
  localSkipped += 4;
1147
1149
  else
1148
1150
  break scan;
@@ -1178,10 +1180,10 @@ function buildTree(data) {
1178
1180
  buffer[--index] = start - bufferStart;
1179
1181
  buffer[--index] = id;
1180
1182
  }
1181
- else if (size == -3 /* ContextChange */) {
1183
+ else if (size == -3 /* SpecialRecord.ContextChange */) {
1182
1184
  contextHash = id;
1183
1185
  }
1184
- else if (size == -4 /* LookAhead */) {
1186
+ else if (size == -4 /* SpecialRecord.LookAhead */) {
1185
1187
  lookAhead = id;
1186
1188
  }
1187
1189
  return index;
@@ -1228,7 +1230,7 @@ mkTree) {
1228
1230
  let total = 0;
1229
1231
  for (let i = from; i < to; i++)
1230
1232
  total += nodeSize(balanceType, children[i]);
1231
- let maxChild = Math.ceil((total * 1.5) / 8 /* BranchFactor */);
1233
+ let maxChild = Math.ceil((total * 1.5) / 8 /* Balance.BranchFactor */);
1232
1234
  let localChildren = [], localPositions = [];
1233
1235
  function divide(children, positions, from, to, offset) {
1234
1236
  for (let i = from; i < to;) {
@@ -1331,16 +1333,16 @@ class TreeFragment {
1331
1333
  this.to = to;
1332
1334
  this.tree = tree;
1333
1335
  this.offset = offset;
1334
- this.open = (openStart ? 1 /* Start */ : 0) | (openEnd ? 2 /* End */ : 0);
1336
+ this.open = (openStart ? 1 /* Open.Start */ : 0) | (openEnd ? 2 /* Open.End */ : 0);
1335
1337
  }
1336
1338
  /// Whether the start of the fragment represents the start of a
1337
1339
  /// parse, or the end of a change. (In the second case, it may not
1338
1340
  /// be safe to reuse some nodes at the start, depending on the
1339
1341
  /// parsing algorithm.)
1340
- get openStart() { return (this.open & 1 /* Start */) > 0; }
1342
+ get openStart() { return (this.open & 1 /* Open.Start */) > 0; }
1341
1343
  /// Whether the end of the fragment represents the end of a
1342
1344
  /// full-document parse, or the start of a change.
1343
- get openEnd() { return (this.open & 2 /* End */) > 0; }
1345
+ get openEnd() { return (this.open & 2 /* Open.End */) > 0; }
1344
1346
  /// Create a set of fragments from a freshly parsed tree, or update
1345
1347
  /// an existing set of fragments by replacing the ones that overlap
1346
1348
  /// with a tree with content from the new tree. When `partial` is
@@ -1437,6 +1439,8 @@ class InnerParse {
1437
1439
  this.overlay = overlay;
1438
1440
  this.target = target;
1439
1441
  this.ranges = ranges;
1442
+ if (!ranges.length || ranges.some(r => r.from >= r.to))
1443
+ throw new RangeError("Invalid inner parse ranges given: " + JSON.stringify(ranges));
1440
1444
  }
1441
1445
  }
1442
1446
  class ActiveOverlay {
@@ -1534,7 +1538,7 @@ class MixedParse {
1534
1538
  enter = false;
1535
1539
  }
1536
1540
  else if (covered && (isCovered = checkCover(covered.ranges, cursor.from, cursor.to))) {
1537
- enter = isCovered != 2 /* Full */;
1541
+ enter = isCovered != 2 /* Cover.Full */;
1538
1542
  }
1539
1543
  else if (!cursor.type.isAnonymous && cursor.from < cursor.to && (nest = this.nest(cursor, this.input))) {
1540
1544
  if (!cursor.tree)
@@ -1589,16 +1593,16 @@ function checkCover(covered, from, to) {
1589
1593
  if (range.from >= to)
1590
1594
  break;
1591
1595
  if (range.to > from)
1592
- return range.from <= from && range.to >= to ? 2 /* Full */ : 1 /* Partial */;
1596
+ return range.from <= from && range.to >= to ? 2 /* Cover.Full */ : 1 /* Cover.Partial */;
1593
1597
  }
1594
- return 0 /* None */;
1598
+ return 0 /* Cover.None */;
1595
1599
  }
1596
1600
  // Take a piece of buffer and convert it into a stand-alone
1597
1601
  // TreeBuffer.
1598
1602
  function sliceBuf(buf, startI, endI, nodes, positions, off) {
1599
1603
  if (startI < endI) {
1600
- let from = buf.buffer[startI + 1], to = buf.buffer[endI - 2];
1601
- nodes.push(buf.slice(startI, endI, from, to));
1604
+ let from = buf.buffer[startI + 1];
1605
+ nodes.push(buf.slice(startI, endI, from));
1602
1606
  positions.push(from - off);
1603
1607
  }
1604
1608
  }
package/dist/parse.d.ts CHANGED
@@ -13,7 +13,7 @@ export declare class TreeFragment {
13
13
  constructor(from: number, to: number, tree: Tree, offset: number, openStart?: boolean, openEnd?: boolean);
14
14
  get openStart(): boolean;
15
15
  get openEnd(): boolean;
16
- static addTree(tree: Tree, fragments?: readonly TreeFragment[], partial?: boolean): TreeFragment[];
16
+ static addTree(tree: Tree, fragments?: readonly TreeFragment[], partial?: boolean): readonly TreeFragment[];
17
17
  static applyChanges(fragments: readonly TreeFragment[], changes: readonly ChangedRange[], minGap?: number): readonly TreeFragment[];
18
18
  }
19
19
  export interface PartialParse {
@@ -42,7 +42,7 @@ export interface Input {
42
42
  readonly lineChunks: boolean;
43
43
  read(from: number, to: number): string;
44
44
  }
45
- export declare type ParseWrapper = (inner: PartialParse, input: Input, fragments: readonly TreeFragment[], ranges: readonly {
45
+ export type ParseWrapper = (inner: PartialParse, input: Input, fragments: readonly TreeFragment[], ranges: readonly {
46
46
  from: number;
47
47
  to: number;
48
48
  }[]) => PartialParse;
package/dist/tree.d.ts CHANGED
@@ -34,7 +34,7 @@ export declare class MountedTree {
34
34
  to: number;
35
35
  }[] | null, parser: Parser);
36
36
  }
37
- export declare type NodePropSource = (type: NodeType) => null | [NodeProp<any>, any];
37
+ export type NodePropSource = (type: NodeType) => null | [NodeProp<any>, any];
38
38
  export declare class NodeType {
39
39
  readonly name: string;
40
40
  readonly id: number;
@@ -94,7 +94,7 @@ export declare class Tree {
94
94
  }): Tree;
95
95
  static build(data: BuildData): Tree;
96
96
  }
97
- declare type BuildData = {
97
+ type BuildData = {
98
98
  buffer: BufferCursor | readonly number[];
99
99
  nodeSet: NodeSet;
100
100
  topID: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lezer/common",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Syntax tree data structure and parser interfaces for the lezer parser",
5
5
  "main": "dist/index.cjs",
6
6
  "type": "module",
@@ -10,14 +10,14 @@
10
10
  },
11
11
  "module": "dist/index.js",
12
12
  "types": "dist/index.d.ts",
13
- "author": "Marijn Haverbeke <marijnh@gmail.com>",
13
+ "author": "Marijn Haverbeke <marijn@haverbeke.berlin>",
14
14
  "license": "MIT",
15
15
  "devDependencies": {
16
16
  "ist": "^1.1.1",
17
17
  "rollup": "^2.52.2",
18
18
  "@rollup/plugin-commonjs": "^15.1.0",
19
19
  "@rollup/plugin-node-resolve": "^9.0.0",
20
- "rollup-plugin-typescript2": "^0.30.0",
20
+ "rollup-plugin-typescript2": "^0.34.1",
21
21
  "typescript": "^4.3.4",
22
22
  "@types/mocha": "^5.2.6",
23
23
  "ts-node": "^10.0.0",