强制ANTLR在特定文件夹中生成输出文件

问题描述:

我不希望ANTLR生成的文件与我的 .g4 语法和其他受版本控制的文档位于同一位置.我想将所有生成的文件放在一个单独的嵌套文件夹中,该文件夹可以通过 .gitignore 排除.到目前为止,我已经尝试在主文件夹内创建一个文件夹< someFolder> ,并从该文件夹中运行:

I don't like to have the ANTLR generated files in the same location as my .g4 grammar and other version-controlled documents. I would like to put all the generated files in a separate nested folder that can be excluded via .gitignore. What I have tried so far is to create a folder <someFolder> inside the main folder and from inside that folder ran:

cd <someFolder>
antlr ../<grammarFile.g4>

但是,它仍然会将所有生成的文件溢出到父文件夹中.

however, it still spills all the generated files in the parent folder.

PS 没关系,但是我的环境是macOS.

P.S. It shouldn't matter but my environment is macOS.