1///|
2fnalias 
(bytes : @bytes.View, encoding~ : @encoding.Encoding) -> String raise @encoding.DecodingError
@encoding.decode
3 4///| 5typealias
enum @encoding.Encoding {
  UTF8
  UTF16LE
  UTF16BE
}
@encoding.Encoding
6 7///| 8impl
trait Show {
  output(Self, &Logger) -> Unit
  to_string(Self) -> String
}

Trait for types that can be converted to String

Show
for
type Type
Type
with
(self : Type, logger : &Logger) -> Unit
output
(
Type
self
,
&Logger
logger
) {
9 try { 10 let
String
s
=
Type
self
.
(self : Type) -> Bytes
spelling
() |>
(bytes : @bytes.View, encoding~ : @encoding.Encoding) -> String raise @encoding.DecodingError
decode
(
@encoding.Encoding
encoding
=
@encoding.Encoding
UTF8
)
11 let
String
k
=
type Type
Type
::
(k : ?) -> Bytes

TODO: use pattern match implemented String version

kind_spelling
(
Type
self
.
(self : Type) -> ?
kind
()) |>
(bytes : @bytes.View, encoding~ : @encoding.Encoding) -> String raise @encoding.DecodingError
decode
(
@encoding.Encoding
encoding
=
@encoding.Encoding
UTF8
)
12
&Logger
logger
.
(&Logger, String) -> Unit
write_string
("{ spelling : \{
String
s
}, kind: \{
String
k
} }")
13 } catch { 14
@encoding.DecodingError
e
=>
&Logger
logger
.
(self : &Logger, obj : @encoding.DecodingError) -> Unit
write_object
(
@encoding.DecodingError
e
)
15 } 16} 17 18///| 19impl
trait Show {
  output(Self, &Logger) -> Unit
  to_string(Self) -> String
}

Trait for types that can be converted to String

Show
for
type Cursor
Cursor
with
(self : Cursor, logger : &Logger) -> Unit
output
(
Cursor
self
,
&Logger
logger
) {
20 try { 21 let
String
s
=
Cursor
self
.
(self : Cursor) -> Bytes
spelling
() |>
(bytes : @bytes.View, encoding~ : @encoding.Encoding) -> String raise @encoding.DecodingError
decode
(
@encoding.Encoding
encoding
=
@encoding.Encoding
UTF8
)
22 let
String
k
=
type Cursor
Cursor
::
(k : ?) -> Bytes

TODO: use pattern match implemented String version

kind_spelling
(
Cursor
self
.
(self : Cursor) -> ?
kind
()) |>
(bytes : @bytes.View, encoding~ : @encoding.Encoding) -> String raise @encoding.DecodingError
decode
(
@encoding.Encoding
encoding
=
@encoding.Encoding
UTF8
)
23
&Logger
logger
.
(&Logger, String) -> Unit
write_string
("{ spelling : \{
String
s
}, kind: \{
String
k
} }")
24 } catch { 25
@encoding.DecodingError
e
=>
&Logger
logger
.
(self : &Logger, obj : @encoding.DecodingError) -> Unit
write_object
(
@encoding.DecodingError
e
)
26 } 27} 28 29///| 30test "type decl" { 31 let
Index
index
=
type Index
Index
::
(excludeDeclarationsFromPCH : Bool, displayDiagnostics : Bool) -> Index
new
(false, false)
32 let
TranslationUnit
tu
=
Index
index
.
(self : Index, source_filename : Bytes, command_line_args : FixedArray[Bytes], option : TranslationUnit_Flags) -> TranslationUnit raise ParseError
parse
(b"test/type_decl.c\x00", [],
TranslationUnit_Flags
None
)
33 let
Cursor
csr
=
TranslationUnit
tu
.
(self : TranslationUnit) -> Cursor
cursor
()
34
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
csr
,
String
content
="{ spelling : test/type_decl.c, kind: TranslationUnit }")
35
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
36
Cursor
csr
.
(self : Cursor) -> Iter[Cursor]
children
(),
37
String
content
="[{ spelling : A, kind: StructDecl }, { spelling : AA, kind: TypedefDecl }, { spelling : x, kind: VarDecl }]",
38 ) 39 let
Cursor
x
=
Cursor
csr
.
(self : Cursor) -> Iter[Cursor]
children
().
(self : Iter[Cursor], f : (Cursor) -> Bool) -> Cursor?

Finds the first element in the iterator that satisfies the predicate function.

Type Parameters

  • T: The type of the elements in the iterator.

Arguments

  • self - The input iterator.
  • f - The predicate function that determines whether an element is the first element to be found.

Returns

An Option that contains the first element that satisfies the predicate function, or None if no such element is found.

find_first
(
Cursor
x
=>
Cursor
x
.
(self : Cursor) -> Bytes
spelling
()
(self : Bytes, other : Bytes) -> Bool

Compares two byte sequences for equality. Returns true only if both sequences have the same length and contain identical bytes in the same order.

Parameters:

  • self : The first byte sequence to compare.
  • other : The second byte sequence to compare.

Returns true if the byte sequences are equal, false otherwise.

Example:

  let bytes1 = b"\x01\x02\x03"
  let bytes2 = b"\x01\x02\x03"
  let bytes3 = b"\x01\x02\x04"
  inspect(bytes1 == bytes2, content="true")
  inspect(bytes1 == bytes3, content="false")
==
"x").
(self : Cursor?) -> Cursor

Extract the value in Some.

If the value is None, it throws a panic.

unwrap
()
40
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
x
,
String
content
="{ spelling : x, kind: VarDecl }")
41
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
x
.
(self : Cursor) -> Type
type_
(),
String
content
="{ spelling : AA, kind: Elaborated }")
42
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
43
Cursor
x
.
(self : Cursor) -> Type
type_
().
(self : Type) -> Cursor
type_declaration
(),
44
String
content
="{ spelling : AA, kind: TypedefDecl }",
45 ) 46
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
47
Cursor
x
.
(self : Cursor) -> Type
type_
().
(self : Type) -> Cursor
type_declaration
().
(self : Cursor) -> Type
type_
(),
48
String
content
="{ spelling : AA, kind: Typedef }",
49 ) 50
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
51
Cursor
x
.
(self : Cursor) -> Type
type_
().
(self : Type) -> Cursor
type_declaration
().
(self : Cursor) -> Type
type_
().
(self : Type) -> Type
desugar
(),
52
String
content
="{ spelling : struct A *, kind: Pointer }",
53 ) 54} 55 56///| 57test { 58 let
Index
index
=
type Index
Index
::
(excludeDeclarationsFromPCH : Bool, displayDiagnostics : Bool) -> Index
new
(false, false)
59 try { 60 let
TranslationUnit
tu
=
Index
index
.
(self : Index, source_filename : Bytes, command_line_args : FixedArray[Bytes], option : TranslationUnit_Flags) -> TranslationUnit raise ParseError
parse
(b"not_exists_file\x00", [],
TranslationUnit_Flags
None
)
61 62 } catch { 63
ParseError
e
=>
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
ParseError
e
,
String
content
="ParseError(ASTReadError)")
64 } 65} 66 67///| 68fn Bytes::
(x : Bytes) -> String
to_utf16
(
Bytes
x
:
Bytes
Bytes
) ->
String
String
{
69
(bytes : @bytes.View, encoding~ : @encoding.Encoding) -> String raise @encoding.DecodingError
decode
(
Bytes
x
,
@encoding.Encoding
encoding
=
@encoding.Encoding
UTF8
) catch {
70 _ =>
() -> String
panic
()
71 } 72} 73 74///| 75test "enum" { 76 let
Index
index
=
type Index
Index
::
(excludeDeclarationsFromPCH : Bool, displayDiagnostics : Bool) -> Index
new
(false, false)
77 let
TranslationUnit
tu
=
Index
index
.
(self : Index, source_filename : Bytes, command_line_args : FixedArray[Bytes], option : TranslationUnit_Flags) -> TranslationUnit raise ParseError
parse
(b"test/enums.c\x00", [],
TranslationUnit_Flags
None
)
78 let
Cursor
csr
=
TranslationUnit
tu
.
(self : TranslationUnit) -> Cursor
cursor
()
79 let
Cursor
x
=
Cursor
csr
.
(self : Cursor) -> Iter[Cursor]
children
().
(self : Iter[Cursor]) -> Cursor?

Returns the first element of the iterator, or None if the iterator is empty.

Type Parameters

  • A : The type of the elements in the iterator.

Parameters

  • self : The iterator to retrieve the first element from.

Returns

  • An Option containing the first element of the iterator if it exists, otherwise None.

Examples

  let iter = Iter::singleton(42)
  assert_eq(iter.head(), Some(42))

  let iter : Iter[Int]= Iter::empty()
  assert_eq(iter.head(), None)
head
().
(self : Cursor?) -> Cursor

Extract the value in Some.

If the value is None, it throws a panic.

unwrap
()
80
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
x
,
String
content
="{ spelling : ExitCode, kind: EnumDecl }")
81 let
Iter[(String, Int64)]
enum_items
=
Cursor
x
82 .
(self : Cursor) -> Iter[Cursor]
children
()
83 .
(self : Iter[Cursor], f : (Cursor) -> (String, Int64)) -> Iter[(String, Int64)]

Transforms the elements of the iterator using a mapping function.

Type Parameters

  • T: The type of the elements in the iterator.
  • R: The type of the transformed elements.

