Setting correct namespace in Antlr4.Runtime.Standard

Viewed 447

How do I set the namespace in the generated lexer/parser classes when using the Antlr4.Runtime.Standard (4.7.2) library under .NET Standard 2.0? I am using the following command line to generate the classes:

java -jar antlr-4.7.2-complete.jar -Dlanguage=CSharp arithmetic.g4

Setting the "Custom Tool Namespace" property in the .g4-file does not help.

1 Answers

With -package ....

The following command:

java -jar antlr-4.7.2-complete.jar -Dlanguage=CSharp -package My.Namespace T.g4

generates source files like this:

namespace My.Namespace {
  ...
}
Related