TokenSequence (@NotNull CharSequence text, @NotNull Lexer lexer) { if (lexer instanceof WrappingLexer) { TokenList existing = ((WrappingLexer)lexer).getTokens(); if (existing instanceof TokenSequence && Comparing.equal(text, ((TokenSequence)existing).myText)) { // prevent clients like PsiBuilder from modifying shared token types return new TokenSequence(((TokenSequence)existing).lexStarts, ((TokenSequence)existing).lexTypes.clone(), ((TokenSequence)existing).lexemeCount, text); } } return new Builder(text, lexer).performLexing(); }