Arguments

  • self - The input iterator.
  • f - The mapping function that transforms each element of the iterator.

Returns

A new iterator that contains the transformed elements.

map
(fn(
Cursor
x
) { (
Cursor
x
.
(self : Cursor) -> Bytes
display_name
().
(x : Bytes) -> String
to_utf16
(),
Cursor
x
.
(self : Cursor) -> Int64
enum_constant_decl_value
()) })
84
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
85
Iter[(String, Int64)]
enum_items
,
86
String
content
=
87 #|[("Success", 0), ("Failure", 255)] 88 , 89 ) 90
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
csr
,
String
content
="{ spelling : test/enums.c, kind: TranslationUnit }")
91} 92 93///| 94test "DetailedPreprocessingRecord" { 95 let
Index
index
=
type Index
Index
::
(excludeDeclarationsFromPCH : Bool, displayDiagnostics : Bool) -> Index
new
(false, false)
96 let
TranslationUnit
tu
=
Index
index
.
(self : Index, source_filename : Bytes, command_line_args : FixedArray[Bytes], option : TranslationUnit_Flags) -> TranslationUnit raise ParseError
parse
(b"test/test.c\x00", [],
TranslationUnit_Flags
DetailedPreprocessingRecord
)
97 let
Cursor
csr
=
TranslationUnit
tu
.
(self : TranslationUnit) -> Cursor
cursor
()
98 let
SourceLocation
csr_loc
=
Cursor
csr
.
(self : Cursor) -> SourceLocation
source_location
()
99 let
SourceRange
csr_rg
=
Cursor
csr
.
(self : Cursor) -> SourceRange
extent
()
100
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
SourceLocation
csr_loc
(self : SourceLocation, other : SourceLocation) -> Bool
==
SourceLocation
csr_loc
,
String
content
="true")
101
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
SourceRange
csr_rg
(self : SourceRange, other : SourceRange) -> Bool
==
SourceRange
csr_rg
,
String
content
="true")
102
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
csr
(self : Cursor, other : Cursor) -> Bool
==
Cursor
csr
,
String
content
="true")
103
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
csr
,
String
content
="{ spelling : test/test.c, kind: TranslationUnit }")
104 let
TargetInfo
ti
=
TranslationUnit
tu
.
(self : TranslationUnit) -> TargetInfo
target_info
()
105
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
TargetInfo
ti
.
(self : TargetInfo) -> Int
pointer_width
(),
String
content
="64")
106
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
TargetInfo
ti
.
(self : TargetInfo) -> Bytes
triple
() |>
(bytes : @bytes.View, encoding~ : @encoding.Encoding) -> String raise @encoding.DecodingError
decode
(
@encoding.Encoding
encoding
=
@encoding.Encoding
UTF8
),
String
content
="x86_64-pc-linux-gnu")
107 let
Array[Cursor]
csr_children
=
Cursor
csr
.
(self : Cursor) -> Iter[Cursor]
children
().
(self : Iter[Cursor]) -> Array[Cursor]

Collects the elements of the iterator into an array.

collect
()
108 let
Cursor
x
=
Array[Cursor]
csr_children
[0]
109 // Cursor predicate 110
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
x
.
(self : Cursor) -> Bool
is_macro_builtin
(),
String
content
="false")
111
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
x
.
(self : Cursor) -> Bool
is_function_inlined
(),
String
content
="false")
112
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
x
.
(self : Cursor) -> Bool
is_null
(),
String
content
="false")
113
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
x
.
(self : Cursor) -> Bool
is_macro_function_like
(),
String
content
="false")
114
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
x
.
(self : Cursor) -> Bool
is_function_inlined
(),
String
content
="false")
115 // Cursor predicate end 116
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
x
.
(self : Cursor) -> LinkageKind
availability
(),
String
content
="Invalid")
117
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
118
Cursor
x
.
(self : Cursor) -> Cursor
canonical
(),
119
String
content
="{ spelling : __llvm__, kind: macro definition }",
120 ) 121
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
x
.
(self : Cursor) -> Bytes
display_name
() |>
(bytes : @bytes.View, encoding~ : @encoding.Encoding) -> String raise @encoding.DecodingError
decode
(
@encoding.Encoding
encoding
=
@encoding.Encoding
UTF8
),
String
content
="__llvm__")
122 let
Int?
struct_idx
=
Array[Cursor]
csr_children
.
(self : Array[Cursor], f : (Cursor) -> Bool) -> Int?

Search the index of the first element that satisfies the predicate.

Example

  let v = [1, 2, 3, 4, 5]
  match v.search_by(fn(x) { x == 3 }) {
    Some(index) => assert_eq(index, 2) // 2
    None => println("Not found")
  }
search_by
(
Cursor
c
=>
Cursor
c
.
(self : Cursor) -> ?
kind
()
(_ : ?, _ : ?) -> Bool
==
123 @cursor_kind.
?
StructDecl
)
124 let
Cursor
st
=
Array[Cursor]
csr_children
(Array[Cursor], Int) -> Cursor

Retrieves an element from the array at the specified index.

Parameters:

  • array : The array to get the element from.
  • index : The position in the array from which to retrieve the element.

Returns the element at the specified index.

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

Example:

  let arr = [1, 2, 3]
  inspect(arr[1], content="2")
[
struct_idx.
(self : Int?) -> Int

Extract the value in Some.

If the value is None, it throws a panic.

unwrap
()]
125
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
st
,
String
content
="{ spelling : A, kind: StructDecl }")
126 let
Type
stty
=
Cursor
st
.
(self : Cursor) -> Type
type_
()
127
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
stty
,
String
content
="{ spelling : struct A, kind: Record }")
128
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
stty
.
(self : Type) -> Int
address_space
(),
String
content
="0")
129
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
stty
.
(self : Type) -> Type
canonical
(),
String
content
="{ spelling : struct A, kind: Record }")
130
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
stty
.
(self : Type) -> Bool
is_const_qualified
(),
String
content
="false")
131
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
stty
.
(self : Type) -> Bool
is_restrict_qualified
(),
String
content
="false")
132
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
stty
.
(self : Type) -> Bool
is_volatile_qualified
(),
String
content
="false")
133
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
stty
.
(self : Type) -> ?
kind
(),
String
content
="105")
134
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
stty
.
(self : Type) -> Int64

Return the size of a type in bytes

sizeof
(),
String
content
="136")
135
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
stty
.
(self : Type, member_ : Bytes) -> Int64

Return the offset of a field named S in a record of type T in bits

offsetof
(b"x\x00"),
String
content
="0")
136
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
stty
.
(self : Type, member_ : Bytes) -> Int64

Return the offset of a field named S in a record of type T in bits

offsetof
(b"y\x00"),
String
content
="32")
137
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
stty
.
(self : Type, member_ : Bytes) -> Int64

Return the offset of a field named S in a record of type T in bits

offsetof
(b"arr\x00"),
String
content
="64")
138
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
stty
.
(self : Type, member_ : Bytes) -> Int64

Return the offset of a field named S in a record of type T in bits

offsetof
(b"undefined_field\x00"),
String
content
="-5")
139 let
Int?
foo_idx
=
Array[Cursor]
csr_children
.
(self : Array[Cursor], f : (Cursor) -> Bool) -> Int?

Search the index of the first element that satisfies the predicate.

Example

  let v = [1, 2, 3, 4, 5]
  match v.search_by(fn(x) { x == 3 }) {
    Some(index) => assert_eq(index, 2) // 2
    None => println("Not found")
  }
search_by
(
Cursor
c
=>
Cursor
c
.
(self : Cursor) -> Bytes
spelling
()
(self : Bytes, other : Bytes) -> Bool

Compares two byte sequences for equality. Returns true only if both sequences have the same length and contain identical bytes in the same order.

Parameters:

  • self : The first byte sequence to compare.
  • other : The second byte sequence to compare.

Returns true if the byte sequences are equal, false otherwise.

Example:

  let bytes1 = b"\x01\x02\x03"
  let bytes2 = b"\x01\x02\x03"
  let bytes3 = b"\x01\x02\x04"
  inspect(bytes1 == bytes2, content="true")
  inspect(bytes1 == bytes3, content="false")
==
b"foo")
140 let
Cursor
foo
=
Array[Cursor]
csr_children
(Array[Cursor], Int) -> Cursor

Retrieves an element from the array at the specified index.

Parameters:

  • array : The array to get the element from.
  • index : The position in the array from which to retrieve the element.

Returns the element at the specified index.

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

Example:

  let arr = [1, 2, 3]
  inspect(arr[1], content="2")
