本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
};
}
示例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;
}
示例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;
}