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
9 * Christopher Lenz - initial API
11 * $Id: ICssScanner.java,v 1.1 2004-09-02 18:07:12 jsurfer Exp $
14 package net.sourceforge.phpeclipse.css.core.parser;
16 import org.eclipse.jface.text.IDocument;
17 import org.eclipse.jface.text.IRegion;
20 * Interface for classes that implement the lexical scanning of CSS source code.
22 * TODO Add a way to only parse a specific range of an IDocument
24 public interface ICssScanner extends IProblemReporter {
26 // Methods -----------------------------------------------------------------
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.
33 * @return the starting position of the current token inside the original
36 IRegion getTokenRegion();
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.
43 * @return the next token
44 * @throws LexicalErrorException in case a lexical error was detected while
45 * trying to retrieve the current token
47 int getNextToken() throws LexicalErrorException;
50 * Sets the document that contains the source style sheet.
52 * TODO Add parameters for range limitation
54 * @param source The document containing the style sheet source
56 void setSource(IDocument source);