use b_plain use cz/vars rm_comments_blank() for_vec(i, lines, cstr) cstr l = *i if strchr(l, '#') char *p = l while *p char *p0 = p if token(&p) == COMMENT # TODO more efficient, don't scan whole comment? while p0 > l && isspace(p0[-1]) --p0 *p0 = '\0' break int blank = is_blank(l) if !blank # remove colons and add func parens int len = strlen(l) if len > 2 && l[len-1] == ':' && l[len-2] != ' ': l[len-1] = '\0' if !strpbrk(l, "\t ()"): l = tofree(cstr_cat(l, "()")) # TODO alloc a little extra space for each line instead? # cope with vim adding unwanted spaces in indent char *from = strstr(l, " \t") if from char *to = from ++from while to > l && to[-1] == ' ' --to cstr_chop_start(to, from) vec_push(work, l) swap(lines, work) vecclr(work)