[
foo_idx.
(self : Int?) -> Int

Extract the value in Some.

If the value is None, it throws a panic.

unwrap
()]
141 let
Type
foo_ty
=
Cursor
foo
.
(self : Cursor) -> Type
type_
()
142
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
143
Type
foo_ty
,
144
String
content
="{ spelling : void (int, double, struct A), kind: FunctionProto }",
145 ) 146
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
foo_ty
(self : Type, other : Type) -> Bool
==
Type
foo_ty
,
String
content
="true")
147
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
foo_ty
.
(self : Type) -> CallingConv
calling_conv
(),
String
content
="C")
148
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
foo_ty
.
(self : Type) -> Type
result
(),
String
content
="{ spelling : void, kind: Void }")
149
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
foo_ty
.
(self : Type) -> Int
arity
(),
String
content
="3")
150
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
foo
.
(self : Cursor) -> LinkageKind
linkage
(),
String
content
="External")
151
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
foo
.
(self : Cursor) -> LanguageKind
language
(),
String
content
="C")
152
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
foo
.
(self : Cursor) -> LinkageKind
visibility
(),
String
content
="UniqueExternal")
153
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
foo
.
(self : Cursor) -> LinkageKind
availability
(),
String
content
="Invalid")
154 let
Int
foo_ty_arity
=
Type
foo_ty
.
(self : Type) -> Int
arity
()
155 let
Array[Type]
args
= []
156 for
Int
i
in
Int
0
..<
Int
foo_ty_arity
{
157
Array[Type]
args
.
(self : Array[Type], value : Type) -> Unit

Adds an element to the end of the array.

If the array is at capacity, it will be reallocated.

Example

  let v = []
  v.push(3)
push
(
Type
foo_ty
.
(self : Type, index : Int) -> Type
argument
(
Int
i
))
158 } 159
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
160
Array[Type]
args
.
(self : Array[Type], f : (Type) -> String) -> Array[String]

Maps a function over the elements of the array.

Example

  let v = [3, 4, 5]
  let v2 = v.map(fn (x) {x + 1})
  assert_eq(v2, [4, 5, 6])
map
(
type Type
Type
(Type) -> String
::to_string
),
161
String
content
=
162 #|["{ spelling : int, kind: Int }", "{ spelling : double, kind: Double }", "{ spelling : struct A, kind: Elaborated }"] 163 , 164 ) 165 let
Int?
happy_idx
=
Array[Cursor]
csr_children
.
(self : Array[Cursor], f : (Cursor) -> Bool) -> Int?

Search the index of the first element that satisfies the predicate.

Example

  let v = [1, 2, 3, 4, 5]
  match v.search_by(fn(x) { x == 3 }) {
    Some(index) => assert_eq(index, 2) // 2
    None => println("Not found")
  }
search_by
(
Cursor
c
=>
Cursor
c
.
(self : Cursor) -> Bytes
spelling
()
(self : Bytes, other : Bytes) -> Bool

Compares two byte sequences for equality. Returns true only if both sequences have the same length and contain identical bytes in the same order.

Parameters:

  • self : The first byte sequence to compare.
  • other : The second byte sequence to compare.

Returns true if the byte sequences are equal, false otherwise.

Example:

  let bytes1 = b"\x01\x02\x03"
  let bytes2 = b"\x01\x02\x03"
  let bytes3 = b"\x01\x02\x04"
  inspect(bytes1 == bytes2, content="true")
  inspect(bytes1 == bytes3, content="false")
==
b"happy")
166 let
Cursor
happy
=
Array[Cursor]
csr_children
(Array[Cursor], Int) -> Cursor

Retrieves an element from the array at the specified index.

Parameters:

  • array : The array to get the element from.
  • index : The position in the array from which to retrieve the element.

Returns the element at the specified index.

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

Example:

  let arr = [1, 2, 3]
  inspect(arr[1], content="2")
[
happy_idx.
(self : Int?) -> Int

Extract the value in Some.

If the value is None, it throws a panic.

unwrap
()]
167
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
happy
,
String
content
="{ spelling : happy, kind: TypedefDecl }")
168 let
Type
happy_ty
=
Cursor
happy
.
(self : Cursor) -> Type
type_
()
169
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
happy
,
String
content
="{ spelling : happy, kind: TypedefDecl }")
170 let
Type
happy_ty_uy
=
Type
happy_ty
.
(self : Type) -> Type
desugar
()
171
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
172
Type
happy_ty_uy
,
173
String
content
="{ spelling : const volatile struct A *restrict, kind: Pointer }",
174 ) 175
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
happy_ty_uy
.
(self : Type) -> ?
kind
(),
String
content
="101")
176
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
happy_ty
.
(self : Type) -> ?
kind
(),
String
content
="107")
177
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
178
Type
happy_ty_uy
.
(self : Type) -> Type
pointee
(),
179
String
content
="{ spelling : const volatile struct A, kind: Record }",
180 ) 181
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
happy_ty_uy
.
(self : Type) -> Type
pointee
().
(self : Type) -> Bool
is_const_qualified
(),
String
content
="true")
182
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
happy_ty_uy
.
(self : Type) -> Type
pointee
().
(self : Type) -> Bool
is_volatile_qualified
(),
String
content
="true")
183
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Type
happy_ty_uy
.
(self : Type) -> Bool
is_restrict_qualified
(),
String
content
="true")
184
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
185
Cursor
happy
.
(self : Cursor) -> Type
typedef_decl_underlying_type
(),
186
String
content
="{ spelling : const volatile struct A *restrict, kind: Pointer }",
187 ) 188
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
happy
.
(self : Cursor) -> Bytes
display_name
() |>
(bytes : @bytes.View, encoding~ : @encoding.Encoding) -> String raise @encoding.DecodingError
decode
(
@encoding.Encoding
encoding
=
@encoding.Encoding
UTF8
),
String
content
="happy")
189} 190 191///| 192test { 193 let
Index
index
=
type Index
Index
::
(excludeDeclarationsFromPCH : Bool, displayDiagnostics : Bool) -> Index
new
(false, false)
194 let
TranslationUnit
tu
=
Index
index
.
(self : Index, source_filename : Bytes, command_line_args : FixedArray[Bytes], option : TranslationUnit_Flags) -> TranslationUnit raise ParseError
parse
(b"test/test.cxx\x00", [],
TranslationUnit_Flags
None
)
195 let
Cursor
csr
=
TranslationUnit
tu
.
(self : TranslationUnit) -> Cursor
cursor
()
196
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
csr
,
String
content
="{ spelling : test/test.cxx, kind: TranslationUnit }")
197 let
Array[Cursor]
toplvls
=
Cursor
csr
.
(self : Cursor) -> Iter[Cursor]
children
().
(self : Iter[Cursor]) -> Array[Cursor]

Collects the elements of the iterator into an array.

collect
()
198 let
Cursor
foo
=
Array[Cursor]
toplvls
[0]
199
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
foo
,
String
content
="{ spelling : swap, kind: FunctionTemplate }")
200 let
Array[Cursor]
methods
=
Cursor
foo
.
(self : Cursor) -> Iter[Cursor]
children
().
(self : Iter[Cursor]) -> Array[Cursor]

Collects the elements of the iterator into an array.

collect
()
201
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Array[Cursor]
methods
.
(self : Array[Cursor], f : (Cursor) -> StorageClass) -> Array[StorageClass]

Maps a function over the elements of the array.

Example

  let v = [3, 4, 5]
  let v2 = v.map(fn (x) {x + 1})
  assert_eq(v2, [4, 5, 6])
map
(
type Cursor
Cursor
(Cursor) -> StorageClass
::storage_class
),
String
content
="[Invalid, None, None]")
202 let
Cursor
bar
=
Array[Cursor]
toplvls
[3]
203
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
bar
,
String
content
="{ spelling : reverse, kind: FunctionTemplate }")
204 let
Array[Cursor]
bar_expr
=
Cursor
bar
.
(self : Cursor) -> Iter[Cursor]
children
().
(self : Iter[Cursor]) -> Cursor?

Returns the first element of the iterator, or None if the iterator is empty.

Type Parameters

  • A : The type of the elements in the iterator.

Parameters

  • self : The iterator to retrieve the first element from.

Returns

  • An Option containing the first element of the iterator if it exists, otherwise None.

Examples

  let iter = Iter::singleton(42)
  assert_eq(iter.head(), Some(42))

  let iter : Iter[Int]= Iter::empty()
  assert_eq(iter.head(), None)
head
().
(self : Cursor?) -> Cursor

Extract the value in Some.

If the value is None, it throws a panic.

unwrap
().
(self : Cursor) -> Iter[Cursor]
children
().
(self : Iter[Cursor]) -> Array[Cursor]

Collects the elements of the iterator into an array.

collect
()
205
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Array[Cursor]
bar_expr
.
(self : Array[Cursor]) -> Int

Returns the number of elements in the array.

Parameters:

  • array : The array whose length is to be determined.

Returns the number of elements in the array as an integer.

Example:

  let arr = [1, 2, 3]
  inspect(arr.length(), content="3")
  let empty : Array[Int] = []
  inspect(empty.length(), content="0")
