This function does count curly and round braces and reindents accordingly the beginning of each line. It does consider line-comments (// and ///) but not multiline comments (/* ... */).