本文整理匯總了Java中com.intellij.lexer.Lexer.getBufferEnd方法的典型用法代碼示例。如果您正苦於以下問題:Java Lexer.getBufferEnd方法的具體用法?Java Lexer.getBufferEnd怎麽用?Java Lexer.getBufferEnd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.lexer.Lexer
的用法示例。
在下文中一共展示了Lexer.getBufferEnd方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseScope
import com.intellij.lexer.Lexer; //導入方法依賴的package包/類
@Override
@Nullable
public String parseScope(Lexer lexer) {
if (lexer.getTokenType() != ScopeTokenTypes.IDENTIFIER) return null;
String id = getTokenText(lexer);
if (FilePatternPackageSet.SCOPE_FILE.equals(id)) {
final CharSequence buf = lexer.getBufferSequence();
final int end = lexer.getTokenEnd();
final int bufferEnd = lexer.getBufferEnd();
if (end >= bufferEnd || buf.charAt(end) != ':' && buf.charAt(end) != '[') {
return null;
}
lexer.advance();
return FilePatternPackageSet.SCOPE_FILE;
}
return null;
}
示例2: parseScope
import com.intellij.lexer.Lexer; //導入方法依賴的package包/類
@Override
public String parseScope(final Lexer lexer) {
if (lexer.getTokenType() != ScopeTokenTypes.IDENTIFIER) return PatternPackageSet.SCOPE_ANY;
String id = getTokenText(lexer);
String scope = PatternPackageSet.SCOPE_ANY;
if (PatternPackageSet.SCOPE_SOURCE.equals(id)) {
scope = PatternPackageSet.SCOPE_SOURCE;
} else if (PatternPackageSet.SCOPE_TEST.equals(id)) {
scope = PatternPackageSet.SCOPE_TEST;
} else if (PatternPackageSet.SCOPE_PROBLEM.equals(id)) {
scope = PatternPackageSet.SCOPE_PROBLEM;
} else if (PatternPackageSet.SCOPE_LIBRARY.equals(id)) {
scope = PatternPackageSet.SCOPE_LIBRARY;
} else if (!id.trim().isEmpty()) {
scope = null;
}
final CharSequence buf = lexer.getBufferSequence();
int end = lexer.getTokenEnd();
int bufferEnd = lexer.getBufferEnd();
if (scope == PatternPackageSet.SCOPE_ANY || end >= bufferEnd || buf.charAt(end) != ':' && buf.charAt(end) != '[') {
return PatternPackageSet.SCOPE_ANY;
}
if (scope != null) {
lexer.advance();
}
return scope;
}