当前位置: 首页>>代码示例>>Java>>正文


Java PsiBuilderUtil类代码示例

本文整理汇总了Java中com.intellij.lang.PsiBuilderUtil的典型用法代码示例。如果您正苦于以下问题:Java PsiBuilderUtil类的具体用法?Java PsiBuilderUtil怎么用?Java PsiBuilderUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PsiBuilderUtil类属于com.intellij.lang包,在下文中一共展示了PsiBuilderUtil类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: advanceGtToken

import com.intellij.lang.PsiBuilderUtil; //导入依赖的package包/类
private static void advanceGtToken(final PsiBuilder builder, final IElementType type) {
  final PsiBuilder.Marker gtToken = builder.mark();

  if (type == JavaTokenType.GTGTGTEQ) {
    PsiBuilderUtil.advance(builder, 4);
  }
  else if (type == JavaTokenType.GTGTGT || type == JavaTokenType.GTGTEQ) {
    PsiBuilderUtil.advance(builder, 3);
  }
  else if (type == JavaTokenType.GTGT || type == JavaTokenType.GE) {
    PsiBuilderUtil.advance(builder, 2);
  }
  else {
    gtToken.drop();
    builder.advanceLexer();
    return;
  }

  gtToken.collapse(type);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ExpressionParser.java

示例2: parseSimpleTag

import com.intellij.lang.PsiBuilderUtil; //导入依赖的package包/类
private void parseSimpleTag(PsiBuilder builder, IElementType endElementType, IElementType to)
{
	PsiBuilder.Marker mark = builder.mark();

	builder.advanceLexer();

	while(!builder.eof() && builder.getTokenType() != endElementType)
	{
		builder.advanceLexer();
	}

	if(!PsiBuilderUtil.expect(builder, endElementType))
	{
		builder.error("%> expected");
	}
	mark.done(to);
}
 
开发者ID:consulo,项目名称:consulo-javaee,代码行数:18,代码来源:JspParser.java

示例3: expectWithError

import com.intellij.lang.PsiBuilderUtil; //导入依赖的package包/类
public static boolean expectWithError(PsiBuilder builder, IElementType elementType, @NotNull String message)
{
	if(PsiBuilderUtil.expect(builder, elementType))
	{
		return true;
	}
	else
	{
		builder.error(message);
		return false;
	}
}
 
开发者ID:consulo,项目名称:consulo-unity3d,代码行数:13,代码来源:ShaderLabParser.java

示例4: expect

import com.intellij.lang.PsiBuilderUtil; //导入依赖的package包/类
private static boolean expect(PsiBuilder builder, TokenSet tokenSet, String text)
{
	if(!PsiBuilderUtil.expect(builder, tokenSet))
	{
		if(text != null)
		{
			builder.error(text);
		}
		return false;
	}
	else
	{
		return true;
	}
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:16,代码来源:MsilParser.java

示例5: expectOrError

import com.intellij.lang.PsiBuilderUtil; //导入依赖的package包/类
public static boolean expectOrError(PsiBuilder builder, TokenSet expected, @PropertyKey(resourceBundle = JavaErrorMessages.BUNDLE) String key)
{
	if(!PsiBuilderUtil.expect(builder, expected))
	{
		error(builder, JavaErrorMessages.message(key));
		return false;
	}
	return true;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:10,代码来源:JavaParserUtil.java

示例6: parseAndDone

import com.intellij.lang.PsiBuilderUtil; //导入依赖的package包/类
@Override
public PsiBuilder.Marker parseAndDone(ShaderLabParserBuilder builder, @NotNull PsiBuilder.Marker mark)
{
	parseBefore(builder);

	if(PsiBuilderUtil.expect(builder, ShaderLabTokens.LBRACE))
	{
		//TODO [VISTALL] hack until full syntax parse
		int count = 0;
		loop:
		while(!builder.eof())
		{
			for(ShaderLabRole role : myRoles)
			{
				if(role.tryParse(builder))
				{
					continue loop;
				}
			}

			IElementType tokenType = builder.getTokenType();
			if(tokenType == ShaderLabTokens.LBRACE)
			{
				count++;
			}

			if(tokenType == ShaderLabTokens.RBRACE)
			{
				if(count == 0)
				{
					break;
				}

				count--;
			}

			if(tokenType == ShaderLabTokens.CGINCLUDE_KEYWORD || tokenType == ShaderLabTokens.CGPROGRAM_KEYWORD)
			{
				PsiBuilder.Marker marker = builder.mark();
				builder.advanceLexer();
				if(builder.getTokenType() == ShaderLabTokens.SHADERSCRIPT)
				{
					builder.advanceLexer();
				}
				ShaderLabParser.expectWithError(builder, ShaderLabTokens.ENDCG_KEYWORD, "Expected 'ENDCG'");
				marker.done(ShaderLabElements.CG_SHADER);
			}
			else
			{
				builder.advanceLexer();
			}
		}

		if(!PsiBuilderUtil.expect(builder, ShaderLabTokens.RBRACE))
		{
			builder.error("'}' expected");
		}
	}
	else
	{
		builder.error("'{' expected");
	}
	mark.done(myDoneElement);
	return mark;
}
 
开发者ID:consulo,项目名称:consulo-unity3d,代码行数:66,代码来源:ShaderLabCompositeRole.java

示例7: parseDirective

import com.intellij.lang.PsiBuilderUtil; //导入依赖的package包/类
private void parseDirective(PsiBuilder builder)
{
	PsiBuilder.Marker mark = builder.mark();

	builder.advanceLexer();

	if(!PsiBuilderUtil.expect(builder, XmlTokenType.XML_TAG_NAME))
	{
		builder.error("Identifier expected");
	}
	else
	{
		while(true)
		{
			if(builder.getTokenType() == XmlTokenType.XML_NAME)
			{
				PsiBuilder.Marker attMark = builder.mark();
				builder.advanceLexer();

				if(PsiBuilderUtil.expect(builder, XmlTokenType.XML_EQ))
				{
					PsiBuilder.Marker attributeValueMarker = builder.mark();
					if(PsiBuilderUtil.expect(builder, XmlTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER))
					{
						PsiBuilderUtil.expect(builder, XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN);

						if(!PsiBuilderUtil.expect(builder, XmlTokenType.XML_ATTRIBUTE_VALUE_END_DELIMITER))
						{
							builder.error("Excted attribute value stopper");
						}

						attributeValueMarker.done(XmlElementType.XML_ATTRIBUTE_VALUE);
					}
					else
					{
						attributeValueMarker.error("Expected attribute start");
					}
				}
				else
				{
					builder.error("'=' expected");
				}

				attMark.done(XmlElementType.XML_ATTRIBUTE);
			}
			else if(builder.getTokenType() == XmlTokenType.XML_EMPTY_ELEMENT_END)
			{
				break;
			}
			else
			{
				builder.error("Identifier expected");
				break;
			}
		}
	}

	if(!PsiBuilderUtil.expect(builder, XmlTokenType.XML_EMPTY_ELEMENT_END))
	{
		builder.error("'%>' expected");
	}
	mark.done(JspElements.DIRECTIVE);
}
 
开发者ID:consulo,项目名称:consulo-javaee,代码行数:64,代码来源:JspParser.java

示例8: parse

import com.intellij.lang.PsiBuilderUtil; //导入依赖的package包/类
@NotNull
@Override
public ASTNode parse(@NotNull IElementType elementType, @NotNull PsiBuilder builder, @NotNull LanguageVersion languageVersion)
{
	PsiBuilder.Marker mark = builder.mark();
	while(!builder.eof())
	{
		if(builder.getTokenType() == CfsTokens.START)
		{
			PsiBuilder.Marker itemMark = builder.mark();
			builder.advanceLexer();

			if(!PsiBuilderUtil.expect(builder, myArgumentElementType))
			{
				builder.error("Argument expected");
			}

			if(builder.getTokenType() == CfsTokens.COMMA)
			{
				builder.advanceLexer();
				if(!PsiBuilderUtil.expect(builder, CfsTokens.ALIGN))
				{
					builder.error("Align expected");
				}
			}

			if(builder.getTokenType() == CfsTokens.COLON)
			{
				builder.advanceLexer();
				if(!PsiBuilderUtil.expect(builder, CfsTokens.FORMAT))
				{
					builder.error("Format expected");
				}
			}

			if(!PsiBuilderUtil.expect(builder, CfsTokens.END))
			{
				builder.error("} expected");
			}
			itemMark.done(CfsElements.ITEM);
		}
		else
		{
			builder.advanceLexer();
		}
	}
	mark.done(elementType);
	return builder.getTreeBuilt();
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:50,代码来源:CfsParser.java


注:本文中的com.intellij.lang.PsiBuilderUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。