当前位置: 首页>>代码示例>>Java>>正文


Java Lexer.getBufferSequence方法代码示例

本文整理汇总了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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:FilePackageSetParserExtension.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:PatternPackageSetParserExtension.java

示例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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:TemplateDataElementType.java


注:本文中的com.intellij.lexer.Lexer.getBufferSequence方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。