本文整理汇总了Java中com.intellij.psi.tree.ILazyParseableElementType类的典型用法代码示例。如果您正苦于以下问题:Java ILazyParseableElementType类的具体用法?Java ILazyParseableElementType怎么用?Java ILazyParseableElementType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ILazyParseableElementType类属于com.intellij.psi.tree包,在下文中一共展示了ILazyParseableElementType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLazy
import com.intellij.psi.tree.ILazyParseableElementType; //导入依赖的package包/类
@Override
public LazyParseableElement createLazy(ILazyParseableElementType type, CharSequence text) {
if (type == XML_FILE) {
return new XmlFileElement(type, text);
}
else if (type == DTD_FILE) {
return new XmlFileElement(type, text);
}
else if (type == XHTML_FILE) {
return new XmlFileElement(type, text);
}
else if (type == HTML_FILE) {
return new HtmlFileElement(text);
}
else if (type instanceof ITemplateDataElementType) {
return new XmlFileElement(type, text);
}
return null;
}
示例2: createLazy
import com.intellij.psi.tree.ILazyParseableElementType; //导入依赖的package包/类
@NotNull
@Override
public LazyParseableElement createLazy(ILazyParseableElementType type, CharSequence text) {
if (type == XML_FILE) {
return new XmlFileElement(type, text);
}
else if (type == DTD_FILE) {
return new XmlFileElement(type, text);
}
else if (type == XHTML_FILE) {
return new XmlFileElement(type, text);
}
else if (type == HTML_FILE) {
return new HtmlFileElement(text);
}
else if (type instanceof TemplateDataElementType) {
return new XmlFileElement(type, text);
}
return null;
}
示例3: isIncomplete
import com.intellij.psi.tree.ILazyParseableElementType; //导入依赖的package包/类
/**
* @param node Tree node
* @return true if node is incomplete
*/
public boolean isIncomplete(@NotNull final ASTNode node) {
if (node.getElementType() instanceof ILazyParseableElementType) return false;
ASTNode lastChild = node.getLastChildNode();
while (lastChild != null &&
!(lastChild.getElementType() instanceof ILazyParseableElementType) &&
(lastChild.getPsi() instanceof PsiWhiteSpace || lastChild.getPsi() instanceof PsiComment)) {
lastChild = lastChild.getTreePrev();
}
return lastChild != null && (lastChild.getPsi() instanceof PsiErrorElement || isIncomplete(lastChild));
}
示例4: parseTagContent
import com.intellij.psi.tree.ILazyParseableElementType; //导入依赖的package包/类
public void parseTagContent() {
PsiBuilder.Marker xmlText = null;
while (token() != XML_END_TAG_START && !eof()) {
final IElementType tt = token();
if (tt == XML_START_TAG_START) {
xmlText = terminateText(xmlText);
parseTag(false);
}
else if (tt == XML_ENTITY_REF_TOKEN) {
xmlText = terminateText(xmlText);
parseReference();
}
else if (tt == XML_CHAR_ENTITY_REF) {
xmlText = startText(xmlText);
parseReference();
}
else if (isCommentToken(tt)) {
xmlText = terminateText(xmlText);
parseComment();
}
else if (tt == XML_BAD_CHARACTER) {
xmlText = startText(xmlText);
final PsiBuilder.Marker error = mark();
advance();
error.error(XmlErrorMessages.message("unescaped.ampersand.or.nonterminated.character.entity.reference"));
}
else if (tt instanceof CustomParsingType || tt instanceof ILazyParseableElementType) {
xmlText = terminateText(xmlText);
advance();
}
else {
xmlText = startText(xmlText);
advance();
}
}
terminateText(xmlText);
}
示例5: lazy
import com.intellij.psi.tree.ILazyParseableElementType; //导入依赖的package包/类
@NotNull
public static LazyParseableElement lazy(@NotNull final ILazyParseableElementType type, CharSequence text) {
final ASTNode node = type.createNode(text);
if (node != null) return (LazyParseableElement)node;
if (type == TokenType.CODE_FRAGMENT) {
return new CodeFragmentElement(null);
}
else if (type == TokenType.DUMMY_HOLDER) {
return new DummyHolderElement(text);
}
final LazyParseableElement customLazy = factory(type).createLazy(type, text);
return customLazy != null ? customLazy : DefaultFactoryHolder.DEFAULT.createLazy(type, text);
}
示例6: createLazy
import com.intellij.psi.tree.ILazyParseableElementType; //导入依赖的package包/类
@Override
@NotNull
public LazyParseableElement createLazy(final ILazyParseableElementType type, final CharSequence text) {
if (type instanceof IFileElementType) {
return new FileElement(type, text);
}
return new LazyParseableElement(type, text);
}
示例7: createTokenElement
import com.intellij.psi.tree.ILazyParseableElementType; //导入依赖的package包/类
@Nullable
public static TreeElement createTokenElement(Lexer lexer, CharTable table) {
IElementType tokenType = lexer.getTokenType();
if (tokenType == null) {
return null;
}
else if (tokenType instanceof ILazyParseableElementType) {
return ASTFactory.lazy((ILazyParseableElementType)tokenType, LexerUtil.internToken(lexer, table));
}
else {
return ASTFactory.leaf(tokenType, LexerUtil.internToken(lexer, table));
}
}
示例8: isIncomplete
import com.intellij.psi.tree.ILazyParseableElementType; //导入依赖的package包/类
/**
* @param node Tree node
* @return true if node is incomplete
*/
public static boolean isIncomplete(@NotNull final ASTNode node) {
if (node.getElementType() instanceof ILazyParseableElementType) return false;
ASTNode lastChild = node.getLastChildNode();
while (lastChild != null &&
!(lastChild.getElementType() instanceof ILazyParseableElementType) &&
(lastChild.getPsi() instanceof PsiWhiteSpace || lastChild.getPsi() instanceof PsiComment)) {
lastChild = lastChild.getTreePrev();
}
return lastChild != null && (lastChild.getPsi() instanceof PsiErrorElement || isIncomplete(lastChild));
}
示例9: ensureParsed
import com.intellij.psi.tree.ILazyParseableElementType; //导入依赖的package包/类
private void ensureParsed() {
if (!ourParsingAllowed) {
LOG.error("Parsing not allowed!!!");
}
CharSequence text = myText();
if (text == null) return;
if (TreeUtil.getFileElement(this) == null) {
LOG.error("Chameleons must not be parsed till they're in file tree: " + this);
}
ApplicationManager.getApplication().assertReadAccessAllowed();
ILazyParseableElementType type = (ILazyParseableElementType)getElementType();
ASTNode parsedNode = type.parseContents(this);
if (parsedNode == null && text.length() > 0) {
CharSequence diagText = ApplicationManager.getApplication().isInternal() ? text : "";
LOG.error("No parse for a non-empty string: " + diagText + "; type=" + LogUtil.objectAndClass(type));
}
synchronized (lock) {
if (myText == null) return;
if (rawFirstChild() != null) {
LOG.error("Reentrant parsing?");
}
myText = null;
if (parsedNode == null) return;
super.rawAddChildrenWithoutNotifications((TreeElement)parsedNode);
}
// create PSI all at once, to reduce contention of PsiLock in CompositeElement.getPsi()
// create PSI outside the 'lock' since this method grabs PSI_LOCK and deadlock is possible when someone else locks in the other order.
createAllChildrenPsiIfNecessary();
}
示例10: parseTagContent
import com.intellij.psi.tree.ILazyParseableElementType; //导入依赖的package包/类
public void parseTagContent()
{
PsiBuilder.Marker xmlText = null;
while(token() != CSharpDocTokenType.XML_END_TAG_START && !eof())
{
final IElementType tt = token();
if(tt == CSharpDocTokenType.XML_START_TAG_START)
{
xmlText = terminateText(xmlText);
parseTag();
}
else if(isCommentToken(tt))
{
xmlText = terminateText(xmlText);
parseComment();
}
else if(tt instanceof CustomParsingType || tt instanceof ILazyParseableElementType)
{
xmlText = terminateText(xmlText);
advance();
}
else
{
xmlText = startText(xmlText);
advance();
}
}
terminateText(xmlText);
}
示例11: getLazyParsableHighlighterIfAny
import com.intellij.psi.tree.ILazyParseableElementType; //导入依赖的package包/类
@Nonnull
static EditorHighlighter getLazyParsableHighlighterIfAny(Project project, Editor editor, PsiFile psiFile) {
if (!PsiDocumentManager.getInstance(project).isCommitted(editor.getDocument())) {
return ((EditorEx)editor).getHighlighter();
}
PsiElement elementAt = psiFile.findElementAt(editor.getCaretModel().getOffset());
for (PsiElement e : SyntaxTraverser.psiApi().parents(elementAt).takeWhile(Conditions.notEqualTo(psiFile))) {
if (!(PsiUtilCore.getElementType(e) instanceof ILazyParseableElementType)) continue;
Language language = ILazyParseableElementType.LANGUAGE_KEY.get(e.getNode());
if (language == null) continue;
TextRange range = e.getTextRange();
final int offset = range.getStartOffset();
SyntaxHighlighter syntaxHighlighter =
SyntaxHighlighterFactory.getSyntaxHighlighter(language, project, psiFile.getVirtualFile());
LexerEditorHighlighter highlighter = new LexerEditorHighlighter(syntaxHighlighter, editor.getColorsScheme()) {
@Nonnull
@Override
public HighlighterIterator createIterator(int startOffset) {
return new HighlighterIteratorWrapper(super.createIterator(Math.max(startOffset - offset, 0))) {
@Override
public int getStart() {
return super.getStart() + offset;
}
@Override
public int getEnd() {
return super.getEnd() + offset;
}
};
}
};
highlighter.setText(editor.getDocument().getText(range));
return highlighter;
}
return ((EditorEx)editor).getHighlighter();
}
示例12: createLazy
import com.intellij.psi.tree.ILazyParseableElementType; //导入依赖的package包/类
@Nullable
public LazyParseableElement createLazy(final ILazyParseableElementType type, final CharSequence text) {
return null;
}
示例13: ensureParsed
import com.intellij.psi.tree.ILazyParseableElementType; //导入依赖的package包/类
private void ensureParsed() {
if (!ourParsingAllowed) {
LOG.error("Parsing not allowed!!!");
}
CharSequence text = myText();
if (text == null) return;
if (TreeUtil.getFileElement(this) == null) {
LOG.error("Chameleons must not be parsed till they're in file tree: " + this);
}
ApplicationManager.getApplication().assertReadAccessAllowed();
DebugUtil.startPsiModification("lazy-parsing");
try {
ILazyParseableElementType type = (ILazyParseableElementType)getElementType();
ASTNode parsedNode = type.parseContents(this);
if (parsedNode == null && text.length() > 0) {
CharSequence diagText = ApplicationManager.getApplication().isInternal() ? text : "";
LOG.error("No parse for a non-empty string: " + diagText + "; type=" + LogUtil.objectAndClass(type));
}
synchronized (lock) {
if (myText == null) return;
if (rawFirstChild() != null) {
LOG.error("Reentrant parsing?");
}
myText = null;
if (parsedNode == null) return;
super.rawAddChildrenWithoutNotifications((TreeElement)parsedNode);
}
}
finally {
DebugUtil.finishPsiModification();
}
if (!Boolean.TRUE.equals(ourSuppressEagerPsiCreation.get())) {
// create PSI all at once, to reduce contention of PsiLock in CompositeElement.getPsi()
// create PSI outside the 'lock' since this method grabs PSI_LOCK and deadlock is possible when someone else locks in the other order.
createAllChildrenPsiIfNecessary();
}
}
示例14: parseTagContent
import com.intellij.psi.tree.ILazyParseableElementType; //导入依赖的package包/类
public void parseTagContent() {
PsiBuilder.Marker xmlText = null;
while (token() != XML_END_TAG_START && !eof()) {
final IElementType tt = token();
if (tt == XML_START_TAG_START) {
xmlText = terminateText(xmlText);
parseTag(false);
}
else if (tt == XML_PI_START) {
xmlText = terminateText(xmlText);
parseProcessingInstruction();
}
else if (tt == XML_ENTITY_REF_TOKEN) {
xmlText = terminateText(xmlText);
parseReference();
}
else if (tt == XML_CHAR_ENTITY_REF) {
xmlText = startText(xmlText);
parseReference();
}
else if (tt == XML_CDATA_START) {
xmlText = startText(xmlText);
parseCData();
}
else if (isCommentToken(tt)) {
xmlText = terminateText(xmlText);
parseComment();
}
else if (tt == XML_BAD_CHARACTER) {
xmlText = startText(xmlText);
final PsiBuilder.Marker error = mark();
advance();
error.error(XmlErrorMessages.message("unescaped.ampersand.or.nonterminated.character.entity.reference"));
}
else if (tt instanceof CustomParsingType || tt instanceof ILazyParseableElementType) {
xmlText = terminateText(xmlText);
advance();
}
else {
xmlText = startText(xmlText);
advance();
}
}
terminateText(xmlText);
}
示例15: setContentElementType
import com.intellij.psi.tree.ILazyParseableElementType; //导入依赖的package包/类
public void setContentElementType(final IElementType contentElementType) {
LOG.assertTrue(contentElementType instanceof ILazyParseableElementType, contentElementType);
myContentElementType = contentElementType;
}