1///|
2pub(all) type Language 
type @tree_sitter_language.Language
@tree_sitter_language.Language
3 4///| 5extern "c" fn ts_language_copy(self :
type Language @tree_sitter_language.Language
Language
) ->
type Language @tree_sitter_language.Language
Language
= "moonbit_ts_language_copy"
6 7///| 8/// Get another reference to the given language. 9pub fn
type Language @tree_sitter_language.Language
Language
::
(self : Language) -> Language

Get another reference to the given language.

copy
(
Language
self
:
type Language @tree_sitter_language.Language
Language
) ->
type Language @tree_sitter_language.Language
Language
{
10
(self : Language) -> Language
ts_language_copy
(
Language
self
)
11} 12 13///| 14extern "c" fn ts_language_delete(self :
type Language @tree_sitter_language.Language
Language
) = "moonbit_ts_language_delete"
15 16///| 17/// Free any dynamically-allocated resources for this language, if 18/// this is the last reference. 19pub fn
type Language @tree_sitter_language.Language
Language
::
(self : Language) -> Unit

Free any dynamically-allocated resources for this language, if this is the last reference.

delete
(
Language
self
:
type Language @tree_sitter_language.Language
Language
) ->
Unit
Unit
{
20
(self : Language) -> Unit
ts_language_delete
(
Language
self
)
21} 22 23///| 24extern "c" fn ts_language_symbol_count(self :
type Language @tree_sitter_language.Language
Language
) ->
UInt
UInt
= "moonbit_ts_language_symbol_count"
25 26///| 27/// Get the number of distinct node types in the language. 28pub fn
type Language @tree_sitter_language.Language
Language
::
(self : Language) -> Int

Get the number of distinct node types in the language.

symbol_count
(
Language
self
:
type Language @tree_sitter_language.Language
Language
) ->
Int
Int
{
29
(value : UInt) -> Int
uint_to_int
(
(self : Language) -> UInt
ts_language_symbol_count
(
Language
self
))
30} 31 32///| 33extern "c" fn ts_language_state_count(self :
type Language @tree_sitter_language.Language
Language
) ->
UInt
UInt
= "moonbit_ts_language_state_count"
34 35///| 36/// Get the number of valid states in this language. 37pub fn
type Language @tree_sitter_language.Language
Language
::
(self : Language) -> Int

Get the number of valid states in this language.

state_count
(
Language
self
:
type Language @tree_sitter_language.Language
Language
) ->
Int
Int
{
38
(value : UInt) -> Int
uint_to_int
(
(self : Language) -> UInt
ts_language_state_count
(
Language
self
))
39} 40 41///| 42type Symbol
UInt
UInt
43 44///| 45/// Get the numerical id for the given node type string. 46#borrow(name) 47extern "c" fn ts_language_symbol_for_name_( 48 self :
type Language @tree_sitter_language.Language
Language
,
49 name :
Bytes
Bytes
50) ->
UInt16
UInt16
= "moonbit_ts_language_symbol_for_name"
51 52///| 53/// Get the numerical id for the given node type string. 54pub fn
type Language @tree_sitter_language.Language
Language
::
(self : Language, name : @string.StringView) -> Symbol?

Get the numerical id for the given node type string.

