final BnfFile bnfFile = (BnfFile)rule.getContainingFile();
final ArrayList<Pair<BnfExpression, BnfAttr>> pinned = new ArrayList<Pair<BnfExpression, BnfAttr>>();
GrammarUtil.processPinnedExpressions(rule, new PairProcessor<BnfExpression, ParserGeneratorUtil.PinMatcher>() {
@Override
public boolean process(BnfExpression bnfExpression, ParserGeneratorUtil.PinMatcher pinMatcher) {
BnfAttr attr = bnfFile.findAttribute(pinMatcher.rule, KnownAttribute.PIN, pinMatcher.funcName);
return pinned.add(Pair.create(bnfExpression, attr));
}
});
for (int i = 0, len = pinned.size(); i < len; i++) {
BnfExpression e = pinned.get(i).first;