129
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2000, 2005 IBM Corporation and others.
|
|
3 * All rights reserved. This program and the accompanying materials
|
|
4 * are made available under the terms of the Eclipse Public License v1.0
|
|
5 * which accompanies this distribution, and is available at
|
|
6 * http://www.eclipse.org/legal/epl-v10.html
|
|
7 *
|
|
8 * Contributors:
|
|
9 * IBM Corporation - initial API and implementation
|
|
10 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 *******************************************************************************/
|
|
13
|
|
14 module dwtx.jface.text.rules.ITokenScanner;
|
|
15
|
|
16 import dwt.dwthelper.utils;
|
|
17
|
|
18
|
|
19 import dwtx.jface.text.IDocument;
|
|
20
|
|
21
|
|
22 /**
|
|
23 * A token scanner scans a range of a document and reports about the token it finds.
|
|
24 * A scanner has state. When asked, the scanner returns the offset and the length of the
|
|
25 * last found token.
|
|
26 *
|
|
27 * @see dwtx.jface.text.rules.IToken
|
|
28 * @since 2.0
|
|
29 */
|
|
30 public interface ITokenScanner {
|
|
31
|
|
32 /**
|
|
33 * Configures the scanner by providing access to the document range that should
|
|
34 * be scanned.
|
|
35 *
|
|
36 * @param document the document to scan
|
|
37 * @param offset the offset of the document range to scan
|
|
38 * @param length the length of the document range to scan
|
|
39 */
|
|
40 void setRange(IDocument document, int offset, int length);
|
|
41
|
|
42 /**
|
|
43 * Returns the next token in the document.
|
|
44 *
|
|
45 * @return the next token in the document
|
|
46 */
|
|
47 IToken nextToken();
|
|
48
|
|
49 /**
|
|
50 * Returns the offset of the last token read by this scanner.
|
|
51 *
|
|
52 * @return the offset of the last token read by this scanner
|
|
53 */
|
|
54 int getTokenOffset();
|
|
55
|
|
56 /**
|
|
57 * Returns the length of the last token read by this scanner.
|
|
58 *
|
|
59 * @return the length of the last token read by this scanner
|
|
60 */
|
|
61 int getTokenLength();
|
|
62 }
|