mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
less garbage during indexing (-30M for IDEA project), just in case each TokenSet is 5K each
This commit is contained in:
@@ -17,12 +17,14 @@ package com.intellij.lexer;
|
||||
|
||||
import com.intellij.psi.JavaDocTokenType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class JavaDocTokenTypes implements DocCommentTokenTypes {
|
||||
public static final DocCommentTokenTypes INSTANCE = new JavaDocTokenTypes();
|
||||
private final TokenSet mySpaceCommentsSet = TokenSet.create(JavaDocTokenType.DOC_SPACE, JavaDocTokenType.DOC_COMMENT_DATA);
|
||||
|
||||
private JavaDocTokenTypes() { }
|
||||
|
||||
@@ -41,6 +43,11 @@ public class JavaDocTokenTypes implements DocCommentTokenTypes {
|
||||
return JavaDocTokenType.DOC_COMMENT_DATA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TokenSet spaceCommentsTokenSet() {
|
||||
return mySpaceCommentsSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IElementType space() {
|
||||
return JavaDocTokenType.DOC_SPACE;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package com.intellij.lexer;
|
||||
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -24,7 +23,7 @@ import java.io.IOException;
|
||||
public class DocCommentLexer extends MergingLexerAdapter {
|
||||
public DocCommentLexer(final DocCommentTokenTypes tokenTypes, final boolean isJdk15Enabled) {
|
||||
super(new AsteriskStripperLexer(new _JavaDocLexer(isJdk15Enabled, tokenTypes), tokenTypes),
|
||||
TokenSet.create(tokenTypes.commentData(), tokenTypes.space()));
|
||||
tokenTypes.spaceCommentsTokenSet());
|
||||
}
|
||||
|
||||
private static class AsteriskStripperLexer extends LexerBase {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.intellij.lexer;
|
||||
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
|
||||
/**
|
||||
* Allows to specify a set of language-dependent token types for the doc comment lexer.
|
||||
@@ -27,6 +28,7 @@ public interface DocCommentTokenTypes {
|
||||
IElementType commentStart();
|
||||
IElementType commentEnd();
|
||||
IElementType commentData();
|
||||
TokenSet spaceCommentsTokenSet();
|
||||
IElementType space();
|
||||
IElementType tagValueToken();
|
||||
IElementType tagValueLParen();
|
||||
|
||||
Reference in New Issue
Block a user