本文整理汇总了Java中com.intellij.lang.javascript.JSTokenTypes.WHITE_SPACE属性的典型用法代码示例。如果您正苦于以下问题:Java JSTokenTypes.WHITE_SPACE属性的具体用法?Java JSTokenTypes.WHITE_SPACE怎么用?Java JSTokenTypes.WHITE_SPACE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.lang.javascript.JSTokenTypes
的用法示例。
在下文中一共展示了JSTokenTypes.WHITE_SPACE属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInitialValueString
@Override
public String getInitialValueString()
{
final JSNamespaceDeclarationStub stub = getStub();
if(stub != null)
{
return stub.getInitialValueString();
}
final ASTNode anchor = getNode().findChildByType(JSTokenTypes.EQ);
if(anchor != null)
{
ASTNode node = anchor.getTreeNext();
if(node != null && node.getElementType() == JSTokenTypes.WHITE_SPACE)
{
node = node.getTreeNext();
}
if(node != null && JavaScriptTokenSets.STRING_LITERALS.contains(node.getElementType()))
{
return node.getText();
}
}
return null;
}
示例2: hasSemanticLineBeforeNextToken
protected boolean hasSemanticLineBeforeNextToken(final PsiBuilder builder)
{
IElementType tokenType = builder.getTokenType();
// force end
if(tokenType == JSTokenTypes.RBRACE)
{
return true;
}
int step = 1;
IElementType rawElementType;
while((rawElementType = builder.rawLookup(step)) != null)
{
if(rawElementType == JSTokenTypes.WHITE_SPACE)
{
int tokenStart = builder.rawTokenTypeStart(step);
CharSequence originalText = builder.getOriginalText();
for(int i = tokenStart; i < originalText.length(); i++)
{
char c = originalText.charAt(i);
if(c == '\n')
{
return true;
}
else if(!Character.isWhitespace(c))
{
return false;
}
}
}
else
{
break;
}
}
return false;
}
示例3: isConst
@Override
public boolean isConst()
{
final T stub = getStub();
if(stub != null)
{
return stub.isConst();
}
final ASTNode parent = getNode().getTreeParent();
if(parent.getElementType() == JSElementTypes.VAR_STATEMENT)
{
ASTNode node = parent.getFirstChildNode();
IElementType type = node.getElementType();
if(type == JSElementTypes.ATTRIBUTE_LIST || type == JSElementTypes.REFERENCE_EXPRESSION)
{
node = node.getTreeNext();
if(node != null && node.getElementType() == JSTokenTypes.WHITE_SPACE)
{
node = node.getTreeNext();
}
}
return node != null && node.getElementType() == JSTokenTypes.CONST_KEYWORD;
}
return false;
}
示例4: advance
private static ASTNode advance(ASTNode astNode)
{
astNode = astNode != null ? astNode.getTreeNext() : null;
if(astNode != null && astNode.getElementType() == JSTokenTypes.WHITE_SPACE)
{
astNode = astNode.getTreeNext();
}
return astNode;
}
示例5: 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;
}
示例6: 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;
}
示例7: removeRangeWithRemovalOfCommas
static void removeRangeWithRemovalOfCommas(final ASTNode myNode, final ASTNode parent)
{
ASTNode from = myNode, to = myNode.getTreeNext();
boolean seenComma = false;
if(to != null && to.getElementType() == JSTokenTypes.WHITE_SPACE)
{
to = to.getTreeNext();
}
if(to != null && to.getElementType() == JSTokenTypes.COMMA)
{
to = to.getTreeNext();
seenComma = true;
if(to != null && to.getElementType() == JSTokenTypes.WHITE_SPACE)
{
to = to.getTreeNext();
}
}
if(!seenComma)
{
ASTNode treePrev = from.getTreePrev();
if(treePrev != null && treePrev.getElementType() == JSTokenTypes.WHITE_SPACE)
{
treePrev = treePrev.getTreePrev();
}
if(treePrev != null && treePrev.getElementType() == JSTokenTypes.COMMA)
{
from = treePrev;
}
if(to != null && to.getElementType() == JSTokenTypes.WHITE_SPACE)
{
to = to.getTreeNext();
}
}
parent.removeRange(from, to);
}