Function getNodeSource [src]
Prototype
pub fn getNodeSource(tree: Ast, node: Node.Index) []const u8
Parameters
tree: Ast
node: Node.Index
Source
pub fn getNodeSource(tree: Ast, node: Node.Index) []const u8 {
const first_token = tree.firstToken(node);
const last_token = tree.lastToken(node);
const start = tree.tokenStart(first_token);
const end = tree.tokenStart(last_token) + tree.tokenSlice(last_token).len;
return tree.source[start..end];
}