Remove Parser.Range and subsliceOffset

Range() existed to recover byte offsets from Highlight subslices.
Now that ParserError carries an explicit Offset field, Range() is
unnecessary. Remove it along with the private subsliceOffset helper
in ast.go.

Tests now use perr.Offset directly and construct Range literals
for Shape() calls.

Co-authored-by: Thomas Pelletier <thomas@pelletier.dev>
This commit is contained in:
Cursor Agent
2026-04-12 19:17:12 +00:00
parent a646ffd9fa
commit 89f970069c
3 changed files with 5 additions and 31 deletions
-12
View File
@@ -90,18 +90,6 @@ type Range struct {
Length uint32
}
func subsliceOffset(data []byte, subslice []byte) int {
if len(subslice) == 0 {
return len(data)
}
for i := range data {
if &data[i] == &subslice[0] {
return i
}
}
panic("subslice is not within data")
}
// Next returns a pointer to the next node, or nil if there is no next node.
func (n *Node) Next() *Node {
if n.next < 0 {