let indenting_space program =
let rec space_indenting rtokens = function
| NEWLINE::SPACE(n)::rest -> space_indenting (SPACE(n)::NEWLINE::rtokens) rest
| COLON::SPACE(n)::rest -> space_indenting (SPACE(n)::COLON::rtokens) rest
| SPACE(n)::rest -> space_indenting rtokens rest
| token::rest -> space_indenting (token::rtokens) rest
| [] -> List.rev rtokens in
match (space_indenting [] (NEWLINE::program)) with
| NEWLINE::rest -> rest
| _ -> wsfail "Indenting should have left a NEWLINE at the start of program; did not."