2

我当然犯了错误,但 antlr 的 gunit 似乎对用户没有选择。

bash-3.2$ java org.antlr.gunit.Interp --help
Exception in thread "main" java.io.FileNotFoundException: --help (No such file or directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:120)
    at java.io.FileInputStream.<init>(FileInputStream.java:79)
    at org.antlr.runtime.ANTLRFileStream.load(ANTLRFileStream.java:59)
    at org.antlr.runtime.ANTLRFileStream.<init>(ANTLRFileStream.java:47)
    at org.antlr.runtime.ANTLRFileStream.<init>(ANTLRFileStream.java:42)
    at org.antlr.gunit.Interp.main(Interp.java:62)
bash-3.2$ 

特别是,我想打开详细选项,否则当错误发生时它告诉我很少。
你知道如何打开它的详细/调试选项吗?

 [java] -----------------------------------------------------------------------
 [java] executing testsuite for grammar:while with 31 tests
 [java] -----------------------------------------------------------------------
 [java] 2 failures found:
 [java] test15 (variables, line20) - 
 [java] expected: OK
 [java] actual: FAIL
 [java] 
 [java] test20 (read, line27) - 
 [java] expected: OK
 [java] actual: FAIL
 [java] 
4

1 回答 1

1

假设您使用的是 antlr3,请查看 GitHub 上的源代码(https://github.com/antlr/antlr3/blob/master/gunit/src/main/java/org/antlr/gunit/Interp.java),您是更正没有详细的选项。

验证测试失败原因的一种方法是在调试模式下通过 AntlrWorks 运行输入,以便查看匹配的规则。

于 2013-01-30T04:53:50.720 回答