private synchronized TextRange @NotNull [] getInjectionRanges(final XmlAttribute attribute, XsltChecker.LanguageLevel languageLevel) {
      final TextRange[] cachedFiles = getCachedRanges(attribute);
      if (cachedFiles != null) {
        return cachedFiles;
      }

      final String value = attribute.getDisplayValue();
      if (value == null) return TextRange.EMPTY_ARRAY;

      final TextRange[] ranges;
      if (XsltSupport.mayBeAVT(attribute)) {
        final List<TextRange> avtRanges = new SmartList<>();

        int i;
        int j = 0;
        Lexer lexer = null;
        while ((i = XsltSupport.getAVTOffset(value, j)) != -1) {
          if (lexer == null) {
            lexer = LanguageParserDefinitions.INSTANCE.forLanguage(languageLevel.getXPathVersion().getLanguage())
              .createLexer(attribute.getProject());
          }

          // "A right curly brace inside a Literal in an expression is not recognized as terminating the expression."
          lexer.start(value, i, value.length());
          j = -1;
          while (lexer.getTokenType() != null) {
            if (lexer.getTokenType() == XPathTokenTypes.RBRACE) {
              j = lexer.getTokenStart();
              break;
            }
            lexer.advance();
          }

          if (j != -1) {
            avtRanges.add(AVTRange.create(attribute, i, j + 1, j > i + 1));
          }
          else {
            // missing '}' error will be flagged by xpath parser
            avtRanges.add(AVTRange.create(attribute, i, value.length(), false));
            break;
          }
        }

        ranges = avtRanges.isEmpty() ? TextRange.EMPTY_ARRAY : avtRanges.toArray(TextRange.EMPTY_ARRAY);
      }
      else {
        ranges = new TextRange[]{ attribute.getValueTextRange() };
      }

      attribute.putUserData(CACHED_FILES, Pair.create(attribute.getValue(), ranges));

      return ranges;
    }
private synchronized TextRange @NotNull [] getInjectionRanges(final XmlAttribute attribute, XsltChecker.LanguageLevel languageLevel)