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


Java JSTokenTypes.FUNCTION_KEYWORD属性代码示例

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


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

示例1: parseNewExpression

protected boolean parseNewExpression(PsiBuilder builder)
{
	ExpressionParsing.LOGGER.assertTrue(builder.getTokenType() == JSTokenTypes.NEW_KEYWORD);
	builder.advanceLexer();

	if(builder.getTokenType() == JSTokenTypes.FUNCTION_KEYWORD)
	{
		getFunctionParsing().parseFunctionExpression(builder);
		return true;
	}

	if(!parseMemberExpression(builder, false))
	{
		builder.error(JavaScriptBundle.message("javascript.parser.message.expected.expression"));
	}
	return false;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:17,代码来源:ExpressionParsing.java

示例2: visitFunctionDeclaration

@Override
public void visitFunctionDeclaration(final ASTNode node)
{
	if(type1 == JSTokenTypes.FUNCTION_KEYWORD && type2 == JSElementTypes.REFERENCE_EXPRESSION)
	{
		setSingleSpace(true);
	}
	else if(type1 == JSElementTypes.REFERENCE_EXPRESSION && type2 == JSElementTypes.PARAMETER_LIST)
	{
		setSingleSpace(mySettings.SPACE_BEFORE_METHOD_PARENTHESES);
	}
	else if(type2 == JSElementTypes.BLOCK_STATEMENT)
	{
		setBraceSpace(mySettings.SPACE_BEFORE_METHOD_LBRACE, mySettings.METHOD_BRACE_STYLE, myChild1.getTextRange());
	}
	else if(type1 == JSElementTypes.ATTRIBUTE_LIST && type2 == JSTokenTypes.FUNCTION_KEYWORD)
	{
		setSingleSpace(true);
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:20,代码来源: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.PACKAGE_KEYWORD)
	{
		parsePackage(builder);
	}
	else if(tokenType == JSTokenTypes.AT)
	{
		builder.advanceLexer();
		getFunctionParsing().parseAttributeWithoutBrackets(builder);
	}
	else
	{
		doParseStatement(builder, true);
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:22,代码来源:EcmaScript4StatementParsing.java

示例4: parseSourceElement

public void parseSourceElement(PsiBuilder builder)
{
	final IElementType tokenType = builder.getTokenType();
	if(tokenType == JSTokenTypes.FUNCTION_KEYWORD)
	{
		getFunctionParsing().parseFunctionDeclaration(builder);
	}
	else
	{
		parseStatement(builder);
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:12,代码来源:StatementParsing.java

示例5: addBefore

@Override
public PsiElement addBefore(@NotNull final PsiElement element, final PsiElement anchor) throws IncorrectOperationException
{
	if(anchor == getFirstChild() && element instanceof JSAttributeList && anchor.getNode().getElementType() == JSTokenTypes.FUNCTION_KEYWORD)
	{
		return JSChangeUtil.doDoAddBefore(this, element, anchor);
	}
	return super.addBefore(element, anchor);
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:9,代码来源:JSFunctionBaseImpl.java

示例6: 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

示例7: parseFunctionNoMarker

public void parseFunctionNoMarker(final PsiBuilder builder, final boolean expressionContext, final @NotNull PsiBuilder.Marker functionMarker)
{
	if(builder.getTokenType() == JSTokenTypes.FUNCTION_KEYWORD)
	{ // function keyword may be ommited in context of get/set property definition
		builder.advanceLexer();
	}

	// Function name

	final IElementType tokenType = builder.getTokenType();
	if(!expressionContext && (tokenType == JSTokenTypes.GET_KEYWORD || tokenType == JSTokenTypes.SET_KEYWORD))
	{
		builder.advanceLexer();
	}

	if(isIdentifierName(builder, builder.getTokenType()))
	{
		getExpressionParsing().parseQualifiedTypeName(builder, false);
	}
	else
	{
		if(!expressionContext && builder.getTokenType() != JSTokenTypes.LPAR /*get/set as name*/)
		{
			builder.error(JavaScriptBundle.message("javascript.parser.message.expected.function.name"));
		}
	}

	parseParameterList(builder);

	getExpressionParsing().tryParseType(builder);

	if(builder.getTokenType() == JSTokenTypes.SEMICOLON)
	{
		builder.advanceLexer();
	}
	else
	{
		getStatementParsing().parseFunctionBody(builder);
	}

	functionMarker.done(expressionContext ? JSElementTypes.FUNCTION_EXPRESSION : JSElementTypes.FUNCTION_DECLARATION);
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:42,代码来源:FunctionParsing.java


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