public void addResult(@NotNull PsiElement match, int start, int end, @NotNull MatchContext context) {
    if (totalMatchedOccurs == -1) {
      final MatchResultImpl matchResult = context.getResult();
      final MatchResultImpl substitution = matchResult.getChild(name);

      if (substitution == null) {
        matchResult.addChild(createMatch(match, start, end) );
      } else if (maxOccurs > 1 || target && !myRepeatedVar) {
        final MatchResultImpl result = createMatch(match, start, end);
  
        if (!substitution.isMultipleMatch()) {
          // adding intermediate node to contain all multiple matches
          final MatchResultImpl sonresult = new MatchResultImpl(
            substitution.getName(),
            substitution.getMatchImage(),
            substitution.getMatchRef(),
            substitution.getStart(),
            substitution.getEnd(),
            target
          );

          substitution.setMatch(match);
          substitution.setMultipleMatch(true);

          if (substitution.isScopeMatch()) {
            substitution.setScopeMatch(false);
            sonresult.setScopeMatch(true);
            for (MatchResult r : substitution.getChildren()) {
              sonresult.addChild(r);
            }
            substitution.removeChildren();
          }

          substitution.addChild(sonresult);
        } 
  
        substitution.addChild(result);
      }
    }
  }
public void addResult(@NotNull PsiElement match, int start, int end, @NotNull MatchContext context)