symbol_for_name
(
55
Language
self
:
type Language @tree_sitter_language.Language
Language
,
56
@string.StringView
name
:
type @string.StringView

A @string.View represents a view of a String that maintains proper Unicode character boundaries. It allows safe access to a substring while handling multi-byte characters correctly.

@string.View
57) ->
type Symbol UInt
Symbol
? {
58 let
Bytes
name_bytes
=
(encoding~ : @encoding.Encoding, string : @string.StringView) -> Bytes

Encode a given string to the specified character encoding and returns the resulting bytes.

Parameters

  • encoding : The target encoding format.
  • src: The input string to be encoded.

Returns

A bytes representing the encoded string in the selected format.

Examples

let src = "Hello, World!"
let encoded_bytes = encode(UTF8, src)
@encoding.encode
(
@encoding.Encoding
encoding
=
@encoding.Encoding
UTF8
,
@string.StringView
name
)
59 let
UInt16
symbol
=
(self : Language, name : Bytes) -> UInt16

Get the numerical id for the given node type string.

ts_language_symbol_for_name_
(
Language
self
,
Bytes
name_bytes
)
60 if
UInt16
symbol
(self : UInt16, that : UInt16) -> Bool
==
0 {
61 return
Symbol?
None
62 } else { 63 return
(Symbol) -> Symbol?
Some
(
UInt16
symbol
.
(self : UInt16) -> Int

Converts an unsigned 16-bit integer to a 32-bit signed integer. The value is zero-extended to fill the higher bits.

Parameters:

  • value : The unsigned 16-bit integer to be converted.

Returns a 32-bit signed integer. Since the input value is always non-negative and less than 65536, the conversion never results in overflow.

Example:

test "UInt16::to_int" {
  let x = Int::to_uint16(42)
  inspect!(x.to_int(), content="42")
  let max = Int::to_uint16(65535) // maximum value of UInt16
  inspect!(max.to_int(), content="65535")
}
to_int
().
(self : Int) -> UInt

reinterpret the signed int as unsigned int, when the value is non-negative, i.e, 0..=2^31-1, the value is the same. When the value is negative, it turns into a large number, for example, -1 turns into 2^32-1

reinterpret_as_uint
())
64 } 65} 66 67///| 68type FieldId
UInt16
UInt16
69 70///| 71extern "c" fn ts_language_field_count(self :
type Language @tree_sitter_language.Language
Language
) ->
Int
Int
= "moonbit_ts_language_field_count"
72 73///| 74/// Get the number of distinct field names in the language. 75pub fn
type Language @tree_sitter_language.Language
Language
::
(self : Language) -> Int

Get the number of distinct field names in the language.

field_count
(
Language
self
:
type Language @tree_sitter_language.Language
Language
) ->
Int
Int
{
76
(self : Language) -> Int
ts_language_field_count
(
Language
self
)
77} 78 79///| 80extern "c" fn ts_language_field_name_for_id( 81 self :
type Language @tree_sitter_language.Language
Language
,
82 id :
type FieldId UInt16
FieldId
83) -> @c.Pointer[
Byte
Byte
] = "moonbit_ts_language_field_name_for_id"
84 85///| 86/// Get the field name string for the given numerical id. 87pub fn
type Language @tree_sitter_language.Language
Language
::
(self : Language, id : FieldId) -> String?

Get the field name string for the given numerical id.

