126 void WriteTo(std::ostream& out,
bool print_offsets,
127 std::vector<uint32_t>* collect_offsets =
nullptr) {
129 if (
lines_.size() == 0)
return;
135 constexpr int kBufSize = 12;
136 char buffer[kBufSize] = {32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
'|'};
137 char*
const buffer_end = buffer + kBufSize - 1;
138 char*
const buffer_start = buffer_end - width;
140 uint32_t
offset = l.bytecode_offset;
141 char* ptr = buffer_end;
143 *(--ptr) =
'0' + (
offset % 10);
149 out.write(buffer_start, width + 1);
150 out.write(l.data, l.len);
157 const char* last_start = first.
data;
158 size_t len = first.len;
161 if (last_start + len == l.data) {
164 out.write(last_start, len);
169 out.write(last_start, len);
170 if (collect_offsets) {
171 collect_offsets->reserve(
lines_.size());
173 collect_offsets->push_back(l.bytecode_offset);