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


Java JSTokenTypes.VAR_KEYWORD属性代码示例

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


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

示例1: visitForInStatement

@Override
public void visitForInStatement(final ASTNode node)
{
	if(type1 == JSTokenTypes.VAR_KEYWORD || type2 == JSTokenTypes.VAR_KEYWORD)
	{
		setSingleSpace(true);
	}
	else if(type1 == JSTokenTypes.FOR_KEYWORD && type2 == JSTokenTypes.LPAR)
	{
		setSingleSpace(mySettings.SPACE_BEFORE_FOR_PARENTHESES);
	}
	else if(type1 == JSTokenTypes.RPAR && type2 == JSElementTypes.BLOCK_STATEMENT)
	{
		TextRange dependentRange = new TextRange(myParent.getStartOffset(), myChild1.getTextRange().getEndOffset());
		setBraceSpace(mySettings.SPACE_BEFORE_FOR_LBRACE, mySettings.BRACE_STYLE, dependentRange);
	}
	else if(type1 == JSTokenTypes.LPAR || type2 == JSTokenTypes.RPAR)
	{
		setSingleSpace(mySettings.SPACE_WITHIN_FOR_PARENTHESES);
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:21,代码来源:JSSpacingProcessor.java

示例2: visitVarStatement

@Override
public void visitVarStatement(final ASTNode node)
{
	if(type1 == JSTokenTypes.VAR_KEYWORD)
	{
		setSingleSpace(true);
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:8,代码来源:JSSpacingProcessor.java

示例3: parseSourceElement

@Override
public void parseSourceElement(PsiBuilder builder)
{
	final IElementType tokenType = builder.getTokenType();
	if(tokenType == JSTokenTypes.FUNCTION_KEYWORD)
	{
		getFunctionParsing().parseFunctionDeclaration(builder);
	}
	else if(tokenType == JSTokenTypes.EXPORT_KEYWORD)
	{
		PsiBuilder.Marker mark = builder.mark();
		PsiBuilder.Marker attributeMark = builder.mark();
		builder.advanceLexer();
		attributeMark.done(JSElementTypes.ATTRIBUTE_LIST);

		IElementType nextType = builder.getTokenType();
		if(nextType == JSTokenTypes.FUNCTION_KEYWORD)
		{
			getFunctionParsing().parseFunctionNoMarker(builder, false, mark);
		}
		else if(nextType == JSTokenTypes.VAR_KEYWORD ||
				nextType == JSTokenTypes.CONST_KEYWORD ||
				nextType == JSTokenTypes.LET_KEYWORD)
		{
			parseVarStatementNoMarker(builder, false, mark);
		}
		else
		{
			mark.error("Expected function or variable");
		}
	}
	else
	{
		doParseStatement(builder, true);
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:36,代码来源:EcmaScript6StatementParsing.java

示例4: parseForLoopHeader

boolean parseForLoopHeader(final PsiBuilder builder)
{
	builder.advanceLexer();
	if(builder.getTokenType() == JSTokenTypes.EACH_KEYWORD)
	{
		builder.advanceLexer();
	}

	Parsing.checkMatches(builder, JSTokenTypes.LPAR, JavaScriptBundle.message("javascript.parser.message.expected.lparen"));
	final boolean empty;
	if(builder.getTokenType() == JSTokenTypes.VAR_KEYWORD || builder.getTokenType() == JSTokenTypes.LET_KEYWORD)
	{
		parseVarStatement(builder, true);
		empty = false;
	}
	else
	{
		empty = !getExpressionParsing().parseExpressionOptional(builder, false);
	}

	boolean forin = false;
	if(builder.getTokenType() == JSTokenTypes.SEMICOLON)
	{
		builder.advanceLexer();
		getExpressionParsing().parseExpressionOptional(builder);

		if(builder.getTokenType() == JSTokenTypes.SEMICOLON)
		{
			builder.advanceLexer();
		}
		else
		{
			builder.error(JavaScriptBundle.message("javascript.parser.message.expected.semicolon"));
		}
		getExpressionParsing().parseExpressionOptional(builder);
	}
	else if(builder.getTokenType() == JSTokenTypes.IN_KEYWORD)
	{
		forin = true;
		if(empty)
		{
			builder.error(JavaScriptBundle.message("javascript.parser.message.expected.forloop.left.hand.side.expression.or.variable.declaration"));
		}
		builder.advanceLexer();
		getExpressionParsing().parseExpression(builder);
	}
	else
	{
		builder.error(JavaScriptBundle.message("javascript.parser.message.expected.forloop.in.or.semicolon"));
	}

	Parsing.checkMatches(builder, JSTokenTypes.RPAR, JavaScriptBundle.message("javascript.parser.message.expected.rparen"));
	return forin;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:54,代码来源:StatementParsing.java

示例5: evaluateTypeFromVariable

private static String evaluateTypeFromVariable(final JSVariable variable)
{
	PsiElement prevSibling = variable.getFirstChild();
	if(prevSibling != null && prevSibling.getNode().getElementType() == JSTokenTypes.IDENTIFIER)
	{
		prevSibling = variable.getPrevSibling();
	}

	if(prevSibling instanceof PsiWhiteSpace)
	{
		prevSibling = prevSibling.getPrevSibling();
	}

	if(prevSibling instanceof PsiComment && prevSibling.getNode().getElementType() != JSTokenTypes.END_OF_LINE_COMMENT)
	{
		String parameterCommentText = prevSibling.getText();
		parameterCommentText = unwrapCommentDelimiters(parameterCommentText).trim();

		if(parameterCommentText.length() > 0 && (Character.isUpperCase(parameterCommentText.charAt(0)) || parameterCommentText.indexOf(' ') == -1))
		{
			return parameterCommentText;
		}
	}

	if(prevSibling != null && prevSibling.getNode() != null && prevSibling.getNode().getElementType() == JSTokenTypes.VAR_KEYWORD)
	{
		prevSibling = variable.getParent().getPrevSibling();

		if(prevSibling instanceof PsiWhiteSpace)
		{
			prevSibling = prevSibling.getPrevSibling();
		}

		if(prevSibling instanceof PsiComment)
		{
			return findTypeFromParameter(variable, prevSibling);
		}

	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:41,代码来源:JSDocumentationUtils.java


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