本文整理匯總了Java中com.intellij.lang.BracePair類的典型用法代碼示例。如果您正苦於以下問題:Java BracePair類的具體用法?Java BracePair怎麽用?Java BracePair使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BracePair類屬於com.intellij.lang包,在下文中一共展示了BracePair類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isRBraceToken
import com.intellij.lang.BracePair; //導入依賴的package包/類
@Override
public boolean isRBraceToken(HighlighterIterator iterator, CharSequence fileText, FileType fileType) {
BracePair pair = findPair(false, iterator, fileText, fileType);
if (pair == null) return false;
if (pair.getRightBraceType() != AppleScriptTypes.END)
return super.isRBraceToken(iterator, fileText, fileType);//true;
boolean result = false;
int count = 0;
while (true) {
iterator.retreat();
count++;
if (iterator.atEnd()) break;
IElementType eType = iterator.getTokenType();
if (eType == AppleScriptTypes.NLS || eType == AppleScriptTypes.BLOCK_BODY)
result = true;
else break;
}
while (count-- > 0) iterator.advance();
return result;
}
示例2: getOppositeBraceTokenTypes
import com.intellij.lang.BracePair; //導入依賴的package包/類
@Override
@NotNull
public List<IElementType> getOppositeBraceTokenTypes(@NotNull IElementType type) {
List<IElementType> result = null;
for (BracePair pair : myMatcher.getPairs()) {
IElementType match = null;
if (type == pair.getRightBraceType()) match = pair.getLeftBraceType();
if (type == pair.getLeftBraceType()) match = pair.getRightBraceType();
if (match != null) {
if (result == null) result = new ArrayList<IElementType>(2);
result.add(match);
}
}
return result != null ? result : Collections.<IElementType>emptyList();
}
示例3: getBraceTokenGroupId
import com.intellij.lang.BracePair; //導入依賴的package包/類
@Override
public int getBraceTokenGroupId(IElementType tokenType) {
final Language l = tokenType.getLanguage();
PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(l);
if (matcher != null) {
BracePair[] pairs = matcher.getPairs();
for (BracePair pair : pairs) {
if (pair.getLeftBraceType() == tokenType || pair.getRightBraceType() == tokenType ) {
return l.hashCode();
}
}
}
if (tokenType instanceof IXmlLeafElementType) {
return tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER || tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_END_DELIMITER
? XML_VALUE_DELIMITER_GROUP
: XML_TAG_TOKEN_GROUP;
}
else{
return BraceMatchingUtil.UNDEFINED_TOKEN_GROUP;
}
}
示例4: isStructuralBrace
import com.intellij.lang.BracePair; //導入依賴的package包/類
@Override
public boolean isStructuralBrace(HighlighterIterator iterator,CharSequence text, FileType fileType) {
IElementType tokenType = iterator.getTokenType();
PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(tokenType.getLanguage());
if (matcher != null) {
BracePair[] pairs = matcher.getPairs();
for (BracePair pair : pairs) {
if ((pair.getLeftBraceType() == tokenType || pair.getRightBraceType() == tokenType) &&
pair.isStructural()) return true;
}
}
if (fileType instanceof XmlLikeFileType) {
return isXmlStructuralBrace(iterator, text, fileType, tokenType);
}
return false;
}
示例5: getBraceTokenGroupId
import com.intellij.lang.BracePair; //導入依賴的package包/類
public int getBraceTokenGroupId(IElementType tokenType) {
final Language l = tokenType.getLanguage();
PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(l);
if (matcher != null) {
BracePair[] pairs = matcher.getPairs();
for (BracePair pair : pairs) {
if (pair.getLeftBraceType() == tokenType || pair.getRightBraceType() == tokenType ) {
return l.hashCode();
}
}
}
if (tokenType instanceof IXmlLeafElementType) {
return tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER || tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_END_DELIMITER
? XML_VALUE_DELIMITER_GROUP
: XML_TAG_TOKEN_GROUP;
}
else{
return BraceMatchingUtil.UNDEFINED_TOKEN_GROUP;
}
}
示例6: isStructuralBrace
import com.intellij.lang.BracePair; //導入依賴的package包/類
public boolean isStructuralBrace(HighlighterIterator iterator,CharSequence text, FileType fileType) {
IElementType tokenType = iterator.getTokenType();
PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(tokenType.getLanguage());
if (matcher != null) {
BracePair[] pairs = matcher.getPairs();
for (BracePair pair : pairs) {
if ((pair.getLeftBraceType() == tokenType || pair.getRightBraceType() == tokenType) &&
pair.isStructural()) return true;
}
}
if (fileType instanceof XmlLikeFileType) {
return isXmlStructuralBrace(iterator, text, fileType, tokenType);
}
return false;
}
示例7: getOppositeBraceTokenType
import com.intellij.lang.BracePair; //導入依賴的package包/類
@Override
public IElementType getOppositeBraceTokenType(@NotNull final IElementType type)
{
PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(type.getLanguage());
if(matcher != null)
{
BracePair[] pairs = matcher.getPairs();
for(BracePair pair : pairs)
{
if(pair.getLeftBraceType() == type)
{
return pair.getRightBraceType();
}
if(pair.getRightBraceType() == type)
{
return pair.getLeftBraceType();
}
}
}
return null;
}
示例8: PlayBaseTemplateBraceMatcher
import com.intellij.lang.BracePair; //導入依賴的package包/類
public PlayBaseTemplateBraceMatcher()
{
super(new PairedBraceMatcher()
{
@Override
public BracePair[] getPairs()
{
return new BracePair[0];
}
@Override
public boolean isPairedBracesAllowedBeforeType(@NotNull IElementType lbraceType, @Nullable IElementType contextType)
{
return true;
}
@Override
public int getCodeConstructStart(PsiFile file, int openingBraceOffset)
{
return openingBraceOffset;
}
}, PlayBaseTemplateLanguage.INSTANCE);
}
示例9: getOppositeBraceTokenTypes
import com.intellij.lang.BracePair; //導入依賴的package包/類
@Override
@Nonnull
public List<IElementType> getOppositeBraceTokenTypes(@Nonnull IElementType type) {
List<IElementType> result = null;
for (BracePair pair : myMatcher.getPairs()) {
IElementType match = null;
if (type == pair.getRightBraceType()) match = pair.getLeftBraceType();
if (type == pair.getLeftBraceType()) match = pair.getRightBraceType();
if (match != null) {
if (result == null) result = new ArrayList<IElementType>(2);
result.add(match);
}
}
return result != null ? result : Collections.<IElementType>emptyList();
}
示例10: getPairs
import com.intellij.lang.BracePair; //導入依賴的package包/類
@Override
public BracePair[] getPairs() {
return new BracePair[]{
new BracePair(WeaveTypes.L_BRACKET, WeaveTypes.R_BRACKET, true),
new BracePair(WeaveTypes.L_PARREN, WeaveTypes.R_PARREN, true),
new BracePair(WeaveTypes.L_CURLY, WeaveTypes.R_CURLY, true)
};
}
示例11: getPairs
import com.intellij.lang.BracePair; //導入依賴的package包/類
@Override
public BracePair[] getPairs() {
return new BracePair[]{
new BracePair(BRACE_OPEN,BRACE_CLOSE,true),
new BracePair(BRACKET_OPEN,BRACKET_CLOSE,false),
new BracePair(PARENTHESES_OPEN,PARENTHESES_CLOSE,false),
new BracePair(VERBATIM_OPEN,VERBATIM_CLOSE,true),
};
}
示例12: getPairs
import com.intellij.lang.BracePair; //導入依賴的package包/類
@Override
public BracePair[] getPairs() {
return new BracePair[]{
new BracePair(GraphQLElementTypes.PAREN_L, GraphQLElementTypes.PAREN_R, true),
new BracePair(GraphQLElementTypes.BRACKET_L, GraphQLElementTypes.BRACKET_R, true),
new BracePair(GraphQLElementTypes.BRACE_L, GraphQLElementTypes.BRACE_R, true)
};
}
示例13: getBraceTokenGroupId
import com.intellij.lang.BracePair; //導入依賴的package包/類
@Override
public int getBraceTokenGroupId(IElementType tokenType) {
final BracePair[] pairs = myMatcher.getPairs();
for (BracePair pair : pairs) {
if (tokenType == pair.getLeftBraceType() || tokenType == pair.getRightBraceType()) return myLanguage.hashCode();
}
return -1;
}
示例14: findPair
import com.intellij.lang.BracePair; //導入依賴的package包/類
@Nullable
public BracePair findPair(boolean left, HighlighterIterator iterator, CharSequence fileText, FileType fileType) {
final IElementType tokenType = iterator.getTokenType();
final BracePair[] pairs = myMatcher.getPairs();
for (BracePair pair : pairs) {
if (tokenType == (left ? pair.getLeftBraceType() : pair.getRightBraceType())) return pair;
}
return null;
}
示例15: getOppositeBraceTokenType
import com.intellij.lang.BracePair; //導入依賴的package包/類
@Override
public IElementType getOppositeBraceTokenType(@NotNull final IElementType type) {
final BracePair[] pairs = myMatcher.getPairs();
for (BracePair pair : pairs) {
if (type == pair.getRightBraceType()) return pair.getLeftBraceType();
if (type == pair.getLeftBraceType()) return pair.getRightBraceType();
}
return null;
}