| ... | @@ -13,6 +13,7 @@ pub const Tree = struct { | ... | @@ -13,6 +13,7 @@ pub const Tree = struct { |
| 13 | root_node: *Node.Root, | 13 | root_node: *Node.Root, |
| 14 | arena_allocator: std.heap.ArenaAllocator, | 14 | arena_allocator: std.heap.ArenaAllocator, |
| 15 | errors: ErrorList, | 15 | errors: ErrorList, |
| | 16 | generated: bool = false, |
| 16 | | 17 | |
| 17 | pub const TokenList = SegmentedList(Token, 64); | 18 | pub const TokenList = SegmentedList(Token, 64); |
| 18 | pub const ErrorList = SegmentedList(Error, 0); | 19 | pub const ErrorList = SegmentedList(Error, 0); |
| ... | @@ -58,6 +59,8 @@ pub const Tree = struct { | ... | @@ -58,6 +59,8 @@ pub const Tree = struct { |
| 58 | .line_start = start_index, | 59 | .line_start = start_index, |
| 59 | .line_end = self.source.len, | 60 | .line_end = self.source.len, |
| 60 | }; | 61 | }; |
| | 62 | if (self.generated) |
| | 63 | return loc; |
| 61 | const token_start = token.start; | 64 | const token_start = token.start; |
| 62 | for (self.source[start_index..]) |c, i| { | 65 | for (self.source[start_index..]) |c, i| { |
| 63 | if (i + start_index == token_start) { | 66 | if (i + start_index == token_start) { |