field_name_for_id
(
Language
self
:
type Language @tree_sitter_language.Language
Language
,
FieldId
id
:
type FieldId UInt16
FieldId
) ->
String
String
? {
88 let
?
name_bytes
=
(self : Language, id : FieldId) -> ?
ts_language_field_name_for_id
(
Language
self
,
FieldId
id
)
89 return
(c_string : ?, length? : Int) -> String?
decode_c_string
(
?
name_bytes
)
90} 91 92///| 93fn
(c_string : ?, length? : Int) -> String?
decode_c_string
(
?
c_string
: @c.Pointer[
Byte
Byte
],
Int?
length
? :
Int
Int
) ->
String
String
? {
94 if
?
c_string
.
() -> Bool
is_null
() {
95 return
String?
None
96 } 97 let
@buffer.T
buffer
=
(size_hint~ : Int = ..) -> @buffer.T

Creates a new extensible buffer with specified initial capacity. If the initial capacity is less than 1, the buffer will be initialized with capacity 1.

Parameters:

  • size_hint : Initial capacity of the buffer in bytes. Defaults to 0.

Returns a new buffer of type T.

Example:

test "new" {
  let buf = @buffer.new(size_hint=10)
  inspect!(buf.length(), content="0")
  buf.write_string("test")
  inspect!(buf.length(), content="8")
}
@buffer.new
()
98 match
Int?
length
{
99
Int?
None
=>
100 for
Int
i
= 0;
?
c_string
(Int) -> Int
[
i]
(x : Int, y : Int) -> Bool
!=
0;
Int
i
=
Int
i
(self : Int, other : Int) -> Int

Adds two 32-bit signed integers. Performs two's complement arithmetic, which means the operation will wrap around if the result exceeds the range of a 32-bit integer.

Parameters:

  • self : The first integer operand.
  • other : The second integer operand.

Returns a new integer that is the sum of the two operands. If the mathematical sum exceeds the range of a 32-bit integer (-2,147,483,648 to 2,147,483,647), the result wraps around according to two's complement rules.

Example:

test "Int::op_add" {
  inspect!(42 + 1, content="43")
  inspect!(2147483647 + 1, content="-2147483648") // Overflow wraps around to minimum value
}
+
1 {
101
@buffer.T
buffer
.
(self : @buffer.T, value : Byte) -> Unit

Writes a single byte to the end of the buffer. The buffer will automatically grow if necessary to accommodate the new byte.

Parameters:

  • buffer : The buffer to write to.
  • byte : The byte value to be written.

Example:

test "write_byte" {
  let buf = @buffer.new()
  buf.write_byte(b'\x41')
  inspect!(buf.contents(), content="b\"\\x41\"")
}
write_byte
(
?
c_string
(Int) -> Byte
[
i])
102 } 103
(Int) -> Int?
Some
(
Int
length
) =>
104 for
Int
i
= 0;
Int
i
(self_ : Int, other : Int) -> Bool
<
Int
length
;
Int
i
=
Int
i
(self : Int, other : Int) -> Int

Adds two 32-bit signed integers. Performs two's complement arithmetic, which means the operation will wrap around if the result exceeds the range of a 32-bit integer.

Parameters:

  • self : The first integer operand.
  • other : The second integer operand.

Returns a new integer that is the sum of the two operands. If the mathematical sum exceeds the range of a 32-bit integer (-2,147,483,648 to 2,147,483,647), the result wraps around according to two's complement rules.

Example:

test "Int::op_add" {
  inspect!(42 + 1, content="43")
  inspect!(2147483647 + 1, content="-2147483648") // Overflow wraps around to minimum value
}
+
1 {
105
@buffer.T
buffer
.
(self : @buffer.T, value : Byte) -> Unit

Writes a single byte to the end of the buffer. The buffer will automatically grow if necessary to accommodate the new byte.

Parameters:

  • buffer : The buffer to write to.
  • byte : The byte value to be written.

Example:

test "write_byte" {
  let buf = @buffer.new()
  buf.write_byte(b'\x41')
  inspect!(buf.contents(), content="b\"\\x41\"")
}
write_byte
(
?
c_string
(Int) -> Byte
[
i])
106 } 107 } 108 let
Bytes
name
=
@buffer.T
buffer
.
(self : @buffer.T) -> Bytes

Returns a copy of the buffer's content as a sequence of bytes.

Parameters:

  • buffer : The buffer to read from.

Returns a Bytes object containing all bytes written to the buffer.

Example:

test "contents" {
  let buf = @buffer.new()
  buf.write_string("Test")
  inspect!(
    buf.contents(),
    content=
      #|b"\x54\x00\x65\x00\x73\x00\x74\x00"
    ,
  )
}
contents
()
109 let
String
name
=
(encoding~ : @encoding.Encoding, input : @bytes.View) -> String
@encoding.decode_lossy
(
@encoding.Encoding
encoding
=
@encoding.Encoding
UTF8
,
Bytes
name
)
110
(String) -> String?
Some
(
String
name
)
111} 112 113///| 114#borrow(name) 115extern "c" fn ts_language_field_id_for_name( 116 self :
type Language @tree_sitter_language.Language
Language
,
117 name :
Bytes
Bytes
118) ->
UInt
UInt
= "moonbit_ts_language_field_id_for_name"
119 120///| 121/// Get the numerical id for the given field name string. 122pub fn
type Language @tree_sitter_language.Language
Language
::
(self : Language, name : @string.StringView) -> Int

