本文整理汇总了Java中org.netbeans.api.lexer.TokenId.equals方法的典型用法代码示例。如果您正苦于以下问题:Java TokenId.equals方法的具体用法?Java TokenId.equals怎么用?Java TokenId.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.api.lexer.TokenId
的用法示例。
在下文中一共展示了TokenId.equals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isTagFirstChar
import org.netbeans.api.lexer.TokenId; //导入方法依赖的package包/类
public static boolean isTagFirstChar(Token token) {
if (token == null) return false;
TokenId tokenID = token.id();
if (tokenID.equals(XMLTokenId.TAG) || tokenID.equals(XMLTokenId.TEXT)) {
String tokenText = token.text().toString();
if ((! isEndTagPrefix(token)) && tokenText.startsWith(TAG_FIRST_CHAR)) {
return true;
}
}
return false;
}
示例2: isTagLastChar
import org.netbeans.api.lexer.TokenId; //导入方法依赖的package包/类
public static boolean isTagLastChar(Token token) {
if (token == null) return false;
TokenId tokenID = token.id();
if (tokenID.equals(XMLTokenId.TAG)) {
String tokenText = token.text().toString();
if (tokenText.equals(TAG_LAST_CHAR)) {
return true;
}
}
return false;
}
示例3: isEndTagPrefix
import org.netbeans.api.lexer.TokenId; //导入方法依赖的package包/类
public static boolean isEndTagPrefix(Token token) {
if (token == null) return false;
TokenId tokenID = token.id();
if (tokenID.equals(XMLTokenId.TAG) || tokenID.equals(XMLTokenId.TEXT)) {
String tokenText = token.text().toString();
if (tokenText.startsWith(END_TAG_PREFIX)) {
return true;
}
}
return false;
}
示例4: isEndTagSuffix
import org.netbeans.api.lexer.TokenId; //导入方法依赖的package包/类
public static boolean isEndTagSuffix(Token token) {
if (token == null) return false;
TokenId tokenID = token.id();
if (tokenID.equals(XMLTokenId.TAG)) {
String tokenText = token.text().toString();
if (tokenText.equals(END_TAG_SUFFIX)) {
return true;
}
}
return false;
}
示例5: isTextTag
import org.netbeans.api.lexer.TokenId; //导入方法依赖的package包/类
public static boolean isTextTag(Token token) {
if (token == null) return false;
TokenId tokenID = token.id();
if (! tokenID.equals(XMLTokenId.TEXT)) return false;
String tokenText = token.text().toString();
if (tokenText.equals("<")) {
return true;
}
boolean result = PATTERN_TEXT_TAG_EOLs.matcher(tokenText).matches();
return result;
}
示例6: isTagAttributeRequired
import org.netbeans.api.lexer.TokenId; //导入方法依赖的package包/类
private boolean isTagAttributeRequired(TokenSequence tokenSequence) {
int caretPos = completionAtOffset;
int diff = tokenSequence.move(caretPos);
tokenSequence.moveNext();
Token tok = tokenSequence.token();
if (tok == null) return false;
TokenId tokID = tok.id();
if (tokID.equals(XMLTokenId.TAG) && CompletionUtil.isEndTagSuffix(tok) &&
(tokenSequence.offset() + 1 == caretPos)) { // <... /|>, | - a caret position
return false;
}
boolean
isAttributeOrSpace = tokID.equals(XMLTokenId.ARGUMENT) ||
tokID.equals(XMLTokenId.WS),
isTagLastCharFound = tokID.equals(XMLTokenId.TAG) &&
(CompletionUtil.isTagLastChar(tok) ||
CompletionUtil.isEndTagSuffix(tok)),
//this may happen when there's a lexical error inside the tag itself,
//for example in this valid case: <tag att|> or in something errorneous
//like: <tag att|#$#$#>
isJustBeforeTagErrorToken = false;
if (tokID.equals(XMLTokenId.ERROR)) {
isJustBeforeTagErrorToken
= tokID.equals(XMLTokenId.ERROR);
String tokenText = tok.text().toString();
isJustBeforeTagErrorToken = tokenText.subSequence(0, diff).toString().trim().isEmpty() ||
diff == 0;
}
while (true) {
if (tokID.equals(XMLTokenId.TAG) || tokID.equals(XMLTokenId.TEXT)) {
if (CompletionUtil.isEndTagPrefix(tok)) break;
else if (tokID.equals(XMLTokenId.TAG)) {
String tagName = CompletionUtil.getTokenTagName(tok);
if (tagName != null) {
int tokOffset = tokenSequence.offset(),
tagNameEndPos = tokOffset + CompletionUtil.TAG_FIRST_CHAR.length() +
tagName.length();
if ((tagNameEndPos < caretPos) &&
(isAttributeOrSpace || isTagLastCharFound || isJustBeforeTagErrorToken)) {
return true;
}
}
}
}
if (! tokenSequence.movePrevious()) break;
tok = tokenSequence.token();
tokID = tok.id();
if (CompletionUtil.isEndTagSuffix(tok) || CompletionUtil.isTagLastChar(tok)) break;
}
return false;
}