Search in sources :

Example 1 with IPartitionTokenScanner

use of org.eclipse.jface.text.rules.IPartitionTokenScanner in project eclipse.platform.text by eclipse.

the class DefaultPartitionerZeroLengthTest method setUp.

@Before
public void setUp() {
    fDoc = new Document();
    IPartitionTokenScanner scanner = new RuleBasedPartitionScanner() {

        {
            IToken comment = new Token(COMMENT);
            IPredicateRule[] rules = new IPredicateRule[] { new MultiLineRule("/*", "*/", comment) };
            setPredicateRules(rules);
        }
    };
    fPartitioner = new FastPartitioner(scanner, new String[] { DEFAULT, COMMENT });
    fDoc.setDocumentPartitioner(fPartitioner);
    fPartitioner.connect(fDoc);
}
Also used : RuleBasedPartitionScanner(org.eclipse.jface.text.rules.RuleBasedPartitionScanner) IToken(org.eclipse.jface.text.rules.IToken) FastPartitioner(org.eclipse.jface.text.rules.FastPartitioner) MultiLineRule(org.eclipse.jface.text.rules.MultiLineRule) IPartitionTokenScanner(org.eclipse.jface.text.rules.IPartitionTokenScanner) IToken(org.eclipse.jface.text.rules.IToken) Token(org.eclipse.jface.text.rules.Token) IPredicateRule(org.eclipse.jface.text.rules.IPredicateRule) Document(org.eclipse.jface.text.Document) IDocument(org.eclipse.jface.text.IDocument) Before(org.junit.Before)

Example 2 with IPartitionTokenScanner

use of org.eclipse.jface.text.rules.IPartitionTokenScanner in project eclipse.platform.text by eclipse.

the class FastPartitionerTest method testBug368219_1.

@Test
public void testBug368219_1() throws Exception {
    fPartitioner.disconnect();
    IPartitionTokenScanner scanner = new RuleBasedPartitionScanner() {

        {
            IToken comment = new Token(COMMENT);
            IPredicateRule[] rules = new IPredicateRule[] { new MultiLineRule("/*", "*/", comment) };
            setPredicateRules(rules);
        }
    };
    fPartitioner = createPartitioner(scanner);
    fDoc.setDocumentPartitioner(fPartitioner);
    fPartitioner.connect(fDoc);
    fDoc.set("/**");
    assertEqualPartition(0, 3, DEFAULT);
}
Also used : RuleBasedPartitionScanner(org.eclipse.jface.text.rules.RuleBasedPartitionScanner) IToken(org.eclipse.jface.text.rules.IToken) MultiLineRule(org.eclipse.jface.text.rules.MultiLineRule) IPartitionTokenScanner(org.eclipse.jface.text.rules.IPartitionTokenScanner) IToken(org.eclipse.jface.text.rules.IToken) Token(org.eclipse.jface.text.rules.Token) IPredicateRule(org.eclipse.jface.text.rules.IPredicateRule) Test(org.junit.Test)

Example 3 with IPartitionTokenScanner

use of org.eclipse.jface.text.rules.IPartitionTokenScanner in project eclipse.platform.text by eclipse.

the class FastPartitionerTest method testBug368219_2.

@Test
public void testBug368219_2() throws Exception {
    fPartitioner.disconnect();
    IPartitionTokenScanner scanner = new RuleBasedPartitionScanner() {

        {
            IToken comment = new Token(COMMENT);
            IPredicateRule[] rules = new IPredicateRule[] { new MultiLineRule("/*", "*/", comment, (char) 0, true) };
            setPredicateRules(rules);
        }
    };
    fPartitioner = createPartitioner(scanner);
    fDoc.setDocumentPartitioner(fPartitioner);
    fPartitioner.connect(fDoc);
    fDoc.set("/**");
    assertEqualPartition(0, 3, COMMENT);
}
Also used : RuleBasedPartitionScanner(org.eclipse.jface.text.rules.RuleBasedPartitionScanner) IToken(org.eclipse.jface.text.rules.IToken) MultiLineRule(org.eclipse.jface.text.rules.MultiLineRule) IPartitionTokenScanner(org.eclipse.jface.text.rules.IPartitionTokenScanner) IToken(org.eclipse.jface.text.rules.IToken) Token(org.eclipse.jface.text.rules.Token) IPredicateRule(org.eclipse.jface.text.rules.IPredicateRule) Test(org.junit.Test)

