Example usage for org.antlr.v4.runtime RuleContext isEmpty

List of usage examples for org.antlr.v4.runtime RuleContext isEmpty

Introduction

In this page you can find the example usage for org.antlr.v4.runtime RuleContext isEmpty.

Prototype

public boolean isEmpty() 

Source Link

Document

A context is empty if there is no invoking state; meaning nobody called current context.

Usage

From source file:org.tvl.goworks.editor.go.completion.GoCompletionQuery.java

License:Open Source License

public static RuleContext getTopContext(Parser parser, RuleContext context, IntervalSet values,
        boolean checkTop) {
    if (checkTop && context instanceof ParserRuleContext) {
        if (values.contains(context.getRuleIndex())) {
            return context;
        }/*from   w w w  . ja v  a 2  s. c om*/
    }

    if (context.isEmpty()) {
        return null;
    }

    if (values.contains(parser.getATN().states.get(context.invokingState).ruleIndex)) {
        return context.parent;
    }

    return getTopContext(parser, context.parent, values, false);
}