Search in sources :

Example 11 with JSDocCharScanner

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));
}
Also used : JSDocCharScanner(org.eclipse.n4js.jsdoc.JSDocCharScanner) Test(org.junit.Test)

Example 12 with JSDocCharScanner

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));
}
Also used : JSDocCharScanner(org.eclipse.n4js.jsdoc.JSDocCharScanner) Test(org.junit.Test)

Aggregations

JSDocCharScanner (org.eclipse.n4js.jsdoc.JSDocCharScanner)12 Test (org.junit.Test)11 JSDocToken (org.eclipse.n4js.jsdoc.JSDocToken)4 ArrayList (java.util.ArrayList)1 Optional (java.util.Optional)1 EcoreUtil (org.eclipse.emf.ecore.util.EcoreUtil)1 ITextViewer (org.eclipse.jface.text.ITextViewer)1 CompletionProposal (org.eclipse.jface.text.contentassist.CompletionProposal)1 ICompletionProposal (org.eclipse.jface.text.contentassist.ICompletionProposal)1 ITagDefinition (org.eclipse.n4js.jsdoc.ITagDefinition)1 ScannerState (org.eclipse.n4js.jsdoc.JSDocCharScanner.ScannerState)1 JSDocCompletionHint (org.eclipse.n4js.jsdoc.JSDocCompletionHint)1 MODULESPEC (org.eclipse.n4js.jsdoc.JSDocCompletionHint.CompletionKind.MODULESPEC)1 NOCOMPLETION (org.eclipse.n4js.jsdoc.JSDocCompletionHint.CompletionKind.NOCOMPLETION)1 JSDocletUtils (org.eclipse.n4js.jsdoc.JSDocletUtils)1 N4JSDocletParser (org.eclipse.n4js.jsdoc.N4JSDocletParser)1 Doclet (org.eclipse.n4js.jsdoc.dom.Doclet)1 FullMemberReference (org.eclipse.n4js.jsdoc.dom.FullMemberReference)1 Tag (org.eclipse.n4js.jsdoc.dom.Tag)1 LineTagWithFullElementReference (org.eclipse.n4js.jsdoc.tags.LineTagWithFullElementReference)1