本文整理汇总了Java中com.intellij.lang.javascript.JSTokenTypes.IF_KEYWORD属性的典型用法代码示例。如果您正苦于以下问题:Java JSTokenTypes.IF_KEYWORD属性的具体用法?Java JSTokenTypes.IF_KEYWORD怎么用?Java JSTokenTypes.IF_KEYWORD使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.lang.javascript.JSTokenTypes
的用法示例。
在下文中一共展示了JSTokenTypes.IF_KEYWORD属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitIfStatement
@Override
public void visitIfStatement(final ASTNode node)
{
if(type1 == JSTokenTypes.IF_KEYWORD && type2 == JSTokenTypes.LPAR)
{
setSingleSpace(mySettings.SPACE_BEFORE_IF_PARENTHESES);
}
else if(type1 == JSTokenTypes.LPAR || type2 == JSTokenTypes.RPAR)
{
setSingleSpace(mySettings.SPACE_WITHIN_IF_PARENTHESES);
}
else if(type1 == JSTokenTypes.RPAR && type2 == JSElementTypes.BLOCK_STATEMENT)
{
TextRange dependentRange = new TextRange(myParent.getStartOffset(), myChild1.getTextRange().getEndOffset());
setBraceSpace(mySettings.SPACE_BEFORE_IF_LBRACE, mySettings.BRACE_STYLE, dependentRange);
}
else if(type2 == JSTokenTypes.ELSE_KEYWORD)
{
setLineBreakSpace(mySettings.ELSE_ON_NEW_LINE);
}
else if(type1 == JSTokenTypes.ELSE_KEYWORD && type2 == JSElementTypes.BLOCK_STATEMENT)
{
setBraceSpace(mySettings.SPACE_BEFORE_ELSE_LBRACE, mySettings.BRACE_STYLE, null);
}
}
示例2: parseCatchBlock
private void parseCatchBlock(final PsiBuilder builder)
{
StatementParsing.LOGGER.assertTrue(builder.getTokenType() == JSTokenTypes.CATCH_KEYWORD);
final PsiBuilder.Marker block = builder.mark();
builder.advanceLexer();
Parsing.checkMatches(builder, JSTokenTypes.LPAR, JavaScriptBundle.message("javascript.parser.message.expected.lparen"));
final IElementType identifierType = builder.getTokenType();
if(JSTokenTypes.IDENTIFIER_TOKENS_SET.contains(identifierType))
{
final PsiBuilder.Marker param = builder.mark();
builder.advanceLexer();
if(!getExpressionParsing().tryParseType(builder))
{
if(builder.getTokenType() == JSTokenTypes.IF_KEYWORD)
{
builder.advanceLexer();
Parsing.checkMatches(builder, identifierType, JavaScriptBundle.message("javascript.parser.message.expected.identifier"));
Parsing.checkMatches(builder, JSTokenTypes.INSTANCEOF_KEYWORD, JavaScriptBundle.message("javascript.parser.message.expected.instanceof"));
Parsing.checkMatches(builder, JSTokenTypes.IDENTIFIER, JavaScriptBundle.message("javascript.parser.message.expected.identifier"));
}
}
param.done(JSElementTypes.FORMAL_PARAMETER);
}
else
{
builder.error(JavaScriptBundle.message("javascript.parser.message.expected.parameter.name"));
}
Parsing.checkMatches(builder, JSTokenTypes.RPAR, JavaScriptBundle.message("javascript.parser.message.expected.rparen"));
parseBlock(builder);
block.done(JSElementTypes.CATCH_BLOCK);
}