let terminate_blocks blocks =
let rec block_terminate rblocks = function
| (n, toks, false)::rest ->
let terminated = if (needs_semi toks) then toks@[SEMI] else toks in
block_terminate ((n, terminated, false)::rblocks) rest
| other::rest ->
block_terminate (other::rblocks) rest
| [] -> List.rev rblocks in
block_terminate [] blocks