@@ 214,7 214,7 @@ fn parse_file(filename: str, lines: *[]str) void = {
const file = os::open(filename)!;
defer io::close(file)!;
let continuation = false;
- const joined_lines: str = "";
+ const joined_lines: []u8 = [];
for (true) {
const line = match (bufio::read_line(file)) {
@@ 230,21 230,22 @@ fn parse_file(filename: str, lines: *[]str) void = {
};
const index = starts_with_any(line, fields);
if (index >= 0) {
- if (joined_lines != "") {
- process_line(joined_lines);
- joined_lines = "";
+ if (len(joined_lines) > 0) {
+ process_line(strings::fromutf8_unsafe(joined_lines));
+ joined_lines = [];
};
continuation = true;
- joined_lines = strings::trim(strings::sub(line, len(fields[index]), strings::end));
+ // can slices be trimmed?
+ joined_lines = strings::toutf8(line)[len(fields[index])..];
} else if (continuation && strings::hasprefix(line, " ")) {
- joined_lines = strings::concat(joined_lines, line);
+ append(joined_lines, strings::toutf8(line));
} else {
continuation = false;
};
};
- if (joined_lines != "") {
- process_line(joined_lines);
+ if (len(joined_lines) > 0) {
+ process_line(strings::fromutf8_unsafe(joined_lines));
};
};