类com.intellij.psi.tree.ILazyParseableElementType源码实例Demo

下面列出了怎么用com.intellij.psi.tree.ILazyParseableElementType的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: reasonml-idea-plugin   文件: OclParser.java
public static ASTNode parseOcamlNode(@NotNull ILazyParseableElementType root, @NotNull ASTNode chameleon) {
    PsiElement parentElement = chameleon.getTreeParent().getPsi();
    Project project = parentElement.getProject();

    PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, new OclLexer(), root.getLanguage(), chameleon.getText());
    //builder.setDebugMode(true);
    OclParser parser = new OclParser();

    return parser.parse(root, builder).getFirstChildNode();
}
 
源代码2 项目: BashSupport   文件: BashBlock.java
/**
 * @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));
}
 
@Override
public StubBuilder getBuilder()
{
	return new DefaultStubBuilder()
	{
		@Nonnull
		@Override
		protected StubElement createStubForFile(@Nonnull PsiFile file)
		{
			if(file instanceof CSharpFileImpl)
			{
				return new CSharpFileStub((CSharpFileImpl) file);
			}
			return super.createStubForFile(file);
		}

		@Override
		public boolean skipChildProcessingWhenBuildingStubs(@Nonnull ASTNode parent, @Nonnull ASTNode node)
		{
			// skip any lazy parseable elements, like preprocessors or code blocks etc
			if(node.getElementType() instanceof ILazyParseableElementType)
			{
				return true;
			}
			return false;
		}
	};
}
 
源代码4 项目: consulo-csharp   文件: CSharpDocParsing.java
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);
}
 
源代码5 项目: consulo   文件: BraceHighlightingHandler.java
@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();
}
 
源代码6 项目: consulo   文件: ParseUtilBase.java
@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));
  }
}
 
源代码7 项目: intellij-haxe   文件: HaxeAstFactory.java
@Nullable
@Override
public LazyParseableElement createLazy(ILazyParseableElementType type, CharSequence text) {
  return super.createLazy(type, text);
}
 
源代码8 项目: consulo   文件: ASTLazyFactory.java
@Nonnull
LazyParseableElement createLazy(@Nonnull ILazyParseableElementType type, @Nullable CharSequence text);
 
源代码9 项目: consulo   文件: ASTFactory.java
@Nonnull
public static LazyParseableElement lazy(@Nonnull final ILazyParseableElementType type, final CharSequence text) {
  return ASTLazyFactory.EP.getValue(type).createLazy(type, text);
}
 
 类所在包
 同包方法