Get the numerical id for the given field name string.

field_id_for_name
(
Language
self
:
type Language @tree_sitter_language.Language
Language
,
@string.StringView
name
:
type @string.StringView

A @string.View represents a view of a String that maintains proper Unicode character boundaries. It allows safe access to a substring while handling multi-byte characters correctly.

@string.View
) ->
Int
Int
{
123 let
Bytes
name_bytes
=
(encoding~ : @encoding.Encoding, string : @string.StringView) -> Bytes

Encode a given string to the specified character encoding and returns the resulting bytes.

Parameters

  • encoding : The target encoding format.
  • src: The input string to be encoded.

Returns

A bytes representing the encoded string in the selected format.

Examples

let src = "Hello, World!"
let encoded_bytes = encode(UTF8, src)
@encoding.encode
(
@encoding.Encoding
encoding
=
@encoding.Encoding
UTF8
,
@string.StringView
name
)
124
(self : Language, name : Bytes) -> UInt
ts_language_field_id_for_name
(
Language
self
,
Bytes
name_bytes
) |>
(value : UInt) -> Int
uint_to_int
()
125} 126 127///| 128extern "c" fn ts_language_supertypes(self :
type Language @tree_sitter_language.Language
Language
) ->
type Array[T]
Array
[
type Symbol UInt
Symbol
] = "moonbit_ts_language_supertypes"
129 130///| 131/// Get a list of all supertype symbols for the language. 132pub fn
type Language @tree_sitter_language.Language
Language
::
(self : Language) -> Array[Symbol]

Get a list of all supertype symbols for the language.

supertypes
(
Language
self
:
type Language @tree_sitter_language.Language
Language
) ->
type Array[T]
Array
[
type Symbol UInt
Symbol
] {
133 return
(self : Language) -> Array[Symbol]
ts_language_supertypes
(
Language
self
)
134} 135 136///| 137extern "c" fn ts_language_subtypes(self :
type Language @tree_sitter_language.Language
Language
) ->
type Array[T]
Array
[
type Symbol UInt
Symbol
] = "moonbit_ts_language_subtypes"
138 139///| 140/// Get a list of all subtype symbol ids for a given supertype symbol. 141/// 142/// See `Language::supertypes` for fetching all supertype symbols. 143pub fn
type Language @tree_sitter_language.Language
Language
::
(self : Language) -> Array[Symbol]

Get a list of all subtype symbol ids for a given supertype symbol.

See Language::supertypes for fetching all supertype symbols.

subtypes
(
Language
self
:
type Language @tree_sitter_language.Language
Language
) ->
type Array[T]
Array
[
type Symbol UInt
Symbol
] {
144 return
(self : Language) -> Array[Symbol]
ts_language_subtypes
(
Language
self
)
145} 146 147///| 148extern "c" fn ts_language_symbol_name( 149 self :
type Language @tree_sitter_language.Language
Language
,
150 symbol :
type Symbol UInt
Symbol
151) -> @c.Pointer[
Byte
Byte
] = "moonbit_ts_language_symbol_name"
152 153///| 154/// Get a node type string for the given numerical id. 155pub fn
type Language @tree_sitter_language.Language
Language
::
(self : Language, symbol : Symbol) -> String?

Get a node type string for the given numerical id.

symbol_name
(
Language
self
:
type Language @tree_sitter_language.Language
Language
,
Symbol
symbol
:
type Symbol UInt
Symbol
) ->
String
String
? {
156 let
?
name_bytes
=
(self : Language, symbol : Symbol) -> ?
ts_language_symbol_name
(
Language
self
,
Symbol
symbol
)
157 return
(c_string : ?, length? : Int) -> String?
decode_c_string
(
?
name_bytes
)
158} 159 160///| 161/// Check whether the given node type id belongs to named nodes, anonymous nodes, 162/// or a hidden nodes. 163enum SymbolType { 164
SymbolType
Regular
165
SymbolType
Anonymous
166
SymbolType
Supertype
167
SymbolType
Auxiliary
168} 169 170///| 171fn
enum SymbolType {
  Regular
  Anonymous
  Supertype
  Auxiliary
}

