use of org.eclipse.n4js.jsdoc.JSDocCharScanner in project n4js by eclipse.
the class RegionTokenizerTest method testSimpleEscaped.
@SuppressWarnings("javadoc")
@Test
public void testSimpleEscaped() {
RegionTokenizer rt = new RegionTokenizer("{", "}", true, '\\', false, false);
JSDocCharScanner scanner = new JSDocCharScanner("{si\\{mp\\}le} and more");
assertEquals("si\\{mp\\}le", rt.nextToken(scanner).token);
scanner = new JSDocCharScanner("{si\\{mple} and more");
assertEquals("si\\{mple", rt.nextToken(scanner).token);
scanner = new JSDocCharScanner("{simple\\} and more");
assertNull(rt.nextToken(scanner));
}
use of org.eclipse.n4js.jsdoc.JSDocCharScanner in project n4js by eclipse.
the class RegionTokenizerTest method testHTML.
@SuppressWarnings("javadoc")
@Test
public void testHTML() {
RegionTokenizer rt = new RegionTokenizer("<pre>", "</pre>", true, '\\', false, true);
JSDocCharScanner scanner = new JSDocCharScanner("<pre>simple</pre> and more");
assertEquals("simple", rt.nextToken(scanner).token);
scanner = new JSDocCharScanner("<pre>si<pre>m</pre>ple</pre> and more");
assertEquals("si<pre>m</pre>ple", rt.nextToken(scanner).token);
rt = new RegionTokenizer("<pre>", "</pre>", false, '\\', false, true);
scanner = new JSDocCharScanner("<pre>si<prem>m</prem>ple</pre> and more");
assertEquals("si<prem>m</prem>ple", rt.nextToken(scanner).token);
scanner = new JSDocCharScanner("<pre>si<p\nre></p\n * re>ple</pre> and more");
assertEquals("si<p\nre></p\nre>ple", rt.nextToken(scanner).token);
scanner = new JSDocCharScanner("<pre>simple</pr");
assertNull(rt.nextToken(scanner));
scanner = new JSDocCharScanner("<pre>simple</p re> and more");
assertNull(rt.nextToken(scanner));
scanner = new JSDocCharScanner("<pre>simple</p\n * re> and more");
assertNull(rt.nextToken(scanner));
}
Aggregations