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


Java JSTokenTypes.IN_KEYWORD属性代码示例

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


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

示例1: parseInExpression

public boolean parseInExpression() {
    final PsiBuilder.Marker expr = builder.mark();
    if (isIdentifierToken(builder.getTokenType())) {
        parseExplicitIdentifier();
    } else {
        final PsiBuilder.Marker keyValue = builder.mark();
        parseKeyValue();
        if (builder.getTokenType() != JSTokenTypes.IN_KEYWORD) {
            expr.rollbackTo();
            return false;
        } else {
            keyValue.done(JSElementTypes.PARENTHESIZED_EXPRESSION);
        }
    }
    builder.advanceLexer();
    parseExpression();
    if (builder.getTokenType() == EmberJSTokenTypes.TRACK_BY_KEYWORD) {
        builder.advanceLexer();
        parseExpression();
    }
    expr.done(EmberJSElementTypes.REPEAT_EXPRESSION);
    return true;
}
 
开发者ID:kristianmandrup,项目名称:emberjs-plugin,代码行数:23,代码来源:EmberJSParser.java

示例2: parseRelationalExpression

private boolean parseRelationalExpression(final PsiBuilder builder, final boolean allowIn)
{
	PsiBuilder.Marker expr = builder.mark();
	if(!parseShiftExpression(builder))
	{
		expr.drop();
		return false;
	}
	while(JSTokenTypes.RELATIONAL_OPERATIONS.contains(builder.getTokenType()) && (allowIn || builder.getTokenType() != JSTokenTypes.IN_KEYWORD))
	{
		builder.advanceLexer();
		if(!parseShiftExpression(builder))
		{
			builder.error(JavaScriptBundle.message("javascript.parser.message.expected.expression"));
		}
		expr.done(JSElementTypes.BINARY_EXPRESSION);
		expr = expr.precede();
	}

	expr.drop();
	return true;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:22,代码来源:ExpressionParsing.java

示例3: getVariableExpression

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

示例4: getCollectionExpression

@Override
public JSExpression getCollectionExpression()
{
	ASTNode child = getNode().getFirstChildNode();
	boolean inPassed = false;
	while(child != null)
	{
		if(child.getElementType() == JSTokenTypes.IN_KEYWORD)
		{
			inPassed = true;
		}
		if(inPassed && JSElementTypes.EXPRESSIONS.contains(child.getElementType()))
		{
			return (JSExpression) child.getPsi();
		}
		child = child.getTreeNext();
	}

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

示例5: getCollectionExpression

/**
 * Method provided as a workaround of a bug in the JavaScript language IDEA plugin.
 * @param forInStatement the for-in statement
 * @return the for-in statement collection expression
 */
private static JSExpression getCollectionExpression(JSForInStatement forInStatement) {
    final ASTNode statementNode = forInStatement.getNode();
    ASTNode       child         = ((statementNode == null) ? null : statementNode.getFirstChildNode());
    boolean       inPassed      = false;

    while (child != null) {
        if (child.getElementType() == JSTokenTypes.IN_KEYWORD) {
            inPassed = true;
        }
        if (inPassed && JSElementTypes.EXPRESSIONS.contains(child.getElementType())) {
            return (JSExpression) child.getPsi();
        }
        child = child.getTreeNext();
    }

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

示例6: getVariableExpression

/**
 * Method provided as a workaround of a bug in the JavaScript language IDEA plugin.
 * @param forInStatement the for-in statement
 * @return the for-in statement collection expression
 */
private static JSExpression getVariableExpression(JSForInStatement forInStatement) {
    final ASTNode statementNode = forInStatement.getNode();
    ASTNode       child         = ((statementNode == null) ? null : statementNode.getFirstChildNode());

    while (child != null) {
        if (child.getElementType() == JSTokenTypes.IN_KEYWORD) {
            return null;
        }

        if (JSElementTypes.EXPRESSIONS.contains(child.getElementType())) {
            return (JSExpression) child.getPsi();
        }
        child = child.getTreeNext();
    }

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

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

示例8: parseExpressionOptional

public boolean parseExpressionOptional(final PsiBuilder builder, final boolean allowIn)
{
	PsiBuilder.Marker expr = builder.mark();
	if(!parseAssignmentExpression(builder, allowIn))
	{
		expr.drop();
		return false;
	}

	if(builder.getTokenType() == JSTokenTypes.IN_KEYWORD)
	{
		expr.done(JSElementTypes.DEFINITION_EXPRESSION);
		return true;
	}

	while(builder.getTokenType() == JSTokenTypes.COMMA)
	{
		builder.advanceLexer();
		if(!parseAssignmentExpression(builder, allowIn))
		{
			builder.error(JavaScriptBundle.message("javascript.parser.message.expected.expression"));
		}

		expr.done(JSElementTypes.COMMA_EXPRESSION);
		expr = expr.precede();
	}

	expr.drop();

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

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


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