1///|
2type Range 
type FixedArray[A]
FixedArray
[
UInt
UInt
]
3 4///| 5pub impl
trait Show {
  output(Self, &Logger) -> Unit
  to_string(Self) -> String
}
Show
for
type Range FixedArray[UInt]
Range
with
(self : Range, logger : &Logger) -> Unit
output
(
Range
self
:
type Range FixedArray[UInt]
Range
,
&Logger
logger
: &
trait Logger {
  write_string(Self, String) -> Unit
  write_substring(Self, String, Int, Int) -> Unit
  write_char(Self, Char) -> Unit
}

Trait for a logger, where debug logs can be written into

@builtin.Logger
) ->
Unit
Unit
{
6
&Logger
logger
.
(self : &Logger, obj : Point) -> Unit
write_object
(
Range
self
.
(self : Range) -> Point
start_point
())
7
&Logger
logger
.
(&Logger, String) -> Unit
write_string
(" - ")
8
&Logger
logger
.
(self : &Logger, obj : Point) -> Unit
write_object
(
Range
self
.
(self : Range) -> Point
end_point
())
9} 10 11///| 12fn
(start_point : Point, end_point : Point, start_byte : UInt, end_byte : UInt) -> Range
ts_range_new
(
13
Point
start_point
:
type Point
Point
,
14
Point
end_point
:
type Point
Point
,
15
UInt
start_byte
:
UInt
UInt
,
16
UInt
end_byte
:
UInt
UInt
17) ->
type Range FixedArray[UInt]
Range
{
18 [ 19
(self : Point) -> UInt
ts_point_row
(
Point
start_point
),
20
(self : Point) -> UInt
ts_point_column
(
Point
start_point
),
21
(self : Point) -> UInt
ts_point_row
(
Point
end_point
),
22
(self : Point) -> UInt
ts_point_column
(
Point
end_point
),
23
UInt
start_byte
,
24
UInt
end_byte
,
25 ] 26} 27 28///| 29pub fn
type Range FixedArray[UInt]
Range
::
(start_pointer : Point, end_pointer : Point, start_byte : Int, end_byte : Int) -> Range
new
(
30
Point
start_point
:
type Point
Point
,
31
Point
end_point
:
type Point
Point
,
32
Int
start_byte
:
Int
Int
,
33
Int
end_byte
:
Int
Int
34) ->
type Range FixedArray[UInt]
Range
{
35 let
UInt
start_byte
=
(value : Int) -> UInt
int_to_uint
(
Int
start_byte
)
36 let
UInt
end_byte
=
(value : Int) -> UInt
int_to_uint
(
Int
end_byte
)
37
(start_point : Point, end_point : Point, start_byte : UInt, end_byte : UInt) -> Range
ts_range_new
(
Point
start_point
,
Point
end_point
,
UInt
start_byte
,
UInt
end_byte
)
38} 39 40///| 41pub fn
type Range FixedArray[UInt]
Range
::
(self : Range) -> Point
start_point
(
Range
self
:
type Range FixedArray[UInt]
Range
) ->
type Point
Point
{
42
(row : UInt, column : UInt) -> Point
ts_point_new
(
Range
self
.
FixedArray[UInt]

Retrieves an element at the specified index from a fixed-size array. This function implements the array indexing operator [].

Parameters:

  • array : The fixed-size array to access.
  • index : The position in the array from which to retrieve the element.

Returns the element at the specified index.

Throws a runtime error if the index is out of bounds (negative or greater than or equal to the length of the array).

Example:

test "FixedArray::op_get" {
  let arr = FixedArray::make(3, 42)
  inspect!(arr[1], content="42")
}

test "panic FixedArray::op_get/out_of_bounds" {
  let arr = FixedArray::make(3, 0)
  ignore(arr[3]) // Index out of bounds
}
_
[0],
Range
self
.
FixedArray[UInt]

Retrieves an element at the specified index from a fixed-size array. This function implements the array indexing operator [].

Parameters:

  • array : The fixed-size array to access.
  • index : The position in the array from which to retrieve the element.

Returns the element at the specified index.

Throws a runtime error if the index is out of bounds (negative or greater than or equal to the length of the array).

Example:

test "FixedArray::op_get" {
  let arr = FixedArray::make(3, 42)
  inspect!(arr[1], content="42")
}

test "panic FixedArray::op_get/out_of_bounds" {
  let arr = FixedArray::make(3, 0)
  ignore(arr[3]) // Index out of bounds
}
_
[1])
43} 44 45///| 46pub fn
type Range FixedArray[UInt]
Range
::
(self : Range) -> Point
end_point
(
Range
self
:
type Range FixedArray[UInt]
Range
) ->
type Point
Point
{
47
(row : UInt, column : UInt) -> Point
ts_point_new
(
Range
self
.
FixedArray[UInt]

Retrieves an element at the specified index from a fixed-size array. This function implements the array indexing operator [].

Parameters:

  • array : The fixed-size array to access.
  • index : The position in the array from which to retrieve the element.

Returns the element at the specified index.

Throws a runtime error if the index is out of bounds (negative or greater than or equal to the length of the array).

Example:

test "FixedArray::op_get" {
  let arr = FixedArray::make(3, 42)
  inspect!(arr[1], content="42")
}

test "panic FixedArray::op_get/out_of_bounds" {
  let arr = FixedArray::make(3, 0)
  ignore(arr[3]) // Index out of bounds
}
_
[2],
Range
self
.
FixedArray[UInt]
_
[3])
48} 49 50///| 51fn
(self : Range) -> UInt
ts_range_start_byte
(
Range
self
:
type Range FixedArray[UInt]
Range
) ->
UInt
UInt
{
52
Range
self
.
FixedArray[UInt]

Retrieves an element at the specified index from a fixed-size array. This function implements the array indexing operator [].

Parameters:

  • array : The fixed-size array to access.
  • index : The position in the array from which to retrieve the element.

Returns the element at the specified index.

Throws a runtime error if the index is out of bounds (negative or greater than or equal to the length of the array).

Example:

test "FixedArray::op_get" {
  let arr = FixedArray::make(3, 42)
  inspect!(arr[1], content="42")
}

test "panic FixedArray::op_get/out_of_bounds" {
  let arr = FixedArray::make(3, 0)
  ignore(arr[3]) // Index out of bounds
}
_
[4]
53} 54 55///| 56pub fn
type Range FixedArray[UInt]
Range
::
(self : Range) -> Int
start_byte
(
Range
self
:
type Range FixedArray[UInt]
Range
) ->
Int
Int
{
57
(value : UInt) -> Int
uint_to_int
(
(self : Range) -> UInt
ts_range_start_byte
(
Range
self
))
58} 59 60///| 61fn
(self : Range) -> UInt
ts_range_end_byte
(
Range
self
:
type Range FixedArray[UInt]
Range
) ->
UInt
UInt
{
62
Range
self
.
FixedArray[UInt]

Retrieves an element at the specified index from a fixed-size array. This function implements the array indexing operator [].

Parameters:

  • array : The fixed-size array to access.
  • index : The position in the array from which to retrieve the element.

Returns the element at the specified index.

Throws a runtime error if the index is out of bounds (negative or greater than or equal to the length of the array).

Example:

test "FixedArray::op_get" {
  let arr = FixedArray::make(3, 42)
  inspect!(arr[1], content="42")
}

test "panic FixedArray::op_get/out_of_bounds" {
  let arr = FixedArray::make(3, 0)
  ignore(arr[3]) // Index out of bounds
}
_
[5]
63} 64 65///| 66pub fn
type Range FixedArray[UInt]
Range
::
(self : Range) -> Int
end_byte
(
Range
self
:
type Range FixedArray[UInt]
Range
) ->
Int
Int
{
67
(value : UInt) -> Int
uint_to_int
(
(self : Range) -> UInt
ts_range_end_byte
(
Range
self
))
68} 69