为什么我的 ANTLR 构建 Ant 任务失败并显示“无法确定生成的类"? [英] Why does my ANTLR build Ant task fail with "Unable to determine generated class"?

查看:14
本文介绍了为什么我的 ANTLR 构建 Ant 任务失败并显示“无法确定生成的类"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 用于 Ant 的 ANTLR3 任务,但我收到无法确定生成的类"构建失败消息.

I'm trying to use ANTLR3 task for Ant, but I get an "Unable to determine generated class" build failure message.

一项快速研究表明,许多人遇到了同样的问题,但没有提供解决方案(请参阅下面的链接).

A quick research shows that many people have had the same problem, with no solution provided (see links below).

有人可以提出一个不使用常规 Java Ant 任务的解决方案吗?

Can someone suggest a solution that doesn't resort to using a regular Java Ant task?

外部链接:

推荐答案

Ant 1.8.2(最新版本)中包含的 antlr 任务似乎依赖于 ANTLR 2.7.2(定义在$ANT_HOME/lib/ant-antlr.pom 并使用 $ANT_HOME/lib/ant-antlr.jar.

The antlr task included with Ant 1.8.2 (the latest version) seems to be dependent on ANTLR 2.7.2 (defined in $ANT_HOME/lib/ant-antlr.pom and using $ANT_HOME/lib/ant-antlr.jar.

任务正在做的是扫描目标文件中匹配^class (.*) extends .* 的行,其中第一个匹配组将用作生成文件的名称.这整个语法似乎已在 ANTLR 3.x 中删除,或者至少是可选的,因为我能够使用您提到的常规 Java 任务解决方法生成解析器,而无需使用它.

What the task is doing is scanning the target file for a line matching ^class (.*) extends .*, where the first match group will be used as the name of the generated file. This whole bit of syntax seems to have been dropped in ANTLR 3.x, or at least made optional, because I'm able to generate parsers without it using the regular java task work-around you mentioned.

http://antlr.org/ 的首页,文件共享"标题下有一个链接AntLR v3 任务,但不幸的是它似乎不是我所希望的那种直接替代品.实际上,它似乎相当复杂,所以我一直坚持使用普通的 java 任务.

On the front page of http://antlr.org/ under the "File Sharing" heading is a link to ANTLR v3 task for Ant, but unfortunately it doesn't appear to be the sort of drop-in replacement I was hoping for. Actually, it seems to be rather convoluted so I've stuck with using the plain java task.

这篇关于为什么我的 ANTLR 构建 Ant 任务失败并显示“无法确定生成的类"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