本文整理汇总了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);
}
示例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);
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例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;
}
示例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);
}
示例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();
}