length
(),
String
content
="0")
206 let
Array[Cursor]
xs
= []
207 fn
(Cursor) -> Unit
dfs
(
Cursor
cur
:
type Cursor
Cursor
) ->
Unit
Unit
{
208 if
Cursor
cur
.
(self : Cursor) -> ?
kind
()
(_ : ?, _ : ?) -> Bool
==
@cursor_kind.
?
OverloadedDeclRef
{
209
Array[Cursor]
xs
.
(self : Array[Cursor], value : Cursor) -> Unit

Adds an element to the end of the array.

If the array is at capacity, it will be reallocated.

Example

  let v = []
  v.push(3)
push
(
Cursor
cur
)
210 } 211 for
Cursor
x
in
Cursor
cur
.
(self : Cursor) -> Iter[Cursor]
children
() {
212
(Cursor) -> Unit
dfs
(
Cursor
x
)
213 } 214 } 215 216
(Cursor) -> Unit
dfs
(
Cursor
csr
)
217
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Array[Cursor]
xs
,
String
content
="[{ spelling : swap, kind: OverloadedDeclRef }]")
218 let
Cursor
oldr
=
Array[Cursor]
xs
[0]
219
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
oldr
.
(self : Cursor) -> Int
overloaded_decls_num
(),
String
content
="2")
220
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
221
Cursor
oldr
.
(self : Cursor, index : Int) -> Cursor
overloaded_decls
(0),
222
String
content
="{ spelling : swap, kind: FunctionDecl }",
223 ) 224
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
225
Cursor
oldr
.
(self : Cursor, index : Int) -> Cursor
overloaded_decls
(1),
226
String
content
="{ spelling : swap, kind: FunctionTemplate }",
227 ) 228} 229 230///| 231test "macro" { 232 let
Index
index
=
type Index
Index
::
(excludeDeclarationsFromPCH : Bool, displayDiagnostics : Bool) -> Index
new
(false, false)
233 let
TranslationUnit
tu
=
Index
index
.
(self : Index, source_filename : Bytes, command_line_args : FixedArray[Bytes], option : TranslationUnit_Flags) -> TranslationUnit raise ParseError
parse
(b"test/macro.c\x00", [],
TranslationUnit_Flags
DetailedPreprocessingRecord
)
234 let
Cursor
csr
=
TranslationUnit
tu
.
(self : TranslationUnit) -> Cursor
cursor
()
235
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
csr
,
String
content
="{ spelling : test/macro.c, kind: TranslationUnit }")
236 let
Cursor
x
=
Cursor
csr
.
(self : Cursor) -> Iter[Cursor]
children
().
(self : Iter[Cursor], f : (Cursor) -> Bool) -> Cursor?

Finds the first element in the iterator that satisfies the predicate function.

Type Parameters

  • T: The type of the elements in the iterator.

Arguments

  • self - The input iterator.
  • f - The predicate function that determines whether an element is the first element to be found.

Returns

An Option that contains the first element that satisfies the predicate function, or None if no such element is found.

find_first
(
Cursor
x
=>
Cursor
x
.
(self : Cursor) -> Bytes
spelling
()
(self : Bytes, other : Bytes) -> Bool

Compares two byte sequences for equality. Returns true only if both sequences have the same length and contain identical bytes in the same order.

Parameters:

  • self : The first byte sequence to compare.
  • other : The second byte sequence to compare.

Returns true if the byte sequences are equal, false otherwise.

Example:

  let bytes1 = b"\x01\x02\x03"
  let bytes2 = b"\x01\x02\x03"
  let bytes3 = b"\x01\x02\x04"
  inspect(bytes1 == bytes2, content="true")
  inspect(bytes1 == bytes3, content="false")
==
"FOO").
(self : Cursor?) -> Cursor

Extract the value in Some.

If the value is None, it throws a panic.

unwrap
()
237
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
x
,
String
content
="{ spelling : FOO, kind: macro definition }")
238 let
SourceRange
range
=
Cursor
x
.
(self : Cursor) -> SourceRange
extent
()
239 let
FixedArray[Token]
toks
=
TranslationUnit
tu
.
(self : TranslationUnit, range : SourceRange) -> FixedArray[Token]
tokenize
(
SourceRange
range
)
240
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
241
FixedArray[Token]
toks
.
(self : FixedArray[Token], f : (Token) -> String) -> FixedArray[String]

Applies a function to each element of the array and returns a new array with the results.

Example

  let arr = [1, 2, 3, 4, 5]
  let doubled = arr.map(fn(x){ x * 2 })
  assert_eq(doubled, [2, 4, 6, 8, 10])
map
(
Token
t
=>
type Token
Token
::
(self : Token) -> Bytes
spelling
(
Token
t
).
(x : Bytes) -> String
to_utf16
()),
242
String
content
=
243 #|["FOO", "(", "{", "1", ",", "2", ",", "3", ",", "4", ",", "5", "}", ")"] 244 , 245 ) 246 let
Cursor
bar
=
Cursor
csr
247 .
(self : Cursor) -> Iter[Cursor]
children
()
248 .
(self : Iter[Cursor], f : (Cursor) -> Bool) -> Cursor?

Finds the first element in the iterator that satisfies the predicate function.

Type Parameters

  • T: The type of the elements in the iterator.

Arguments

  • self - The input iterator.
  • f - The predicate function that determines whether an element is the first element to be found.

Returns

An Option that contains the first element that satisfies the predicate function, or None if no such element is found.

find_first
(
Cursor
x
=>
Cursor
x
.
(self : Cursor) -> Bytes
spelling
()
(self : Bytes, other : Bytes) -> Bool

Compares two byte sequences for equality. Returns true only if both sequences have the same length and contain identical bytes in the same order.

Parameters:

  • self : The first byte sequence to compare.
  • other : The second byte sequence to compare.

Returns true if the byte sequences are equal, false otherwise.

Example:

  let bytes1 = b"\x01\x02\x03"
  let bytes2 = b"\x01\x02\x03"
  let bytes3 = b"\x01\x02\x04"
  inspect(bytes1 == bytes2, content="true")
  inspect(bytes1 == bytes3, content="false")
==
"Bar"
(Bool, Bool) -> Bool
&&
249
Cursor
x
.
(self : Cursor) -> ?
kind
()
(_ : ?, _ : ?) -> Bool
==
@cursor_kind.
?
MacroDefinition
)
250 .
(self : Cursor?) -> Cursor

Extract the value in Some.

If the value is None, it throws a panic.

unwrap
()
251
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
bar
,
String
content
="{ spelling : Bar, kind: macro definition }")
252 let
SourceRange
rg
=
Cursor
bar
.
(self : Cursor) -> SourceRange
extent
()
253
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
bar
.
(self : Cursor) -> Bytes
display_name
() |>
(bytes : @bytes.View, encoding~ : @encoding.Encoding) -> String raise @encoding.DecodingError
decode
(
@encoding.Encoding
encoding
=
@encoding.Encoding
UTF8
),
String
content
="Bar")
254
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
bar
.
(self : Cursor) -> Iter[Cursor]
children
(),
String
content
="[]")
255 let
FixedArray[Token]
toks
=
TranslationUnit
tu
.
(self : TranslationUnit, range : SourceRange) -> FixedArray[Token]
tokenize
(
SourceRange
rg
)
256
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
257
FixedArray[Token]
toks
.
(self : FixedArray[Token], f : (Token) -> String) -> FixedArray[String]

Applies a function to each element of the array and returns a new array with the results.

Example

  let arr = [1, 2, 3, 4, 5]
  let doubled = arr.map(fn(x){ x * 2 })
  assert_eq(doubled, [2, 4, 6, 8, 10])
map
(
Token
t
=>
type Token
Token
::
(self : Token) -> Bytes
spelling
(
Token
t
).
(x : Bytes) -> String
to_utf16
()),
258
String
content
=
259 #|["Bar", "Bar"] 260 , 261 ) 262 let
Cursor
max
=
Cursor
csr
.
(self : Cursor) -> Iter[Cursor]
children
().
(self : Iter[Cursor], f : (Cursor) -> Bool) -> Cursor?

Finds the first element in the iterator that satisfies the predicate function.

Type Parameters

  • T: The type of the elements in the iterator.

Arguments

  • self - The input iterator.
  • f - The predicate function that determines whether an element is the first element to be found.

Returns

An Option that contains the first element that satisfies the predicate function, or None if no such element is found.

find_first
(
Cursor
x
=>
Cursor
x
.
(self : Cursor) -> Bytes
spelling
()
(self : Bytes, other : Bytes) -> Bool

Compares two byte sequences for equality. Returns true only if both sequences have the same length and contain identical bytes in the same order.

Parameters:

  • self : The first byte sequence to compare.
  • other : The second byte sequence to compare.

Returns true if the byte sequences are equal, false otherwise.

Example:

  let bytes1 = b"\x01\x02\x03"
  let bytes2 = b"\x01\x02\x03"
  let bytes3 = b"\x01\x02\x04"
  inspect(bytes1 == bytes2, content="true")
  inspect(bytes1 == bytes3, content="false")
==
"max").
(self : Cursor?) -> Cursor

Extract the value in Some.

If the value is None, it throws a panic.

unwrap
()
263 let
SourceRange
rg
=
Cursor
max
.
(self : Cursor) -> SourceRange
extent
()
264
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
max
.
(self : Cursor) -> Bytes
display_name
() |>
(bytes : @bytes.View, encoding~ : @encoding.Encoding) -> String raise @encoding.DecodingError
decode
(
@encoding.Encoding
encoding
=
@encoding.Encoding
UTF8
),
String
content
="max")
265
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
max
.
(self : Cursor) -> Iter[Cursor]
children
(),
String
content
="[]")
266 let
FixedArray[Token]
toks
=
TranslationUnit
tu
.
(self : TranslationUnit, range : SourceRange) -> FixedArray[Token]
tokenize
(
SourceRange
rg
)
267
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
268
FixedArray[Token]
toks
.
(self : FixedArray[Token], f : (Token) -> String) -> FixedArray[String]

Applies a function to each element of the array and returns a new array with the results.

Example

  let arr = [1, 2, 3, 4, 5]
  let doubled = arr.map(fn(x){ x * 2 })
  assert_eq(doubled, [2, 4, 6, 8, 10])
