ranges: Ranges

rangesR Documentation

Ranges

Description

  • range() creates a new tree-sitter range.

  • range_start_byte() and range_end_byte() access a range's start and end bytes, respectively.

  • range_start_point() and range_end_point() access a range's start and end points, respectively.

  • is_range() determines whether or not an object is a range.

Note that the bytes and points used in ranges are 0-indexed.

Usage

range(start_byte, start_point, end_byte, end_point)

range_start_byte(x)

range_start_point(x)

range_end_byte(x)

range_end_point(x)

is_range(x)

Arguments

start_byte, end_byte

⁠[double(1)]⁠

0-indexed bytes for the start and end of the range, respectively.

start_point, end_point

⁠[tree_sitter_point]⁠

0-indexed points for the start and end of the range, respectively.

x

⁠[tree_sitter_range]⁠

A range.

Value

  • range() returns a new range.

  • range_start_byte() and range_end_byte() return a single double.

  • range_start_point() and range_end_point() return a point().

  • is_range() returns TRUE or FALSE.

See Also

node_range()

Examples

x <- range(5, point(1, 3), 7, point(1, 5))
x

range_start_byte(x)
range_end_byte(x)

range_start_point(x)
range_end_point(x)

is_range(x)

treesitter documentation built on June 24, 2024, 5:07 p.m.