compilation - 编译语法时出错

标签 compilation antlr grammar

我有一个语法 P.g,直到最近才悄悄编译。今天,当我在命令提示符下输入时:

java -cp .;../antlr-3.5-complete.jar org.antlr.Tool P.g

(语法在gram文件夹中,antlr-3.5-complete.jar在父文件夹中,提示放在gram文件夹中。)

生成以下错误:

warning(24):  template error: context [/outputFile /parser /genericParser /region__/genericParser__m
embers] 32:3 no such property or can't access: org.antlr.tool.Grammar.indirectDelegates
Caused by: org.stringtemplate.v4.misc.STNoSuchPropertyException: no such property: org.antlr.tool.Gr
ammar.indirectDelegates
        at org.stringtemplate.v4.misc.ObjectModelAdaptor.throwNoSuchProperty(ObjectModelAdaptor.java
:106)
        at org.stringtemplate.v4.misc.ObjectModelAdaptor.lookupMethod(ObjectModelAdaptor.java:99)
        at org.stringtemplate.v4.misc.ObjectModelAdaptor.getProperty(ObjectModelAdaptor.java:67)
        at org.stringtemplate.v4.Interpreter.getObjectProperty(Interpreter.java:1158)
        at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:210)
        at org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145)
        at org.stringtemplate.v4.Interpreter.writeObject(Interpreter.java:703)
        at org.stringtemplate.v4.Interpreter.writeObjectNoOptions(Interpreter.java:635)
        at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:285)
        at org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145)
        at org.stringtemplate.v4.Interpreter.writeObject(Interpreter.java:703)
        at org.stringtemplate.v4.Interpreter.writeObjectNoOptions(Interpreter.java:635)
        at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:285)
        at org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145)
        at org.stringtemplate.v4.Interpreter.writeObject(Interpreter.java:703)
        at org.stringtemplate.v4.Interpreter.writeObjectNoOptions(Interpreter.java:635)
        at org.stringtemplate.v4.Interpreter._exec(Interpreter.java:285)
        at org.stringtemplate.v4.Interpreter.exec(Interpreter.java:145)
        at org.stringtemplate.v4.ST.write(ST.java:415)
        at org.antlr.codegen.CodeGenerator.write(CodeGenerator.java:1296)
        at org.antlr.codegen.Target.genRecognizerFile(Target.java:98)
        at org.antlr.codegen.CodeGenerator.genRecognizer(CodeGenerator.java:459)
        at org.antlr.Tool.generateRecognizer(Tool.java:696)
        at org.antlr.Tool.process(Tool.java:509)
        at org.antlr.Tool.main(Tool.java:98)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.stringtemplate.v4.misc.Misc.invokeMethod(Misc.java:218)
        at org.stringtemplate.v4.misc.ObjectModelAdaptor.lookupMethod(ObjectModelAdaptor.java:84)
        ... 23 more
Caused by: java.lang.NullPointerException
        at java.util.Objects.requireNonNull(Unknown Source)
        at java.util.ArrayList.removeAll(Unknown Source)
        at org.antlr.tool.CompositeGrammar.getIndirectDelegates(CompositeGrammar.java:226)
        at org.antlr.tool.Grammar.getIndirectDelegates(Grammar.java:2722)
        ... 29 more

我没有改变任何东西。所有这些错误的原因是什么?

非常感谢您

最佳答案

使用Java8会发生这种情况,请尝试切换回7

关于compilation - 编译语法时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23572544/

相关文章:

Java 调用 Python(需要类、接口(interface)或枚举)

compilation - 即时 (JIT) 编译器有什么作用?

c - 如 Brian W. Kernighan 和 Dennis M. Ritchie 所著的 The C Programming Language 一书中所述,C 中的宏如何帮助减少程序开销?

java - 永远无法达到以下替代方案 : 2

antlr - 在 ParserVisitor 中获取行号?

python - h5py 安装后报错

unit-testing - DSL生成测试数据

grammar - 如何在Raku中使用匹配的定界符

grammar - Flex,多行规则

python - 仅匹配出现在解析字符串右半部分的元素