[antlr-interest] ENHANCEMENT [ Ant Task ] - Add "mapper" for extracting target filenames.

Austin Hastings Austin_Hastings at Yahoo.com
Mon Dec 3 06:07:04 PST 2007


I'd love to see an ant mapper 
(http://ant.apache.org/manual/CoreTypes/mapper.html) built around the 
same code that the ANTLR3 task uses for deciding the output filename 
(that is, the "grammar type" info in the file). It should probably take 
the same options vis-a-vis flattening directory structures, output 
directory, etc. as does ANTLR3 itself:

<pathconvert
    property = "my.parser.path"
    targetos = "unix"
    >
    <mapper
       type = "antlr3:ParserNameMapper"
       from = "${my.grammar.file}"
       />
</pathconvert>
<echo>My parser file path is: ${my.parser.path}</echo>

Would output any of:

lexer.g -> null
parser.g -> parser.java (or is it parserParser.java?)
combo.g -> comboParser.java
treeparser.g -> treeparser.java


depending on what the grammar type was.

There could obviously be an "antlr3:LexerNameMapper" as well, and even 
an "antlr3:WorthlessIntermediateFilesToDeleteMapper" until that stupid 
__.g file goes away.

=Austin



More information about the antlr-interest mailing list