Check whether the given node type id belongs to named nodes, anonymous nodes, or a hidden nodes.

SymbolType
::
(value : UInt) -> SymbolType
of_int
(
UInt
value
:
UInt
UInt
) ->
enum SymbolType {
  Regular
  Anonymous
  Supertype
  Auxiliary
}

Check whether the given node type id belongs to named nodes, anonymous nodes, or a hidden nodes.

SymbolType
{
172 match
UInt
value
{
173 0 => SymbolType::
SymbolType
Regular
174 1 => SymbolType::
SymbolType
Anonymous
175 2 => SymbolType::
SymbolType
Supertype
176 3 => SymbolType::
SymbolType
Auxiliary
177
UInt
value
=>
(msg : String) -> SymbolType

Aborts the program with an error message. Always causes a panic, regardless of the message provided.

Parameters:

  • message : A string containing the error message to be displayed when aborting.

Returns a value of type T. However, this function never actually returns a value as it always causes a panic.

abort
("Invalid SymbolType: \{
UInt
value
}")
178 } 179} 180 181///| 182fn
enum SymbolType {
  Regular
  Anonymous
  Supertype
  Auxiliary
}

Check whether the given node type id belongs to named nodes, anonymous nodes, or a hidden nodes.

SymbolType
::
(self : SymbolType) -> UInt
to_int
(
SymbolType
self
:
enum SymbolType {
  Regular
  Anonymous
  Supertype
  Auxiliary
}

Check whether the given node type id belongs to named nodes, anonymous nodes, or a hidden nodes.

SymbolType
) ->
UInt
UInt
{
183 match
SymbolType
self
{
184 SymbolType::
SymbolType
Regular
=> 0
185 SymbolType::
SymbolType
Anonymous
=> 1
186 SymbolType::
SymbolType
Supertype
=> 2
187 SymbolType::
SymbolType
Auxiliary
=> 3
188 } 189} 190 191///| 192extern "c" fn ts_language_symbol_type(self :
type Language @tree_sitter_language.Language
Language
, symbol :
type Symbol UInt
Symbol
) ->
UInt
UInt
= "moonbit_ts_language_symbol_type"
193 194///| 195/// Check whether the given node type id belongs to named nodes, anonymous nodes, 196/// or a hidden nodes. 197/// 198/// See also `Node::is_named`. Hidden nodes are never returned from the API. 199pub fn
type Language @tree_sitter_language.Language
Language
::
(self : Language, symbol : Symbol) -> SymbolType

Check whether the given node type id belongs to named nodes, anonymous nodes, or a hidden nodes.

See also Node::is_named. Hidden nodes are never returned from the API.

symbol_type
(
Language
self
:
type Language @tree_sitter_language.Language
Language
,
Symbol
symbol
:
type Symbol UInt
Symbol
) ->
enum SymbolType {
  Regular
  Anonymous
  Supertype
  Auxiliary
}

Check whether the given node type id belongs to named nodes, anonymous nodes, or a hidden nodes.

SymbolType
{
200 return
enum SymbolType {
  Regular
  Anonymous
  Supertype
  Auxiliary
}

Check whether the given node type id belongs to named nodes, anonymous nodes, or a hidden nodes.

SymbolType
::
(value : UInt) -> SymbolType
of_int
(
(self : Language, symbol : Symbol) -> UInt
ts_language_symbol_type
(
Language
self
,
Symbol
symbol
))
201} 202 203///| 204extern "c" fn ts_language_version(self :
type Language @tree_sitter_language.Language
Language
) ->
UInt
UInt
= "moonbit_ts_language_version"
205 206///| 207/// Get the ABI version number for this language. This version number is used 208/// to ensure that languages were generated by a compatible version of 209/// Tree-sitter. 210/// 211/// See also `Parser::set_language`. 212#deprecated("Use `Language::abi_version` instead") 213pub fn
type Language @tree_sitter_language.Language
Language
::
(self : Language) -> Int

