Java Code Examples for org.eclipse.xtext.ui.editor.syntaxcoloring.TokenScanner#setRange()
The following examples show how to use
org.eclipse.xtext.ui.editor.syntaxcoloring.TokenScanner#setRange() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TokenScannerTest.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Test public void testFullRange() throws Exception { TokenScanner scanner = getTokenScanner(3, 4, 3, 2); scanner.setRange(null, 0, 12); scanner.nextToken(); assertEquals(3, scanner.getTokenLength()); assertEquals(0, scanner.getTokenOffset()); scanner.nextToken(); assertEquals(4, scanner.getTokenLength()); assertEquals(3, scanner.getTokenOffset()); scanner.nextToken(); assertEquals(3, scanner.getTokenLength()); assertEquals(7, scanner.getTokenOffset()); scanner.nextToken(); assertEquals(2, scanner.getTokenLength()); assertEquals(10, scanner.getTokenOffset()); assertEquals(Token.EOF, scanner.nextToken()); }
Example 2
Source File: TokenScannerTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Test public void testBeginning() throws Exception { TokenScanner scanner = getTokenScanner(3, 4, 3, 2); scanner.setRange(null, 0, 7); scanner.nextToken(); assertEquals(3, scanner.getTokenLength()); assertEquals(0, scanner.getTokenOffset()); scanner.nextToken(); assertEquals(4, scanner.getTokenLength()); assertEquals(3, scanner.getTokenOffset()); assertEquals(Token.EOF, scanner.nextToken()); }
Example 3
Source File: TokenScannerTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Test public void testMidRange() throws Exception { TokenScanner scanner = getTokenScanner(3, 4, 3, 2); scanner.setRange(null, 3, 7); scanner.nextToken(); assertEquals(4, scanner.getTokenLength()); assertEquals(3, scanner.getTokenOffset()); scanner.nextToken(); assertEquals(3, scanner.getTokenLength()); assertEquals(7, scanner.getTokenOffset()); assertEquals(Token.EOF, scanner.nextToken()); }
Example 4
Source File: TokenScannerTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Test public void testTrailingRange() throws Exception { TokenScanner scanner = getTokenScanner(3, 4, 3, 2); scanner.setRange(null, 7, 5); scanner.nextToken(); assertEquals(3, scanner.getTokenLength()); assertEquals(7, scanner.getTokenOffset()); scanner.nextToken(); assertEquals(2, scanner.getTokenLength()); assertEquals(10, scanner.getTokenOffset()); assertEquals(Token.EOF, scanner.nextToken()); }