map
(
Token
t
=>
type Token
Token
::
(self : Token) -> Bytes
spelling
(
Token
t
).
(x : Bytes) -> String
to_utf16
()),
269
String
content
=
270 #|["max", "(", "a", ",", "b", ")", "(", "a", ">", "b", "?", "a", ":", "b", ")"] 271 , 272 ) 273
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
max
,
String
content
="{ spelling : max, kind: macro definition }")
274} 275 276///| 277test { 278 let
Index
index
=
type Index
Index
::
(excludeDeclarationsFromPCH : Bool, displayDiagnostics : Bool) -> Index
new
(false, false)
279 let
TranslationUnit
tu
=
Index
index
.
(self : Index, source_filename : Bytes, command_line_args : FixedArray[Bytes], option : TranslationUnit_Flags) -> TranslationUnit raise ParseError
parse
(b"test/test.c\x00", [],
TranslationUnit_Flags
DetailedPreprocessingRecord
)
280 let
Cursor
csr
=
TranslationUnit
tu
.
(self : TranslationUnit) -> Cursor
cursor
()
281
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
Cursor
csr
,
String
content
="{ spelling : test/test.c, kind: TranslationUnit }")
282 let
SourceRange
sr
=
Cursor
csr
.
(self : Cursor) -> SourceRange
extent
()
283 let
FixedArray[Token]
toks
=
TranslationUnit
tu
.
(self : TranslationUnit, range : SourceRange) -> FixedArray[Token]
tokenize
(
SourceRange
sr
)
284 let
String
tokss
=
FixedArray[Token]
toks
.
(self : FixedArray[Token], f : (Token) -> String) -> FixedArray[String]

Applies a function to each element of the array and returns a new array with the results.

Example

  let arr = [1, 2, 3, 4, 5]
  let doubled = arr.map(fn(x){ x * 2 })
  assert_eq(doubled, [2, 4, 6, 8, 10])
map
(
Token
tok
=>
Token
tok
.
(self : Token) -> Bytes
spelling
().
(x : Bytes) -> String
to_utf16
()).
(self : FixedArray[String]) -> Iter[String]

Creates an iterator over the elements of a fixed-size array, providing sequential access to each element.

Parameters:

  • array : The fixed-size array to iterate over.

Returns an iterator that yields each element of the array in order from first to last.

Example:

  let arr = FixedArray::make(3, 42)
  let mut sum = 0
  arr.iter().each(fn(x) { sum = sum + x })
  inspect(sum, content="126")
iter
().
(self : Iter[String], sep : String) -> String

Collects the elements of the iterator into a string.

join
(" ")
285
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
FixedArray[Token]
toks
.
(self : FixedArray[Token]) -> Int

Returns the number of elements in a fixed-size array.

Parameters:

  • array : The fixed-size array whose length is to be determined.

Returns an integer representing the number of elements in the array.

Example:

  let arr = FixedArray::make(3, 42)
  inspect(arr.length(), content="3")
length
(),
String
content
="50")
286
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
287
String
tokss
,
288
String
content
="struct A { int x ; int y ; char arr [ 128 ] ; } ; void foo ( int x , double y , struct A z ) { } # define id ( x ) ( x ) typedef struct A const volatile * restrict happy ;",
289 ) 290
FixedArray[Token]
toks
|>
(t : FixedArray[Token]) -> Unit

Evaluates an expression and discards its result. This is useful when you want to execute an expression for its side effects but don't care about its return value, or when you want to explicitly indicate that a value is intentionally unused.

Parameters:

  • value : The value to be ignored. Can be of any type.

Example:

  let x = 42
  ignore(x) // Explicitly ignore the value
  let mut sum = 0
  ignore([1, 2, 3].iter().each(fn(x) { sum = sum + x })) // Ignore the Unit return value of each()
ignore
291
(obj : &Show, content~ : String, loc~ : SourceLoc = _, args_loc~ : ArgsLoc = _) -> Unit raise InspectError

Tests if the string representation of an object matches the expected content. Used primarily in test cases to verify the correctness of Show implementations and program outputs.

Parameters:

  • object : The object to be inspected. Must implement the Show trait.
  • content : The expected string representation of the object. Defaults to an empty string.
  • location : Source code location information for error reporting. Automatically provided by the compiler.
  • arguments_location : Location information for function arguments in source code. Automatically provided by the compiler.

Throws an InspectError if the actual string representation of the object does not match the expected content. The error message includes detailed information about the mismatch, including source location and both expected and actual values.

Example:

  inspect(42, content="42")
  inspect("hello", content="hello")
  inspect([1, 2, 3], content="[1, 2, 3]")
