@lezer/common 1.5.3 → 1.5.4
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 +7 -4
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +7 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1328,13 +1328,16 @@ function buildTree(data) {
|
|
|
1328
1328
|
cursor.next();
|
|
1329
1329
|
let localChildren = [], localPositions = [];
|
|
1330
1330
|
let localInRepeat = id >= minRepeatType ? id : -1;
|
|
1331
|
-
let lastGroup = 0, lastEnd = end;
|
|
1331
|
+
let lastGroup = 0, lastEnd = end, groupLookAhead = lookAheadAtStart;
|
|
1332
1332
|
while (cursor.pos > endPos) {
|
|
1333
1333
|
if (localInRepeat >= 0 && cursor.id == localInRepeat && cursor.size >= 0) {
|
|
1334
1334
|
if (cursor.end <= lastEnd - maxBufferLength) {
|
|
1335
|
-
makeRepeatLeaf(localChildren, localPositions, start, lastGroup, cursor.end, lastEnd, localInRepeat,
|
|
1335
|
+
makeRepeatLeaf(localChildren, localPositions, start, lastGroup, cursor.end, lastEnd, localInRepeat, groupLookAhead, contextAtStart);
|
|
1336
1336
|
lastGroup = localChildren.length;
|
|
1337
1337
|
lastEnd = cursor.end;
|
|
1338
|
+
// The buffer is read backwards, so the current look-ahead is
|
|
1339
|
+
// the one recorded after the next group's end.
|
|
1340
|
+
groupLookAhead = lookAhead;
|
|
1338
1341
|
}
|
|
1339
1342
|
cursor.next();
|
|
1340
1343
|
}
|
|
@@ -1346,7 +1349,7 @@ function buildTree(data) {
|
|
|
1346
1349
|
}
|
|
1347
1350
|
}
|
|
1348
1351
|
if (localInRepeat >= 0 && lastGroup > 0 && lastGroup < localChildren.length)
|
|
1349
|
-
makeRepeatLeaf(localChildren, localPositions, start, lastGroup, start, lastEnd, localInRepeat,
|
|
1352
|
+
makeRepeatLeaf(localChildren, localPositions, start, lastGroup, start, lastEnd, localInRepeat, groupLookAhead, contextAtStart);
|
|
1350
1353
|
localChildren.reverse();
|
|
1351
1354
|
localPositions.reverse();
|
|
1352
1355
|
if (localInRepeat > -1 && lastGroup > 0) {
|
|
@@ -1399,7 +1402,7 @@ function buildTree(data) {
|
|
|
1399
1402
|
if (!lastI && last.type == type && last.length == length)
|
|
1400
1403
|
return last;
|
|
1401
1404
|
if (lookAheadProp = last.prop(NodeProp.lookAhead))
|
|
1402
|
-
lookAhead = positions[lastI] + last.length + lookAheadProp;
|
|
1405
|
+
lookAhead = positions[lastI] + last.length + lookAheadProp - length;
|
|
1403
1406
|
}
|
|
1404
1407
|
return makeTree(type, children, positions, length, lookAhead, contextHash);
|
|
1405
1408
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -1171,5 +1171,4 @@ tree.
|
|
|
1171
1171
|
*/
|
|
1172
1172
|
declare function parseMixed(nest: (node: SyntaxNodeRef, input: Input) => NestedParse | null): ParseWrapper;
|
|
1173
1173
|
|
|
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 };
|
|
1174
|
+
export { BufferCursor, ChangedRange, DefaultBufferLength, Input, IterMode, MountedTree, NestedParse, NodeIterator, NodeProp, NodePropSource, NodeSet, NodeType, NodeWeakMap, ParseWrapper, Parser, PartialParse, SyntaxNode, SyntaxNodeRef, Tree, TreeBuffer, TreeCursor, TreeFragment, parseMixed };
|
package/dist/index.d.ts
CHANGED
|
@@ -1171,5 +1171,4 @@ tree.
|
|
|
1171
1171
|
*/
|
|
1172
1172
|
declare function parseMixed(nest: (node: SyntaxNodeRef, input: Input) => NestedParse | null): ParseWrapper;
|
|
1173
1173
|
|
|
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 };
|
|
1174
|
+
export { BufferCursor, ChangedRange, DefaultBufferLength, Input, IterMode, MountedTree, NestedParse, NodeIterator, NodeProp, NodePropSource, NodeSet, NodeType, NodeWeakMap, ParseWrapper, Parser, PartialParse, SyntaxNode, SyntaxNodeRef, Tree, TreeBuffer, TreeCursor, TreeFragment, parseMixed };
|
package/dist/index.js
CHANGED
|
@@ -1326,13 +1326,16 @@ function buildTree(data) {
|
|
|
1326
1326
|
cursor.next();
|
|
1327
1327
|
let localChildren = [], localPositions = [];
|
|
1328
1328
|
let localInRepeat = id >= minRepeatType ? id : -1;
|
|
1329
|
-
let lastGroup = 0, lastEnd = end;
|
|
1329
|
+
let lastGroup = 0, lastEnd = end, groupLookAhead = lookAheadAtStart;
|
|
1330
1330
|
while (cursor.pos > endPos) {
|
|
1331
1331
|
if (localInRepeat >= 0 && cursor.id == localInRepeat && cursor.size >= 0) {
|
|
1332
1332
|
if (cursor.end <= lastEnd - maxBufferLength) {
|
|
1333
|
-
makeRepeatLeaf(localChildren, localPositions, start, lastGroup, cursor.end, lastEnd, localInRepeat,
|
|
1333
|
+
makeRepeatLeaf(localChildren, localPositions, start, lastGroup, cursor.end, lastEnd, localInRepeat, groupLookAhead, contextAtStart);
|
|
1334
1334
|
lastGroup = localChildren.length;
|
|
1335
1335
|
lastEnd = cursor.end;
|
|
1336
|
+
// The buffer is read backwards, so the current look-ahead is
|
|
1337
|
+
// the one recorded after the next group's end.
|
|
1338
|
+
groupLookAhead = lookAhead;
|
|
1336
1339
|
}
|
|
1337
1340
|
cursor.next();
|
|
1338
1341
|
}
|
|
@@ -1344,7 +1347,7 @@ function buildTree(data) {
|
|
|
1344
1347
|
}
|
|
1345
1348
|
}
|
|
1346
1349
|
if (localInRepeat >= 0 && lastGroup > 0 && lastGroup < localChildren.length)
|
|
1347
|
-
makeRepeatLeaf(localChildren, localPositions, start, lastGroup, start, lastEnd, localInRepeat,
|
|
1350
|
+
makeRepeatLeaf(localChildren, localPositions, start, lastGroup, start, lastEnd, localInRepeat, groupLookAhead, contextAtStart);
|
|
1348
1351
|
localChildren.reverse();
|
|
1349
1352
|
localPositions.reverse();
|
|
1350
1353
|
if (localInRepeat > -1 && lastGroup > 0) {
|
|
@@ -1397,7 +1400,7 @@ function buildTree(data) {
|
|
|
1397
1400
|
if (!lastI && last.type == type && last.length == length)
|
|
1398
1401
|
return last;
|
|
1399
1402
|
if (lookAheadProp = last.prop(NodeProp.lookAhead))
|
|
1400
|
-
lookAhead = positions[lastI] + last.length + lookAheadProp;
|
|
1403
|
+
lookAhead = positions[lastI] + last.length + lookAheadProp - length;
|
|
1401
1404
|
}
|
|
1402
1405
|
return makeTree(type, children, positions, length, lookAhead, contextHash);
|
|
1403
1406
|
};
|