intial source from ttp://www.sf.net/projects/wdte
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.css.core / src / net / sourceforge / phpeclipse / css / core / parser / ICssScanner.java
1 /*
2  * Copyright (c) 2003-2004 Christopher Lenz and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     Christopher Lenz - initial API
10  * 
11  * $Id: ICssScanner.java,v 1.1 2004-09-02 18:07:12 jsurfer Exp $
12  */
13
14 package net.sourceforge.phpeclipse.css.core.parser;
15
16 import org.eclipse.jface.text.IDocument;
17 import org.eclipse.jface.text.IRegion;
18
19 /**
20  * Interface for classes that implement the lexical scanning of CSS source code.
21  * 
22  * TODO Add a way to only parse a specific range of an IDocument
23  */
24 public interface ICssScanner extends IProblemReporter {
25
26         // Methods -----------------------------------------------------------------
27
28         /**
29          * Returns the starting position of the current token inside the original 
30          * source. This position is zero-based and inclusive. It corresponds to the 
31          * position of the first character which is part of this token.
32          * 
33          * @return the starting position of the current token inside the original
34          *         source
35          */
36         IRegion getTokenRegion();
37
38         /**
39          * Read the next token in the source, and returns the value corresponding
40          * to the symbolic constant corresponding to the token type (as defined by
41          * the constants in this interface), or with read character itself.
42          * 
43          * @return the next token
44          * @throws LexicalErrorException in case a lexical error was detected while 
45          *         trying to retrieve the current token
46          */
47         int getNextToken() throws LexicalErrorException;
48
49         /**
50          * Sets the document that contains the source style sheet.
51          * 
52          * TODO Add parameters for range limitation
53          * 
54          * @param source The document containing the style sheet source
55          */
56         void setSource(IDocument source);
57
58 }