org.eclipse.jface.text.rules.WordPatternRule类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(178)

本文整理了Java中org.eclipse.jface.text.rules.WordPatternRule类的一些代码示例,展示了WordPatternRule类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WordPatternRule类的具体详情如下:
包路径:org.eclipse.jface.text.rules.WordPatternRule
类名称:WordPatternRule

WordPatternRule介绍

[英]A specific single line rule which stipulates that the start and end sequence occur within a single word, as defined by a word detector.
[中]一种特定的单行规则,规定起始和结束顺序出现在一个单词内,由单词检测器定义。

代码示例

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
  protected boolean sequenceDetected(ICharacterScanner scanner, char[] sequence, boolean eofAllowed) {
    fCount= 0;
    return super.sequenceDetected(scanner, sequence, eofAllowed);
  }
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

@Override
protected boolean endSequenceDetected(ICharacterScanner scanner) {
  fCount++;
  if (scanner.read() == '}')
    return fCount > 2;
  scanner.unread();
  return super.endSequenceDetected(scanner);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

/**
 * Returns whether the end sequence was detected.
 * The rule acquires the rest of the word, using the
 * provided word detector, and tests to determine if
 * it ends with the end sequence.
 *
 * @param scanner the scanner to be used
 * @return <code>true</code> if the word ends on the given end sequence
 */
@Override
protected boolean endSequenceDetected(ICharacterScanner scanner) {
  fBuffer.setLength(0);
  int c= scanner.read();
  while (fDetector.isWordPart((char) c)) {
    fBuffer.append((char) c);
    c= scanner.read();
  }
  scanner.unread();
  if (fBuffer.length() >= fEndSequence.length) {
    for (int i=fEndSequence.length - 1, j= fBuffer.length() - 1; i >= 0; i--, j--) {
      if (fEndSequence[i] != fBuffer.charAt(j)) {
        unreadBuffer(scanner);
        return false;
      }
    }
    return true;
  }
  unreadBuffer(scanner);
  return false;
}

代码示例来源:origin: RepreZen/KaiZen-OpenAPI-Editor

rules.add(new IndicatorCharacterRule(indicatorCharToken));
rules.add(new WhitespaceRule(whitespaceToken));
rules.add(new WordPatternRule(new AnchorWordDetector(), "&", "", anchorToken));
rules.add(new WordPatternRule(new AnchorWordDetector(), "*", "", aliasToken));
rules.add(new WordPatternRule(new TagWordDetector(), "!", "", tagPropToken));

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

protected boolean endSequenceDetected(ICharacterScanner scanner) {
  fCount++;
  if (scanner.read() == '}')
    return fCount > 2;
  scanner.unread();
  return super.endSequenceDetected(scanner);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * Returns whether the end sequence was detected.
 * The rule acquires the rest of the word, using the
 * provided word detector, and tests to determine if
 * it ends with the end sequence.
 *
 * @param scanner the scanner to be used
 * @return <code>true</code> if the word ends on the given end sequence
 */
@Override
protected boolean endSequenceDetected(ICharacterScanner scanner) {
  fBuffer.setLength(0);
  int c= scanner.read();
  while (fDetector.isWordPart((char) c)) {
    fBuffer.append((char) c);
    c= scanner.read();
  }
  scanner.unread();
  if (fBuffer.length() >= fEndSequence.length) {
    for (int i=fEndSequence.length - 1, j= fBuffer.length() - 1; i >= 0; i--, j--) {
      if (fEndSequence[i] != fBuffer.charAt(j)) {
        unreadBuffer(scanner);
        return false;
      }
    }
    return true;
  }
  unreadBuffer(scanner);
  return false;
}

代码示例来源:origin: oyse/yedit

rules.add(new IndicatorCharacterRule(indicatorCharToken));
rules.add(new WhitespaceRule(whitespaceToken));
rules.add(new WordPatternRule(new AnchorWordDetector(), "&", "", anchorToken));
rules.add(new WordPatternRule(new AnchorWordDetector(), "*", "", aliasToken));
rules.add(new WordPatternRule(new TagWordDetector(), "!", "", tagPropToken));

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

@Override
protected boolean endSequenceDetected(ICharacterScanner scanner) {
  // Read the next character
  char character = (char) scanner.read();
  // Detect end character
  if (Character.isWhitespace(character)) {
    return true;
  } else if (character == '<') {
    return true;
  }
  // Unread the character just read
  scanner.unread();
  // Process as normal
  return super.endSequenceDetected(scanner);
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

@Override
  protected boolean sequenceDetected(ICharacterScanner scanner, char[] sequence, boolean eofAllowed) {
    fCount = 0;
    return super.sequenceDetected(scanner, sequence, eofAllowed);
  }
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
protected boolean endSequenceDetected(ICharacterScanner scanner) {
  fCount++;
  if (scanner.read() == '}')
    return fCount > 2;
  scanner.unread();
  return super.endSequenceDetected(scanner);
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

protected boolean sequenceDetected(ICharacterScanner scanner, char[] sequence, boolean eofAllowed) {
    fCount= 0;
    return super.sequenceDetected(scanner, sequence, eofAllowed);
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

@Override
protected boolean endSequenceDetected(ICharacterScanner scanner) {
  fCount++;
  if (scanner.read() == '}')
    return fCount > 2;
  scanner.unread();
  return super.endSequenceDetected(scanner);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

@Override
  protected boolean sequenceDetected(ICharacterScanner scanner, char[] sequence, boolean eofAllowed) {
    fCount= 0;
    return super.sequenceDetected(scanner, sequence, eofAllowed);
  }
}

相关文章