TextRange (@NotNull String text) { LOG.assertTrue(isStringLiteralToken(text), "Text of a single string literal node expected"); int startOffset = getPrefixLength(text); int delimiterLength = 1; final String afterPrefix = text.substring(startOffset); if (afterPrefix.startsWith("\"\"\"") || afterPrefix.startsWith("'''")) { delimiterLength = 3; } final String delimiter = text.substring(startOffset, startOffset + delimiterLength); startOffset += delimiterLength; int endOffset = text.length(); if (text.substring(startOffset).endsWith(delimiter)) { endOffset -= delimiterLength; } return new TextRange(startOffset, endOffset); }