9c73c17238
Signed-off-by: Drew DeVault <sir@cmpwn.com>
33 lines
637 B
Hare
33 lines
637 B
Hare
use fmt;
|
|
use os;
|
|
use unicode;
|
|
|
|
export fn main() void = {
|
|
const input = os::args[1];
|
|
|
|
fmt::println(input)!;
|
|
|
|
let ix = 0u;
|
|
const lb = unicode::new_line_breaker(input);
|
|
for (const (pos, mand) => unicode::next_line_break(&lb)) {
|
|
for (ix < pos; ix += 1) {
|
|
fmt::print(' ')!;
|
|
};
|
|
ix += 1;
|
|
|
|
if (mand) {
|
|
fmt::println('|')!;
|
|
} else {
|
|
fmt::print('^')!;
|
|
};
|
|
};
|
|
|
|
fmt::println()!;
|
|
fmt::println()!;
|
|
|
|
fmt::println("Line break opportunities:")!;
|
|
const lb = unicode::new_line_breaker(input);
|
|
for (const (pos, mand) => unicode::next_line_break(&lb)) {
|
|
fmt::printfln("- {} {}", pos, if (mand) "(mandatory)" else "")!;
|
|
};
|
|
};
|