This question already has answers here:
ANTLRInputStream and ANTLRFileStream are deprecated, what are the alternatives?

(2 个回答)


3年前关闭。



import  org.antlr.v4.runtime.*;
import  org.antlr.v4.runtime.tree.*;

public class Test{
public static void main(String[] args) throws Exception{

    ANTLRInputStream input = new ANTLRInputStream(System.in);

    ArrayInitLexer lexer = new ArrayInitLexer(input);

    CommonTokenStream tokens = new CommonTokenStream(lexer);

    ArrayInitParser parser = new ArrayInitParser(tokens);

    ParseTree tree = parser.init();
    System.out.println(tree.toStringTree(parser));


}
}

我已经找到了官方 API ( http://www.antlr.org/api/Java/index.html ) ,但我仍然不知道如何解决它。

最佳答案

他们的官方 ANTLR 站点建议使用 CharsStreams 类,因为 4.7 版 ANTRLInputStream 已弃用。

关于java - ANTLR-4.7.1 :The type ANTLRInputStream is deprecated,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50691510/

10-09 03:39