"Walter Bright" <[email protected]> wrote in message news:[email protected]... > Nick Sabalausky wrote: >> I know (or at least have heard) that Mac's EOLs are traditionally '\r'. >> But, mac directory separators are traditionally ':' and I know that these >> days macs can, and often do, use '/' just fine instead. So...are '\r' >> line endings still in use and worth supporting, or have they pretty much >> disappeared in favor of '\n'? (I'm mainly wondering for code, but also >> curious about other text too). > > What I do is regard the following: > > CR > LF > CR,LF > > as line separators. Haven't had a problem with that strategy.
Yea, that's what I'm doing in Goldie (a grammar-independant lexer/parser, see D.announce). But unless someone sees a reason otherwise, I think I'm going to leave my Haxe preprocessor (ie, a D implementation of Haxe's preprocessor, and the immediate reason for my inquiry) just looking for \n, at least for now. That handles both win/unix newlines, and from the other comments here, it sounds like it would be extremely unlikely to encounter Haxe source that used \r. Plus, because of the way this particular app works, if I'm wrong, the only thing it'll mess up is the reported line numbers. Although that does make me think of something I should ask: In D's strings, does the '\n' escape sequence always evaluate to LF regardless of platform (and same question about '\r' and CR)? And do any phobos or tango output routines every do any automatic conversion on LF or CR? Until now I've been assuming none of that ever gets converted to anything else (except, of course, for CRs and LFs actually embedded in a string literal), but only now did I realize that's just an assumption.
