本文整理汇总了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));
}