authorgravatar for wink@saville.comWink Saville <wink@saville.com> 2018-10-01 21:51:53-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-10-02 00:51:53-04:00
logcd211bcc20d3d1ddd1a50d57c7645aa3445934f0
treeb315f7029f7b87800656a678ec0589e179548cea
parentbc3e99c5e5a5f054e57a7056a64ff08762d42e9f

Add doc comment for tokenLocationPtr (#1618)

The algorithm seemed unusual and I had spent some effort understanding it, so I thought I'd add a comment.

1 files changed, 1 insertions(+), 0 deletions(-)

std/zig/ast.zig+1
...@@ -45,6 +45,7 @@ pub const Tree = struct {...@@ -45,6 +45,7 @@ pub const Tree = struct {
45 line_end: usize,45 line_end: usize,
46 };46 };
4747
48 /// Return the Location of the token relative to the offset specified by `start_index`.
48 pub fn tokenLocationPtr(self: *Tree, start_index: usize, token: *const Token) Location {49 pub fn tokenLocationPtr(self: *Tree, start_index: usize, token: *const Token) Location {
49 var loc = Location{50 var loc = Location{
50 .line = 0,51 .line = 0,