Skip to content

"Generated from..." : a useless line that prevents compilation #4839

Open
@phandaal

Description

@phandaal

My .g4 files are in src/main/antlr4/path/to/my/unbelievable/package.

Antlr generates the desired .java files, and adds a comment at the beginning to point out that these files have been automatically generated:

// Generated from path\to\my\unbelievable\package\MyLexer.g4 by ANTLR 4.13.0

As per Java Language Specification, §3.3: "Unicode escapes are recognized in comments and character literals before tokenization." so when it sees the \u of my\unbelievable\package...

illegal unicode escape(errors(1): 1:34-1:36)
Invalid unicodeJava(1610612992)

and a purely decorative comment prevents compilation.

Proposed solution

Use / instead of \

// Generated from path/to/my/unbelievable./package/MyLexer.g4 by ANTLR 4.13.0

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