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


Java JSTokenTypes.LBRACE属性代码示例

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


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

示例1: evalAnchor

protected void evalAnchor(final Editor editor, final PsiFile file)
{
	anchor = null;
	final PsiElement at = file.findElementAt(editor.getCaretModel().getOffset());
	PsiElement parent;

	if(at != null && ((parent = at.getParent()) == myJsClass || (parent instanceof JSFile && myJsClass.getParent().getContainingFile() == parent
			.getContext().getContainingFile())))
	{
		final ASTNode atNode = at.getNode();
		if(atNode.getElementType() == JSTokenTypes.RBRACE)
		{
			return;
		}

		for(ASTNode node = atNode; node != null; node = node.getTreeNext())
		{
			if(node.getElementType() == JSTokenTypes.LBRACE)
			{
				return;
			}
		}
		anchor = at;
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:25,代码来源:BaseCreateMethodsFix.java

示例2: parsePackage

private void parsePackage(final PsiBuilder builder)
{
	final PsiBuilder.Marker packageMarker = builder.mark();
	builder.advanceLexer();
	if(builder.getTokenType() == JSTokenTypes.IDENTIFIER)
	{
		getExpressionParsing().parseQualifiedTypeName(builder);
	}

	if(builder.getTokenType() != JSTokenTypes.LBRACE)
	{
		builder.error(JavaScriptBundle.message("javascript.parser.message.expected.name.or.lbrace"));
	}
	else
	{
		parseBlockOrFunctionBody(builder, BlockType.PACKAGE_OR_CLASS_BODY);
	}
	packageMarker.done(JSElementTypes.PACKAGE_STATEMENT);
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:19,代码来源:EcmaScript4StatementParsing.java

示例3: EmberJSParser

public EmberJSParser(PsiBuilder builder) {
    super(JavaScriptSupportLoader.JAVASCRIPT_1_5, builder);
    myExpressionParser = new EmberJSExpressionParser();
    myStatementParser = new StatementParser<EmberJSParser>(this) {
        @Override
        protected void doParseStatement(boolean canHaveClasses) {
            final IElementType firstToken = builder.getTokenType();
            if (firstToken == JSTokenTypes.LBRACE) {
                parseExpressionStatement();
                checkForSemicolon();
                return;
            }
            if (isIdentifierToken(firstToken)) {
                final IElementType nextToken = builder.lookAhead(1);
                if (nextToken == JSTokenTypes.IN_KEYWORD) {
                    parseInStatement();
                    return;
                }
            }
            if (builder.getTokenType() == JSTokenTypes.LPAR) {
                if (parseInStatement()) {
                    return;
                }
            }
            super.doParseStatement(canHaveClasses);
        }

        private boolean parseInStatement() {
            PsiBuilder.Marker statement = builder.mark();
            if (!getExpressionParser().parseInExpression()) {
                statement.drop();
                return false;
            }
            statement.done(JSElementTypes.EXPRESSION_STATEMENT);
            return true;
        }
    };
}
 
开发者ID:kristianmandrup,项目名称:emberjs-plugin,代码行数:38,代码来源:EmberJSParser.java

示例4: visitObjectLiteralExpression

@Override
public void visitObjectLiteralExpression(final ASTNode node)
{
	if(((type1 == JSTokenTypes.LBRACE && type2 != JSTokenTypes.RBRACE) ||
			type1 == JSTokenTypes.COMMA ||
			(type1 != JSTokenTypes.LBRACE && type2 == JSTokenTypes.RBRACE)) && shouldFormatObjectLiteralExpression())
	{
		myResult = Spacing.createSpacing(0, 0, 1, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:10,代码来源:JSSpacingProcessor.java

示例5: findLBrace

@Nullable
private static PsiElement findLBrace(final JSElement holder)
{
	for(PsiElement child = holder.getFirstChild(); child != null; child = child.getNextSibling())
	{
		if(child.getNode().getElementType() == JSTokenTypes.LBRACE)
		{
			return child;
		}
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:12,代码来源:ImportUtils.java

示例6: parseLambdaExpression

private boolean parseLambdaExpression(PsiBuilder builder)
{
	PsiBuilder.Marker mark = builder.mark();

	IElementType tokenType = builder.getTokenType();
	if(tokenType == JSTokenTypes.IDENTIFIER)
	{
		PsiBuilder.Marker parameterList = builder.mark();
		getFunctionParsing().parseParameter(builder, null);
		parameterList.done(JSElementTypes.PARAMETER_LIST);
	}
	else
	{
		getFunctionParsing().parseParameterList(builder);
	}

	if(builder.getTokenType() == JSTokenTypes.DARROW)
	{
		builder.advanceLexer();
	}

	if(builder.getTokenType() == JSTokenTypes.LBRACE)
	{
		getStatementParsing().parseBlock(builder);
	}
	else
	{
		parseExpression(builder);
	}

	mark.done(JSElementTypes.LAMBDA_EXPRESSION);
	return true;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:33,代码来源:EcmaScript6ExpressionParsing.java

示例7: parseRoot

private void parseRoot(PsiBuilder builder)
{
	if(builder.getTokenType() == JSTokenTypes.LBRACKET)
	{
		parseArrayLiteralExpression(builder);
		if(builder.getTokenType() != null)
		{
			builder.error(JavaScriptBundle.message("javascript.parser.message.expected.eof"));
		}
	}
	else if(builder.getTokenType() == JSTokenTypes.LBRACE)
	{
		parseObjectLiteralExpression(builder);
		if(builder.getTokenType() != null)
		{
			builder.error(JavaScriptBundle.message("javascript.parser.message.expected.eof"));
		}
	}
	else
	{
		builder.error(JavaScriptBundle.message("javascript.parser.message.expected.lbrace.or.lbracket"));
	}

	while(builder.getTokenType() != null)
	{
		builder.advanceLexer();
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:28,代码来源:JsonJavaScriptParser.java

示例8: parseBlockOrFunctionBody

protected void parseBlockOrFunctionBody(final PsiBuilder builder, BlockType type)
{
	final PsiBuilder.Marker block = type != BlockType.PACKAGE_OR_CLASS_BODY ? builder.mark() : null;
	if(builder.getTokenType() != JSTokenTypes.LBRACE)
	{
		if(block != null)
		{
			block.rollbackTo();
		}
		builder.error(JavaScriptBundle.message("javascript.parser.message.expected.lbrace"));
		return;
	}

	builder.advanceLexer();
	while(builder.getTokenType() != JSTokenTypes.RBRACE)
	{
		if(builder.eof())
		{
			builder.error(JavaScriptBundle.message("javascript.parser.message.missing.rbrace"));
			if(block != null)
			{
				block.done(JSElementTypes.BLOCK_STATEMENT);
			}
			return;
		}

		if(type == BlockType.FUNCTION_BODY)
		{
			parseSourceElement(builder);
		}
		else if(type == BlockType.BLOCK)
		{
			parseStatement(builder);
		}
		else
		{
			parsePackageBodyStatement(builder);
		}
	}

	builder.advanceLexer();
	if(block != null)
	{
		block.done(JSElementTypes.BLOCK_STATEMENT);
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:46,代码来源:StatementParsing.java

示例9: shouldMakeLBraceOnNextLine

private boolean shouldMakeLBraceOnNextLine()
{
	return type2 == JSTokenTypes.LBRACE && mySettings.CLASS_BRACE_STYLE == CodeStyleSettings.NEXT_LINE;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:4,代码来源:JSSpacingProcessor.java

示例10: processBlock

private void processBlock(final ASTNode node)
{
	if(JSElementTypes.SOURCE_ELEMENTS.contains(type1) || JSElementTypes.SOURCE_ELEMENTS.contains(type2) ||
			type2 == JSTokenTypes.RBRACE)
	{
		if(isInjectedJSHack(type1, type2) ||
				isInjectedJSHack(type2, type1) ||
				(type2 == JSTokenTypes.END_OF_LINE_COMMENT && isInlineEndOfLineCommentOnLeft() && type1 != JSElementTypes.IMPORT_STATEMENT))
		{
			myResult = Spacing.getReadOnlySpacing();
		}
		else
		{
			final boolean keepOneLine = myParent.getPsi() instanceof JSFunction ? mySettings.KEEP_SIMPLE_METHODS_IN_ONE_LINE : mySettings
					.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE;

			if(keepOneLine && (type1 == JSTokenTypes.LBRACE || type2 == JSTokenTypes.RBRACE))
			{
				myResult = Spacing.createDependentLFSpacing(0, 1, node.getTextRange(), mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
			}
			else
			{
				if((JSElementTypes.IMPORT_STATEMENT == type1 && JSElementTypes.IMPORT_STATEMENT != type2 && JSTokenTypes.RBRACE != type2) || (JSElementTypes
						.IMPORT_STATEMENT != type1 && JSTokenTypes.LBRACE != type1 && JSElementTypes.IMPORT_STATEMENT == type2))
				{
					myResult = Spacing.createSpacing(0, 0, 2, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
				}
				else if(JSElementTypes.IMPORT_STATEMENT == type1 && JSElementTypes.IMPORT_STATEMENT == type2)
				{
					myResult = getSpacingBetweenImports();
				}
				else
				{
					if(shouldPlaceExtraLinesAroundMethod())
					{
						myResult = Spacing.createSpacing(0, 0, 1 + mySettings.BLANK_LINES_AROUND_METHOD, mySettings.KEEP_LINE_BREAKS,
								mySettings.KEEP_BLANK_LINES_IN_CODE);
					}
					else
					{
						myResult = Spacing.createSpacing(0, 0, 1, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
					}
				}
			}
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:47,代码来源:JSSpacingProcessor.java

示例11: parseProperty

private void parseProperty(final PsiBuilder builder)
{
	if(myPropertyDepth > 1000)
	{
		builder.error("Too big depth for property");
		int braceCount = 0;
		int bracketCount = 0;
		while(!builder.eof())
		{
			IElementType tokenType = builder.getTokenType();
			if(tokenType == JSTokenTypes.LBRACE)
			{
				braceCount++;
			}
			else if(tokenType == JSTokenTypes.LBRACKET)
			{
				bracketCount++;
			}
			else if(tokenType == JSTokenTypes.RBRACE)
			{
				braceCount--;
				if(braceCount < 0)
				{
					break;
				}
			}
			else if(tokenType == JSTokenTypes.RBRACKET)
			{
				bracketCount--;
				if(bracketCount < 0)
				{
					break;
				}
			}
			builder.advanceLexer();
		}

		return;
	}

	final IElementType nameToken = builder.getTokenType();
	final PsiBuilder.Marker property = builder.mark();
	myPropertyDepth++;

	if(isNotPropertyStart(nameToken))
	{
		builder.error(JavaScriptBundle.message("javascript.parser.message.expected.identifier.string.literal.or.numeric.literal"));
	}
	builder.advanceLexer();
	Parsing.checkMatches(builder, JSTokenTypes.COLON, JavaScriptBundle.message("javascript.parser.message.expected.colon"));

	if(!parseValue(builder))
	{
		builder.error(JavaScriptBundle.message("javascript.parser.message.expected.expression"));
	}
	myPropertyDepth--;

	property.done(JSElementTypes.PROPERTY);
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:59,代码来源:JsonJavaScriptParser.java

示例12: parseValue

private boolean parseValue(PsiBuilder builder)
{
	final IElementType firstToken = builder.getTokenType();
	if(firstToken == JSTokenTypes.NUMERIC_LITERAL ||
			firstToken == JSTokenTypes.STRING_LITERAL ||
			firstToken == JSTokenTypes.SINGLE_QUOTE_STRING_LITERAL ||
			firstToken == JSTokenTypes.NULL_KEYWORD ||
			firstToken == JSTokenTypes.FALSE_KEYWORD ||
			firstToken == JSTokenTypes.TRUE_KEYWORD)
	{
		String errorMessage = ExpressionParsing.validateLiteral(builder);
		Parsing.buildTokenElement(JSElementTypes.LITERAL_EXPRESSION, builder);
		if(errorMessage != null)
		{
			builder.error(errorMessage);
		}
		return true;
	}
	if(firstToken == JSTokenTypes.LBRACKET)
	{
		parseArrayLiteralExpression(builder);
		return true;
	}
	else if(firstToken == JSTokenTypes.MINUS)
	{
		PsiBuilder.Marker marker = builder.mark();
		builder.advanceLexer();
		if(builder.getTokenType() == JSTokenTypes.NUMERIC_LITERAL)
		{
			builder.advanceLexer();
			marker.done(JSElementTypes.PREFIX_EXPRESSION);
		}
		else
		{
			marker.error("Unexpected token");
		}
		return true;
	}
	else if(firstToken == JSTokenTypes.LBRACE)
	{
		parseObjectLiteralExpression(builder);
		return true;
	}
	else
	{
		return false;
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:48,代码来源:JsonJavaScriptParser.java


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