本文整理汇总了Java中com.intellij.lang.javascript.JSTokenTypes.COMMA属性的典型用法代码示例。如果您正苦于以下问题:Java JSTokenTypes.COMMA属性的具体用法?Java JSTokenTypes.COMMA怎么用?Java JSTokenTypes.COMMA使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.lang.javascript.JSTokenTypes
的用法示例。
在下文中一共展示了JSTokenTypes.COMMA属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseKeyValue
private void parseKeyValue() {
builder.advanceLexer();
final PsiBuilder.Marker comma = builder.mark();
parseExplicitIdentifierWithError();
if (builder.getTokenType() == JSTokenTypes.COMMA) {
builder.advanceLexer();
} else {
builder.error(JSBundle.message("javascript.parser.message.expected.comma"));
}
parseExplicitIdentifierWithError();
comma.done(JSElementTypes.COMMA_EXPRESSION);
if (builder.getTokenType() == JSTokenTypes.RPAR) {
builder.advanceLexer();
} else {
builder.error(JSBundle.message("javascript.parser.message.expected.rparen"));
}
}
示例2: parseReferenceList
private void parseReferenceList(final PsiBuilder builder)
{
final IElementType tokenType = builder.getTokenType();
EcmaScript4StatementParsing.LOGGER.assertTrue(tokenType == JSTokenTypes.EXTENDS_KEYWORD || tokenType == JSTokenTypes.IMPLEMENTS_KEYWORD);
final PsiBuilder.Marker referenceList = builder.mark();
builder.advanceLexer();
if(getExpressionParsing().parseQualifiedTypeName(builder))
{
while(builder.getTokenType() == JSTokenTypes.COMMA)
{
builder.advanceLexer();
if(!getExpressionParsing().parseQualifiedTypeName(builder))
{
break;
}
}
}
referenceList.done(tokenType == JSTokenTypes.EXTENDS_KEYWORD ? JSElementTypes.EXTENDS_LIST : JSElementTypes.IMPLEMENTS_LIST);
}
示例3: parseLetExpressionStart
PsiBuilder.Marker parseLetExpressionStart(final PsiBuilder builder)
{
StatementParsing.LOGGER.assertTrue(builder.getTokenType() == JSTokenTypes.LET_KEYWORD);
final PsiBuilder.Marker marker = builder.mark();
builder.advanceLexer();
if(builder.getTokenType() == JSTokenTypes.LPAR)
{
builder.advanceLexer();
if(getExpressionParsing().parseAssignmentExpression(builder))
{
while(builder.getTokenType() == JSTokenTypes.COMMA)
{
builder.advanceLexer();
if(!getExpressionParsing().parseAssignmentExpression(builder))
{
break;
}
}
}
Parsing.checkMatches(builder, JSTokenTypes.RPAR, JavaScriptBundle.message("javascript.parser.message.expected.rparen"));
}
return marker;
}
示例4: visitJSArrayLiteralExpression
@Override
public void visitJSArrayLiteralExpression(final JSArrayLiteralExpression node)
{
final PsiElement lastChild = node.getLastChild();
PsiElement child = lastChild != null ? lastChild.getPrevSibling() : null;
if(child instanceof PsiWhiteSpace)
{
child = child.getPrevSibling();
}
ASTNode childNode;
if(child != null && (childNode = child.getNode()) != null && childNode.getElementType() == JSTokenTypes.COMMA)
{
final Annotation annotation = myHolder.createWarningAnnotation(child, JavaScriptBundle.message("javascript.validation.message.unneeded.comma"));
annotation.registerFix(new RemoveASTNodeFix(childNode, "javascript.validation.message.remove.unneeded.comma.fix"));
}
}
示例5: visitParameterList
@Override
public void visitParameterList(final ASTNode node)
{
if(type1 == JSTokenTypes.LPAR && type2 == JSTokenTypes.RPAR)
{
setSingleSpace(false);
}
else if(type1 == JSTokenTypes.LPAR || type2 == JSTokenTypes.RPAR)
{
setSingleSpace(mySettings.SPACE_WITHIN_METHOD_PARENTHESES);
}
else if(type1 == JSTokenTypes.COMMA)
{
setSingleSpace(mySettings.SPACE_AFTER_COMMA);
}
else if(type2 == JSTokenTypes.COMMA)
{
setSingleSpace(mySettings.SPACE_BEFORE_COMMA);
}
}
示例6: visitArgumentList
@Override
public void visitArgumentList(final ASTNode node)
{
if(type1 == JSTokenTypes.LPAR || type2 == JSTokenTypes.RPAR)
{
setSingleSpace(false);
}
else if(type1 == JSTokenTypes.COMMA)
{
setSingleSpace(mySettings.SPACE_AFTER_COMMA);
}
else if(type2 == JSTokenTypes.COMMA)
{
setSingleSpace(mySettings.SPACE_BEFORE_COMMA);
}
}
示例7: parseObjectLiteralExpression
public void parseObjectLiteralExpression(final PsiBuilder builder)
{
ExpressionParsing.LOGGER.assertTrue(builder.getTokenType() == JSTokenTypes.LBRACE);
final PsiBuilder.Marker expr = builder.mark();
builder.advanceLexer();
IElementType elementType = builder.getTokenType();
while(elementType != JSTokenTypes.RBRACE && elementType != null)
{
parseProperty(builder);
elementType = builder.getTokenType();
if(elementType == JSTokenTypes.RBRACE)
{
break;
}
else if(elementType == JSTokenTypes.COMMA)
{
builder.advanceLexer();
}
else
{
builder.error(JavaScriptBundle.message("javascript.parser.message.expected.comma"));
}
elementType = builder.getTokenType();
if(elementType == JSTokenTypes.RBRACE)
{
builder.error(JavaScriptBundle.message("javascript.parser.property.expected"));
}
else if(isNotPropertyStart(builder, elementType))
{
break;
}
}
Parsing.checkMatches(builder, JSTokenTypes.RBRACE, JavaScriptBundle.message("javascript.parser.message.expected.rbrace"));
expr.done(JSElementTypes.OBJECT_LITERAL_EXPRESSION);
}
示例8: parseArgumentList
protected void parseArgumentList(final PsiBuilder builder)
{
ExpressionParsing.LOGGER.assertTrue(builder.getTokenType() == JSTokenTypes.LPAR);
final PsiBuilder.Marker arglist = builder.mark();
builder.advanceLexer();
boolean first = true;
while(builder.getTokenType() != JSTokenTypes.RPAR)
{
if(first)
{
first = false;
}
else
{
if(builder.getTokenType() == JSTokenTypes.COMMA)
{
builder.advanceLexer();
}
else
{
builder.error(JavaScriptBundle.message("javascript.parser.message.expected.comma.or.rparen"));
break;
}
}
if(!parseAssignmentExpression(builder))
{
builder.error(JavaScriptBundle.message("javascript.parser.message.expected.expression"));
}
}
Parsing.checkMatches(builder, JSTokenTypes.RPAR, JavaScriptBundle.message("javascript.parser.message.expected.rparen"));
arglist.done(JSElementTypes.ARGUMENT_LIST);
}
示例9: 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;
}
示例10: parseVarStatementNoMarker
protected void parseVarStatementNoMarker(final PsiBuilder builder, final boolean inForInitializationContext, final @NotNull PsiBuilder.Marker var)
{
final IElementType declType = builder.getTokenType();
StatementParsing.LOGGER.assertTrue(declType == JSTokenTypes.VAR_KEYWORD ||
declType == JSTokenTypes.CONST_KEYWORD ||
declType == JSTokenTypes.LET_KEYWORD);
builder.advanceLexer();
boolean first = true;
while(true)
{
if(first)
{
first = false;
}
else
{
Parsing.checkMatches(builder, JSTokenTypes.COMMA, JavaScriptBundle.message("javascript.parser.message.expected.comma"));
}
parseVarDeclaration(builder, !inForInitializationContext);
if(builder.getTokenType() != JSTokenTypes.COMMA)
{
break;
}
}
if(!inForInitializationContext)
{
checkForSemicolon(builder);
}
var.done(JSElementTypes.VAR_STATEMENT);
}
示例11: parseObjectLiteralExpression
public void parseObjectLiteralExpression(final PsiBuilder builder)
{
LOGGER.assertTrue(builder.getTokenType() == JSTokenTypes.LBRACE);
final PsiBuilder.Marker expr = builder.mark();
builder.advanceLexer();
IElementType elementType = builder.getTokenType();
while(elementType != JSTokenTypes.RBRACE && elementType != null)
{
parseProperty(builder);
elementType = builder.getTokenType();
if(elementType == JSTokenTypes.RBRACE)
{
break;
}
else if(elementType == JSTokenTypes.COMMA)
{
builder.advanceLexer();
}
else
{
builder.error(JavaScriptBundle.message("javascript.parser.message.expected.comma"));
}
elementType = builder.getTokenType();
if(elementType == JSTokenTypes.RBRACE)
{
builder.error(JavaScriptBundle.message("javascript.parser.property.expected"));
}
else if(isNotPropertyStart(elementType))
{
break;
}
}
Parsing.checkMatches(builder, JSTokenTypes.RBRACE, JavaScriptBundle.message("javascript.parser.message.expected.rbrace"));
expr.done(JSElementTypes.OBJECT_LITERAL_EXPRESSION);
}
示例12: isAppropriateElementTypeForLiteral
@Override
public boolean isAppropriateElementTypeForLiteral(@NotNull IElementType tokenType)
{
return JavaScriptTokenSets.COMMENTS.contains(tokenType) ||
tokenType == JSTokenTypes.WHITE_SPACE ||
tokenType == JSTokenTypes.SEMICOLON ||
tokenType == JSTokenTypes.COMMA ||
tokenType == JSTokenTypes.RPAR ||
tokenType == JSTokenTypes.RBRACKET ||
tokenType == JSTokenTypes.RBRACE ||
tokenType == JSTokenTypes.SINGLE_QUOTE_STRING_LITERAL ||
tokenType == JSTokenTypes.STRING_LITERAL;
}
示例13: 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);
}
}
示例14: visitArrayLiteralExpression
@Override
public void visitArrayLiteralExpression(final ASTNode node)
{
if(((type1 == JSTokenTypes.LBRACKET && type2 != JSTokenTypes.RBRACKET) ||
type1 == JSTokenTypes.COMMA ||
(type1 != JSTokenTypes.LBRACKET && type2 == JSTokenTypes.RBRACKET)) && shouldFormatArrayLiteralExpression())
{
myResult = Spacing.createSpacing(0, 0, 1, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
}
}
示例15: isPairedBracesAllowedBeforeType
@Override
public boolean isPairedBracesAllowedBeforeType(@NotNull final IElementType lbraceType, @Nullable final IElementType tokenType)
{
return JSTokenTypes.WHITE_SPACE == tokenType || JSTokenTypes.COMMENTS.contains(tokenType) || tokenType == JSTokenTypes.SEMICOLON || tokenType ==
JSTokenTypes.COMMA || tokenType == JSTokenTypes.RPAR || tokenType == JSTokenTypes.RBRACKET || tokenType == JSTokenTypes.RBRACE || null ==
tokenType;
}