@lezer/common 1.5.1 → 1.5.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @lezer/common
2
2
 
3
- [ [**WEBSITE**](http://lezer.codemirror.net) | [**ISSUES**](https://github.com/lezer-parser/lezer/issues) | [**FORUM**](https://discuss.codemirror.net/c/lezer) | [**CHANGELOG**](https://github.com/lezer-parser/common/blob/master/CHANGELOG.md) ]
3
+ [ [**WEBSITE**](http://lezer.codemirror.net) | [**ISSUES**](https://code.haverbeke.berlin/lezer/lezer/issues) | [**FORUM**](https://discuss.codemirror.net/c/lezer) | [**CHANGELOG**](https://code.haverbeke.berlin/lezer/common/src/branch/main/CHANGELOG.md) ]
4
4
 
5
5
  [Lezer](https://lezer.codemirror.net/) is an incremental parser system
6
6
  intended for use in an editor or similar system.
package/dist/index.cjs CHANGED
@@ -2025,15 +2025,21 @@ class StructureCursor {
2025
2025
  constructor(root, offset) {
2026
2026
  this.offset = offset;
2027
2027
  this.done = false;
2028
- this.cursor = root.cursor(exports.IterMode.IncludeAnonymous | exports.IterMode.IgnoreMounts);
2028
+ this.cursor = root.cursor(exports.IterMode.IncludeAnonymous | exports.IterMode.IgnoreMounts | exports.IterMode.ExcludeBuffers);
2029
2029
  }
2030
2030
  // Move to the first node (in pre-order) that starts at or after `pos`.
2031
2031
  moveTo(pos) {
2032
2032
  let { cursor } = this, p = pos - this.offset;
2033
2033
  while (!this.done && cursor.from < p) {
2034
- if (cursor.to >= pos && cursor.enter(p, 1, exports.IterMode.IgnoreOverlays | exports.IterMode.ExcludeBuffers)) ;
2035
- else if (!cursor.next(false))
2036
- this.done = true;
2034
+ if (cursor.to >= p && cursor.enter(p, 1, exports.IterMode.IncludeAnonymous | exports.IterMode.IgnoreOverlays | exports.IterMode.ExcludeBuffers)) ;
2035
+ else if (cursor.to <= p) {
2036
+ if (!cursor.next(false))
2037
+ this.done = true;
2038
+ // Moved to next node
2039
+ }
2040
+ else {
2041
+ break;
2042
+ }
2037
2043
  }
2038
2044
  }
2039
2045
  hasNode(cursor) {
package/dist/index.d.cts CHANGED
@@ -1171,4 +1171,5 @@ tree.
1171
1171
  */
1172
1172
  declare function parseMixed(nest: (node: SyntaxNodeRef, input: Input) => NestedParse | null): ParseWrapper;
1173
1173
 
1174
- export { type BufferCursor, type ChangedRange, DefaultBufferLength, type Input, IterMode, MountedTree, type NestedParse, type NodeIterator, NodeProp, type NodePropSource, NodeSet, NodeType, NodeWeakMap, type ParseWrapper, Parser, type PartialParse, type SyntaxNode, type SyntaxNodeRef, Tree, TreeBuffer, TreeCursor, TreeFragment, parseMixed };
1174
+ export { DefaultBufferLength, IterMode, MountedTree, NodeProp, NodeSet, NodeType, NodeWeakMap, Parser, Tree, TreeBuffer, TreeCursor, TreeFragment, parseMixed };
1175
+ export type { BufferCursor, ChangedRange, Input, NestedParse, NodeIterator, NodePropSource, ParseWrapper, PartialParse, SyntaxNode, SyntaxNodeRef };
package/dist/index.d.ts CHANGED
@@ -1171,4 +1171,5 @@ tree.
1171
1171
  */
1172
1172
  declare function parseMixed(nest: (node: SyntaxNodeRef, input: Input) => NestedParse | null): ParseWrapper;
1173
1173
 
1174
- export { type BufferCursor, type ChangedRange, DefaultBufferLength, type Input, IterMode, MountedTree, type NestedParse, type NodeIterator, NodeProp, type NodePropSource, NodeSet, NodeType, NodeWeakMap, type ParseWrapper, Parser, type PartialParse, type SyntaxNode, type SyntaxNodeRef, Tree, TreeBuffer, TreeCursor, TreeFragment, parseMixed };
1174
+ export { DefaultBufferLength, IterMode, MountedTree, NodeProp, NodeSet, NodeType, NodeWeakMap, Parser, Tree, TreeBuffer, TreeCursor, TreeFragment, parseMixed };
1175
+ export type { BufferCursor, ChangedRange, Input, NestedParse, NodeIterator, NodePropSource, ParseWrapper, PartialParse, SyntaxNode, SyntaxNodeRef };
package/dist/index.js CHANGED
@@ -2023,15 +2023,21 @@ class StructureCursor {
2023
2023
  constructor(root, offset) {
2024
2024
  this.offset = offset;
2025
2025
  this.done = false;
2026
- this.cursor = root.cursor(IterMode.IncludeAnonymous | IterMode.IgnoreMounts);
2026
+ this.cursor = root.cursor(IterMode.IncludeAnonymous | IterMode.IgnoreMounts | IterMode.ExcludeBuffers);
2027
2027
  }
2028
2028
  // Move to the first node (in pre-order) that starts at or after `pos`.
2029
2029
  moveTo(pos) {
2030
2030
  let { cursor } = this, p = pos - this.offset;
2031
2031
  while (!this.done && cursor.from < p) {
2032
- if (cursor.to >= pos && cursor.enter(p, 1, IterMode.IgnoreOverlays | IterMode.ExcludeBuffers)) ;
2033
- else if (!cursor.next(false))
2034
- this.done = true;
2032
+ if (cursor.to >= p && cursor.enter(p, 1, IterMode.IncludeAnonymous | IterMode.IgnoreOverlays | IterMode.ExcludeBuffers)) ;
2033
+ else if (cursor.to <= p) {
2034
+ if (!cursor.next(false))
2035
+ this.done = true;
2036
+ // Moved to next node
2037
+ }
2038
+ else {
2039
+ break;
2040
+ }
2035
2041
  }
2036
2042
  }
2037
2043
  hasNode(cursor) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lezer/common",
3
- "version": "1.5.1",
3
+ "version": "1.5.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",
@@ -21,8 +21,8 @@
21
21
  },
22
22
  "files": ["dist"],
23
23
  "repository": {
24
- "type" : "git",
25
- "url" : "https://github.com/lezer-parser/common.git"
24
+ "type": "git",
25
+ "url": "git+https://code.haverbeke.berlin/lezer/common.git"
26
26
  },
27
27
  "scripts": {
28
28
  "watch": "node build.js --watch",