Example usage for org.antlr.v4.tool.ast GrammarAST getChildrenAsArray

List of usage examples for org.antlr.v4.tool.ast GrammarAST getChildrenAsArray

Introduction

In this page you can find the example usage for org.antlr.v4.tool.ast GrammarAST getChildrenAsArray.

Prototype

public GrammarAST[] getChildrenAsArray() 

Source Link

Usage

From source file:org.opencypher.tools.grammar.Antlr4ToolFacade.java

License:Apache License

private static RuleAST lastGoodRule(GrammarAST ast) {
    ast = (GrammarAST) ast.getFirstChildWithType(GrammarTreeVisitor.RULES);
    if (ast == null) {
        return null;
    }//from  ww w .j  a v a2  s .  c  o m
    RuleAST last = null;
    for (GrammarAST rule : ast.getChildrenAsArray()) {
        if (rule instanceof RuleAST) {
            last = (RuleAST) rule;
        } else {
            return last;
        }
    }
    return null;
}