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


Java JSTokenTypes.QUEST属性代码示例

本文整理汇总了Java中com.intellij.lang.javascript.JSTokenTypes.QUEST属性的典型用法代码示例。如果您正苦于以下问题:Java JSTokenTypes.QUEST属性的具体用法?Java JSTokenTypes.QUEST怎么用?Java JSTokenTypes.QUEST使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.intellij.lang.javascript.JSTokenTypes的用法示例。


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

示例1: getCondition

@Override
public JSExpression getCondition()
{
	ASTNode child = getNode().getFirstChildNode();
	while(child != null)
	{
		final IElementType type = child.getElementType();
		if(type == JSTokenTypes.QUEST)
		{
			return null;
		}
		if(JSElementTypes.EXPRESSIONS.contains(type))
		{
			return (JSExpression) child.getPsi();
		}
		child = child.getTreeNext();
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:19,代码来源:JSConditionalExpressionImpl.java

示例2: getThen

@Override
public JSExpression getThen()
{
	boolean questPassed = false;
	ASTNode child = getNode().getFirstChildNode();
	while(child != null)
	{
		final IElementType type = child.getElementType();
		if(type == JSTokenTypes.QUEST)
		{
			questPassed = true;
		}
		if(type == JSTokenTypes.COLON)
		{
			return null;
		}
		if(questPassed && JSElementTypes.EXPRESSIONS.contains(type))
		{
			return (JSExpression) child.getPsi();
		}

		child = child.getTreeNext();
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:25,代码来源:JSConditionalExpressionImpl.java

示例3: getElse

@Override
public JSExpression getElse()
{
	boolean questPassed = false;
	boolean colonPassed = false;
	ASTNode child = getNode().getFirstChildNode();
	while(child != null)
	{
		final IElementType type = child.getElementType();
		if(type == JSTokenTypes.QUEST)
		{
			questPassed = true;
		}
		if(type == JSTokenTypes.COLON)
		{
			colonPassed = true;
		}
		if(questPassed && colonPassed && JSElementTypes.EXPRESSIONS.contains(type))
		{
			return (JSExpression) child.getPsi();
		}

		child = child.getTreeNext();
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:26,代码来源:JSConditionalExpressionImpl.java

示例4: visitConditionalExpression

@Override
public void visitConditionalExpression(final ASTNode node)
{
	if(type1 == JSTokenTypes.QUEST)
	{
		setSingleSpace(mySettings.SPACE_AFTER_QUEST);
	}
	else if(type2 == JSTokenTypes.QUEST)
	{
		setSingleSpace(mySettings.SPACE_BEFORE_QUEST);
	}
	else if(type1 == JSTokenTypes.COLON)
	{
		setSingleSpace(mySettings.SPACE_AFTER_COLON);
	}
	else if(type2 == JSTokenTypes.COLON)
	{
		setSingleSpace(mySettings.SPACE_BEFORE_COLON);
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:20,代码来源:JSSpacingProcessor.java

示例5: parseConditionalExpression

private boolean parseConditionalExpression(final PsiBuilder builder, final boolean allowIn)
{
	final PsiBuilder.Marker expr = builder.mark();
	if(!parseORExpression(builder, allowIn))
	{
		expr.drop();
		return false;
	}

	final IElementType nextTokenType = builder.getTokenType();

	if(nextTokenType == JSTokenTypes.QUEST)
	{
		builder.advanceLexer();
		if(!parseAssignmentExpression(builder, allowIn))
		{
			builder.error(JavaScriptBundle.message("javascript.parser.message.expected.expression"));
		}
		Parsing.checkMatches(builder, JSTokenTypes.COLON, JavaScriptBundle.message("javascript.parser.message.expected.colon"));
		if(!parseAssignmentExpression(builder, allowIn))
		{
			builder.error(JavaScriptBundle.message("javascript.parser.message.expected.expression"));
		}
		expr.done(JSElementTypes.CONDITIONAL_EXPRESSION);
	}
	else if(nextTokenType == JSTokenTypes.FOR_KEYWORD && builder.getUserData(WITHIN_ARRAY_LITERAL_EXPRESSION) != null)
	{
		getStatementParsing().parseForLoopHeader(builder);      // TODO: make it more clear
		expr.done(JSElementTypes.CONDITIONAL_EXPRESSION);
	}
	else
	{
		expr.drop();
	}
	return true;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:36,代码来源:ExpressionParsing.java

示例6: getWrap

@Nullable
private Wrap getWrap(final ASTNode node, final ASTNode child)
{
	WrapType wrapType = null;
	if(node.getElementType() == JSElementTypes.ASSIGNMENT_EXPRESSION)
	{
		final JSAssignmentExpression assignment = (JSAssignmentExpression) node.getPsi();
		if(child.getElementType() == assignment.getOperationSign() && mySettings.PLACE_ASSIGNMENT_SIGN_ON_NEXT_LINE || child.getPsi() == assignment
				.getROperand() && !mySettings.PLACE_ASSIGNMENT_SIGN_ON_NEXT_LINE)
		{
			wrapType = WrapType.byLegacyRepresentation(mySettings.ASSIGNMENT_WRAP);
		}
	}
	else if(node.getElementType() == JSElementTypes.BINARY_EXPRESSION)
	{
		final JSBinaryExpression binary = (JSBinaryExpression) node.getPsi();
		if(child.getElementType() == binary.getOperationSign() && mySettings.BINARY_OPERATION_SIGN_ON_NEXT_LINE || child.getPsi() == binary.getROperand()
				&& !mySettings.BINARY_OPERATION_SIGN_ON_NEXT_LINE)
		{
			wrapType = WrapType.byLegacyRepresentation(mySettings.BINARY_OPERATION_WRAP);
		}
	}
	else if(node.getElementType() == JSElementTypes.PARENTHESIZED_EXPRESSION)
	{
		if(child == node.findChildByType(JSTokenTypes.LPAR) && mySettings.PARENTHESES_EXPRESSION_LPAREN_WRAP)
		{
			wrapType = Wrap.NORMAL;
		}
		else if(child == node.findChildByType(JSTokenTypes.RPAR) && mySettings.PARENTHESES_EXPRESSION_RPAREN_WRAP)
		{
			wrapType = Wrap.ALWAYS;
		}
	}
	else if(node.getElementType() == JSElementTypes.ARRAY_LITERAL_EXPRESSION)
	{
		if(child == node.findChildByType(JSTokenTypes.LBRACE) && mySettings.ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE)
		{
			wrapType = Wrap.NORMAL;
		}
		else if(child == node.findChildByType(JSTokenTypes.RPAR) && mySettings.ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE)
		{
			wrapType = Wrap.ALWAYS;
		}
	}
	else if(node.getElementType() == JSElementTypes.CONDITIONAL_EXPRESSION)
	{
		final IElementType elementType = child.getElementType();
		if((mySettings.TERNARY_OPERATION_SIGNS_ON_NEXT_LINE && (elementType == JSTokenTypes.QUEST || elementType == JSTokenTypes.COLON)) || (!mySettings
				.TERNARY_OPERATION_SIGNS_ON_NEXT_LINE && child.getPsi() instanceof JSExpression))
		{
			wrapType = WrapType.byLegacyRepresentation(mySettings.TERNARY_OPERATION_WRAP);
		}
	}
	else if(node.getElementType() == JSElementTypes.CALL_EXPRESSION)
	{
		if(child == node.findChildByType(JSTokenTypes.LPAR) && mySettings.CALL_PARAMETERS_LPAREN_ON_NEXT_LINE)
		{
			wrapType = Wrap.NORMAL;
		}
		else if(child == node.findChildByType(JSTokenTypes.RPAR) && mySettings.CALL_PARAMETERS_RPAREN_ON_NEXT_LINE)
		{
			wrapType = Wrap.ALWAYS;
		}
	}
	else if(node.getElementType() == JSElementTypes.PARAMETER_LIST)
	{
		if(child.getElementType() == JSElementTypes.FORMAL_PARAMETER)
		{
			wrapType = WrapType.byLegacyRepresentation(mySettings.METHOD_PARAMETERS_WRAP);
		}
	}
	else if(node.getElementType() == JSElementTypes.FOR_STATEMENT || node.getElementType() == JSElementTypes.FOR_IN_STATEMENT)
	{
		if(JSElementTypes.EXPRESSIONS.contains(child.getElementType()))
		{
			wrapType = WrapType.byLegacyRepresentation(mySettings.FOR_STATEMENT_WRAP);
		}
	}

	return wrapType == null ? null : Wrap.createWrap(wrapType, false);
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:81,代码来源:SubBlockVisitor.java


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