Get the ABI version number for this language. This version number is used to ensure that languages were generated by a compatible version of Tree-sitter.

See also Parser::set_language.

version
(
Language
self
:
type Language @tree_sitter_language.Language
Language
) ->
Int
Int
{
214
(value : UInt) -> Int
uint_to_int
(
(self : Language) -> UInt
ts_language_version
(
Language
self
))
215} 216 217///| 218extern "c" fn ts_language_abi_version(self :
type Language @tree_sitter_language.Language
Language
) ->
UInt
UInt
= "moonbit_ts_language_abi_version"
219 220///| 221/// Get the ABI version number for this language. This version number is used 222/// to ensure that languages were generated by a compatible version of 223/// Tree-sitter. 224/// 225/// See also `Parser::set_language`. 226pub fn
type Language @tree_sitter_language.Language
Language
::
(self : Language) -> Int

Get the ABI version number for this language. This version number is used to ensure that languages were generated by a compatible version of Tree-sitter.

See also Parser::set_language.

abi_version
(
Language
self
:
type Language @tree_sitter_language.Language
Language
) ->
Int
Int
{
227
(value : UInt) -> Int
uint_to_int
(
(self : Language) -> UInt
ts_language_abi_version
(
Language
self
))
228} 229 230///| 231/// The metadata associated with a language. 232/// 233/// Currently, this metadata can be used to check the [Semantic Version](https://semver.org/) 234/// of the language. This version information should be used to signal if a given parser might 235/// be incompatible with existing queries when upgrading between major versions, or minor versions 236/// if it's in zerover. 237type LanguageMetadata
Bytes
Bytes
238 239///| 240pub fn
type LanguageMetadata Bytes

The metadata associated with a language.

Currently, this metadata can be used to check the Semantic Version of the language. This version information should be used to signal if a given parser might be incompatible with existing queries when upgrading between major versions, or minor versions if it's in zerover.

LanguageMetadata
::
(self : LanguageMetadata) -> Byte
major_version
(
LanguageMetadata
self
:
type LanguageMetadata Bytes

The metadata associated with a language.

Currently, this metadata can be used to check the Semantic Version of the language. This version information should be used to signal if a given parser might be incompatible with existing queries when upgrading between major versions, or minor versions if it's in zerover.

LanguageMetadata
) ->
Byte
Byte
{
241
LanguageMetadata
self
.
Bytes
_
[0]
242} 243 244///| 245pub fn
type LanguageMetadata Bytes

The metadata associated with a language.

Currently, this metadata can be used to check the Semantic Version of the language. This version information should be used to signal if a given parser might be incompatible with existing queries when upgrading between major versions, or minor versions if it's in zerover.

LanguageMetadata
::
(self : LanguageMetadata) -> Byte
minor_version
(
LanguageMetadata
self
:
type LanguageMetadata Bytes

The metadata associated with a language.

Currently, this metadata can be used to check the Semantic Version of the language. This version information should be used to signal if a given parser might be incompatible with existing queries when upgrading between major versions, or minor versions if it's in zerover.

LanguageMetadata
) ->
Byte
Byte
{
246
LanguageMetadata
self
.
Bytes

Retrieves a byte at the specified index from a byte sequence.

Parameters:

  • bytes : The byte sequence to access.
  • index : The position in the byte sequence from which to retrieve the byte.

Returns a byte value from the specified position in the sequence.

Throws a panic if the index is negative or greater than or equal to the length of the byte sequence.

Example:

test "Bytes::op_get" {
  let bytes = b"\x01\x02\x03"
  inspect!(bytes[1], content="b'\\x02'")
}

test "panic Bytes::op_get/out_of_bounds" {
  let bytes = b"\x01\x02\x03"
  ignore(bytes[3]) // Index out of bounds
}
_
[1]
247} 248 249///| 250pub fn
type LanguageMetadata Bytes

The metadata associated with a language.

Currently, this metadata can be used to check the Semantic Version of the language. This version information should be used to signal if a given parser might be incompatible with existing queries when upgrading between major versions, or minor versions if it's in zerover.

