[antlr-interest] Line wrapping in generated lexer/parser

Mark Wright markwright at internode.on.net
Tue May 4 05:06:34 PDT 2010


Hi Richard,

Of course you can just download the antlr source code, and fix it,
I think the place to look is in this file:

antlr-3.2/tool/src/main/java/org/antlr/codegen/PythonTarget.java

Regards, Mark

On Tue, May 04, 2010 at 12:14:21PM +0100, Richard Gildea wrote:
> Hi,
> 
> I am using Antlr-3.1.2 to generate a Python target for my grammar.  I am
> observing slight discrepancies in the generated code between different
> platforms, which shows up as differences when committing to svn.
> I suspect it is an issue with the different line endings for the different
> platforms, which is causing the lines to be wrapped differently.
> 
> e.g.
> (on Windows)
>         DFA.unpack(u"\2\144\2\uffff\1\144\22\uffff\20\144\12\u00da\105"
>         u"\144"),
> vs
> (on Mac)
> 
>  DFA.unpack(u"\2\144\2\uffff\1\144\22\uffff\20\144\12\u00dc\105\144"),
> 
> In all cases it seems to be where one character is pushed to the next line.
>  Is this an issue with CR+LF counting as two characters on Windows, and
> causing the line to creep over the character limit? If so, is there a
> possible way round this behaviour so that I can get a clean diff between
> generated code on different platforms?
> 
> Thanks,
> 
> Richard
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> 


More information about the antlr-interest mailing list