本文整理匯總了Java中com.intellij.lexer.Lexer.getBufferSequence方法的典型用法代碼示例。如果您正苦於以下問題:Java Lexer.getBufferSequence方法的具體用法?Java Lexer.getBufferSequence怎麽用?Java Lexer.getBufferSequence使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.lexer.Lexer
的用法示例。
在下文中一共展示了Lexer.getBufferSequence方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
示例3: createOuterLanguageElement
import com.intellij.lexer.Lexer; //導入方法依賴的package包/類
protected OuterLanguageElementImpl createOuterLanguageElement(final Lexer lexer, final CharTable table,
@NotNull IElementType outerElementType) {
final CharSequence buffer = lexer.getBufferSequence();
final int tokenStart = lexer.getTokenStart();
if (tokenStart < 0 || tokenStart > buffer.length()) {
LOG.error("Invalid start: " + tokenStart + "; " + lexer);
}
final int tokenEnd = lexer.getTokenEnd();
if (tokenEnd < 0 || tokenEnd > buffer.length()) {
LOG.error("Invalid end: " + tokenEnd + "; " + lexer);
}
return new OuterLanguageElementImpl(outerElementType, table.intern(buffer, tokenStart, tokenEnd));
}