LanguageMetadata
::
(self : LanguageMetadata) -> Byte
patch_version
(
LanguageMetadata
self
:
type LanguageMetadata Bytes

The metadata associated with a language.

Currently, this metadata can be used to check the Semantic Version of the language. This version information should be used to signal if a given parser might be incompatible with existing queries when upgrading between major versions, or minor versions if it's in zerover.

LanguageMetadata
) ->
Byte
Byte
{
251
LanguageMetadata
self
.
Bytes
_
[2]
252} 253 254///| 255extern "c" fn ts_language_metadata(self :
type Language @tree_sitter_language.Language
Language
) ->
type LanguageMetadata Bytes

The metadata associated with a language.

Currently, this metadata can be used to check the Semantic Version of the language. This version information should be used to signal if a given parser might be incompatible with existing queries when upgrading between major versions, or minor versions if it's in zerover.

LanguageMetadata
= "moonbit_ts_language_metadata"
256 257///| 258/// Get the metadata for this language. This information is generated by the 259/// CLI, and relies on the language author providing the correct metadata in 260/// the language's `tree-sitter.json` file. 261/// 262/// See also `LanguageMetadata`. 263pub fn
type Language @tree_sitter_language.Language
Language
::
(self : Language) -> LanguageMetadata

Get the metadata for this language. This information is generated by the CLI, and relies on the language author providing the correct metadata in the language's tree-sitter.json file.

See also LanguageMetadata.

metadata
(
Language
self
:
type Language @tree_sitter_language.Language
Language
) ->
type LanguageMetadata Bytes

The metadata associated with a language.

Currently, this metadata can be used to check the Semantic Version of the language. This version information should be used to signal if a given parser might be incompatible with existing queries when upgrading between major versions, or minor versions if it's in zerover.

LanguageMetadata
{
264 return
(self : Language) -> LanguageMetadata
ts_language_metadata
(
Language
self
)
265} 266 267///| 268type StateId
UInt16
UInt16
269 270///| 271extern "c" fn ts_language_next_state( 272 self :
type Language @tree_sitter_language.Language
Language
,
273 state :
type StateId UInt16
StateId
,
274 symbol :
type Symbol UInt
Symbol
275) ->
type StateId UInt16
StateId
= "moonbit_ts_language_next_state"
276 277///| 278/// Get the next parse state. Combine this with lookahead iterators to generate 279/// completion suggestions or valid symbols in error nodes. Use 280/// `Node::grammar_symbol` for valid symbols. 281pub fn
type Language @tree_sitter_language.Language
Language
::
(self : Language, state : StateId, symbol : Symbol) -> StateId

Get the next parse state. Combine this with lookahead iterators to generate completion suggestions or valid symbols in error nodes. Use Node::grammar_symbol for valid symbols.

next_state
(
282
Language
self
:
type Language @tree_sitter_language.Language
Language
,
283
StateId
state
:
type StateId UInt16
StateId
,
284
Symbol
symbol
:
type Symbol UInt
Symbol
285) ->
type StateId UInt16
StateId
{
286 return
(self : Language, state : StateId, symbol : Symbol) -> StateId
ts_language_next_state
(
Language
self
,
StateId
state
,
Symbol
symbol
)
287} 288 289///| 290extern "c" fn ts_language_name(self :
type Language @tree_sitter_language.Language
Language
) -> @c.Pointer[
Byte
Byte
] = "moonbit_ts_language_name"
291 292///| 293/// Get the name of this language. This returns `None` in older parsers. 294pub fn
type Language @tree_sitter_language.Language
Language
::
(self : Language) -> String?

Get the name of this language. This returns None in older parsers.

name
(
Language
self
:
type Language @tree_sitter_language.Language
Language
) ->
String
String
? {
295 let
?
name
=
(self : Language) -> ?
ts_language_name
(
Language
self
.
@tree_sitter_language.Language
_
)
296 return
(c_string : ?, length? : Int) -> String?
decode_c_string
(
?
name
)
297} 298