Package org.eclipse.jface.text.rules

Examples of org.eclipse.jface.text.rules.Token


    /**
     * Single token scanner.
     */
    static class SingleTokenScanner extends BufferedRuleBasedScanner {
      public SingleTokenScanner(TextAttribute attribute) {
        setDefaultReturnToken(new Token(attribute));
      }
View Full Code Here


   * @param provider the color provider
   */
   public JavaDocScanner(JavaColorProvider provider) {
    super();

    IToken keyword= new Token(new TextAttribute(provider.getColor(JavaColorProvider.JAVADOC_KEYWORD)));
    IToken tag= new Token(new TextAttribute(provider.getColor(JavaColorProvider.JAVADOC_TAG)));
    IToken link= new Token(new TextAttribute(provider.getColor(JavaColorProvider.JAVADOC_LINK)));

    List list= new ArrayList();

    // Add rule for tags.
    list.add(new SingleLineRule("<", ">", tag)); //$NON-NLS-2$ //$NON-NLS-1$
View Full Code Here

   * Creates the partitioner and sets up the appropriate rules.
   */
  public JavaPartitionScanner() {
    super();

    IToken javaDoc= new Token(JAVA_DOC);
    IToken comment= new Token(JAVA_MULTILINE_COMMENT);

    List rules= new ArrayList();

    // Add rule for single line comments.
    rules.add(new EndOfLineRule("//", Token.UNDEFINED)); //$NON-NLS-1$
View Full Code Here

    /**
     * Single token scanner, used for scanning for multiline comments mainly.
     */
    static class SingleTokenScanner extends BufferedRuleBasedScanner {
        public SingleTokenScanner(TextAttribute attribute) {
            setDefaultReturnToken(new Token(attribute));
        }
View Full Code Here

  }
 
  protected void runRuleTest(String text, Integer[] tokenIndexes, Integer[] tokenLen) {
    StringCharacterScanner scanner = new StringCharacterScanner(text);
    
    FullPatternRule fpRule = new FullPatternRule(new Token(null), sequences, new SampleJavaWordDetector());
    
    while (scanner.peekNext() != ICharacterScanner.EOF) {
      int beginOffset = scanner.textOffset;
      IToken token = fpRule.evaluate(scanner);
      if(token.isUndefined()) {
View Full Code Here

 
  private static final char NO_ESCAPE_CHAR = (char) -1;
 
  /**Creates the partitioner and sets up the appropriate rules. */
  public DeePartitionScanner() {
    IToken tkString = new Token(DeePartitions.DEE_STRING);
    IToken tkRawString = new Token(DeePartitions.DEE_RAW_STRING);
    IToken tkRawString2 = new Token(DeePartitions.DEE_RAW_STRING2);
    IToken tkDelimString = new Token(DeePartitions.DEE_DELIM_STRING);
    IToken tkCharacter = new Token(DeePartitions.DEE_CHARACTER);
    IToken tkSingleComment = new Token(DeePartitions.DEE_SINGLE_COMMENT);
    IToken tkSingleDocComment = new Token(DeePartitions.DEE_SINGLE_DOCCOMMENT);
    IToken tkMultiComment = new Token(DeePartitions.DEE_MULTI_COMMENT);
    IToken tkMultiDocComment = new Token(DeePartitions.DEE_MULTI_DOCCOMMENT);
    IToken tkNestedComment = new Token(DeePartitions.DEE_NESTED_COMMENT);
    IToken tkNestedDocComment = new Token(DeePartitions.DEE_NESTED_DOCCOMMENT);
   
    ArrayList2<IPredicateRule> rules = new ArrayList2<>();
   
    rules.add(new PatternRule_Fixed("`", "`", tkRawString, NO_ESCAPE_CHAR, false, true));
    rules.add(new PatternRule_Fixed("r\"", "\"", tkRawString2, NO_ESCAPE_CHAR, false, true));
View Full Code Here

     */
  protected XMLScanner getXMLScanner() {
    if (scanner == null) {
      scanner = new XMLScanner(colorManager);
      scanner.setDefaultReturnToken(
        new Token(
          new TextAttribute(
            colorManager.getColor(XMLColorConstants.DEFAULT))));
    }
    return scanner;
  }
View Full Code Here

     */
    protected XMLTagScanner getXMLTagScanner() {
    if (tagScanner == null) {
      tagScanner = new XMLTagScanner(colorManager);
      tagScanner.setDefaultReturnToken(
        new Token(
          new TextAttribute(
            colorManager.getColor(XMLColorConstants.TAG))));
    }
    return tagScanner;
  }
View Full Code Here

     * Construct a new XMLScanner.
     * @param manager The ColorManager associated with this XMLScanner.
     */
    public XMLScanner(ColorManager manager) {
        IToken procInstr =
                new Token(new TextAttribute(
                        manager.getColor(XMLColorConstants.PROC_INSTR)));

        IRule[] rules = new IRule[2];
        //Add rule for processing instructions
        rules[0] = new SingleLineRule("<?", "?>", procInstr); //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

    /**
     * Construct a new XMLPartitionScanner.
     */
  public XMLPartitionScanner() {

    IToken xmlComment = new Token(XML_COMMENT);
    IToken tag = new Token(XML_TAG);

    IPredicateRule[] rules = new IPredicateRule[2];

    rules[0] = new MultiLineRule("<!--", "-->", xmlComment); //$NON-NLS-1$ //$NON-NLS-2$
    rules[1] = new TagRule(tag);
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.rules.Token

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.