Skip to content

Commit 4c5d3a4

Browse files
docs: correct example usage in README
1 parent 7f531d3 commit 4c5d3a4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ pub fn main() !void {
6565
try parser.setLanguage(language);
6666
6767
// Parse some source code and get the root node
68-
const tree = try parser.parseBuffer("pub fn main() !void {}", null, null);
69-
defer tree.destroy();
68+
const tree = parser.parseString("pub fn main() !void {}", null);
69+
defer tree.?.destroy();
7070
71-
const node = tree.rootNode();
72-
std.debug.assert(std.mem.eql(u8, node.type(), "source_file"));
73-
std.debug.assert(node.endPoint().cmp(.{ .row = 0, .column = 22 }) == 0);
71+
const node = tree.?.rootNode();
72+
std.debug.assert(std.mem.eql(u8, node.kind(), "source_file"));
73+
std.debug.assert(node.endPoint().cmp(.{ .row = 0, .column = 22 }) == .eq);
7474
7575
// Create a query and execute it
7676
var error_offset: u32 = 0;
@@ -84,7 +84,7 @@ pub fn main() !void {
8484
// Get the captured node of the first match
8585
const match = cursor.nextMatch().?;
8686
const capture = match.captures[0].node;
87-
std.debug.assert(std.mem.eql(u8, capture.type(), "identifier"));
87+
std.debug.assert(std.mem.eql(u8, capture.kind(), "identifier"));
8888
}
8989
```
9090

0 commit comments

Comments
 (0)