Andreas wrote:
The most flexible but safe solution is to simply define the indentation as the sequence of indentation characters used. Two consecutive lines are indented consistently whenever one indentation is a prefix of the other. Hence you may freely mix different indentation characters, but you must be consistent across lines. Any decent editor should be able to ensure that.
Well no they won't, because some editors might replace blocks of 8 spaces at the start of a line with TABs (or something like that), meaning that 8 and 7 spaces would go to "\t" and " ", which your algorithm would reject. On the other hand, so would mine, so perhaps your algorithm is better, being simpler Simon Marlow wrote:
As for the width of the tab character: tab stops are every 8 columns. Period. The Haskell report says so
Yes, true. I think it was Leslie Lamport who wrote in TeXHaX that anyone defining an input format which includes tabs should be sentenced to ten years programming COBOL in Nijny-Novgorod. Off you go, Simon ... :)