@lezer/common 1.3.0 → 1.4.0

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/dist/index.cjs CHANGED
@@ -767,6 +767,7 @@ class TreeNode extends BaseNode {
767
767
  get lastChild() { return this.nextChild(this._tree.children.length - 1, -1, 0, 4 /* Side.DontCare */); }
768
768
  childAfter(pos) { return this.nextChild(0, 1, pos, 2 /* Side.After */); }
769
769
  childBefore(pos) { return this.nextChild(this._tree.children.length - 1, -1, pos, -2 /* Side.Before */); }
770
+ prop(prop) { return this._tree.prop(prop); }
770
771
  enter(pos, side, mode = 0) {
771
772
  let mounted;
772
773
  if (!(mode & exports.IterMode.IgnoreOverlays) && (mounted = MountedTree.get(this._tree)) && mounted.overlay) {
@@ -860,6 +861,7 @@ class BufferNode extends BaseNode {
860
861
  get lastChild() { return this.child(-1, 0, 4 /* Side.DontCare */); }
861
862
  childAfter(pos) { return this.child(1, pos, 2 /* Side.After */); }
862
863
  childBefore(pos) { return this.child(-1, pos, -2 /* Side.Before */); }
864
+ prop(prop) { return this.type.prop(prop); }
863
865
  enter(pos, side, mode = 0) {
864
866
  if (mode & exports.IterMode.ExcludeBuffers)
865
867
  return null;
@@ -1441,7 +1443,7 @@ function buildTree(data) {
1441
1443
  fork.next();
1442
1444
  while (fork.pos > startPos) {
1443
1445
  if (fork.size < 0) {
1444
- if (fork.size == -3 /* SpecialRecord.ContextChange */)
1446
+ if (fork.size == -3 /* SpecialRecord.ContextChange */ || fork.size == -4 /* SpecialRecord.LookAhead */)
1445
1447
  localSkipped += 4;
1446
1448
  else
1447
1449
  break scan;
package/dist/index.d.cts CHANGED
@@ -918,6 +918,10 @@ interface SyntaxNode extends SyntaxNodeRef {
918
918
  */
919
919
  prevSibling: SyntaxNode | null;
920
920
  /**
921
+ Read the given node prop from this node.
922
+ */
923
+ prop<T>(prop: NodeProp<T>): T | undefined;
924
+ /**
921
925
  A [tree cursor](#common.TreeCursor) starting at this node.
922
926
  */
923
927
  cursor(mode?: IterMode): TreeCursor;
package/dist/index.d.ts CHANGED
@@ -918,6 +918,10 @@ interface SyntaxNode extends SyntaxNodeRef {
918
918
  */
919
919
  prevSibling: SyntaxNode | null;
920
920
  /**
921
+ Read the given node prop from this node.
922
+ */
923
+ prop<T>(prop: NodeProp<T>): T | undefined;
924
+ /**
921
925
  A [tree cursor](#common.TreeCursor) starting at this node.
922
926
  */
923
927
  cursor(mode?: IterMode): TreeCursor;
package/dist/index.js CHANGED
@@ -765,6 +765,7 @@ class TreeNode extends BaseNode {
765
765
  get lastChild() { return this.nextChild(this._tree.children.length - 1, -1, 0, 4 /* Side.DontCare */); }
766
766
  childAfter(pos) { return this.nextChild(0, 1, pos, 2 /* Side.After */); }
767
767
  childBefore(pos) { return this.nextChild(this._tree.children.length - 1, -1, pos, -2 /* Side.Before */); }
768
+ prop(prop) { return this._tree.prop(prop); }
768
769
  enter(pos, side, mode = 0) {
769
770
  let mounted;
770
771
  if (!(mode & IterMode.IgnoreOverlays) && (mounted = MountedTree.get(this._tree)) && mounted.overlay) {
@@ -858,6 +859,7 @@ class BufferNode extends BaseNode {
858
859
  get lastChild() { return this.child(-1, 0, 4 /* Side.DontCare */); }
859
860
  childAfter(pos) { return this.child(1, pos, 2 /* Side.After */); }
860
861
  childBefore(pos) { return this.child(-1, pos, -2 /* Side.Before */); }
862
+ prop(prop) { return this.type.prop(prop); }
861
863
  enter(pos, side, mode = 0) {
862
864
  if (mode & IterMode.ExcludeBuffers)
863
865
  return null;
@@ -1439,7 +1441,7 @@ function buildTree(data) {
1439
1441
  fork.next();
1440
1442
  while (fork.pos > startPos) {
1441
1443
  if (fork.size < 0) {
1442
- if (fork.size == -3 /* SpecialRecord.ContextChange */)
1444
+ if (fork.size == -3 /* SpecialRecord.ContextChange */ || fork.size == -4 /* SpecialRecord.LookAhead */)
1443
1445
  localSkipped += 4;
1444
1446
  else
1445
1447
  break scan;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lezer/common",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Syntax tree data structure and parser interfaces for the lezer parser",
5
5
  "main": "dist/index.cjs",
6
6
  "type": "module",