Search in sources :

Example 16 with ICharacterPairMatcher

use of org.eclipse.jface.text.source.ICharacterPairMatcher in project eclipse.platform.text by eclipse.

the class AbstractPairMatcherTest method testBug377417.

@Test
public void testBug377417() {
    final ICharacterPairMatcher matcher = createMatcher("()[]{}");
    performMatch(matcher, "#( %  )%#");
    performMatch(matcher, "#[ %  ]%#");
    performMatch(matcher, "#{ %  }%#");
    matcher.dispose();
}
Also used : ICharacterPairMatcher(org.eclipse.jface.text.source.ICharacterPairMatcher) Test(org.junit.Test)

Example 17 with ICharacterPairMatcher

use of org.eclipse.jface.text.source.ICharacterPairMatcher in project eclipse.platform.text by eclipse.

the class AbstractPairMatcherTest method testTightPartitioned.

/**
 * Test that it works properly next to partition boundaries.
 *
 * @throws BadLocationException test failure
 */
@Test
public void testTightPartitioned() throws BadLocationException {
    final ICharacterPairMatcher matcher = createMatcher("()[]{}");
    performMatch(matcher, "(|b)%b|");
    performMatch(matcher, "(%|b)b|");
    performMatch(matcher, "|a(a|)%");
    performMatch(matcher, "|a(%a|)");
    performMatch(matcher, "|c#(c|)(|c)%c|");
    performMatch(matcher, "|c(%c|)(|c)#c|");
    performMatch(matcher, "(%|a)a||b)b||c)c|)#");
    performMatch(matcher, "|c#(c|)(|%c)#c|");
    performMatch(matcher, "|c#(c%|)(|c)#c|");
    performMatch(matcher, "#(%|a)a||b)b||c)c|)#");
    matcher.dispose();
}
Also used : ICharacterPairMatcher(org.eclipse.jface.text.source.ICharacterPairMatcher) Test(org.junit.Test)

Example 18 with ICharacterPairMatcher

use of org.eclipse.jface.text.source.ICharacterPairMatcher in project eclipse.platform.text by eclipse.

the class DefaultPairMatcherTest2 method testSimpleMatchSameMatcher1.

/**
 * Very simple checks.
 *
 * @throws BadLocationException test failure
 */
@Test
public void testSimpleMatchSameMatcher1() throws BadLocationException {
    final ICharacterPairMatcher matcher = createMatcher("()[]{}");
    performMatch(matcher, "#(   %)");
    performMatch(matcher, "#[   %]");
    performMatch(matcher, "#{   %}");
    performMatch(matcher, "%(   )#");
    performMatch(matcher, "%[   ]#");
    performMatch(matcher, "%{   }#");
    matcher.dispose();
}
Also used : ICharacterPairMatcher(org.eclipse.jface.text.source.ICharacterPairMatcher) Test(org.junit.Test)

Example 19 with ICharacterPairMatcher

use of org.eclipse.jface.text.source.ICharacterPairMatcher in project webtools.sourceediting by eclipse.

the class AbstractPairMatcherTest method testIncompleteMatch.

/**
 * Checks of simple situations where no matches should be found.
 *
 * @throws BadLocationException
 */
public void testIncompleteMatch() throws BadLocationException {
    final ICharacterPairMatcher matcher = createMatcher("()[]{}");
    performMatch(matcher, "(% ");
    performMatch(matcher, "%(  )");
    performMatch(matcher, "( % )");
    performMatch(matcher, "(  %)");
    performMatch(matcher, "%");
    matcher.dispose();
}
Also used : ICharacterPairMatcher(org.eclipse.jface.text.source.ICharacterPairMatcher)

Example 20 with ICharacterPairMatcher

use of org.eclipse.jface.text.source.ICharacterPairMatcher in project webtools.sourceediting by eclipse.

the class AbstractPairMatcherTest method testNesting.

/**
 * Test that nesting works properly
 */
public void testNesting() {
    final ICharacterPairMatcher matcher = createMatcher("()[]{}");
    performMatch(matcher, " ( #( ( ( ) ) ( ) )% ) ");
    performMatch(matcher, " ( (% ( ( ) ) ( ) )# ) ");
    performMatch(matcher, " ( #( { ( ) } [ ] )% ) ");
    performMatch(matcher, " ( (% { ( ) } [ ] )# ) ");
    performMatch(matcher, " ( ( #{ ( ) }% [ ] ) ) ");
    performMatch(matcher, " ( ( {% ( ) }# [ ] ) ) ");
    performMatch(matcher, "a(b#(c(d(e)f)g(h)i)%j)k");
    performMatch(matcher, "a(b(%c(d(e)f)g(h)i)#j)k");
    performMatch(matcher, "a(b#(c{d(e)f}g[h]i)%j)k");
    performMatch(matcher, "a(b(%c{d(e)f}g[h]i)#j)k");
    performMatch(matcher, "a(b(c#{d(e)f}%g[h]i)j)k");
    performMatch(matcher, "a(b(c{%d(e)f}#g[h]i)j)k");
    matcher.dispose();
}
Also used : ICharacterPairMatcher(org.eclipse.jface.text.source.ICharacterPairMatcher)

Aggregations

ICharacterPairMatcher (org.eclipse.jface.text.source.ICharacterPairMatcher)26 Test (org.junit.Test)12 DefaultCharacterPairMatcher (org.eclipse.jface.text.source.DefaultCharacterPairMatcher)3 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)2 Point (org.eclipse.swt.graphics.Point)2 IDocument (org.eclipse.jface.text.IDocument)1 IRegion (org.eclipse.jface.text.IRegion)1 ITextViewerExtension5 (org.eclipse.jface.text.ITextViewerExtension5)1 ISourceViewer (org.eclipse.jface.text.source.ISourceViewer)1 ExtendedConfigurationBuilder (org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder)1