[antlr-interest] C# line endings

Terence Parr parrt at cs.usfca.edu
Sat Oct 27 04:34:52 PDT 2007


ANTLR uses a template written on unix so when I hit return it gives  
me \n.  ANTLR dutifully spits out that verbatim.  ST does have a  
writer filter that can be tweaked or added etc...  For example, ST  
has the auto-indent bits in the default writer.

Ter
On Oct 27, 2007, at 10:56 AM, Benjamin Niemann wrote:

> de Jong, Ron wrote:
>
>> I'm using 3.0b5 with a C# target. The source code generation by Antlr
>> doesn't have CR/LF line endings
>>
>> so whenever I try and view them I'm prompted to fix them up. Can  
>> setting
>> the line ending in the generated code be made an option.
>
> Use an editor that does not complain about correct line endings ;)
>
> ANTLR uses StringTemplate for code generation and I don't know of  
> an option
> to make ST do line ending conversion. Mmmm, it might be just a  
> matter of
> using fopen(..., 'r') instead of fopen(..., 'rb') - or whatever the  
> Java
> equivalent for this is.
>
> Thinking about it, ANTLR should probably always write it's output  
> using the
> local conventions.
> (Although I'd prefer, if everybody just uses plain LFs and we could  
> simply
> forget this issue...)
>
>



More information about the antlr-interest mailing list