Search in sources :

Example 1 with Usages

use of org.antlr.works.find.Usages in project antlrworks by antlr.

the class FindMenu method findUsage.

public void findUsage() {
    StatisticsAW.shared().recordEvent(StatisticsAW.EVENT_FIND_USAGES);
    ATEToken token = delegate.getCurrentToken();
    if (token == null)
        return;
    Usages usage = new Usages(delegate, token);
    delegate.addUsagesTab(usage);
    for (ATEToken ateToken : delegate.getTokens()) {
        if (ateToken.getAttribute().equals(token.getAttribute())) {
            ElementRule matchedRule = delegate.getEditorRules().getEnclosingRuleAtPosition(ateToken.getStartIndex());
            if (matchedRule != null)
                usage.addMatch(matchedRule, ateToken);
        }
    }
}
Also used : ElementRule(org.antlr.works.grammar.element.ElementRule) Usages(org.antlr.works.find.Usages) ATEToken(org.antlr.works.ate.syntax.misc.ATEToken)

Aggregations

ATEToken (org.antlr.works.ate.syntax.misc.ATEToken)1 Usages (org.antlr.works.find.Usages)1 ElementRule (org.antlr.works.grammar.element.ElementRule)1