inspect
(
292
Cursor
csr
.
(self : Cursor) -> Iter[Cursor]
children
().
(self : Iter[Cursor], f : (Cursor) -> String) -> Iter[String]

Transforms the elements of the iterator using a mapping function.

Type Parameters

  • T: The type of the elements in the iterator.
  • R: The type of the transformed elements.

Arguments

  • self - The input iterator.
  • f - The mapping function that transforms each element of the iterator.

Returns

A new iterator that contains the transformed elements.

map
(
Cursor
c
=>
Cursor
c
.
(self : Cursor) -> String
to_string
()).
(self : Iter[String], sep : String) -> String

Collects the elements of the iterator into a string.

join
("\n"),
293
String
content
=
294 #|{ spelling : __llvm__, kind: macro definition } 295 #|{ spelling : __clang__, kind: macro definition } 296 #|{ spelling : __clang_major__, kind: macro definition } 297 #|{ spelling : __clang_minor__, kind: macro definition } 298 #|{ spelling : __clang_patchlevel__, kind: macro definition } 299 #|{ spelling : __clang_version__, kind: macro definition } 300 #|{ spelling : __GNUC__, kind: macro definition } 301 #|{ spelling : __GNUC_MINOR__, kind: macro definition } 302 #|{ spelling : __GNUC_PATCHLEVEL__, kind: macro definition } 303 #|{ spelling : __GXX_ABI_VERSION, kind: macro definition } 304 #|{ spelling : __ATOMIC_RELAXED, kind: macro definition } 305 #|{ spelling : __ATOMIC_CONSUME, kind: macro definition } 306 #|{ spelling : __ATOMIC_ACQUIRE, kind: macro definition } 307 #|{ spelling : __ATOMIC_RELEASE, kind: macro definition } 308 #|{ spelling : __ATOMIC_ACQ_REL, kind: macro definition } 309 #|{ spelling : __ATOMIC_SEQ_CST, kind: macro definition } 310 #|{ spelling : __MEMORY_SCOPE_SYSTEM, kind: macro definition } 311 #|{ spelling : __MEMORY_SCOPE_DEVICE, kind: macro definition } 312 #|{ spelling : __MEMORY_SCOPE_WRKGRP, kind: macro definition } 313 #|{ spelling : __MEMORY_SCOPE_WVFRNT, kind: macro definition } 314 #|{ spelling : __MEMORY_SCOPE_SINGLE, kind: macro definition } 315 #|{ spelling : __OPENCL_MEMORY_SCOPE_WORK_ITEM, kind: macro definition } 316 #|{ spelling : __OPENCL_MEMORY_SCOPE_WORK_GROUP, kind: macro definition } 317 #|{ spelling : __OPENCL_MEMORY_SCOPE_DEVICE, kind: macro definition } 318 #|{ spelling : __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES, kind: macro definition } 319 #|{ spelling : __OPENCL_MEMORY_SCOPE_SUB_GROUP, kind: macro definition } 320 #|{ spelling : __FPCLASS_SNAN, kind: macro definition } 321 #|{ spelling : __FPCLASS_QNAN, kind: macro definition } 322 #|{ spelling : __FPCLASS_NEGINF, kind: macro definition } 323 #|{ spelling : __FPCLASS_NEGNORMAL, kind: macro definition } 324 #|{ spelling : __FPCLASS_NEGSUBNORMAL, kind: macro definition } 325 #|{ spelling : __FPCLASS_NEGZERO, kind: macro definition } 326 #|{ spelling : __FPCLASS_POSZERO, kind: macro definition } 327 #|{ spelling : __FPCLASS_POSSUBNORMAL, kind: macro definition } 328 #|{ spelling : __FPCLASS_POSNORMAL, kind: macro definition } 329 #|{ spelling : __FPCLASS_POSINF, kind: macro definition } 330 #|{ spelling : __PRAGMA_REDEFINE_EXTNAME, kind: macro definition } 331 #|{ spelling : __VERSION__, kind: macro definition } 332 #|{ spelling : __OBJC_BOOL_IS_BOOL, kind: macro definition } 333 #|{ spelling : __CONSTANT_CFSTRINGS__, kind: macro definition } 334 #|{ spelling : __clang_literal_encoding__, kind: macro definition } 335 #|{ spelling : __clang_wide_literal_encoding__, kind: macro definition } 336 #|{ spelling : __ORDER_LITTLE_ENDIAN__, kind: macro definition } 337 #|{ spelling : __ORDER_BIG_ENDIAN__, kind: macro definition } 338 #|{ spelling : __ORDER_PDP_ENDIAN__, kind: macro definition } 339 #|{ spelling : __BYTE_ORDER__, kind: macro definition } 340 #|{ spelling : __LITTLE_ENDIAN__, kind: macro definition } 341 #|{ spelling : _LP64, kind: macro definition } 342 #|{ spelling : __LP64__, kind: macro definition } 343 #|{ spelling : __CHAR_BIT__, kind: macro definition } 344 #|{ spelling : __BOOL_WIDTH__, kind: macro definition } 345 #|{ spelling : __SHRT_WIDTH__, kind: macro definition } 346 #|{ spelling : __INT_WIDTH__, kind: macro definition } 347 #|{ spelling : __LONG_WIDTH__, kind: macro definition } 348 #|{ spelling : __LLONG_WIDTH__, kind: macro definition } 349 #|{ spelling : __BITINT_MAXWIDTH__, kind: macro definition } 350 #|{ spelling : __SCHAR_MAX__, kind: macro definition } 351 #|{ spelling : __SHRT_MAX__, kind: macro definition } 352 #|{ spelling : __INT_MAX__, kind: macro definition } 353 #|{ spelling : __LONG_MAX__, kind: macro definition } 354 #|{ spelling : __LONG_LONG_MAX__, kind: macro definition } 355 #|{ spelling : __WCHAR_MAX__, kind: macro definition } 356 #|{ spelling : __WCHAR_WIDTH__, kind: macro definition } 357 #|{ spelling : __WINT_MAX__, kind: macro definition } 358 #|{ spelling : __WINT_WIDTH__, kind: macro definition } 359 #|{ spelling : __INTMAX_MAX__, kind: macro definition } 360 #|{ spelling : __INTMAX_WIDTH__, kind: macro definition } 361 #|{ spelling : __SIZE_MAX__, kind: macro definition } 362 #|{ spelling : __SIZE_WIDTH__, kind: macro definition } 363 #|{ spelling : __UINTMAX_MAX__, kind: macro definition } 364 #|{ spelling : __UINTMAX_WIDTH__, kind: macro definition } 365 #|{ spelling : __PTRDIFF_MAX__, kind: macro definition } 366 #|{ spelling : __PTRDIFF_WIDTH__, kind: macro definition } 367 #|{ spelling : __INTPTR_MAX__, kind: macro definition } 368 #|{ spelling : __INTPTR_WIDTH__, kind: macro definition } 369 #|{ spelling : __UINTPTR_MAX__, kind: macro definition } 370 #|{ spelling : __UINTPTR_WIDTH__, kind: macro definition } 371 #|{ spelling : __SIZEOF_DOUBLE__, kind: macro definition } 372 #|{ spelling : __SIZEOF_FLOAT__, kind: macro definition } 373 #|{ spelling : __SIZEOF_INT__, kind: macro definition } 374 #|{ spelling : __SIZEOF_LONG__, kind: macro definition } 375 #|{ spelling : __SIZEOF_LONG_DOUBLE__, kind: macro definition } 376 #|{ spelling : __SIZEOF_LONG_LONG__, kind: macro definition } 377 #|{ spelling : __SIZEOF_POINTER__, kind: macro definition } 378 #|{ spelling : __SIZEOF_SHORT__, kind: macro definition } 379 #|{ spelling : __SIZEOF_PTRDIFF_T__, kind: macro definition } 380 #|{ spelling : __SIZEOF_SIZE_T__, kind: macro definition } 381 #|{ spelling : __SIZEOF_WCHAR_T__, kind: macro definition } 382 #|{ spelling : __SIZEOF_WINT_T__, kind: macro definition } 383 #|{ spelling : __SIZEOF_INT128__, kind: macro definition } 384 #|{ spelling : __INTMAX_TYPE__, kind: macro definition } 385 #|{ spelling : __INTMAX_FMTd__, kind: macro definition } 386 #|{ spelling : __INTMAX_FMTi__, kind: macro definition } 387 #|{ spelling : __INTMAX_C_SUFFIX__, kind: macro definition } 388 #|{ spelling : __UINTMAX_TYPE__, kind: macro definition } 389 #|{ spelling : __UINTMAX_FMTo__, kind: macro definition } 390 #|{ spelling : __UINTMAX_FMTu__, kind: macro definition } 391 #|{ spelling : __UINTMAX_FMTx__, kind: macro definition } 392 #|{ spelling : __UINTMAX_FMTX__, kind: macro definition } 393 #|{ spelling : __UINTMAX_C_SUFFIX__, kind: macro definition } 394 #|{ spelling : __PTRDIFF_TYPE__, kind: macro definition } 395 #|{ spelling : __PTRDIFF_FMTd__, kind: macro definition } 396 #|{ spelling : __PTRDIFF_FMTi__, kind: macro definition } 397 #|{ spelling : __INTPTR_TYPE__, kind: macro definition } 398 #|{ spelling : __INTPTR_FMTd__, kind: macro definition } 399 #|{ spelling : __INTPTR_FMTi__, kind: macro definition } 400 #|{ spelling : __SIZE_TYPE__, kind: macro definition } 401 #|{ spelling : __SIZE_FMTo__, kind: macro definition } 402 #|{ spelling : __SIZE_FMTu__, kind: macro definition } 403 #|{ spelling : __SIZE_FMTx__, kind: macro definition } 404 #|{ spelling : __SIZE_FMTX__, kind: macro definition } 405 #|{ spelling : __WCHAR_TYPE__, kind: macro definition } 406 #|{ spelling : __WINT_TYPE__, kind: macro definition } 407 #|{ spelling : __SIG_ATOMIC_MAX__, kind: macro definition } 408 #|{ spelling : __SIG_ATOMIC_WIDTH__, kind: macro definition } 409 #|{ spelling : __CHAR16_TYPE__, kind: macro definition } 410 #|{ spelling : __CHAR32_TYPE__, kind: macro definition } 411 #|{ spelling : __UINTPTR_TYPE__, kind: macro definition } 412 #|{ spelling : __UINTPTR_FMTo__, kind: macro definition } 413 #|{ spelling : __UINTPTR_FMTu__, kind: macro definition } 414 #|{ spelling : __UINTPTR_FMTx__, kind: macro definition } 415 #|{ spelling : __UINTPTR_FMTX__, kind: macro definition } 416 #|{ spelling : __FLT16_DENORM_MIN__, kind: macro definition } 417 #|{ spelling : __FLT16_HAS_DENORM__, kind: macro definition } 418 #|{ spelling : __FLT16_DIG__, kind: macro definition } 419 #|{ spelling : __FLT16_DECIMAL_DIG__, kind: macro definition } 420 #|{ spelling : __FLT16_EPSILON__, kind: macro definition } 421 #|{ spelling : __FLT16_HAS_INFINITY__, kind: macro definition } 422 #|{ spelling : __FLT16_HAS_QUIET_NAN__, kind: macro definition } 423 #|{ spelling : __FLT16_MANT_DIG__, kind: macro definition } 424 #|{ spelling : __FLT16_MAX_10_EXP__, kind: macro definition } 425 #|{ spelling : __FLT16_MAX_EXP__, kind: macro definition } 426 #|{ spelling : __FLT16_MAX__, kind: macro definition } 427 #|{ spelling : __FLT16_MIN_10_EXP__, kind: macro definition } 428 #|{ spelling : __FLT16_MIN_EXP__, kind: macro definition } 429 #|{ spelling : __FLT16_MIN__, kind: macro definition } 430 #|{ spelling : __FLT_DENORM_MIN__, kind: macro definition } 431 #|{ spelling : __FLT_HAS_DENORM__, kind: macro definition } 432 #|{ spelling : __FLT_DIG__, kind: macro definition } 433 #|{ spelling : __FLT_DECIMAL_DIG__, kind: macro definition } 434 #|{ spelling : __FLT_EPSILON__, kind: macro definition } 435 #|{ spelling : __FLT_HAS_INFINITY__, kind: macro definition } 436 #|{ spelling : __FLT_HAS_QUIET_NAN__, kind: macro definition } 437 #|{ spelling : __FLT_MANT_DIG__, kind: macro definition } 438 #|{ spelling : __FLT_MAX_10_EXP__, kind: macro definition } 439 #|{ spelling : __FLT_MAX_EXP__, kind: macro definition } 440 #|{ spelling : __FLT_MAX__, kind: macro definition } 441 #|{ spelling : __FLT_MIN_10_EXP__, kind: macro definition } 442 #|{ spelling : __FLT_MIN_EXP__, kind: macro definition } 443 #|{ spelling : __FLT_MIN__, kind: macro definition } 444 #|{ spelling : __DBL_DENORM_MIN__, kind: macro definition } 445 #|{ spelling : __DBL_HAS_DENORM__, kind: macro definition } 446 #|{ spelling : __DBL_DIG__, kind: macro definition } 447 #|{ spelling : __DBL_DECIMAL_DIG__, kind: macro definition } 448 #|{ spelling : __DBL_EPSILON__, kind: macro definition } 449 #|{ spelling : __DBL_HAS_INFINITY__, kind: macro definition } 450 #|{ spelling : __DBL_HAS_QUIET_NAN__, kind: macro definition } 451 #|{ spelling : __DBL_MANT_DIG__, kind: macro definition } 452 #|{ spelling : __DBL_MAX_10_EXP__, kind: macro definition } 453 #|{ spelling : __DBL_MAX_EXP__, kind: macro definition } 454 #|{ spelling : __DBL_MAX__, kind: macro definition } 455 #|{ spelling : __DBL_MIN_10_EXP__, kind: macro definition } 456 #|{ spelling : __DBL_MIN_EXP__, kind: macro definition } 457 #|{ spelling : __DBL_MIN__, kind: macro definition } 458 #|{ spelling : __LDBL_DENORM_MIN__, kind: macro definition } 459 #|{ spelling : __LDBL_HAS_DENORM__, kind: macro definition } 460 #|{ spelling : __LDBL_DIG__, kind: macro definition } 461 #|{ spelling : __LDBL_DECIMAL_DIG__, kind: macro definition } 462 #|{ spelling : __LDBL_EPSILON__, kind: macro definition } 463 #|{ spelling : __LDBL_HAS_INFINITY__, kind: macro definition } 464 #|{ spelling : __LDBL_HAS_QUIET_NAN__, kind: macro definition } 465 #|{ spelling : __LDBL_MANT_DIG__, kind: macro definition } 466 #|{ spelling : __LDBL_MAX_10_EXP__, kind: macro definition } 467 #|{ spelling : __LDBL_MAX_EXP__, kind: macro definition } 468 #|{ spelling : __LDBL_MAX__, kind: macro definition } 469 #|{ spelling : __LDBL_MIN_10_EXP__, kind: macro definition } 470 #|{ spelling : __LDBL_MIN_EXP__, kind: macro definition } 471 #|{ spelling : __LDBL_MIN__, kind: macro definition } 472 #|{ spelling : __POINTER_WIDTH__, kind: macro definition } 473 #|{ spelling : __BIGGEST_ALIGNMENT__, kind: macro definition } 474 #|{ spelling : __WINT_UNSIGNED__, kind: macro definition } 475 #|{ spelling : __INT8_TYPE__, kind: macro definition } 476 #|{ spelling : __INT8_FMTd__, kind: macro definition } 477 #|{ spelling : __INT8_FMTi__, kind: macro definition } 478 #|{ spelling : __INT8_C_SUFFIX__, kind: macro definition } 479 #|{ spelling : __INT16_TYPE__, kind: macro definition } 480 #|{ spelling : __INT16_FMTd__, kind: macro definition } 481 #|{ spelling : __INT16_FMTi__, kind: macro definition } 482 #|{ spelling : __INT16_C_SUFFIX__, kind: macro definition } 483 #|{ spelling : __INT32_TYPE__, kind: macro definition } 484 #|{ spelling : __INT32_FMTd__, kind: macro definition } 485 #|{ spelling : __INT32_FMTi__, kind: macro definition } 486 #|{ spelling : __INT32_C_SUFFIX__, kind: macro definition } 487 #|{ spelling : __INT64_TYPE__, kind: macro definition } 488 #|{ spelling : __INT64_FMTd__, kind: macro definition } 489 #|{ spelling : __INT64_FMTi__, kind: macro definition } 490 #|{ spelling : __INT64_C_SUFFIX__, kind: macro definition } 491 #|{ spelling : __UINT8_TYPE__, kind: macro definition } 492 #|{ spelling : __UINT8_FMTo__, kind: macro definition } 493 #|{ spelling : __UINT8_FMTu__, kind: macro definition } 494 #|{ spelling : __UINT8_FMTx__, kind: macro definition } 495 #|{ spelling : __UINT8_FMTX__, kind: macro definition } 496 #|{ spelling : __UINT8_C_SUFFIX__, kind: macro definition } 497 #|{ spelling : __UINT8_MAX__, kind: macro definition } 498 #|{ spelling : __INT8_MAX__, kind: macro definition } 499 #|{ spelling : __UINT16_TYPE__, kind: macro definition } 500 #|{ spelling : __UINT16_FMTo__, kind: macro definition } 501 #|{ spelling : __UINT16_FMTu__, kind: macro definition } 502 #|{ spelling : __UINT16_FMTx__, kind: macro definition } 503 #|{ spelling : __UINT16_FMTX__, kind: macro definition } 504 #|{ spelling : __UINT16_C_SUFFIX__, kind: macro definition } 505 #|{ spelling : __UINT16_MAX__, kind: macro definition } 506 #|{ spelling : __INT16_MAX__, kind: macro definition } 507 #|{ spelling : __UINT32_TYPE__, kind: macro definition } 508 #|{ spelling : __UINT32_FMTo__, kind: macro definition } 509 #|{ spelling : __UINT32_FMTu__, kind: macro definition } 510 #|{ spelling : __UINT32_FMTx__, kind: macro definition } 511 #|{ spelling : __UINT32_FMTX__, kind: macro definition } 512 #|{ spelling : __UINT32_C_SUFFIX__, kind: macro definition } 513 #|{ spelling : __UINT32_MAX__, kind: macro definition } 514 #|{ spelling : __INT32_MAX__, kind: macro definition } 515 #|{ spelling : __UINT64_TYPE__, kind: macro definition } 516 #|{ spelling : __UINT64_FMTo__, kind: macro definition } 517 #|{ spelling : __UINT64_FMTu__, kind: macro definition } 518 #|{ spelling : __UINT64_FMTx__, kind: macro definition } 519 #|{ spelling : __UINT64_FMTX__, kind: macro definition } 520 #|{ spelling : __UINT64_C_SUFFIX__, kind: macro definition } 521 #|{ spelling : __UINT64_MAX__, kind: macro definition } 522 #|{ spelling : __INT64_MAX__, kind: macro definition } 523 #|{ spelling : __INT_LEAST8_TYPE__, kind: macro definition } 524 #|{ spelling : __INT_LEAST8_MAX__, kind: macro definition } 525 #|{ spelling : __INT_LEAST8_WIDTH__, kind: macro definition } 526 #|{ spelling : __INT_LEAST8_FMTd__, kind: macro definition } 527 #|{ spelling : __INT_LEAST8_FMTi__, kind: macro definition } 528 #|{ spelling : __UINT_LEAST8_TYPE__, kind: macro definition } 529 #|{ spelling : __UINT_LEAST8_MAX__, kind: macro definition } 530 #|{ spelling : __UINT_LEAST8_FMTo__, kind: macro definition } 531 #|{ spelling : __UINT_LEAST8_FMTu__, kind: macro definition } 532 #|{ spelling : __UINT_LEAST8_FMTx__, kind: macro definition } 533 #|{ spelling : __UINT_LEAST8_FMTX__, kind: macro definition } 534 #|{ spelling : __INT_LEAST16_TYPE__, kind: macro definition } 535 #|{ spelling : __INT_LEAST16_MAX__, kind: macro definition } 536 #|{ spelling : __INT_LEAST16_WIDTH__, kind: macro definition } 537 #|{ spelling : __INT_LEAST16_FMTd__, kind: macro definition } 538 #|{ spelling : __INT_LEAST16_FMTi__, kind: macro definition } 539 #|{ spelling : __UINT_LEAST16_TYPE__, kind: macro definition } 540 #|{ spelling : __UINT_LEAST16_MAX__, kind: macro definition } 541 #|{ spelling : __UINT_LEAST16_FMTo__, kind: macro definition } 542 #|{ spelling : __UINT_LEAST16_FMTu__, kind: macro definition } 543 #|{ spelling : __UINT_LEAST16_FMTx__, kind: macro definition } 544 #|{ spelling : __UINT_LEAST16_FMTX__, kind: macro definition } 545 #|{ spelling : __INT_LEAST32_TYPE__, kind: macro definition } 546 #|{ spelling : __INT_LEAST32_MAX__, kind: macro definition } 547 #|{ spelling : __INT_LEAST32_WIDTH__, kind: macro definition } 548 #|{ spelling : __INT_LEAST32_FMTd__, kind: macro definition } 549 #|{ spelling : __INT_LEAST32_FMTi__, kind: macro definition } 550 #|{ spelling : __UINT_LEAST32_TYPE__, kind: macro definition } 551 #|{ spelling : __UINT_LEAST32_MAX__, kind: macro definition } 552 #|{ spelling : __UINT_LEAST32_FMTo__, kind: macro definition } 553 #|{ spelling : __UINT_LEAST32_FMTu__, kind: macro definition } 554 #|{ spelling : __UINT_LEAST32_FMTx__, kind: macro definition } 555 #|{ spelling : __UINT_LEAST32_FMTX__, kind: macro definition } 556 #|{ spelling : __INT_LEAST64_TYPE__, kind: macro definition } 557 #|{ spelling : __INT_LEAST64_MAX__, kind: macro definition } 558 #|{ spelling : __INT_LEAST64_WIDTH__, kind: macro definition } 559 #|{ spelling : __INT_LEAST64_FMTd__, kind: macro definition } 560 #|{ spelling : __INT_LEAST64_FMTi__, kind: macro definition } 561 #|{ spelling : __UINT_LEAST64_TYPE__, kind: macro definition } 562 #|{ spelling : __UINT_LEAST64_MAX__, kind: macro definition } 563 #|{ spelling : __UINT_LEAST64_FMTo__, kind: macro definition } 564 #|{ spelling : __UINT_LEAST64_FMTu__, kind: macro definition } 565 #|{ spelling : __UINT_LEAST64_FMTx__, kind: macro definition } 566 #|{ spelling : __UINT_LEAST64_FMTX__, kind: macro definition } 567 #|{ spelling : __INT_FAST8_TYPE__, kind: macro definition } 568 #|{ spelling : __INT_FAST8_MAX__, kind: macro definition } 569 #|{ spelling : __INT_FAST8_WIDTH__, kind: macro definition } 570 #|{ spelling : __INT_FAST8_FMTd__, kind: macro definition } 571 #|{ spelling : __INT_FAST8_FMTi__, kind: macro definition } 572 #|{ spelling : __UINT_FAST8_TYPE__, kind: macro definition } 573 #|{ spelling : __UINT_FAST8_MAX__, kind: macro definition } 574 #|{ spelling : __UINT_FAST8_FMTo__, kind: macro definition } 575 #|{ spelling : __UINT_FAST8_FMTu__, kind: macro definition } 576 #|{ spelling : __UINT_FAST8_FMTx__, kind: macro definition } 577 #|{ spelling : __UINT_FAST8_FMTX__, kind: macro definition } 578 #|{ spelling : __INT_FAST16_TYPE__, kind: macro definition } 579 #|{ spelling : __INT_FAST16_MAX__, kind: macro definition } 580 #|{ spelling : __INT_FAST16_WIDTH__, kind: macro definition } 581 #|{ spelling : __INT_FAST16_FMTd__, kind: macro definition } 582 #|{ spelling : __INT_FAST16_FMTi__, kind: macro definition } 583 #|{ spelling : __UINT_FAST16_TYPE__, kind: macro definition } 584 #|{ spelling : __UINT_FAST16_MAX__, kind: macro definition } 585 #|{ spelling : __UINT_FAST16_FMTo__, kind: macro definition } 586 #|{ spelling : __UINT_FAST16_FMTu__, kind: macro definition } 587 #|{ spelling : __UINT_FAST16_FMTx__, kind: macro definition } 588 #|{ spelling : __UINT_FAST16_FMTX__, kind: macro definition } 589 #|{ spelling : __INT_FAST32_TYPE__, kind: macro definition } 590 #|{ spelling : __INT_FAST32_MAX__, kind: macro definition } 591 #|{ spelling : __INT_FAST32_WIDTH__, kind: macro definition } 592 #|{ spelling : __INT_FAST32_FMTd__, kind: macro definition } 593 #|{ spelling : __INT_FAST32_FMTi__, kind: macro definition } 594 #|{ spelling : __UINT_FAST32_TYPE__, kind: macro definition } 595 #|{ spelling : __UINT_FAST32_MAX__, kind: macro definition } 596 #|{ spelling : __UINT_FAST32_FMTo__, kind: macro definition } 597 #|{ spelling : __UINT_FAST32_FMTu__, kind: macro definition } 598 #|{ spelling : __UINT_FAST32_FMTx__, kind: macro definition } 599 #|{ spelling : __UINT_FAST32_FMTX__, kind: macro definition } 600 #|{ spelling : __INT_FAST64_TYPE__, kind: macro definition } 601 #|{ spelling : __INT_FAST64_MAX__, kind: macro definition } 602 #|{ spelling : __INT_FAST64_WIDTH__, kind: macro definition } 603 #|{ spelling : __INT_FAST64_FMTd__, kind: macro definition } 604 #|{ spelling : __INT_FAST64_FMTi__, kind: macro definition } 605 #|{ spelling : __UINT_FAST64_TYPE__, kind: macro definition } 606 #|{ spelling : __UINT_FAST64_MAX__, kind: macro definition } 607 #|{ spelling : __UINT_FAST64_FMTo__, kind: macro definition } 608 #|{ spelling : __UINT_FAST64_FMTu__, kind: macro definition } 609 #|{ spelling : __UINT_FAST64_FMTx__, kind: macro definition } 610 #|{ spelling : __UINT_FAST64_FMTX__, kind: macro definition } 611 #|{ spelling : __USER_LABEL_PREFIX__, kind: macro definition } 612 #|{ spelling : __FINITE_MATH_ONLY__, kind: macro definition } 613 #|{ spelling : __GNUC_STDC_INLINE__, kind: macro definition } 614 #|{ spelling : __GCC_ATOMIC_TEST_AND_SET_TRUEVAL, kind: macro definition } 615 #|{ spelling : __CLANG_ATOMIC_BOOL_LOCK_FREE, kind: macro definition } 616 #|{ spelling : __CLANG_ATOMIC_CHAR_LOCK_FREE, kind: macro definition } 617 #|{ spelling : __CLANG_ATOMIC_CHAR16_T_LOCK_FREE, kind: macro definition } 618 #|{ spelling : __CLANG_ATOMIC_CHAR32_T_LOCK_FREE, kind: macro definition } 619 #|{ spelling : __CLANG_ATOMIC_WCHAR_T_LOCK_FREE, kind: macro definition } 620 #|{ spelling : __CLANG_ATOMIC_SHORT_LOCK_FREE, kind: macro definition } 621 #|{ spelling : __CLANG_ATOMIC_INT_LOCK_FREE, kind: macro definition } 622 #|{ spelling : __CLANG_ATOMIC_LONG_LOCK_FREE, kind: macro definition } 623 #|{ spelling : __CLANG_ATOMIC_LLONG_LOCK_FREE, kind: macro definition } 624 #|{ spelling : __CLANG_ATOMIC_POINTER_LOCK_FREE, kind: macro definition } 625 #|{ spelling : __GCC_ATOMIC_BOOL_LOCK_FREE, kind: macro definition } 626 #|{ spelling : __GCC_ATOMIC_CHAR_LOCK_FREE, kind: macro definition } 627 #|{ spelling : __GCC_ATOMIC_CHAR16_T_LOCK_FREE, kind: macro definition } 628 #|{ spelling : __GCC_ATOMIC_CHAR32_T_LOCK_FREE, kind: macro definition } 629 #|{ spelling : __GCC_ATOMIC_WCHAR_T_LOCK_FREE, kind: macro definition } 630 #|{ spelling : __GCC_ATOMIC_SHORT_LOCK_FREE, kind: macro definition } 631 #|{ spelling : __GCC_ATOMIC_INT_LOCK_FREE, kind: macro definition } 632 #|{ spelling : __GCC_ATOMIC_LONG_LOCK_FREE, kind: macro definition } 633 #|{ spelling : __GCC_ATOMIC_LLONG_LOCK_FREE, kind: macro definition } 634 #|{ spelling : __GCC_ATOMIC_POINTER_LOCK_FREE, kind: macro definition } 635 #|{ spelling : __NO_INLINE__, kind: macro definition } 636 #|{ spelling : __PIC__, kind: macro definition } 637 #|{ spelling : __pic__, kind: macro definition } 638 #|{ spelling : __PIE__, kind: macro definition } 639 #|{ spelling : __pie__, kind: macro definition } 640 #|{ spelling : __FLT_RADIX__, kind: macro definition } 641 #|{ spelling : __DECIMAL_DIG__, kind: macro definition } 642 #|{ spelling : __ELF__, kind: macro definition } 643 #|{ spelling : __GCC_ASM_FLAG_OUTPUTS__, kind: macro definition } 644 #|{ spelling : __code_model_small__, kind: macro definition } 645 #|{ spelling : __amd64__, kind: macro definition } 646 #|{ spelling : __amd64, kind: macro definition } 647 #|{ spelling : __x86_64, kind: macro definition } 648 #|{ spelling : __x86_64__, kind: macro definition } 649 #|{ spelling : __SEG_GS, kind: macro definition } 650 #|{ spelling : __SEG_FS, kind: macro definition } 651 #|{ spelling : __seg_gs, kind: macro definition } 652 #|{ spelling : __seg_fs, kind: macro definition } 653 #|{ spelling : __k8, kind: macro definition } 654 #|{ spelling : __k8__, kind: macro definition } 655 #|{ spelling : __tune_k8__, kind: macro definition } 656 #|{ spelling : __REGISTER_PREFIX__, kind: macro definition } 657 #|{ spelling : __NO_MATH_INLINES, kind: macro definition } 658 #|{ spelling : __FXSR__, kind: macro definition } 659 #|{ spelling : __SSE2__, kind: macro definition } 660 #|{ spelling : __SSE2_MATH__, kind: macro definition } 661 #|{ spelling : __SSE__, kind: macro definition } 662 #|{ spelling : __SSE_MATH__, kind: macro definition } 663 #|{ spelling : __MMX__, kind: macro definition } 664 #|{ spelling : __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1, kind: macro definition } 665 #|{ spelling : __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2, kind: macro definition } 666 #|{ spelling : __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4, kind: macro definition } 667 #|{ spelling : __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8, kind: macro definition } 668 #|{ spelling : __SIZEOF_FLOAT128__, kind: macro definition } 669 #|{ spelling : unix, kind: macro definition } 670 #|{ spelling : __unix, kind: macro definition } 671 #|{ spelling : __unix__, kind: macro definition } 672 #|{ spelling : linux, kind: macro definition } 673 #|{ spelling : __linux, kind: macro definition } 674 #|{ spelling : __linux__, kind: macro definition } 675 #|{ spelling : __gnu_linux__, kind: macro definition } 676 #|{ spelling : __FLOAT128__, kind: macro definition } 677 #|{ spelling : __STDC__, kind: macro definition } 678 #|{ spelling : __STDC_HOSTED__, kind: macro definition } 679 #|{ spelling : __STDC_VERSION__, kind: macro definition } 680 #|{ spelling : __STDC_UTF_16__, kind: macro definition } 681 #|{ spelling : __STDC_UTF_32__, kind: macro definition } 682 #|{ spelling : __GCC_HAVE_DWARF2_CFI_ASM, kind: macro definition } 683 #|{ spelling : id, kind: macro definition } 684 #|{ spelling : A, kind: StructDecl } 685 #|{ spelling : foo, kind: FunctionDecl } 686 #|{ spelling : happy, kind: TypedefDecl } 687 , 688 ) 689} 690