Example 4 with IPartitionTokenScanner

use of org.eclipse.jface.text.rules.IPartitionTokenScanner in project eclipse.platform.text by eclipse.

the class FastPartitionerTest method setUp.

@Before
public void setUp() {
    fDoc = new Document();
    IPartitionTokenScanner scanner = new RuleBasedPartitionScanner() {

        {
            IToken comment = new Token(COMMENT);
            IPredicateRule[] rules = new IPredicateRule[] { new MultiLineRule("/*", "*/", comment) };
            setPredicateRules(rules);
        }
    };
    fPartitioner = createPartitioner(scanner);
    fDoc.setDocumentPartitioner(fPartitioner);
    fPartitioner.connect(fDoc);
}
Also used : RuleBasedPartitionScanner(org.eclipse.jface.text.rules.RuleBasedPartitionScanner) IToken(org.eclipse.jface.text.rules.IToken) MultiLineRule(org.eclipse.jface.text.rules.MultiLineRule) IPartitionTokenScanner(org.eclipse.jface.text.rules.IPartitionTokenScanner) IToken(org.eclipse.jface.text.rules.IToken) Token(org.eclipse.jface.text.rules.Token) IPredicateRule(org.eclipse.jface.text.rules.IPredicateRule) Document(org.eclipse.jface.text.Document) IDocument(org.eclipse.jface.text.IDocument) Before(org.junit.Before)

Example 5 with IPartitionTokenScanner

use of org.eclipse.jface.text.rules.IPartitionTokenScanner in project eclipse.platform.text by eclipse.

the class FastPartitionerTest method testBug409538_1.

@Test
public void testBug409538_1() throws Exception {
    fPartitioner.disconnect();
    IPartitionTokenScanner scanner = new RuleBasedPartitionScanner() {

        {
            IToken comment = new Token(COMMENT);
            IPredicateRule[] rules = new IPredicateRule[] { new MultiLineRule("<!--", "-->", comment, (char) 0, true) };
            setPredicateRules(rules);
        }
    };
    fPartitioner = createPartitioner(scanner);
    fDoc.setDocumentPartitioner(fPartitioner);
    fPartitioner.connect(fDoc);
    fDoc.set("<");
    assertEqualPartition(0, 1, DEFAULT);
}
Also used : RuleBasedPartitionScanner(org.eclipse.jface.text.rules.RuleBasedPartitionScanner) IToken(org.eclipse.jface.text.rules.IToken) MultiLineRule(org.eclipse.jface.text.rules.MultiLineRule) IPartitionTokenScanner(org.eclipse.jface.text.rules.IPartitionTokenScanner) IToken(org.eclipse.jface.text.rules.IToken) Token(org.eclipse.jface.text.rules.Token) IPredicateRule(org.eclipse.jface.text.rules.IPredicateRule) Test(org.junit.Test)

Aggregations

IPartitionTokenScanner (org.eclipse.jface.text.rules.IPartitionTokenScanner)11 IPredicateRule (org.eclipse.jface.text.rules.IPredicateRule)10 IToken (org.eclipse.jface.text.rules.IToken)10 RuleBasedPartitionScanner (org.eclipse.jface.text.rules.RuleBasedPartitionScanner)10 Token (org.eclipse.jface.text.rules.Token)10 MultiLineRule (org.eclipse.jface.text.rules.MultiLineRule)8 Test (org.junit.Test)5 Document (org.eclipse.jface.text.Document)4 IDocument (org.eclipse.jface.text.IDocument)4 FastPartitioner (org.eclipse.jface.text.rules.FastPartitioner)3 SingleLineRule (org.eclipse.jface.text.rules.SingleLineRule)2 Before (org.junit.Before)2 GroovyPartitionScanner (eu.esdihumboldt.hale.ui.util.groovy.internal.GroovyPartitionScanner)1 IDocumentPartitioner (org.eclipse.jface.text.IDocumentPartitioner)1