本文整理汇总了Java中com.intellij.lang.javascript.JSTokenTypes.LBRACKET属性的典型用法代码示例。如果您正苦于以下问题:Java JSTokenTypes.LBRACKET属性的具体用法?Java JSTokenTypes.LBRACKET怎么用?Java JSTokenTypes.LBRACKET使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.lang.javascript.JSTokenTypes
的用法示例。
在下文中一共展示了JSTokenTypes.LBRACKET属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getQualifier
@Override
public JSExpression getQualifier()
{
ASTNode child = getNode().getFirstChildNode();
while(child != null)
{
final IElementType type = child.getElementType();
if(type == JSTokenTypes.LBRACKET)
{
return null;
}
if(JSElementTypes.EXPRESSIONS.contains(type))
{
return (JSExpression) child.getPsi();
}
child = child.getTreeNext();
}
return null;
}
示例2: getIndexExpression
@Override
public JSExpression getIndexExpression()
{
ASTNode child = getNode().getFirstChildNode();
boolean bracketPassed = false;
while(child != null)
{
final IElementType type = child.getElementType();
if(type == JSTokenTypes.LBRACKET)
{
bracketPassed = true;
}
if(bracketPassed && JSElementTypes.EXPRESSIONS.contains(type))
{
return (JSExpression) child.getPsi();
}
child = child.getTreeNext();
}
return null;
}
示例3: 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);
}
}
示例4: 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();
}
}
示例5: isNotPropertyStart
@Override
public boolean isNotPropertyStart(PsiBuilder builder, IElementType elementType)
{
return super.isNotPropertyStart(builder, elementType) && elementType != JSTokenTypes.LBRACKET;
}
示例6: 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);
}
示例7: 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;
}
}