perlpartitionscanner.java

来自「<Apress.The.Definitive.Guide.to.SWT.a」· Java 代码 · 共 26 行

JAVA
26
字号
package examples.ch18.perledit.source;

import org.eclipse.jface.text.rules.*;

/**
 * This class scans a document and partitions it
 */
public class PerlPartitionScanner extends RuleBasedPartitionScanner {
  // Create a partition for comments, and leave the rest for code
  public static final String COMMENT = "comment";
  public static final String[] TYPES = { COMMENT};

  /**
   * PerlPartitionScanner constructor
   */
  public PerlPartitionScanner() {
    super();

    // Create the token for comment partitions
    IToken comment = new Token(COMMENT);

    // Set the rule--anything from # to the end of the line is a comment
    setPredicateRules(new IPredicateRule[] { new EndOfLineRule("#", comment)});
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?