Example usage for org.antlr.v4.runtime ParserRuleContext depth

List of usage examples for org.antlr.v4.runtime ParserRuleContext depth

Introduction

In this page you can find the example usage for org.antlr.v4.runtime ParserRuleContext depth.

Prototype

public int depth() 

Source Link

Usage

From source file:tilda.grammar.TildaSQLTreePrinter.java

License:Apache License

@Override
public void enterEveryRule(ParserRuleContext ctx) {
    LOG.debug(PaddingUtil.getPad(ctx.depth() * 3) + _Parser.getRuleNames()[ctx.getRuleIndex()]);
    if (isLeafNode(ctx) == true)
        LOG.debug(PaddingUtil.getPad(ctx.depth() * 3) + "   -] " + ctx.getText());

    if (_Path.containsKey(ctx.parent) == false)
        _Path.put(ctx.parent, new ArrayList<String>());
    if (_Path.containsKey(ctx) == false)
        _Path.put(ctx, new ArrayList<String>());

    _Path.get(ctx).add(_Parser.getRuleNames()[ctx.getRuleIndex()]);
}