Example usage for org.antlr.v4.runtime Parser getRuleInvocationStack

List of usage examples for org.antlr.v4.runtime Parser getRuleInvocationStack

Introduction

In this page you can find the example usage for org.antlr.v4.runtime Parser getRuleInvocationStack.

Prototype

public List<String> getRuleInvocationStack(RuleContext p) 

Source Link

Usage

From source file:org.eclipse.titan.common.parsers.ParserLogger.java

License:Open Source License

/**
 * Rule info in string format for logging purpose
 * @param aRule rule/*from   w  w w.  ja  v a 2 s  .co  m*/
 * @param aParser parser to get rule name
 * @param aTokenNameResolver resolver to get token name (used only if rule is erroneous) 
 * @return rule name and exception and some other info if rule is erroneous
 */
private static String getRuleInfo(final ParserRuleContext aRule, final Parser aParser,
        final TokenNameResolver aTokenNameResolver) {
    // only rule name
    String info = aParser.getRuleInvocationStack(aRule).get(0);
    info += getExceptionInfo(aRule, aTokenNameResolver);
    return info;
}