Skip to content

Strange formatting of comments #148

@fpga-guy

Description

@fpga-guy

Unfortunately javadoc style multiline comments preceding a rule cause a strange formatting effect. The following rule is moved to just after the comment ending. Also, multiple single line comments are indented and extra lines are added.

grammar Funny;

/**
This is a funny grammar that confuses Antlr4Formatter
*/
test : 'a' 'b' 'c' test2 EOF;

//
// test number 2
//
test2 : '1' '2' '3';

turns into

grammar Funny;

/**
This is a funny grammar that confuses Antlr4Formatter
*/ test
   : 'a' 'b' 'c' test2 EOF
   ;
   //
   
   // test number 2
   
   //
   
test2
   : '1' '2' '3'
   ;

This seems very odd to me. I'm not sure if this is intentional or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions