diff --git a/antlr4-maven-plugin/src/main/java/org/antlr/mojo/antlr4/Antlr4Mojo.java b/antlr4-maven-plugin/src/main/java/org/antlr/mojo/antlr4/Antlr4Mojo.java index f4b40fb4d..000f9a3cc 100644 --- a/antlr4-maven-plugin/src/main/java/org/antlr/mojo/antlr4/Antlr4Mojo.java +++ b/antlr4-maven-plugin/src/main/java/org/antlr/mojo/antlr4/Antlr4Mojo.java @@ -90,6 +90,12 @@ public class Antlr4Mojo extends AbstractMojo { @Parameter(defaultValue = "false") protected boolean atn; + /** + * specify grammar file encoding; e.g., euc-jp + */ + @Parameter + protected String encoding; + /** * generate parse tree listener (default) */ @@ -102,6 +108,12 @@ public class Antlr4Mojo extends AbstractMojo { @Parameter(defaultValue = "false") protected boolean visitor; + /** + * treat warnings as errors + */ + @Parameter(defaultValue = "false") + protected boolean treatWarningsAsErrors; + /** * add config set to DFA states */ @@ -300,6 +312,11 @@ public class Antlr4Mojo extends AbstractMojo { args.add("-atn"); } + if (encoding != null && !encoding.isEmpty()) { + args.add("-encoding"); + args.add(encoding); + } + if (listener) { args.add("-listener"); } @@ -314,6 +331,10 @@ public class Antlr4Mojo extends AbstractMojo { args.add("-no-visitor"); } + if (treatWarningsAsErrors) { + args.add("-Werror"); + } + if (verbose_dfa) { args.add("-Xverbose-dfa"); }